
Alexander Solla wrote:
(Do you confirm that tilde in s~s1 means "s has the same type as s1"? I have not found this information explicitly in the Haskell stuff I have read).
Yes.
http://www.haskell.org/ghc/docs/7.4.1/html/users_guide/equality-constraints....
Is this (Typeable) the right way to go? Is there any other solution?
Using typeable is a perfectly reasonable way to go.
Thanks for your help. Unfortunately, I am in the following case (in my real code, not the dummy example of my initial post): http://haskell.1045720.n5.nabble.com/Can-t-make-a-derived-instance-of-Typeab... Indeed, I obtain at compilation: Can't make a derived instance of `Typeable (Tensor ($a))': `Tensor' must only have arguments of kind `*' "Tensor" is a type constructor which takes a type-level integer as argument to make a concrete type "Tensor order" (so its kind is Nat -> *). Thus in my real code, I cannot derive the typeable instance automatically. I am compelled to write an instance of typeable for my GADT. Are there some tutorial around here? Because the documentation page is a bit terse for my level of knowledge: http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data-Typeable.htm... In the first link above, someone writes: """ You'll have to manually write a Typeable instance if you want one. The process is somewhat trickier than you might expect, due to the fact that Typeable does some unsafe stuff. But there are plenty of examples for how to do it safely. """ Where are these examples that can help me to write my instance? I have tried to read the source of the implemented instances in data.typeable, not so easy for me. Thanks, TP