Hello,

in the following example, where I define a
state transformer monad "St" parametrized with 
the state "c", the ghc-2.08 typechecker reports
the following error message in the type definition of
function "foo" which uses the instantiated "St":  

  `St' should have no arguments, but has been given 1 .

It works if I comment out the type definition. It also
works in hugs-1.3 with the type definition. Is there a
way to get it being typechecked by given a special compiler option?

Thanks in advance
----------------------------------------------------------------------
 Christoph Herrmann
 E-mail:  [EMAIL PROTECTED]
 WWW:     http://brahms.fmi.uni-passau.de/cl/staff/herrmann.html
----------------------------------------------------------------------
data State c a = State (c -> (a,c))

unState :: State c a -> (c -> (a,c))
unState (State x) = x

unitState :: a -> State c a
unitState a = State (\s0 -> (a,s0))

bindState :: State c a -> (a -> State c b) -> State c b
bindState m k = State (\s0 -> let (a,s1) = (unState m) s0
                                  (b,s2) = (unState (k a)) s1 
                              in (b,s2))

instance Eq c => Monad (State c) where
    return = unitState 
    (>>=)  = bindState 

data TS = TS { vs::Int } deriving (Show,Eq)

type St = State TS

foo :: Int -> St Int  -- it works if this line is not given
foo x = return x
----------------------------------------------------------------------
END OF MESSAGE

Reply via email to