Re: [Haskell-cafe] Scrap your rolls/unrolls

2010-11-03 Thread Max Bolingbroke
On 2 November 2010 14:10, Bertram Felgenhauer bertram.felgenha...@googlemail.com wrote: Indeed. I had a lot of fun with the ideas of this thread, extending the 'Force' type family (which I call 'Eval' below) to a small EDSL on the type level: I also came up with this.. I was trying to use it

Re: [Haskell-cafe] Scrap your rolls/unrolls

2010-11-02 Thread Bertram Felgenhauer
Max Bolingbroke wrote: On 23 October 2010 15:32, Sjoerd Visscher sjo...@w3future.com wrote: A little prettier (the cata detour wasn't needed after all):   data IdThunk a   type instance Force (IdThunk a) = a Yes, this IdThunk is key - in my own implementation I called this Forced,

Re: [Haskell-cafe] Scrap your rolls/unrolls

2010-10-23 Thread Sebastian Fischer
Hi Max, neat idea! Haskell supports laziness even on the type level ;) I tried to play with your code but did not get very far. I quickly ran into two problems. On Oct 22, 2010, at 7:37 PM, Max Bolingbroke wrote: The annoying part of this exercise is the the presence of a Force in the

Re: [Haskell-cafe] Scrap your rolls/unrolls

2010-10-23 Thread Sjoerd Visscher
On Oct 23, 2010, at 1:27 PM, Sebastian Fischer wrote: I think `Control.Functor.Categorical.CFunctor` is a more natural replacement for functor here. One can define instance CFunctor (ListF a) ForceCat Hask and I was hoping that I could define `fold` based on CFunctor but I did not

Re: [Haskell-cafe] Scrap your rolls/unrolls

2010-10-23 Thread Sjoerd Visscher
A little prettier (the cata detour wasn't needed after all): data IdThunk a type instance Force (IdThunk a) = a type Alg f a = f (IdThunk a) - a fold :: CFunctor f ForceCat (-) = Alg f a - Fix f - a fold alg = alg . cmap (ForceCat $ fold alg) sumAlg :: Alg (ListF Int) Int

Re: [Haskell-cafe] Scrap your rolls/unrolls

2010-10-23 Thread Max Bolingbroke
On 23 October 2010 15:32, Sjoerd Visscher sjo...@w3future.com wrote: A little prettier (the cata detour wasn't needed after all):   data IdThunk a   type instance Force (IdThunk a) = a Yes, this IdThunk is key - in my own implementation I called this Forced, so: type instance Force (Forced

Re: [Haskell-cafe] Scrap your rolls/unrolls

2010-10-23 Thread Sjoerd Visscher
I use Apply for Functor application in data-category, I used an infix operator :% http://hackage.haskell.org/packages/archive/data-category/0.3.0.1/doc/html/src/Data-Category-Functor.html#line-57 F.e. composition is defined like this: type instance (g :.: h) :% a = g :% (h :% a) Sjoerd On

Re: [Haskell-cafe] Scrap your rolls/unrolls

2010-10-22 Thread Dan Doel
On Friday 22 October 2010 6:37:49 am Max Bolingbroke wrote: This is all well and good, but it means when working with data types defined in this manner you have to write Roll and unroll everywhere. This is tedious :-( Your discovery is interesting (and I haven't seen it before). Another