stefan@stefans-MacBook-Pro curs10 % ghci ghci GHCi, version 8.10.7: https://www.haskell.org/ghc/ :? for help Prelude> :l curs10 :l curs10 [1 of 1] Compiling Main ( curs10.hs, interpreted ) curs10.hs:5:12: error: Cannot parse data constructor in a data/newtype declaration: [Dir] | 5 | data Pos = [Dir] | ^^^^^ Failed, no modules loaded. Prelude> :r :r [1 of 1] Compiling Main ( curs10.hs, interpreted ) Ok, one module loaded. *Main> :r :r [1 of 1] Compiling Main ( curs10.hs, interpreted ) Ok, one module loaded. *Main> elemAt [L,L] t0 elemAt [L,L] t0 :4:14: error: Variable not in scope: t0 :: Tree *Main> :r :r [1 of 1] Compiling Main ( curs10.hs, interpreted ) Ok, one module loaded. *Main> elemAt [L,L] t0 elemAt [L,L] t0 *** Exception: should not be here CallStack (from HasCallStack): error, called at curs10.hs:21:23 in main:Main *Main> :r :r [1 of 1] Compiling Main ( curs10.hs, interpreted ) Ok, one module loaded. *Main> elemAt [L,L] t0 elemAt [L,L] t0 *** Exception: should not be here CallStack (from HasCallStack): error, called at curs10.hs:21:23 in main:Main *Main> elemAt [L] t0 elemAt [L] t0 Leaf *Main> :r :r [1 of 1] Compiling Main ( curs10.hs, interpreted ) Ok, one module loaded. *Main> elemAt t0 Leaf elemAt t0 Leaf :11:8: error: • Couldn't match type ‘Tree’ with ‘[Dir]’ Expected type: Pos Actual type: Tree • In the first argument of ‘elemAt’, namely ‘t0’ In the expression: elemAt t0 Leaf In an equation for ‘it’: it = elemAt t0 Leaf *Main> elemAt [L,L] t0 elemAt [L,L] t0 Leaf *Main> :r :r [1 of 1] Compiling Main ( curs10.hs, interpreted ) curs10.hs:21:16: error: • The constructor ‘Leaf’ should have 1 argument, but has been given none • In the pattern: Leaf In an equation for ‘elemAt’: elemAt (L : pos) Leaf = error "should not be here" | 21 | elemAt (L:pos) Leaf = error "should not be here" | ^^^^ Failed, no modules loaded. Prelude> :r :r [1 of 1] Compiling Main ( curs10.hs, interpreted ) Ok, one module loaded. *Main> elemAt [L,L] t0 elemAt [L,L] t0 Leaf 3 *Main> elemAt [L,L] t0 elemAt [L,L] t0 Leaf 3 *Main> elemAt [L,R] t0 elemAt [L,R] t0 Leaf 4 *Main> :r :r [1 of 1] Compiling Main ( curs10.hs, interpreted ) Ok, one module loaded. *Main> t1 t1 Node 1 (Node 2 (Leaf 4) (Leaf 5)) (Node 3 (Leaf 6) (Leaf 7)) *Main> :r :r [1 of 1] Compiling Main ( curs10.hs, interpreted ) curs10.hs:13:31: error: parse error on input ‘=’ | 13 | elemAt (L:pos) = (Node _ l r) = elemAt pos l | ^ Failed, no modules loaded. Prelude> :Lr :Lr unknown command ':Lr' use :? for help. Prelude> :r :r [1 of 1] Compiling Main ( curs10.hs, interpreted ) Ok, one module loaded. *Main> elemAt [L, R] t1 elemAt [L, R] t1 Leaf 5 *Main> :r :r [1 of 1] Compiling Main ( curs10.hs, interpreted ) curs10.hs:19:11: error: • Couldn't match expected type ‘Dir’ with actual type ‘[Dir]’ • In the pattern: L : pos In the pattern: [L : pos] In an equation for ‘changeAt’: changeAt [L : pos] (Node v l r) i = Node v (changeAt pos l i) r | 19 | changeAt [L:pos] (Node v l r) i = Node v (changeAt pos l i) r | ^^^^^ curs10.hs:20:11: error: • Couldn't match expected type ‘Dir’ with actual type ‘[Dir]’ • In the pattern: R : pos In the pattern: [R : pos] In an equation for ‘changeAt’: changeAt [R : pos] (Node v l r) i = Node v l (changeAt pos r i) | 20 | changeAt [R:pos] (Node v l r) i = Node v l (changeAt pos r i) | ^^^^^ Failed, no modules loaded. Prelude> :r :r [1 of 1] Compiling Main ( curs10.hs, interpreted ) Ok, one module loaded. *Main> elemAt [L, R] t1 elemAt [L, R] t1 Leaf 5 *Main> changeAt [L, R] t1 12 changeAt [L, R] t1 12 Node 1 (Node 2 (Leaf 4) (Leaf 12)) (Node 3 (Leaf 6) (Leaf 7)) *Main> t1 t1 Node 1 (Node 2 (Leaf 4) (Leaf 5)) (Node 3 (Leaf 6) (Leaf 7)) *Main> changeAt [R, R] t1 12 changeAt [R, R] t1 12 Node 1 (Node 2 (Leaf 4) (Leaf 5)) (Node 3 (Leaf 6) (Leaf 12)) *Main> changeAt [R, R] t1 8 changeAt [R, R] t1 8 Node 1 (Node 2 (Leaf 4) (Leaf 5)) (Node 3 (Leaf 6) (Leaf 8)) *Main> :r :r [1 of 1] Compiling Main ( curs10.hs, interpreted ) curs10.hs:31:11: error: • Couldn't match expected type ‘Dir’ with actual type ‘[Dir]’ • In the pattern: L : pos In the pattern: [L : pos] In an equation for ‘zipperAt’: zipperAt [L : pos] (Node v l r) = let (trail, arb) = zipperAt pos l in (LL v r : trail, arb) | 31 | zipperAt [L:pos] (Node v l r) = let (trail, arb) = zipperAt pos l in | ^^^^^ curs10.hs:33:11: error: • Couldn't match expected type ‘Dir’ with actual type ‘[Dir]’ • In the pattern: R : pos In the pattern: [R : pos] In an equation for ‘zipperAt’: zipperAt [R : pos] (Node v l r) = let (trail, arb) = zipperAt pos r in (RR v l : trail, arb) | 33 | zipperAt [R:pos] (Node v l r) = let (trail, arb) = zipperAt pos r in | ^^^^^ Failed, no modules loaded. Prelude> :r :r [1 of 1] Compiling Main ( curs10.hs, interpreted ) Ok, one module loaded. *Main> zipperAt [R, R] t1 zipperAt [R, R] t1 :33:1: error: • No instance for (Show Crumb) arising from a use of ‘print’ • In a stmt of an interactive GHCi command: print it *Main> :r :r [1 of 1] Compiling Main ( curs10.hs, interpreted ) Ok, one module loaded. *Main> zipperAt [R, R] t1 zipperAt [R, R] t1 ([RR 1 (Node 2 (Leaf 4) (Leaf 5)),RR 3 (Leaf 6)],Leaf 7) *Main> :r :r [1 of 1] Compiling Main ( curs10.hs, interpreted ) curs10.hs:8:41: error: • Variable not in scope: leaf :: t0 -> Tree • Perhaps you meant data constructor ‘Leaf’ (line 1) | 8 | t3' = Node 3 (Leaf 6) (Node 7 (Leaf 8) (leaf 9)) | ^^^^ Failed, no modules loaded. Prelude> :r :r [1 of 1] Compiling Main ( curs10.hs, interpreted ) Ok, one module loaded. *Main> zipperAt [R, R] t1 zipperAt [R, R] t1 ([RR 1 (Node 2 (Leaf 4) (Leaf 5)),RR 3 (Leaf 6)],Leaf 7) *Main> zipperAt [R, R] t1' zipperAt [R, R] t1' ([RR 1 (Node 2 (Leaf 4) (Leaf 5)),RR 3 (Leaf 6)],Node 7 (Leaf 8) (Leaf 9)) *Main> :r :r [1 of 1] Compiling Main ( curs10.hs, interpreted ) curs10.hs:41:38: error: • Couldn't match expected type ‘Tree -> Tree’ with actual type ‘Tree’ • The function ‘treeOf’ is applied to two arguments, but its type ‘Zipper -> Tree’ has only one In the second argument of ‘Node’, namely ‘(treeOf trail t)’ In the expression: Node v (treeOf trail t) r | 41 | treeOf ((LL v r):trail, t) = Node v (treeOf trail t) r | ^^^^^^^^^^^^^^ curs10.hs:41:45: error: • Couldn't match type ‘[Crumb]’ with ‘(Trail, Tree)’ Expected type: Zipper Actual type: [Crumb] • In the first argument of ‘treeOf’, namely ‘trail’ In the second argument of ‘Node’, namely ‘(treeOf trail t)’ In the expression: Node v (treeOf trail t) r | 41 | treeOf ((LL v r):trail, t) = Node v (treeOf trail t) r | ^^^^^ curs10.hs:42:40: error: • Couldn't match expected type ‘Tree -> Tree’ with actual type ‘Tree’ • The function ‘treeOf’ is applied to two arguments, but its type ‘Zipper -> Tree’ has only one In the third argument of ‘Node’, namely ‘(treeOf trail t)’ In the expression: Node v l (treeOf trail t) | 42 | treeOf ((RR v l):trail, t) = Node v l (treeOf trail t) | ^^^^^^^^^^^^^^ curs10.hs:42:47: error: • Couldn't match type ‘[Crumb]’ with ‘(Trail, Tree)’ Expected type: Zipper Actual type: [Crumb] • In the first argument of ‘treeOf’, namely ‘trail’ In the third argument of ‘Node’, namely ‘(treeOf trail t)’ In the expression: Node v l (treeOf trail t) | 42 | treeOf ((RR v l):trail, t) = Node v l (treeOf trail t) | ^^^^^ Failed, no modules loaded. Prelude> :r :r [1 of 1] Compiling Main ( curs10.hs, interpreted ) Ok, one module loaded. *Main> zipperAt [R, R] t1 zipperAt [R, R] t1 ([RR 1 (Node 2 (Leaf 4) (Leaf 5)),RR 3 (Leaf 6)],Leaf 7) *Main> treeOf (zipperAt [R, R] t1) treeOf (zipperAt [R, R] t1) Node 1 (Node 2 (Leaf 4) (Leaf 5)) (Node 3 (Leaf 6) (Leaf 7)) *Main> treeOf (zipperAt [R, R] t1') treeOf (zipperAt [R, R] t1') Node 1 (Node 2 (Leaf 4) (Leaf 5)) (Node 3 (Leaf 6) (Node 7 (Leaf 8) (Leaf 9))) *Main> treeOf (zipperAt [L, R] t1') treeOf (zipperAt [L, R] t1') Node 1 (Node 2 (Leaf 4) (Leaf 5)) (Node 3 (Leaf 6) (Node 7 (Leaf 8) (Leaf 9))) *Main> treeOf (zipperAt [R,L] t1') treeOf (zipperAt [R,L] t1') Node 1 (Node 2 (Leaf 4) (Leaf 5)) (Node 3 (Leaf 6) (Node 7 (Leaf 8) (Leaf 9))) *Main> :r :r [1 of 1] Compiling Main ( curs10.hs, interpreted ) Ok, one module loaded. *Main> zipperAt [R,R] t1' zipperAt [R,R] t1' ([RR 1 (Node 2 (Leaf 4) (Leaf 5)),RR 3 (Leaf 6)],Node 7 (Leaf 8) (Leaf 9)) *Main> :r :r [1 of 1] Compiling Main ( curs10.hs, interpreted ) Ok, one module loaded. *Main> t1' t1' Node 1 (Node 2 (Leaf 4) (Leaf 5)) (Node 3 (Leaf 6) (Node 7 (Leaf 8) (Leaf 9))) *Main> z1' z1' ([RR 1 (Node 2 (Leaf 4) (Leaf 5)),RR 3 (Leaf 6)],Node 7 (Leaf 8) (Leaf 9)) *Main> treeOf (change z1' 42) treeOf (change z1' 42) Node 1 (Node 2 (Leaf 4) (Leaf 5)) (Node 3 (Leaf 6) (Node 42 (Leaf 8) (Leaf 9))) *Main> :r :r [1 of 1] Compiling Main ( curs10.hs, interpreted ) curs10.hs:63:1: error: The type signature for ‘goRight’ lacks an accompanying binding | 63 | goRight :: Zipper -> Zipper | ^^^^^^^ curs10.hs:65:1: error: The type signature for ‘goUp’ lacks an accompanying binding | 65 | goUp :: Zipper -> Zipper | ^^^^ Failed, no modules loaded. Prelude> :r :r [1 of 1] Compiling Main ( curs10.hs, interpreted ) curs10.hs:46:1: error: Equations for ‘zipperAtAux’ have different numbers of arguments curs10.hs:46:1-27 curs10.hs:47:1-65 | 46 | zipperAtAux [] t a = (a, t) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^... Failed, no modules loaded. Prelude> :r :r [1 of 1] Compiling Main ( curs10.hs, interpreted ) Ok, one module loaded. *Main> zipperAt [R,R] t1' zipperAt [R,R] t1' ([LL 3 (Leaf 6),LL 1 (Node 2 (Leaf 4) (Leaf 5))],Node 7 (Leaf 8) (Leaf 9)) *Main> :r :r [1 of 1] Compiling Main ( curs10.hs, interpreted ) Ok, one module loaded. *Main> zipperAt [R,R] t1' zipperAt [R,R] t1' ([RR 3 (Leaf 6),RR 1 (Node 2 (Leaf 4) (Leaf 5))],Node 7 (Leaf 8) (Leaf 9)) *Main> :r :r [1 of 1] Compiling Main ( curs10.hs, interpreted ) Ok, one module loaded. *Main> treeOf (zipperAt [R,R] t1') treeOf (zipperAt [R,R] t1') Node 1 (Node 2 (Leaf 4) (Leaf 5)) (Node 3 (Leaf 6) (Node 7 (Leaf 8) (Leaf 9))) *Main> treeOf (zipperAt [R,R] t1) treeOf (zipperAt [R,R] t1) Node 1 (Node 2 (Leaf 4) (Leaf 5)) (Node 3 (Leaf 6) (Leaf 7)) *Main> :r :r [1 of 1] Compiling Main ( curs10.hs, interpreted ) Ok, one module loaded. *Main> treeOf (zipperAt [R,R] t1) treeOf (zipperAt [R,R] t1) Node 1 (Node 2 (Leaf 4) (Leaf 5)) (Node 3 (Leaf 6) (Leaf 7)) *Main> treeOf (zipperAt [R,R] t1') treeOf (zipperAt [R,R] t1') Node 1 (Node 2 (Leaf 4) (Leaf 5)) (Node 3 (Leaf 6) (Node 7 (Leaf 8) (Leaf 9))) *Main> zipperAt [R,R] t1' zipperAt [R,R] t1' ([RR 3 (Leaf 6),RR 1 (Node 2 (Leaf 4) (Leaf 5))],Node 7 (Leaf 8) (Leaf 9)) *Main> goLeft (zipperAt [R,R] t1') goLeft (zipperAt [R,R] t1') ([LL 7 (Leaf 9),RR 3 (Leaf 6),RR 1 (Node 2 (Leaf 4) (Leaf 5))],Leaf 8) *Main> goRight (zipperAt [R,R] t1') goRight (zipperAt [R,R] t1') :67:1: error: • Variable not in scope: goRight :: Zipper -> t • Perhaps you meant data constructor ‘Right’ (imported from Prelude) *Main> :r :r [1 of 1] Compiling Main ( curs10.hs, interpreted ) Ok, one module loaded. *Main> goRight (zipperAt [R,R] t1') goRight (zipperAt [R,R] t1') ([RR 7 (Leaf 8),RR 3 (Leaf 6),RR 1 (Node 2 (Leaf 4) (Leaf 5))],Leaf 9) *Main> :r :r [1 of 1] Compiling Main ( curs10.hs, interpreted ) Ok, one module loaded. *Main> goUp ([RR 7 (Leaf 8),RR 3 (Leaf 6),RR 1 (Node 2 (Leaf 4) (Leaf 5))],Leaf 9) ],Leaf 9) ([RR 3 (Leaf 6),RR 1 (Node 2 (Leaf 4) (Leaf 5))],Node 7 (Leaf 8) (Leaf 9)) *Main> *Main> goUp ([RR 7 (Leaf 8),RR 3 (Leaf 6),RR 1 (Node 2 (Leaf 4) (Leaf 5))],Leaf 9) ],Leaf 9) ([RR 3 (Leaf 6),RR 1 (Node 2 (Leaf 4) (Leaf 5))],Node 7 (Leaf 8) (Leaf 9)) *Main> *Main> goUp (go Up (goUp ([RR 7 (Leaf 8),RR 3 (Leaf 6),RR 1 (Node 2 (Leaf 4) (Leaf 5))],Leaf 9))) 4) (Leaf 5))],Leaf 9))) :75:7: error: Variable not in scope: go :: t0 -> Zipper -> Zipper :75:10: error: Data constructor not in scope: Up *Main> *Main> goUp (goUp (goUp ([RR 7 (Leaf 8),RR 3 (Leaf 6),RR 1 (Node 2 (Leaf 4) (Leaf 5))],Leaf 9))) 4) (Leaf 5))],Leaf 9))) ([],Node 1 (Node 2 (Leaf 4) (Leaf 5)) (Node 3 (Leaf 6) (Node 7 (Leaf 8) (Leaf 9)))) *Main> *Main> goRight (zipperAt [R,R] t1') goRight (zipperAt [R,R] t1') ([RR 7 (Leaf 8),RR 3 (Leaf 6),RR 1 (Node 2 (Leaf 4) (Leaf 5))],Leaf 9) *Main> goUp (goRight (zipperAt [R,R] t1')) goUp (goRight (zipperAt [R,R] t1')) ([RR 3 (Leaf 6),RR 1 (Node 2 (Leaf 4) (Leaf 5))],Node 7 (Leaf 8) (Leaf 9)) *Main> goUp (goRight z1') == z1' goUp (goRight z1') == z1' True *Main> goUp (goLeft z1') == z1' goUp (goLeft z1') == z1' True *Main> :r :r [1 of 1] Compiling Main ( curs10.hs, interpreted ) Ok, one module loaded. *Main> treeOf' z1' == treeOf z1' treeOf' z1' == treeOf z1' True *Main> :r :r [1 of 1] Compiling Main ( curs10.hs, interpreted ) Ok, one module loaded. *Main> zipperAt' [R, R] t1 == zipperAt [R, R] t1 zipperAt' [R, R] t1 == zipperAt [R, R] t1 True *Main> zipperAt' [L, R] t1 == zipperAt [L, R] t1 zipperAt' [L, R] t1 == zipperAt [L, R] t1 False *Main> zipperAt' [L, R] t1 == zipperAt [R, L] t1 zipperAt' [L, R] t1 == zipperAt [R, L] t1 True *Main> :r :r [1 of 1] Compiling Main ( curs10.hs, interpreted ) Ok, one module loaded. *Main> zipperAt' [R, R] t1 == zipperAt [R, R] t1 zipperAt' [R, R] t1 == zipperAt [R, R] t1 True *Main> zipperAt' [L, R] t1 == zipperAt [L, R] t1 zipperAt' [L, R] t1 == zipperAt [L, R] t1 True *Main> zipperAt' [R, L] t1 == zipperAt [R, L] t1 zipperAt' [R, L] t1 == zipperAt [R, L] t1 True *Main> zipperAt [] t1 zipperAt [] t1 ([],Node 1 (Node 2 (Leaf 4) (Leaf 5)) (Node 3 (Leaf 6) (Leaf 7))) *Main> goUp (zipperAt [] t1) goUp (zipperAt [] t1) *** Exception: curs10.hs:(76,1)-(77,46): Non-exhaustive patterns in function goUp *Main> :r :r [1 of 1] Compiling Main ( curs10.hs, interpreted ) Ok, one module loaded. *Main> pred 0 pred 0 :96:1: error: Ambiguous occurrence ‘pred’ It could refer to either ‘Prelude.pred’, imported from ‘Prelude’ at curs10.hs:1:1 (and originally defined in ‘GHC.Enum’) or ‘Main.pred’, defined at curs10.hs:103:1 *Main> :r :r [1 of 1] Compiling Main ( curs10.hs, interpreted ) Ok, one module loaded. *Main> pred' 0 pred' 0 Nothing *Main> pred' 12 pred' 12 Just 11 *Main> pred' 11 pred' 11 Just 10 *Main> pred' (pred' 12) pred' (pred' 12) :101:8: error: • Couldn't match expected type ‘Int’ with actual type ‘Maybe Int’ • In the first argument of ‘pred'’, namely ‘(pred' 12)’ In the expression: pred' (pred' 12) In an equation for ‘it’: it = pred' (pred' 12) *Main> :i Maybe :i Maybe type Maybe :: * -> * data Maybe a = Nothing | Just a -- Defined in ‘GHC.Maybe’ instance Applicative Maybe -- Defined in ‘GHC.Base’ instance Eq a => Eq (Maybe a) -- Defined in ‘GHC.Maybe’ instance Functor Maybe -- Defined in ‘GHC.Base’ instance Monad Maybe -- Defined in ‘GHC.Base’ instance Semigroup a => Monoid (Maybe a) -- Defined in ‘GHC.Base’ instance Ord a => Ord (Maybe a) -- Defined in ‘GHC.Maybe’ instance Semigroup a => Semigroup (Maybe a) -- Defined in ‘GHC.Base’ instance Show a => Show (Maybe a) -- Defined in ‘GHC.Show’ instance MonadFail Maybe -- Defined in ‘Control.Monad.Fail’ instance Read a => Read (Maybe a) -- Defined in ‘GHC.Read’ instance Foldable Maybe -- Defined in ‘Data.Foldable’ instance Traversable Maybe -- Defined in ‘Data.Traversable’ *Main> :t (>>=) :t (>>=) (>>=) :: Monad m => m a -> (a -> m b) -> m b *Main> :t (>>=) :: Maybe a -> (a -> Maybe b) -> Maybe b :t (>>=) :: Maybe a -> (a -> Maybe b) -> Maybe b (>>=) :: Maybe a -> (a -> Maybe b) -> Maybe b :: Maybe a -> (a -> Maybe b) -> Maybe b *Main> Nothing >>= (\x -> Just 12) Nothing >>= (\x -> Just 12) Nothing *Main> Just 3 >>= (\x -> Just (x + 3) Just 3 >>= (\x -> Just (x + 3) :106:31: error: parse error (possibly incorrect indentation or mismatched brackets) *Main> (Just 3) >>= (\x -> Just (x + 3)) (Just 3) >>= (\x -> Just (x + 3)) Just 6 *Main> Nothing >>= (\x -> Just (x + 3)) Nothing >>= (\x -> Just (x + 3)) Nothing *Main> (Just 3) >>= (\x -> Just (x + 3)) (Just 3) >>= (\x -> Just (x + 3)) Just 6 *Main> (Just 3) >>= (\x -> Just (x + 3)) >>= (\y -> Just (y + 42)) (Just 3) >>= (\x -> Just (x + 3)) >>= (\y -> Just (y + 42)) Just 48 *Main> (Just 3) >>= (\x -> Just (x + 3)) >>= (\y -> Just (y + 42)) (Just 3) >>= (\x -> Just (x + 3)) >>= (\y -> Just (y + 42)) Just 48 *Main> Just 3 >>= pred' >>= pred' Just 3 >>= pred' >>= pred' Just 1 *Main> Just 3 >>= pred' >>= pred' >>= pred' Just 3 >>= pred' >>= pred' >>= pred' Just 0 *Main> Just 3 >>= pred' >>= pred' >>= pred' >>= pred' Just 3 >>= pred' >>= pred' >>= pred' >>= pred' Nothing *Main> Just 3 >>= pred' >>= pred' >>= pred' >>= pred' >>= pred' Just 3 >>= pred' >>= pred' >>= pred' >>= pred' >>= pred' Nothing *Main> :r :r [1 of 1] Compiling Main ( curs10.hs, interpreted ) Ok, one module loaded. *Main> :r :r Ok, one module loaded. *Main> l l :118:1: error: Variable not in scope: l *Main> :l curs10liste.hs :l curs10liste.hs [1 of 1] Compiling Main ( curs10liste.hs, interpreted ) curs10liste.hs:3:12: error: Cannot parse data constructor in a data/newtype declaration: [Dir] | 3 | data Pos = [Dir] | ^^^^^ Failed, no modules loaded. Prelude> :r :r [1 of 1] Compiling Main ( curs10liste.hs, interpreted ) Ok, one module loaded. *Main> l l [1,2,3,42,7,5] *Main> listAt [Fwd, Fwd, Fwd] l listAt [Fwd, Fwd, Fwd] l :122:24: error: • Couldn't match type ‘Integer’ with ‘Int’ Expected type: [Int] Actual type: [Integer] • In the second argument of ‘listAt’, namely ‘l’ In the expression: listAt [Fwd, Fwd, Fwd] l In an equation for ‘it’: it = listAt [Fwd, Fwd, Fwd] l *Main> :r :r [1 of 1] Compiling Main ( curs10liste.hs, interpreted ) Ok, one module loaded. *Main> listAt [Fwd, Fwd, Fwd] l listAt [Fwd, Fwd, Fwd] l [42,7,5] *Main> :r :r [1 of 1] Compiling Main ( curs10liste.hs, interpreted ) Ok, one module loaded. *Main> changeAt [Fwd, Fwd, Fwd] l 7 changeAt [Fwd, Fwd, Fwd] l 7 [1,2,3,7,7,5] *Main> :r :r [1 of 1] Compiling Main ( curs10liste.hs, interpreted ) curs10liste.hs:17:16: error: Illegal binding of built-in syntax: (,) | 17 | data Zipper1 = (Trail, [Int]) | ^^^^^^^^^^^^^^ Failed, no modules loaded. Prelude> :r :r [1 of 1] Compiling Main ( curs10liste.hs, interpreted ) curs10liste.hs:22:30: error: • Couldn't match type ‘([Crumb], Trail, [Int])’ with ‘(Trail, [Int])’ Expected type: Zipper1 Actual type: ([Crumb], Trail, [Int]) • In the expression: (F h : trail, trail, lc) In the expression: let (trail, lc) = zipperAt pos t in (F h : trail, trail, lc) In an equation for ‘zipperAt’: zipperAt (Fwd : pos) (h : t) = let (trail, lc) = zipperAt pos t in (F h : trail, trail, lc) | 22 | (F h:trail, trail, lc) | ^^^^^^^^^^^^^^^^^^^^^^ Failed, no modules loaded. Prelu:r :r [1 of 1] Compiling Main ( curs10liste.hs, interpreted ) curs10liste.hs:22:30: error: • Couldn't match type ‘([Crumb], Trail, [Int])’ with ‘(Trail, [Int])’ Expected type: Zipper1 Actual type: ([Crumb], Trail, [Int]) • In the expression: ((F h) : trail, trail, lc) In the expression: let (trail, lc) = zipperAt pos t in ((F h) : trail, trail, lc) In an equation for ‘zipperAt’: zipperAt (Fwd : pos) (h : t) = let (trail, lc) = zipperAt pos t in ((F h) : trail, trail, lc) | 22 | ((F h):trail, trail, lc) | ^^^^^^^^^^^^^^^^^^^^^^^^ Failed, no modules loaded. Prelude> :r :r [1 of 1] Compiling Main ( curs10liste.hs, interpreted ) curs10liste.hs:22:30: error: • Couldn't match type ‘([Crumb], Trail, [Int])’ with ‘(Trail, [Int])’ Expected type: Zipper1 Actual type: ([Crumb], Trail, [Int]) • In the expression: ((F h) : trail, trail, lc) In the expression: let (trail, lc) = zipperAt pos t in ((F h) : trail, trail, lc) In an equation for ‘zipperAt’: zipperAt (Fwd : pos) (h : t) = let (trail, lc) = zipperAt pos t in ((F h) : trail, trail, lc) | 22 | ((F h):trail, trail, lc) | ^^^^^^^^^^^^^^^^^^^^^^^^ Failed, no modules loaded. Prelude> :r :r [1 of 1] Compiling Main ( curs10liste.hs, interpreted ) Ok, one module loaded. *Main> zipperAt [Fwd, Fwd, Fwd] l zipperAt [Fwd, Fwd, Fwd] l :132:1: error: • No instance for (Show Crumb) arising from a use of ‘print’ • In a stmt of an interactive GHCi command: print it *Main> :r :r [1 of 1] Compiling Main ( curs10liste.hs, interpreted ) Ok, one module loaded. *Main> zipperAt [Fwd, Fwd, Fwd] l zipperAt [Fwd, Fwd, Fwd] l ([F 1,F 2,F 3],[42,7,5]) *Main> l l [1,2,3,42,7,5] *Main> :r :r [1 of 1] Compiling Main ( curs10liste.hs, interpreted ) curs10liste.hs:29:1: error: Duplicate type signatures for ‘zipperAtAux’ at curs10liste.hs:25:1-11 curs10liste.hs:29:1-11 | 29 | zipperAtAux :: Pos -> [Int] -> Zipper1 | ^^^^^^^^^^^ Failed, no modules loaded. Prelude> :r :r [1 of 1] Compiling Main ( curs10liste.hs, interpreted ) Ok, one module loaded. *Main> zipperAt [Fwd, Fwd, Fwd] l zipperAt [Fwd, Fwd, Fwd] l ([F 3,F 2,F 1],[42,7,5]) *Main> :r :r [1 of 1] Compiling Main ( curs10liste.hs, interpreted ) curs10liste.hs:36:1: error: Illegal type signature: ‘(trail, h : t)’ Type signatures are only allowed in patterns with ScopedTypeVariables | 36 | goFwd :: (trail, h:t) = (F h:trail, t) | ^^^^^^^^^^^^^^^^^^^^^ curs10liste.hs:36:19: error: Illegal operator ‘:’ in type ‘h : t’ Use TypeOperators to allow operators in types | 36 | goFwd :: (trail, h:t) = (F h:trail, t) | ^ curs10liste.hs:39:1: error: Illegal type signature: ‘(F v : trail, l)’ Type signatures are only allowed in patterns with ScopedTypeVariables | 39 | goBwd :: (F v:trail, l) = (trail, v:l) | ^^^^^^^^^^^^^^^^^^^^^^^ curs10liste.hs:39:11: error: Not in scope: type constructor or class ‘F’ A data constructor of that name is in scope; did you mean DataKinds? | 39 | goBwd :: (F v:trail, l) = (trail, v:l) | ^ curs10liste.hs:39:14: error: Illegal operator ‘:’ in type ‘F v : trail’ Use TypeOperators to allow operators in types | 39 | goBwd :: (F v:trail, l) = (trail, v:l) | ^ Failed, no modules loaded. Prelude> :r :r [1 of 1] Compiling Main ( curs10liste.hs, interpreted ) curs10liste.hs:36:1: error: Illegal type signature: ‘(trail, h : t)’ Type signatures are only allowed in patterns with ScopedTypeVariables | 36 | goFwd :: (trail, h:t) = (F h:trail, t) | ^^^^^^^^^^^^^^^^^^^^^ curs10liste.hs:36:19: error: Illegal operator ‘:’ in type ‘h : t’ Use TypeOperators to allow operators in types | 36 | goFwd :: (trail, h:t) = (F h:trail, t) | ^ curs10liste.hs:39:1: error: Illegal type signature: ‘((F v) : trail, l)’ Type signatures are only allowed in patterns with ScopedTypeVariables | 39 | goBwd :: ((F v):trail, l) = (trail, v:l) | ^^^^^^^^^^^^^^^^^^^^^^^^^ curs10liste.hs:39:12: error: Not in scope: type constructor or class ‘F’ A data constructor of that name is in scope; did you mean DataKinds? | 39 | goBwd :: ((F v):trail, l) = (trail, v:l) | ^ curs10liste.hs:39:16: error: Illegal operator ‘:’ in type ‘(F v) : trail’ Use TypeOperators to allow operators in types | 39 | goBwd :: ((F v):trail, l) = (trail, v:l) | ^ Failed, no modules loaded. Prelude> :r :r [1 of 1] Compiling Main ( curs10liste.hs, interpreted ) curs10liste.hs:36:1: error: Illegal type signature: ‘(trail, (h : t))’ Type signatures are only allowed in patterns with ScopedTypeVariables | 36 | goFwd :: (trail, (h:t)) = ((F h):trail, t) | ^^^^^^^^^^^^^^^^^^^^^^^ curs10liste.hs:36:20: error: Illegal operator ‘:’ in type ‘h : t’ Use TypeOperators to allow operators in types | 36 | goFwd :: (trail, (h:t)) = ((F h):trail, t) | ^ curs10liste.hs:39:1: error: Illegal type signature: ‘((F v) : trail, l)’ Type signatures are only allowed in patterns with ScopedTypeVariables | 39 | goBwd :: ((F v):trail, l) = (trail, v:l) | ^^^^^^^^^^^^^^^^^^^^^^^^^ curs10liste.hs:39:12: error: Not in scope: type constructor or class ‘F’ A data constructor of that name is in scope; did you mean DataKinds? | 39 | goBwd :: ((F v):trail, l) = (trail, v:l) | ^ curs10liste.hs:39:16: error: Illegal operator ‘:’ in type ‘(F v) : trail’ Use TypeOperators to allow operators in types | 39 | goBwd :: ((F v):trail, l) = (trail, v:l) | ^ Failed, no modules loaded. Prelude> :r :r [1 of 1] Compiling Main ( curs10liste.hs, interpreted ) curs10liste.hs:36:1: error: Illegal type signature: ‘(trail, (h : t))’ Type signatures are only allowed in patterns with ScopedTypeVariables | 36 | goFwd :: (trail, (h:t)) = ((F h):trail, t) | ^^^^^^^^^^^^^^^^^^^^^^^ curs10liste.hs:36:20: error: Illegal operator ‘:’ in type ‘h : t’ Use TypeOperators to allow operators in types | 36 | goFwd :: (trail, (h:t)) = ((F h):trail, t) | ^ Failed, no modules loaded. Prelude> :r :r [1 of 1] Compiling Main ( curs10liste.hs, interpreted ) Ok, one module loaded. *Main> :r :r [1 of 1] Compiling Main ( curs10liste.hs, interpreted ) Ok, one module loaded. *Main> (zipperAt [] l) (zipperAt [] l) ([],[1,2,3,42,7,5]) *Main> goFwd (goFwd (goFwd (zipperAt [] l))) goFwd (goFwd (goFwd (zipperAt [] l))) ([F 3,F 2,F 1],[42,7,5]) *Main> change (goFwd (goFwd (goFwd (zipperAt [] l)))) 7 change (goFwd (goFwd (goFwd (zipperAt [] l)))) 7 ([F 3,F 2,F 1],[7,7,5]) *Main> goBwd $ goBwd $ goBwd $ change (goFwd (goFwd (goFwd (zipperAt [] l)))) 7 )))) 7 ([],[1,2,3,7,7,5]) *Main> l l [1,2,3,42,7,5] *Main> (zipperAt [Fwd, Fwd, Fwd] l) (zipperAt [Fwd, Fwd, Fwd] l) ([F 3,F 2,F 1],[42,7,5]) *Main> l l [1,2,3,42,7,5] *Main> ([3,2,1],[42,7,5])::Zipper ([3,2,1],[42,7,5])::Zipper :152:21: error: Not in scope: type constructor or class ‘Zipper’ Perhaps you meant ‘Zipper1’ (line 17) *Main> :r :r [1 of 1] Compiling Main ( curs10liste.hs, interpreted ) Ok, one module loaded. *Main> ([3,2,1],[42,7,5])::Zipper ([3,2,1],[42,7,5])::Zipper ([3,2,1],[42,7,5]) *Main> :r :r [1 of 1] Compiling Main ( curs10liste.hs, interpreted ) curs10liste.hs:63:1: error: Duplicate type signatures for ‘goBwd’ at curs10liste.hs:38:1-5 curs10liste.hs:63:1-5 | 63 | goBwd :: Zipper -> Zipper | ^^^^^ Failed, no modules loaded. Prelude> :r :r [1 of 1] Compiling Main ( curs10liste.hs, interpreted ) curs10liste.hs:51:28: error: • Couldn't match type ‘Crumb’ with ‘Int’ Expected type: [Int] Actual type: Trail • In the expression: trail In the expression: (trail, l) In an equation for ‘zipperAtAux'’: zipperAtAux' [] l trail = (trail, l) | 51 | zipperAtAux' [] l trail = (trail, l) | ^^^^^ curs10liste.hs:52:38: error: • Couldn't match type ‘Crumb’ with ‘Int’ Expected type: Zipper Actual type: Zipper1 • In the expression: zipperAtAux pos t (h : trail) In an equation for ‘zipperAtAux'’: zipperAtAux' (Fwd : pos) (h : t) trail = zipperAtAux pos t (h : trail) | 52 | zipperAtAux' (Fwd:pos) (h:t) trail = zipperAtAux pos t (h:trail) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ curs10liste.hs:52:57: error: • Couldn't match type ‘Int’ with ‘Crumb’ Expected type: Trail Actual type: [Int] • In the third argument of ‘zipperAtAux’, namely ‘(h : trail)’ In the expression: zipperAtAux pos t (h : trail) In an equation for ‘zipperAtAux'’: zipperAtAux' (Fwd : pos) (h : t) trail = zipperAtAux pos t (h : trail) | 52 | zipperAtAux' (Fwd:pos) (h:t) trail = zipperAtAux pos t (h:trail) | ^^^^^^^ curs10liste.hs:52:59: error: • Couldn't match type ‘Crumb’ with ‘Int’ Expected type: [Int] Actual type: Trail • In the second argument of ‘(:)’, namely ‘trail’ In the third argument of ‘zipperAtAux’, namely ‘(h : trail)’ In the expression: zipperAtAux pos t (h : trail) | 52 | zipperAtAux' (Fwd:pos) (h:t) trail = zipperAtAux pos t (h:trail) | ^^^^^ curs10liste.hs:55:17: error: • Couldn't match type ‘Crumb’ with ‘Int’ Expected type: Zipper Actual type: Zipper1 • In the expression: zipperAtAux p l [] In an equation for ‘zipperAt'’: zipperAt' p l = zipperAtAux p l [] | 55 | zipperAt' p l = zipperAtAux p l [] | ^^^^^^^^^^^^^^^^^^ Failed, no modules loaded. Prelude> :r :r [1 of 1] Compiling Main ( curs10liste.hs, interpreted ) curs10liste.hs:51:28: error: • Couldn't match type ‘Crumb’ with ‘Int’ Expected type: [Int] Actual type: Trail • In the expression: trail In the expression: (trail, l) In an equation for ‘zipperAtAux'’: zipperAtAux' [] l trail = (trail, l) | 51 | zipperAtAux' [] l trail = (trail, l) | ^^^^^ curs10liste.hs:52:58: error: • Couldn't match type ‘Int’ with ‘Crumb’ Expected type: Trail Actual type: [Int] • In the third argument of ‘zipperAtAux'’, namely ‘(h : trail)’ In the expression: zipperAtAux' pos t (h : trail) In an equation for ‘zipperAtAux'’: zipperAtAux' (Fwd : pos) (h : t) trail = zipperAtAux' pos t (h : trail) | 52 | zipperAtAux' (Fwd:pos) (h:t) trail = zipperAtAux' pos t (h:trail) | ^^^^^^^ curs10liste.hs:52:60: error: • Couldn't match type ‘Crumb’ with ‘Int’ Expected type: [Int] Actual type: Trail • In the second argument of ‘(:)’, namely ‘trail’ In the third argument of ‘zipperAtAux'’, namely ‘(h : trail)’ In the expression: zipperAtAux' pos t (h : trail) | 52 | zipperAtAux' (Fwd:pos) (h:t) trail = zipperAtAux' pos t (h:trail) | ^^^^^ Failed, no modules loaded. Prelude> :r :r [1 of 1] Compiling Main ( curs10liste.hs, interpreted ) Ok, one module loaded. *Main> goBwd' $ goBwd' $ goBwd' $ change' (goFwd' (goFwd' (goFwd' (zipperAt' [] l)))) 7 At' [] l)))) 7 ([],[1,2,3,7,7,5]) *Main> change' (goFwd' (goFwd' (goFwd' (zipperAt' [] l)))) 7 change' (goFwd' (goFwd' (goFwd' (zipperAt' [] l)))) 7 ([3,2,1],[7,7,5]) *Main>