If I have the custom data type as follows:
data MyType :: * -> * where
Zero:: MyType a
One:: a -> MyType a
Two:: MyType a -> MyType b -> MyType (a,b)
Is it the same as writing them as:
data MyType a = Zero
| One a
Is the above correct? And how do I represent Two?
This has to be done via GADT. The trick is to enable KindSignature in your program.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.