> Beeing able to derive instances of DeepSeq would be nice too.

Here is an implementation using GHC's derivable type classes.

Cheers, Ralf

----

ghc -c -fglasgow-exts -fgenerics -package lang Eval.lhs

> module Force
> where
> import Generics

> class Force a where
>   force                       :: a -> ()
>
>   force{|Unit|} a             =  a `seq` ()
>
>   force{|b :+: c|} a          =  case a of
>                                    Inl b -> force b
>                                    Inr c -> force c
>
>   force{|b :*: c|} a          =  case a of
>                                    b :*: c -> force b `seq` force c
>
> instance Force Char where
>   force a                     =  a `seq` ()
> instance Force Int where
>   force a                     =  a `seq` ()

> eval                          :: (Force a) => a -> a
> eval a                        =  force a `s

_______________________________________________
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to