fork(1) download
  1. {-# LANGUAGE PolyKinds #-}
  2. {-# LANGUAGE TypeInType #-}
  3. {-# LANGUAGE TypeFamilies #-}
  4. {-# LANGUAGE GADTs #-}
  5.  
  6.  
  7. main = print "Hello"
  8.  
  9. -- type SomeSing :: * -> *
  10. data SomeSing k where
  11. SomeSing :: Sing (a :: k) -> SomeSing k
  12.  
  13. data family Sing (a :: k)
  14.  
  15. class SingKind k where
  16. fromSing :: Sing (a :: k) -> k
  17. toSing :: k -> SomeSing k
  18.  
  19. -----
  20.  
  21. data instance Sing (a :: Bool) where
  22. STrue :: Sing True
  23. SFalse :: Sing False
  24.  
  25. instance SingKind Bool where
  26. fromSing s = case s of
  27. STrue -> True
  28. SFalse -> False
  29.  
  30. toSing b = case b of
  31. True -> SomeSing STrue
  32. False -> SomeSing SFalse
  33.  
  34.  
Success #stdin #stdout 0s 4812KB
stdin
Standard input is empty
stdout
"Hello"