Quick actions

cmd+k|ctrl+k

Navigation

Languages

type family Or

Snippet info

Language

Haskell

Visibility

public

Author

homam

Created

2018-12-24T08:03:28Z

Updated

2019-10-12T21:23:57Z

{-# LANGUAGE AllowAmbiguousTypes, TypeApplications, ScopedTypeVariables, TypeFamilies, DataKinds #-}

import Data.Typeable

typeName :: forall a. Typeable a => String
typeName = show . typeRep $ Proxy @a


type family Or (x :: Bool) (y:: Bool) :: Bool where
  Or 'True y  = 'True
  Or 'False y = y
  

type family And (x :: Bool) (y:: Bool) :: Bool where
  And 'True y  = y
  And 'False y = 'False
    
  
type T = Or 'True 'False

domeSomething :: Proxy 'True -> IO ()
domeSomething p = putStrLn $ show p

main =  domeSomething (Proxy :: Proxy (Or 'False (And 'True 'True))) >> putStrLn "..."


five :: (a ~ Int) => a
five = 5
INFO