monadfix Questions

2

How can we prove that the continuation monad has no valid instance of MonadFix?
Granary asked 13/9, 2014 at 20:10

2

Solved

The transformers implementation of MonadFix for MaybeT fails if the function ever evaluates to Nothing. Why is Nothing not propagating over mfix? mfix' :: MonadFix m => (a -> MaybeT m a) -&g...
Kinesiology asked 2/4, 2018 at 14:59

1

Solved

Given newtype Tree m a = Tree { runTree :: m (Node m a) } data Node m a = Node { nodeValue :: a , nodeChildren :: [Tree m a] } Is there a valid MonadFix instance? My attempt was instance ...
Matrimony asked 15/12, 2017 at 13:16

2

Solved

The instance is defined as instance MonadFix [] where mfix f = case fix (f . head) of [] -> [] (x:_) -> x : mfix (tail . f) But I'm failing to grasp the intuitive meaning behind it with...
Medeah asked 3/7, 2016 at 9:55

1

Data.Tree includes unfoldTreeM_BF and unfoldForestM_BF functions to construct trees breadth-first using the results of monadic actions. The tree unfolder can be written easily using the forest unfo...
Deuteronomy asked 2/1, 2015 at 21:3

2

Solved

The question is mostly in the title. It seems like mfix can be defined for any monadic computation, even though it might diverge: mfix :: (a -> m a) -> m a mfix f = fix (join . liftM f) Wh...
Caldwell asked 12/9, 2014 at 18:23

1

I'm working on camlp4 extension for haskell-like do notation in Ocaml, and trying to figure out how GHC compiles recursive do-bindings (enabled with -XDoRec). I wonder if it possible for monadic fi...
Determine asked 21/3, 2013 at 16:55

3

Solved

http://hackage.haskell.org/package/free in Control.Monad.Free.Free allows one to get access to the "free monad" for any given Functor. It does not, however, have a MonadFix instance. Is this becaus...
Geodesic asked 31/1, 2013 at 22:7

5

Solved

I'm working on a Haskell project that involves tying a big knot: I'm parsing a serialized representation of a graph, where each node is at some offset into the file, and may reference another node ...
Sleeping asked 16/6, 2012 at 3:34

1

Solved

I've stumbled upon something that I'm guessing is a bug in Data.Map, but which is also quite possibly a bug in my Haskell knowledge. Hoping somebody can clarify which it is :) Please reference thi...
Tradein asked 24/6, 2012 at 19:28

2

Solved

A simple question, I hope: The binary package defines two types, Get and Put. The former is essentially a state monad, and the latter is essentially a writer. Both state and writer have reasonable ...
Mendie asked 17/6, 2012 at 2:16

2

Solved

I'm writing a brainfuck interpreter in Haskell, and I came up with what I believe to be a very interesting description of a program: data Program m = Instruction (m ()) (Program m) | Control (m (...
Hazan asked 12/5, 2012 at 0:35

1

Solved

I want to write a slick bit of code (saving me much time to implement otherwise) by tying the knot. It goes roughly like this, n <- myinstr n x where in theory, myinstr should run x to get a ...
Crescantia asked 5/12, 2011 at 0:41
1

© 2022 - 2024 — McMap. All rights reserved.