Skip to main content

All Questions

Filter by
Sorted by
Tagged with
6 votes
1 answer
2k views

Writing monadic Haskell to evaluate arithmetic expression

I have been studying Haskell by myself for about a little over a year. And I have been stuck at monad/monad transformers for quite a while until recently some examples I read online enlightened me. So ...
dhu's user avatar
  • 327
3 votes
1 answer
970 views

Infix to postfix notation in Haskell (Shunting-yard algorithm)

I've written an infix to postfix converter in Haskell using the Shunting-yard algorithm. Example of how it works: ...
atmostmediocre's user avatar
1 vote
1 answer
659 views

Reverse Polish Notation evaluator in Haskell

I've created an RPN evaluator in Haskell, as an exercise because I'm new to this language. It runs well: $ ./rpn 2 3 4 5 + - + -4 And the source code: ...
atmostmediocre's user avatar
3 votes
2 answers
985 views

CodeWars - Three-pass compiler for arithmetic expressions

I'm looking for feedback on my solution to the Tiny Three-Pass Compiler kata on CodeWars. The kata is to implement a compiler for an arithmetic language in three passes - parsing to an AST, constant ...
DylanSp's user avatar
  • 193
6 votes
1 answer
413 views

Data structure for expression evaluation in Haskell

I've made a data structure for mathematical expressions. I want to parse mathematical expressions like: \$x = 3\$ \$y = 4\$ \$z = x + y :\$ into an evaluated document like: \$x = 3\$ \$y = 4\$ \$z = x ...
Teodor's user avatar
  • 163
4 votes
3 answers
1k views

Math eval function for Haskell

I recently finished reading Learn you a Haskell for great good!. Even though some topics are a bit over my head (Monads anyone?), I wanted to try my hand at a ...
J Atkin's user avatar
  • 1,810
4 votes
1 answer
226 views

Safe Reverse Polish Notation

I implemented the following (what I believe to be) safe Reverse Polish Calculator. Now I'm using foldM to take advantage of the power of Monads. Previously, I was ...
Kevin Meredith's user avatar
6 votes
1 answer
3k views

Reverse Polish Notation Calculator

Working through Learn You a Haskell, I made a Reverse Polish Notation calculator. Please critique it. ...
Kevin Meredith's user avatar