Hi!

I believe dependent types is the right term for my problem. I was
trying to solve it with GADTs but I was not successful so I am turning
to infinite (lazy) wisdom of Haskell Cafe.

I am attaching example code where I had to define MaybePacket data
type which combines different types of Packets I would like to allow
over Line. The problem is that there is a correlation between Line
type and MaybePacket type and I would like to tell Haskell about that.
But I am not sure how. Because now compiler, for example, warns me of
a non-exhaustive pattern even if some MaybePacket value is not
possible for given Line.

Somehow I would like to have a getFromFirstLine function which would
based on type of given Line return Maybe (Packet i) (for Line) or
Maybe AnyPacket (for LineAny). So that this would be enforced and type
checked.

Best regards and thanks for any help


Mitar

Attachment: Test2.hs
Description: Binary data

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to