finger-tree

Finding the Missing 'Reduce' Typeclass from Finger Tree Article

ぐ巨炮叔叔 提交于 2019-12-22 04:24:31
问题 Yesterday's Wikibender that started with this stackoverflow qestion on Comonads ended up at MarkCC's article on Finger Trees. In the article he makes extensive use of the Reduce type class. He writes about this typeclass as if it is a very common and frequently use library, but I cannot find it on hackage, nor can I find enough documentation to really understand the code. Can someone help me understand what the Reduce typeclass is doing, how the (-<) and (>-) operators work, and what should

Finding the Missing 'Reduce' Typeclass from Finger Tree Article

孤人 提交于 2019-12-05 02:01:23
Yesterday's Wikibender that started with this stackoverflow qestion on Comonads ended up at MarkCC's article on Finger Trees . In the article he makes extensive use of the Reduce type class. He writes about this typeclass as if it is a very common and frequently use library, but I cannot find it on hackage, nor can I find enough documentation to really understand the code. Can someone help me understand what the Reduce typeclass is doing, how the (-<) and (>-) operators work, and what should tell me about the code in the article (copied below)? Code Listing from Finger Trees Done Right (I hope

Why aren't FingerTrees used enough to have a stable implementation?

☆樱花仙子☆ 提交于 2019-12-04 10:13:55
问题 A while ago, I ran across an article on FingerTrees (See Also an accompanying Stack Overflow Question) and filed the idea away. I have finally found a reason to make use of them. My problem is that the Data.FingerTree package seems to have a little bit rot around the edges. Moreover, Data.Sequence in the Containers package which makes use of the data structure re-implements a (possibly better) version, but doesn't export it. As theoretically useful as this structure seems to be, it doesn't

Type error when implementing finger trees

蹲街弑〆低调 提交于 2019-12-01 17:29:53
I wanted to play around with 2-3 finger trees as described in the (Haskell) paper by Hinze (see also this blog ). type Node<'a> = | Node2 of 'a * 'a | Node3 of 'a * 'a * 'a static member OfList = function | [a; b] -> Node2(a, b) | [a; b; c] -> Node3(a, b, c) | _ -> failwith "Only lists of length 2 or 3 accepted!" member me.ToList () = match me with | Node2(a, b) -> [a; b] | Node3(a, b, c) -> [a; b; c] type Digit<'a> = | One of 'a | Two of 'a * 'a | Three of 'a * 'a * 'a | Four of 'a * 'a * 'a * 'a static member OfList = function | [a] -> One(a) | [a; b] -> Two(a, b) | [a; b; c] -> Three(a, b,

Type error when implementing finger trees

谁说我不能喝 提交于 2019-12-01 16:37:20
问题 I wanted to play around with 2-3 finger trees as described in the (Haskell) paper by Hinze (see also this blog). type Node<'a> = | Node2 of 'a * 'a | Node3 of 'a * 'a * 'a static member OfList = function | [a; b] -> Node2(a, b) | [a; b; c] -> Node3(a, b, c) | _ -> failwith "Only lists of length 2 or 3 accepted!" member me.ToList () = match me with | Node2(a, b) -> [a; b] | Node3(a, b, c) -> [a; b; c] type Digit<'a> = | One of 'a | Two of 'a * 'a | Three of 'a * 'a * 'a | Four of 'a * 'a * 'a