[Haskell-cafe] Rigid types fun

Mitar mmitar at gmail.com
Fri Nov 5 05:45:21 EDT 2010


Hi!

I have much fun with rigid types, type signatures and GADTs. And I
would like to invite also others in and share my joy. ;-)

Please see the attached file and chase a solution to how to make it
compile. I would like to have a function which I would call like:

createNerve (Axon undefined) (AxonAny undefined)

and it would return proper Nerve. Similar to how asTypeOf works.

I would like to do that to remove repeating code like:

from <- newChan
for <- newChan
let nerve = Nerve (Axon from) (AxonAny for)

which I have to write again and again just to make types work out. Why
I cannot move that into the function?

I am using GHC 6.12.3. Is this something which will work in 7.0?


Mitar
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Test.hs
Type: application/octet-stream
Size: 1240 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20101105/2379c65d/Test.obj


More information about the Haskell-Cafe mailing list