> {-# OPTIONS -fglasgow-exts #-}
>
> import Maybe
> import Data.Typeable
>
> data Nil = Nil deriving (Eq,Typeable,Show)
>
> class (Typeable t) => List a t where
>     init :: (t -> b) -> (forall y . (List a y) => y -> b)
>     init f z = fromJust $ do x <- cast z
>                              return $ f x
>
> instance List a Nil where

    Could not deduce (List a1 y)
      from the context (List a Nil, Typeable Nil, List a y)
      arising from use of `Main.$dminit' at Main.hs:21:0
Probable fix: add (List a1 y) to the class or instance method `Main.init'
    In the definition of `init': init = Main.$dminit
    In the definition for method `Main.init'
    In the instance declaration for `List a Nil'

but copying and pasting the code from init to the instance declaration works fine.

Jim

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

Reply via email to