Skip to main content

All 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 ...
StormCrow's user avatar
  • 369
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 ...
el_micha's user avatar
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 (...
Mehdi Saffar's user avatar
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 ...
thesecretmaster's user avatar
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 ...
markonius's user avatar
  • 121
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 ...
NaN's user avatar
  • 205
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 ...
Carlos Rodriguez's user avatar
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 (...
Manningham's user avatar
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 ...
Kazark's user avatar
  • 273
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 ...
Blair Davidson's user avatar
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 ...
user103853's user avatar
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 ...
Matthew's user avatar
  • 153
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 ...
Liviu's user avatar
  • 131
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-...
amon's user avatar
  • 12.6k
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 ...
Blair Davidson's user avatar

15 30 50 per page