fixpoint-combinators Questions
1
Solved
Consider the following datatype:
data Foo = Halt | Iter Foo
This is the fixpoint of Maybe. It contains the direct limit of the sequence Void, Maybe Void, Maybe (Maybe Void) and so on, where pure i...
Sticktight asked 31/7, 2023 at 2:12
1
In Haskell, Given a monad m, there is mfix :: (a -> m a) -> m a that computes the fixed-point of a monadic computation.
Dually, given a comonad w, there is cofix :: w (w a -> a) -> a th...
Crist asked 15/3, 2023 at 12:35
5
Solved
I was a bit confused by the documentation for fix (although I think I understand what it's supposed to do now), so I looked at the source code. That left me more confused:
fix :: (a -> a) ->...
Opec asked 24/1, 2011 at 21:34
1
Solved
fix f = let {x = f x} in x
Talking about let, I thought that let P = Q in R would evaluate Q -> Q' then P is replaced by Q' in R, or: R[P -> Q'].
But in fix definition the Q depends on R, how...
Angeli asked 3/12, 2020 at 10:15
1
Solved
In texts about fixed points in Haskell there is often mention of least and greatest fixed points. E.g. in the Data.Functor.Fixedpoint documentation or here.
Least and greatest imply an order on t...
Calque asked 13/5, 2020 at 20:14
1
Solved
In the recursion-schemes package the following types are defined:
newtype Fix f = Fix (f (Fix f))
newtype Mu f = Mu (forall a. (f a -> a) -> a)
Are they isomorphic? If so, how do you prov...
Dnieper asked 7/4, 2020 at 15:17
2
Solved
I'm trying to convince myself that type Fix and function fix are the same thing.
But I can't find the correlation between their definitions
-- definition of fix
fix :: (p -> p) -> p
fix f = ...
Royer asked 28/1, 2020 at 15:50
3
Solved
This is the usual definition of the fixed-point combinator in Haskell:
fix :: (a -> a) -> a
fix f = let x = f x in x
On https://wiki.haskell.org/Prime_numbers, they define a different fixe...
Plage asked 11/12, 2018 at 0:45
3
Solved
I feel like understanding the abstract concept of fixed point of a functor, however, I am still struggling to figure out the exact implementation of it and its catamorphism in Haskell.
For example...
Tetrabasic asked 27/11, 2018 at 4:28
1
Solved
Description of loop from Control.Arrow:
The loop operator expresses computations in which an output value is fed back as input, although the computation occurs only once. It underlies the rec va...
Junto asked 9/8, 2018 at 3:27
1
Solved
How come the least fix point coincides with the greatest fix point in a lazy non-total language like Haskell. What does continuity on complete partial orders have to do with that?
Agate asked 4/8, 2018 at 7:8
1
Solved
Since Nothing >>= f = Nothing for every f, the following trivial definition is suitable for mfix:
mfix _ = Nothing
But this has no practical use, so we have the following nontotal definiti...
Climate asked 13/7, 2018 at 11:29
1
Solved
I have this lovely fixana function here that performs about 5 times faster than her sister ana. (i have a criterion report to back me on this)
ana alg = Fix . fmap (ana alg) . alg
fixana alg = fi...
Pacify asked 9/2, 2018 at 12:5
1
Solved
In this article about the Free Monads in Haskell we are given a Toy datatype defined by:
data Toy b next =
Output b next
| Bell next
| Done
Fix is defined as follows:
data Fix f = Fix (f (Fi...
Ogive asked 28/8, 2017 at 9:55
1
Solved
In Ed Kmett's recursion-scheme package, there are three declarations:
newtype Fix f = Fix (f (Fix f))
newtype Mu f = Mu (forall a. (f a -> a) -> a)
data Nu f where
Nu :: (a -> f a) -&...
Eleanoreleanora asked 9/8, 2017 at 2:45
2
Solved
Let's say I want to have a very generic ListF data type:
{-# LANGUAGE GADTs, DataKinds #-}
data ListF :: * -> * -> * where
Nil :: List a b
Cons :: a -> b -> List a b
Now I can use...
Skirr asked 22/7, 2017 at 16:32
4
Solved
The fix-point combinators are very useful tools to introduce recursion.
The Continuation-Passing style is a style of lambda calculus where functions never return. Instead you pass the rest of your...
Seneschal asked 10/3, 2016 at 13:45
2
I was reading http://www.haskellforall.com/2013/06/from-zero-to-cooperative-threads-in-33.html where an abstract syntax tree is derived as the free monad of a functor representing a set of instruct...
Fresno asked 25/6, 2013 at 20:59
1
Solved
I'm trying to implement a recursive datatype using recursion-schemes. I would like to be able to print it.
import Data.Functor.Foldable
data T1F a = Foo deriving Show
type T1 = Fix T1F
data T2 = ...
Hysteric asked 21/3, 2017 at 18:36
2
Solved
Still working on my text editor Rasa.
At the moment I'm building out the system for tracking viewports/splits (similar to vim splits). It seemed natural to me to represent this structure as a tree...
Chrystal asked 7/1, 2017 at 18:27
2
Solved
To make that clear, I'm not talking about how the free monad looks a lot like a fixpoint combinator applied to a functor, i.e. how Free f is basically a fixed point of f. (Not that this isn't inter...
Meridithmeriel asked 17/12, 2016 at 19:18
1
Solved
I'm trying to bend my head around fixed points and recursive definitions.
This works:
>>> take 10 $ let x = (0:x) in x
[0,0,0,0,0,0,0,0,0,0]
This does the same thing, which makes sense...
Midstream asked 11/9, 2016 at 19:1
1
Solved
Y - Combinator
I've been trying to learn about Y - Combinators (an explanation on that would be lovely as well) and came across an example from this wiki. An in depth explanation on the subject...
Ancipital asked 11/8, 2016 at 17:18
3
Solved
In Haskell, this is a simple (naive) definition of a fixed point
fix :: (a -> a) -> a
fix f = f (fix f)
But, here is how Haskell actually implements it (more efficient)
fix f = let x = f ...
Supra asked 21/5, 2016 at 17:45
2
Solved
I'm having trouble with the fixed point combinator in F#:
let rec fix f a = f (fix f) a
fix (fun body num ->
if num = 1000000
then System.Console.WriteLine "Done!"
else body (num + 1)
) ...
Meisel asked 18/4, 2015 at 18:2
1 Next >
© 2022 - 2024 — McMap. All rights reserved.