Hi Guys!
I have defined the following type: data Entry a = EmptyEntry | MakeEntry a a
i have defined show and read as follows:
---------------------------------------------
instance (Show a) => Show (Entry a)
where showsPrec _ x = showEntry xshowEntry :: (Show a) => Entry a -> String -> String
showEntry EmptyEntry = shows "Empty"
showEntry (MakeEntry a b) = shows a . (':':) . (' ':) . shows binstance (Read a) => Read (Entry a)
where readsPrec _ s = readEntry sreadEntry :: (Read a) => ReadS (Entry a)
readEntry s = [(EmptyEntry, x) | ("Empty", x) <- lex s]
++
[(MakeEntry a b, w) | (a, u) <- reads s,
(": ", v) <- lex u,
(b, w) <- reads v]
------------------------------------------------when I use show or read in any function, i get the following errormessage from hugs:
ERROR "./main.hgs":14 - Cannot justify constraints in explicitly typed binding
*** Expression : getandparse
*** Type : String -> Entry a
*** Given context : ()
*** Constraints : Read a
printing an instance of Entry directly ( print (MakeEntry "Hello" "World") ) works. But using print in a function that takes a string, doesn't work...
Does anybody have an idea how to solve the problem? thanks Stephan _______________________________________________ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell
