Try *instance NFData a => NFData (MyGADT (Maybe a) )* On Sunday, January 19, 2014, Corentin Dupont <corentin.dupont@gmail.com> wrote:
Hi, I've tried the make an instance of NFData for all types, although I have a problem with the GATD:
*data MyGADT a where MyField :: b -> MyGADT (Maybe b) instance NFData a => NFData (MyGADT a) where rnf (MyField b) = (rnf b)* Gives me : Could not deduce (NFData b) arising from a use of `rnf' from the context (NFData a)
Which I understand (that's because a ~ *Maybe b *and not* a ~ b *due to the declaration of *MyField b *being of type *MyGADT (Maybe b)*)
*But I have no idea how to solve that?? *
*Thanks...*
*Corentin*
On Mon, Jan 13, 2014 at 1:10 AM, Brandon Allbery <allbery.b@gmail.com<javascript:_e({}, 'cvml', 'allbery.b@gmail.com');>
wrote:
On Sun, Jan 12, 2014 at 6:44 PM, Corentin Dupont < corentin.dupont@gmail.com <javascript:_e({}, 'cvml', 'corentin.dupont@gmail.com');>> wrote:
One question: Since it works with putStrLn, can I simulate the behaviour of putStrLn without actually... printing anything? As a workaround...
Worst case, open a handle on /dev/null and hPutStr to it.
I'd probably try to figure out how to write appropriate NFData instances, though.
-- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com <javascript:_e({}, 'cvml', 'allbery.b@gmail.com');> ballbery@sinenomine.net <javascript:_e({}, 'cvml', 'ballbery@sinenomine.net');> unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net