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

sections Get a little more information about

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -