[Haskell-cafe] What's wrong in my Data.Generic.Zipper code?
Martijn Schrage
martijn at oblomov.com
Sun Jul 10 13:17:13 UTC 2016
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]
Cheers,
Martijn
On 10 juli 2016 at 11:55:48, martin (martin.drautzburg at web.de) wrote:
Hello all,
I do not understand why this simple piece of code returns Nothing instead
of [1,2,3]. Can anybody help?
{-# LANGUAGE BangPatterns,NoMonomorphismRestriction, DeriveDataTypeable #-}
import Data.Typeable
import Data.Data
import Data.Generics.Zipper
ex_list1 :: [Int]
ex_list1 = [1,2,3]
t1 = toZipper ex_list1
-- *Main> getHole t1
-- Nothing
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20160710/9254bb6a/attachment.html>
More information about the Haskell-Cafe
mailing list