All Questions
Tagged with functional-programming monads
17 questions
5
votes
1
answer
925
views
Monad object in C++
Have I defined a Monad object for C++? Below is a class called var which I created years ago to implement a lambda calculus like interpreter in C++. The class ...
7
votes
1
answer
422
views
A beginner's brainfuck interpreter in Haskell
I am rather new to haskell, and could use some feedback on my code and the decisions I had to make. In my previous project, I made a JSON parser, but relied heavily on guidance from a university ...
5
votes
1
answer
173
views
Typescript monad for data being loaded
I have been struggling to make typescript happy about the types.
I am pulling data from our backend API and I wanted to give context to the data. Basically it is a monad with 4 shapes:
Initial (...
1
vote
1
answer
50
views
Stack Exchange API Reader
I've been working on some code to pull questions from the realtime feed on stackexchange.com and query more information about them from the API. It works, but I'd love some feedback on how I could ...
2
votes
0
answers
62
views
Monadic implementation of asynchronous tasks (hidden overhead of threads)
So, I've been reading about monads and I wanted to see if I could implement a system for asynchronous computation in a monadic way.
I came up with two solutions:
The first one spawns a thread for ...
7
votes
1
answer
133
views
Monadic list for a more functional approach to C#
I am learning about monadic structures and have created a sort of monad list that implements the map and binding "operators" (or technically methods) in C#.
I understand that Linq already exists and ...
8
votes
1
answer
618
views
F# Either computation expression with while loop
I want to implement an Either computation expression in F#. The computation executes a function inside a while loop, and this function's return type is ...
4
votes
1
answer
1k
views
Monad Implementation in Typescript
Having been introduced to monads through Scala, I am trying to add the generalized design pattern to my toolkit by implementing it in a language I use more regularly (typescript).
My tests pass (...
6
votes
1
answer
396
views
Algebraic Effect Monad to separate pure and impure code
I want to write my C# code in a way which makes effects (state, I/O, etc) explicit in the type signature. I have started to understand monads, and have some acquaintance with algebraic effects, though ...
8
votes
1
answer
384
views
Functional Programming Library
I have started putting together a functional programming library in C# which is somewhat inspired by scalaz and the book Functional Programming in Scala.
I am hoping to get some feedback on the Monad ...
5
votes
2
answers
320
views
Checking in four directions for board game win
I have the following code which I would like to simplify in Haskell, although I'm not sure how. I recall that I can use monads to simplify a case chain when the result of the case leads onto a next ...
5
votes
1
answer
360
views
Popping from a list in state while a condition is true
I'm dealing with data that stores its state as a String, treating the string like a stack. I also have to combine that with error handling.
To that end, I'm using ...
2
votes
2
answers
626
views
Haskell monads: sum of primes
They say you cannot get out of the monad, but I need to use the result (at least for assertions / unit tests). But print how does it do it?
Otherwise, I worked ...
8
votes
1
answer
228
views
Monadic Immutable Linked List in the Least Functional Language Evar
I've written a List monad as an example for a related question. This is a rather frustrating experience as I wanted to use Java, which (as of Java 7) still lacks lambda expressions and lacks higher-...
10
votes
2
answers
1k
views
Monad transformers in C# for use in validation
I am working on using monad transformers in C#. I would like to know if the following code I present, shows that I have understood this. I am fairly new to this so any feedback / comments are really ...