Thank you! And yes that works...
But what if i do want to give several parameters to hprint? In my second email i noted i get a different error message in that case?
so for instance:
Hi Emmanuel,
> writeProgramInfo :: Handle -> ProgramInfo -> IO ()
> writeProgramInfo handle program = do
> TF.hprint handle "hello"
>
> I get this error message at build time:
>
> Couldn't match expected type `IO ()'
> with actual type `ps0 -> m0 ()'
> In the return type of a call of `TF.hprint'
> In the expression: TF.hprint handle "hello"
> In the expression: do { TF.hprint handle "hello" }
GHC expects an expression of 'IO ()' - the return type of writeProgramInfo -
but the expression 'TF.hprint handle "hello"' has the type 'ps0 -> m0 ()'
Look at the type of 'hprint':
hprint :: (MonadIO m, Params ps) => Handle -> Format -> ps -> m ()
Your call of 'hprint' is missing the last argument, the 'ps'. So
instead of 'm ()' you're returing the function 'ps -> m()', that's
what GHC tries to tell you.
You might be confused, because 'hprintf' uses some magic to allow
multiple parameters and can even be called without any parameter.
'hprint' uses are more explict - and imho a nicer and simpler approach -
for the parameters, but the parameter can't be completly omitted,
it has to be at least '()'.
So in your case: TF.hprint handle "hello" ()
Greetings,
Daniel
_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners