[Haskell-beginners] IO String inside a CmdArgs data

Kamil Stachowski kamil.stachowski at gmail.com
Fri Jan 14 21:45:49 CET 2011


It is funny, indeed :)

In fact, I am after all going to get unsafe because what Daniel Fischer
wrote above worked perfectly until I wanted to add annotations to ftConf
(the "&= summary" bit in http://community.haskell.org/~ndm/cmdargs/). The
only way I can go around the errors I get is precisely unsafe, so ah, you
only live once ;)


On 14 January 2011 21:36, Brent Yorgey <byorgey at seas.upenn.edu> wrote:

> On Fri, Jan 14, 2011 at 08:14:38PM +0100, Kamil Stachowski wrote:
> > @Daniel Fischer
> > Thanks for the offer, it's very kind of you, but I'm afraid I'll just
> need
> > to try to understand monads for the hundredth time :/
> >
> > @Brent Yorgey
> > Ah, thank you! But that would be the unsafe way, right? I think I should
> try
> > to do it the "right" way, but I'm sure this'll come in handy when I get
> > lost.
>
> Yes, I was mostly linking to that package just because it is funny,
> it's probably not what you really want to do. =)
>
> -Brent
>
> >
> >
> > On 14 January 2011 20:00, Brent Yorgey <byorgey at seas.upenn.edu> wrote:
> >
> > > On Fri, Jan 14, 2011 at 07:41:07PM +0100, Daniel Fischer wrote:
> > > >
> > > > b) if you absolutely have to have ftConf as a top-level name and it
> is
> > > safe
> > > > here:
> > > >
> > > > import System.IO.Unsafe (unsafePerformIO)
> > > >
> > > > {-# NOINLINE ftConf #-}
> > > > ftConf :: FuzzyTimeConf
> > > > ftConf = unsafePerformIO $ do
> > > >   now <- getClockTime
> > > >   return $ FuzzyTimeConf { time = convert now }
> > >
> > > There's already a Hackage package to accomplish this:
> > >
> > >  http://hackage.haskell.org/package/acme-now
> > >
> > > =)
> > >
> > > -Brent
> > >
> > > _______________________________________________
> > > Beginners mailing list
> > > Beginners at haskell.org
> > > http://www.haskell.org/mailman/listinfo/beginners
> > >
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20110114/ecaeba02/attachment-0001.htm>


More information about the Beginners mailing list