Sometimes, especially when dealing with business logic, we have to deal with data that comes in from the real world, or elsewhere, naturally very messily typed, leading to nasty type signatures and messes of macros or code generation to build data structures from a schema. Row polymorphism can help us by abstracting over the fields contained in a record type in the type signature, letting us define records based on data, concatenate records together, and define functions that are generic acro...| Stranger Systems
Monadic parsing is a form of parsing that combines lexing, parsing, and often evaluation in the same recursive process. Languages with strong algebraic data types (andthereby good pattern-matching) are excellent candidates for monadic parsing. Interestingly, Rust has a popular parser-combinator library called nom, but using it is not as clean as in ML-like languages due … Continue reading A simple Monadic Parser Combinator library in Idris| Talking with a Lisp
I thought it would be an interesting experiment to compare the generation of primes, lazily, in both Haskell and Idris. Haskell has lazy evaluation by default, and Idris does support it via the Lazy and Force primitives, and infinite data structuresusing Streams etc. Here is the code in Haskell (adapted from Graham Hutton’s book, “Programming … Continue reading Lazy primes in Idris| Talking with a Lisp
I had tried Idris some time back, and while I liked it, I didn’t follow through with it. One major reason was the fact that Idris’ focus appeared to be purely on research despitemarketing itself as a language for programmers. There is a bit of contradiction in that statement. Of late, however, especially with the … Continue reading Basic Matrix operations in Idris| Talking with a Lisp