fork download
  1. {-# LANGUAGE GADTs, MultiParamTypeClasses #-}
  2. import Data.Word
  3.  
  4. data Expr a where
  5. Value :: a -> Expr a
  6. Cast :: (Castable a b) => Expr a -> Expr a
  7.  
  8. class Castable a b where
  9. cast :: a -> b
  10.  
  11. instance Castable Word64 Word32 where
  12. cast = fromIntegral
  13.  
  14. instance (Show a) => Show (Expr a) where
  15. show (Cast e) = "Cast " ++ show e -- ERROR
  16.  
  17. main = print ""
Success #stdin #stdout 0s 6232KB
stdin
Standard input is empty
stdout
""