[Haskell-cafe] Should "do 1" compile
Neil Mitchell
ndmitchell at gmail.com
Wed May 23 14:54:27 EDT 2007
Hi
> > foo = do (1 :: Int)
>
> While intuitively this should be disallowed, it seems a pity that
> desugaring couldn't be totally separated from typechecking. Hmm.
You can always desugar as:
do x ==> return () >> x
Although then you are relying on the Monad laws more than you possibly
should. You could also have:
monady :: Monad m => m a -> m a
monady x = x
do x ==> monady x
Then you are relying on an additional function that doesn't currently exist.
Thanks
Neil
More information about the Haskell-Cafe
mailing list