[Hs-Generics] RE: Generics

Neil Mitchell ndmitchell at gmail.com
Thu Dec 11 03:49:12 EST 2008


Hi Pedro,

>> I'm not sure there is a nice solution - reflection at the type level
>> (using _|_ at the value level), combined with strictness at the value
>> level, has limitations. It may be that the reflection machinery in SYB
>> can be tweaked to either alert the user in advance (i.e. by getting
>> the strictness of various fields), or providing some operation
>> combining gmapQ and fromConstr which isn't strict. To see my use case
>> take a look at "contains" in:
>>
>> http://www.cs.york.ac.uk/fp/darcs/uniplate/Data/Generics/PlateData.hs
>
> I'm not sure there's an easy solution either. As you say, the problem here
> seems to be caused by the strictness. Getting the strictness of each field
> would require changes to the representation types and to the deriving
> mechanism.
>
> Would your problem be solved if you used fromConstrB instead of simply
> fromConstr and built an entirely determined (without bottoms) value?

I might be able to use fromConstrB, but it requires a lot more work -
initialising lots of things and creating lots of dummy values. I'll
look into it.

I also note that the documentation for fromConstrB seems to have
disappeared. See:
http://haskell.org/ghc/docs/latest/html/libraries/syb/doc-index.html -
the entry is still there but the link is gone.

(I'm also aware that the Hoogle documentation for it is missing, but
hope to fix that this weekend - I've had issues trying to build
things)

Thanks

Neil


More information about the Generics mailing list