Serguey Zefirov <[email protected]> writes:
>>> I cannot directly create my own class instances for them because of
>>> that. But I found that I can write Template Haskell code that could do
>>> that - those data types could be reified just fine.
>> Huh? Sure you can write class instances for them.
>> ,----
>> | instance SizeOf (Map k v) where
>> | sizeOf = Map.size
>> `----
>
> Those are trivial. They are not interesting.
You said you couldn't write any, and of course I wrote a trivial one
because I didn't want to write a whole library in an email.
> I cannot write classes that see into internal structure. For example,
> I cannot write my own (de)serialization without using from/toAscList.
So? What's wrong with using {from,to}AscList ?
You could also try using GHC's stand-alone deriving mechanism to derive
binary or something:
http://www.haskell.org/haskellwiki/GHC/Stand-alone_deriving_declarations
>>> This is somewhat strange situation. Was it a design decision?
>> The reason that they are exported abstractly is so that you don't see
>> the internals of the data structure, because 1) you don't need to, and
>> 2) to stop you from doing anything stupid with them.
>
> I was talking about successful reification of abstract data types.
>
> That way I can do anything stupid with them.
Why do you want to?
--
Ivan Lazar Miljenovic
[email protected]
IvanMiljenovic.wordpress.com
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe