Hi Tony and James, I'm having trouble constructing the ToObj instance.
The obvious code: toObj (w o) = o fails with a syntax error. How do I unwrap the value? Kevin On Sep 8, 2:30 pm, James Andrew Cook <[email protected]> wrote: > On Sep 8, 2010, at 8:19 AM, Kevin Jardine wrote: > > > > > Hi Tony, > > > I stared at that specific section for at least half an hour earlier > > today but could not figure out how it applied in my specific case. The > > only examples I have see are for deriving Num. Do you have any more > > detail on how I could use that extension? > > > Kevin > > > On Sep 8, 2:05 pm, Tony Morris <[email protected]> wrote: > >> I think you might want -XGeneralizedNewtypeDeriving > > >>http://haskell.org/ghc/docs/6.12.2/html/users_guide/deriving.html#id6... > > >> On 08/09/10 22:01, Kevin Jardine wrote: > > I'm not sure if it's what he originally had in mind, but if your Obj class > has a ToObj instance (which would be reasonable), then that extension allows > your other classes to derive it: > > > newtype Foo = Foo Obj deriving ToObj > > -- James_______________________________________________ > Haskell-Cafe mailing list > [email protected]http://www.haskell.org/mailman/listinfo/haskell-cafe _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
