Hi,
Unfortunately yhc still uses nhc98's rather broken type checker. It
clearly doesn't infer that 'parse' must be bound to be the Float case.
Adding a type annotation fixes the problem.
readfloat :: String -> Maybe Float
readfloat x | null parse || not (null leftover) = fail $ "myRead: "++x
| otherwise = return v
where
parse :: [(Float,String)]
parse@((v,leftover):ps) = readsPrec 0 x
Cheers
Tom
Thomas Hartman wrote:
Is there some way to compile the following function in yhc?
works in ghc with glasgow exts deactivated, yhc complains context for
Prelude.read needed (in final line)
readfloat :: String -> Maybe Float
readfloat x | null parse || not (null leftover) = fail $ "myRead: "++x
| otherwise = return v
where parse@((v,leftover):ps) = readsPrec 0 x
thanks!
---
This e-mail may contain confidential and/or privileged information. If you
are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail. Any
unauthorized copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.
------------------------------------------------------------------------
_______________________________________________
Yhc mailing list
Yhc@haskell.org
http://www.haskell.org/mailman/listinfo/yhc
_______________________________________________
Yhc mailing list
Yhc@haskell.org
http://www.haskell.org/mailman/listinfo/yhc