Your wish is my IO (). If I break, you can: 1. Restart: M-x haskell-process-restart 2. Configure logging: C-h v haskell-process-log (useful for debugging) 3. General config: M-x customize-mode 4. Hide these tips: C-h v haskell-process-show-debug-tips Changed directory: /home/hugo/Academic/Teaching/2022.2/TCPF/Aulas/ λ> :i Foldable type Foldable :: (* -> *) -> Constraint class Foldable t where Data.Foldable.fold :: Monoid m => t m -> m foldMap :: Monoid m => (a -> m) -> t a -> m Data.Foldable.foldMap' :: Monoid m => (a -> m) -> t a -> m foldr :: (a -> b -> b) -> b -> t a -> b Data.Foldable.foldr' :: (a -> b -> b) -> b -> t a -> b foldl :: (b -> a -> b) -> b -> t a -> b Data.Foldable.foldl' :: (b -> a -> b) -> b -> t a -> b foldr1 :: (a -> a -> a) -> t a -> a foldl1 :: (a -> a -> a) -> t a -> a Data.Foldable.toList :: t a -> [a] null :: t a -> Bool length :: t a -> Int elem :: Eq a => a -> t a -> Bool maximum :: Ord a => t a -> a minimum :: Ord a => t a -> a sum :: Num a => t a -> a product :: Num a => t a -> a {-# MINIMAL foldMap | foldr #-} -- Defined in ‘Data.Foldable’ instance Foldable [] -- Defined in ‘Data.Foldable’ instance Foldable Maybe -- Defined in ‘Data.Foldable’ instance Foldable (Either a) -- Defined in ‘Data.Foldable’ instance Foldable ((,) a) -- Defined in ‘Data.Foldable’ λ> meusum [1,2,3,4] 10 λ> :t (+1) (+1) :: Num a => a -> a λ> meulength [4,5,6,7,9] 5 λ> hashilength [1,3,6,62,3,6] 6 λ> :t const const :: a -> b -> a λ> :t const (+1) const (+1) :: Num a => b -> a -> a λ> :t (+1) (+1) :: Num a => a -> a λ> Suc (Suc Zero) 2 λ> :t Suc Suc :: Natural -> Natural λ> grito 'a' 15 :163:11-12: error: • No instance for (Num Natural) arising from the literal ‘15’ There are instances for similar types: instance Num GHC.Natural.Natural -- Defined in ‘GHC.Num’ • In the second argument of ‘grito’, namely ‘15’ In the expression: grito 'a' 15 In an equation for ‘it’: it = grito 'a' 15 λ> grito 'a' (Suc (Suc (Suc Zero))) "aaa" λ> constroi 15 15 λ> :t controi 15 :1:1-7: error: • Variable not in scope: controi :: t0 -> t • Perhaps you meant ‘constroi’ (line 19) λ> :t constroi 15 constroi 15 :: Natural λ> somaFold (constroi 5) (constroi 8) 13 λ> torreFold (constroi 2) (constroi 3) 16 λ> torreFold (constroi 2) (constroi 4) Interrupted. λ> 2^16 65536 λ> torreFold (constroi 2) (constroi 2) 4 λ> :t const Suc const Suc :: b -> Natural -> Natural λ> dois = constroi 2 λ> tres = constroi 3 λ> um = constroi 1 λ> fgh 0 dois tres 5 λ> fgh 1 dois tres 6 λ> fgh 2 dois tres 8 λ> fgh 3 dois tres 16 λ> fgh 4 um um 1 λ> fgh 4 um dois 1 λ> fgh 4 dois um 2 λ> fgh 4 dois dois 4 λ> fgh 4 tres dois Interrupted. λ> fgh 100 dois dois 4 λ>