[Haskell-cafe] What's wrong in my Data.Generic.Zipper code?

martin martin.drautzburg at web.de
Sun Jul 10 18:03:48 UTC 2016


Am 07/10/2016 um 03:17 PM schrieb Martijn Schrage:
> Hi Martin,
> 
> Ghci defaults the type of 'getHole t1' to 'Maybe ()'. You can see this happening if you enable warnings in ghci with
> ':set -Wall'. Providing the correct type signature gives you the answer you're expecting:
> 
> *Main> getHole t1 :: Maybe [Int]
> Just [1,2,3]

I understand, thanks.

I tried a generic Zipper with a pair and noticed that going down gives me the second component. This does make some
sense, but I am still having trouble to anticipate what up, down, left and right do when the the datatype is more
complicated and not a tree. E.g. this one gives me trouble:

import qualified Data.Sequence as S

data Items lbl = Items (S.Seq (lbl, Items lbl))
                 deriving (Eq, Show, Typeable, Data)


Is there an easy way to understinfing those moves?





More information about the Haskell-Cafe mailing list