How to put type constraint on data type in idris -
In IDRI, how can I disrupt the type of parameters in the algebraic data type?
In Haskell, I could do this:
data foo = bar {x :: integer, str :: string}
< P> Can I do it in Idris?
There are two options: data type
data Foo = Bar Int String
or Record
Record Fu: Type where bar: (x: int) -> (Str: string) - & gt; FU
There are some limitations in both: You do not have records in the case of data types, in case of records, you can have only one constructor.
You can make datasets and records in 3.2 data types and 3.11 dependent records
Comments
Post a Comment