fork download
  1. {-# LANGUAGE DataKinds, TypeFamilies #-}
  2.  
  3. data State (s :: Bool) = State deriving Show
  4.  
  5. off :: State False
  6. off = State
  7.  
  8. type family TurnOff s where
  9. TurnOff True = False
  10.  
  11. turnOff :: State True -> State False
  12. turnOff State = State
  13.  
  14. bad = turnOff off
  15.  
  16. main = print bad
Compilation error #stdin compilation error #stdout 0s 4352KB
stdin
Standard input is empty
compilation info
[1 of 1] Compiling Main             ( prog.hs, prog.o )

prog.hs:14:15: error:
    • Couldn't match type ‘'False’ with ‘'True’
      Expected type: State 'True
        Actual type: State 'False
    • In the first argument of ‘turnOff’, namely ‘off’
      In the expression: turnOff off
      In an equation for ‘bad’: bad = turnOff off
stdout
Standard output is empty