This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| λ> import Data.Tree | |
| λ> import Control.Comonad | |
| λ> let t = Node (1::Int) [Node 2 [Node 4 [],Node 5 []],Node 3 [Node 6 [],Node 7 []]] | |
| λ> let draw = putStrLn . drawTree . fmap show | |
| λ> draw t | |
| 1 | |
| | | |
| +- 2 | |
| | | | |
| | +- 4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Transforming between classy stuff. | |
| -- | Foo is present in input and output. | |
| data Foo = Foo | |
| -- | Classy. | |
| class HasFoo a where foo :: Lens' a Foo | |
| -- | Maybe Bar is added to output type. | |
| data Bar = Bar |
NewerOlder