[Haskell-cafe] Invertible functions list

Eugene Kirpichov ekirpichov at gmail.com
Tue Dec 29 11:07:20 EST 2009


Use operator precedence: infixr . I don't remember exactly how it is
used, but it should do the trick and let you get rid of the
parentheses.

2009/12/29 Jonathan Fischoff <jonathangfischoff at gmail.com>:
> Thirst will work I think. I tested a demo and the only problem I can see is
> the unwieldiness of the syntax, i.e
> testThirst = f `Cons` (g `Cons` (h `Cons` Nil))
> Maybe there is a way to sugar up the syntax to get rid of the parentheses?
> On Mon, Dec 28, 2009 at 7:43 PM, Antoine Latter <aslatter at gmail.com> wrote:
>>
>> On Mon, Dec 28, 2009 at 10:32 PM, Jonathan Fischoff
>> <jonathangfischoff at gmail.com> wrote:
>> > Hi,
>> > I would to create a list of tuples (or something similar) of invertible
>> > functions
>> > [((a -> b), (b -> a)), ((b -> c), (c -> b)), ....
>> > Such that I could call
>> > forward invertibleFuctionList domainValue = ? -- composite all the
>> > functions
>> > backward invertibleFuctionList rangeValue =
>> >     forward (reverse invertibleFuctionList) rangeValue  -- or something
>> > similar
>> >
>> > I would also like to concat them. This sounds like a job for GADT that
>> > someone might have already tackled. Any ideas?
>>
>> It looks like the thrist package should help you out:
>>
>> http://hackage.haskell.org/cgi-bin/hackage-scripts/package/thrist
>>
>> You could define some sort of type Iso:
>>
>> data Iso a b = Iso (a -> b) (b -> a)
>>
>> And then build a Thrist and fold over it, the functions forward and
>> backwards can both be implemented with right-folds.
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>



-- 
Eugene Kirpichov
Web IR developer, market.yandex.ru


More information about the Haskell-Cafe mailing list