Hours of hacking await! 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 Talvez :1:1-6: error: Not in scope: ‘Talvez’ λ> :t Talvez :1:1-6: error: Data constructor not in scope: Talvez λ> :t Talvez :1:1-6: error: Data constructor not in scope: Talvez λ> :t Talvez :1:1-6: error: Data constructor not in scope: Talvez λ> :k Talvez Talvez :: * -> * λ> :t Talvez :1:1-6: error: Data constructor not in scope: Talvez λ> :t DeFato DeFato :: a -> Talvez a λ> :t Applicative :1:1-11: error: Data constructor not in scope: Applicative λ> :i Applicative type Applicative :: (* -> *) -> Constraint class Functor f => Applicative f where pure :: a -> f a (<*>) :: f (a -> b) -> f a -> f b GHC.Base.liftA2 :: (a -> b -> c) -> f a -> f b -> f c (*>) :: f a -> f b -> f b (<*) :: f a -> f b -> f a {-# MINIMAL pure, ((<*>) | liftA2) #-} -- Defined in ‘GHC.Base’ instance Applicative Talvez -- Defined at Aula27.hs:29:10 instance Applicative (Either e) -- Defined in ‘Data.Either’ instance Applicative [] -- Defined in ‘GHC.Base’ instance Applicative Maybe -- Defined in ‘GHC.Base’ instance Applicative IO -- Defined in ‘GHC.Base’ instance Applicative ((->) r) -- Defined in ‘GHC.Base’ instance (Monoid a, Monoid b, Monoid c) => Applicative ((,,,) a b c) -- Defined in ‘GHC.Base’ instance (Monoid a, Monoid b) => Applicative ((,,) a b) -- Defined in ‘GHC.Base’ instance Monoid a => Applicative ((,) a) -- Defined in ‘GHC.Base’ λ> DeFato (+4) <*> DeFato 10 DeFato 14 λ> DeFato (+4) <*> Nada Nada λ> :t Either :1:1-6: error: • Data constructor not in scope: Either • Perhaps you meant variable ‘either’ (imported from Prelude) λ> :i Either type Either :: * -> * -> * data Either a b = Left a | Right b -- Defined in ‘Data.Either’ instance Applicative (Either e) -- Defined in ‘Data.Either’ instance (Eq a, Eq b) => Eq (Either a b) -- Defined in ‘Data.Either’ instance Functor (Either a) -- Defined in ‘Data.Either’ instance Monad (Either e) -- Defined in ‘Data.Either’ instance (Ord a, Ord b) => Ord (Either a b) -- Defined in ‘Data.Either’ instance Semigroup (Either a b) -- Defined in ‘Data.Either’ instance (Show a, Show b) => Show (Either a b) -- Defined in ‘Data.Either’ instance (Read a, Read b) => Read (Either a b) -- Defined in ‘Data.Either’ instance Foldable (Either a) -- Defined in ‘Data.Foldable’ instance Traversable (Either a) -- Defined in ‘Data.Traversable’ λ> Vaca {"Malhada", 300} :133:7: error: parse error on input ‘"’ λ> Vaca {nome="Malhada", peso=300} Vaca {nome = "Malhada", peso = 300} λ> Vaca "Malhada" 300 Vaca {nome = "Malhada", peso = 300} λ> :t Vaca Vaca :: String -> Integer -> Vaca λ> constroiVaca "Malhada" 300 DeFato (Vaca {nome = "Malhada", peso = 300}) λ> constroiVaca "Malhada" -300 :186:1-27: error: • No instance for (Num (Integer -> Talvez Vaca)) arising from a use of ‘-’ (maybe you haven't applied a function to enough arguments?) • In the expression: constroiVaca "Malhada" - 300 In an equation for ‘it’: it = constroiVaca "Malhada" - 300 λ> constroiVaca "Malhada" (-300) Nada λ> constroiVaca "" 300 Nada λ> :t Vaca Vaca :: String -> Integer -> Vaca λ> pure Vaca λ> :t pure Vaca pure Vaca :: Applicative f => f (String -> Integer -> Vaca) λ> λ> constroiVaca "Malhada" 300 DeFato (Vaca {nome = "Malhada", peso = 300}) λ> constroiVaca "Malhada" 0 Nada λ> :t Vaca Vaca :: String -> Integer -> Vaca λ> :t Vaca "Malhada" Vaca "Malhada" :: Integer -> Vaca λ> :t DeFato (Vaca "Malhada") DeFato (Vaca "Malhada") :: Talvez (Integer -> Vaca) λ> import Control.Applicative λ> :t liftA3 liftA3 :: Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d λ> :t liftA4 :1:1-6: error: • Variable not in scope: liftA4 • Perhaps you meant one of these: ‘liftA2’ (imported from Control.Applicative), ‘liftA’ (imported from Control.Applicative), ‘liftA3’ (imported from Control.Applicative) λ> :t liftA liftA :: Applicative f => (a -> b) -> f a -> f b λ> :t liftA0 :1:1-6: error: • Variable not in scope: liftA0 • Perhaps you meant one of these: ‘liftA2’ (imported from Control.Applicative), ‘liftA’ (imported from Control.Applicative), ‘liftA3’ (imported from Control.Applicative) λ> :t Erro Erro :: a -> UmOuOutro a b λ> :t pure (.) pure (.) :: Applicative f => f ((b -> c) -> (a -> b) -> a -> c) λ>