Re[Haskell-cafe] cursive referencing
Eugene Kirpichov
ekirpichov at gmail.com
Thu Jan 29 02:22:47 EST 2009
By the way, more advanced stuff of this kind is called "Tying the
knot"; you can do doubly linked lists with it and much more.
http://www.haskell.org/haskellwiki/Tying_the_Knot
2009/1/29 Belka <lambda-belka at yandex.ru>:
>
> Hello!
> I'm puzzled, if in Haskell it's possible to create a (pure) data structure,
> consisting of 2 substructures referencing each other:
> -------------------------
> data AA = AA {
> someData1 :: SomeData1
> bb :: BB
> }
>
> data BB = BB {
> someData2 :: SomeData2
> aa :: AA
> }
>
> f :: SomeData1 -> SomeData2 -> AA
> f somedata1 somedata2 = ??????????
>
> -- Always True:
> ghci> f == aa $ bb f
> True
> -------------------------
> Any ideas?
>
> Belka
> --
> View this message in context: http://www.nabble.com/Recursive-referencing-tp21722002p21722002.html
> Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
--
Евгений Кирпичев
Разработчик Яндекс.Маркета
More information about the Haskell-Cafe
mailing list