Prelude> floor (sqrt (fromIntegral 55)) 7 Prelude> floor (sqrt $ fromIntegral 5) 2 Prelude> floor $ sqrt $ fromIntegral 5 2 Prelude> floor . sqrt . fromIntegral $ 5 2 Prelude> floor . sqrt . fromIntegral 5 :49:1: Non type-variable argument in the constraint: Num (a -> a) (Use FlexibleContexts to permit this) When checking that ‘it’ has the inferred type it :: forall c a a1. (Floating a1, Integral c, Num (a -> a1), RealFrac a1) => a -> c Prelude> (floor . sqrt . fromIntegral) 5 2 Prelude> floor . sqrt . fromIntegral (5) :51:1: Non type-variable argument in the constraint: Num (a -> a) (Use FlexibleContexts to permit this) When checking that ‘it’ has the inferred type it :: forall c a a1. (Floating a1, Integral c, Num (a -> a1), RealFrac a1) => a -> c Prelude> Prelude> let fn x = floor . sqrt . fromIntegral x :53:5: Non type-variable argument in the constraint: Num (a -> a) (Use FlexibleContexts to permit this) When checking that ‘fn’ has the inferred type fn :: forall c a a1 a2. (Floating a1, Integral c, Integral a2, Num (a -> a1), RealFrac a1) => a2 -> a -> c Prelude> let fn x = floor . sqrt . fromIntegral $ x Prelude> fn 5 2 Prelude> :t max max :: Ord a => a -> a -> a Prelude> :t fn fn :: (Integral c, Integral r) => r -> c Prelude> let f1 = floor . sqrt . fromIntegral Prelude> :t fromIntegral fromIntegral :: (Integral a, Num b) => a -> b Prelude> :t fromIntegral 5 fromIntegral 5 :: Num b => b Prelude> :t f1 f1 :: (Integral c, Integral a) => a -> c Prelude> f x = (x+) :62:5: parse error on input ‘=’ Prelude> let f x = (x+) Prelude> f 4 :64:1: No instance for (Show (a0 -> a0)) (maybe you haven't applied enough arguments to a function?) arising from a use of ‘print’ In the first argument of ‘print’, namely ‘it’ In a stmt of an interactive GHCi command: print it Prelude> f 4 5 9 Prelude> f 4 $ 5 9 Prelude> let f x y = (-) x y Prelude> let f1 x = (-) x Prelude> let f2 = (-) Prelude> (5-) 3 2 Prelude> (-5) 3 :71:1: Non type-variable argument in the constraint: Num (a -> t) (Use FlexibleContexts to permit this) When checking that ‘it’ has the inferred type it :: forall a t. (Num a, Num (a -> t)) => t Prelude> ((-) 5) 3 2 Prelude> (2^) 3 8 Prelude> (^2) 3 9 Prelude> map ($ 2) [(4+), succ, (^3)] [6,3,8] Prelude> (4+) $ 2 6 Prelude> succ $ 2 3 Prelude> (^3) $ 2 8 Prelude> map ( succ . (^2)) [1//4 :79:25: parse error (possibly incorrect indentation or mismatched brackets) Prelude> map ( succ . (^2)) [1..4] [2,5,10,17] Prelude> map ( succ . (^2) $) [1..4] [2,5,10,17] Prelude> sum [1..3] 6 Prelude> product [1..5] 120 Prelude> let factorial n = product [1..n] Prelude> let factorial n = foldr (*) 1 [1..n] Prelude> let factorial n = product [1..n] Prelude> factorial 5 120 Prelude> :t Maybe :1:1: Not in scope: data constructor ‘Maybe’ Perhaps you meant variable ‘maybe’ (imported from Prelude) Prelude> :t maybe maybe :: b -> (a -> b) -> Maybe a -> b Prelude> :t : not an expression: ‘’ Prelude> :t product product :: (Num a, Foldable t) => t a -> a Prelude> :cd C:\Users\Dari\Documents Prelude> :load "main.hs" [1 of 1] Compiling Main ( main.hs, interpreted ) Ok, modules loaded: Main. *Main> occurrences [1..6] [1,2,3,4,3,2,5,5,6,2,1,3] [2,3,3,1,2,1] *Main> :r [1 of 1] Compiling Main ( main.hs, interpreted ) main.hs:2:21: Couldn't match type ‘[b0]’ with ‘[[a]] -> a’ Expected type: [t0 b0] -> [[a]] -> a Actual type: [t0 b0] -> [b0] Relevant bindings include sumProducts :: [[a]] -> a (bound at main.hs:2:1) Possible cause: ‘map’ is applied to too many arguments In the second argument of ‘($)’, namely ‘map product’ In the expression: sum $ map product Failed, modules loaded: none. Prelude> :r [1 of 1] Compiling Main ( main.hs, interpreted ) Ok, modules loaded: Main. *Main> :t all all :: Foldable t => (a -> Bool) -> t a -> Bool *Main> :r [1 of 1] Compiling Main ( main.hs, interpreted ) Ok, modules loaded: Main. *Main> isSquare [[1,2,3],[4,5,6],[7,8,9]] True *Main> isSquare [[1,2,3],[4,5,6],[7,8,9,10]] False *Main> :r [1 of 1] Compiling Main ( main.hs, interpreted ) Ok, modules loaded: Main. *Main> mainDiag [[1,2,3],[4,5,6],[7,8,9,10]] [2,6,10] *Main> :r [1 of 1] Compiling Main ( main.hs, interpreted ) Ok, modules loaded: Main. *Main> mainDiag [[1,2,3],[4,5,6],[7,8,9,10]] [1,5,9] *Main> :r [1 of 1] Compiling Main ( main.hs, interpreted ) main.hs:13:46: parse error on input ‘)’ Failed, modules loaded: none. Prelude> :r main.hs:13:59: Not in scope: ‘l’ [1 of 1] Compiling Main ( main.hs, interpreted ) Failed, modules loaded: none. Prelude> :r [1 of 1] Compiling Main ( main.hs, interpreted ) Ok, modules loaded: Main. *Main> mainDiag [[1..3],[4..6],[7..9]] [1,5,9] *Main> :r [1 of 1] Compiling Main ( main.hs, interpreted ) Ok, modules loaded: Main. *Main> sndDiag [[1..3],[4..6],[7..9]] [3,5,7] *Main> :r [1 of 1] Compiling Main ( main.hs, interpreted ) Ok, modules loaded: Main. *Main> compose-N succ 5 $ 1 :112:1: Not in scope: ‘compose’ Perhaps you meant one of these: ‘composeN’ (line 20), ‘compare’ (imported from Prelude) :112:9: Not in scope: data constructor ‘N’ *Main> composeN succ 5 $ 1 6 *Main> :r [1 of 1] Compiling Main ( main.hs, interpreted ) Ok, modules loaded: Main. *Main> composeN succ 5 $ 1 6 *Main> id :116:1: No instance for (Show (a0 -> a0)) (maybe you haven't applied enough arguments to a function?) arising from a use of ‘print’ In a stmt of an interactive GHCi command: print it *Main> :t id id :: a -> a *Main> id 5 5 *Main> :r [1 of 1] Compiling Main ( main.hs, interpreted ) Ok, modules loaded: Main. *Main> composeN succ 5 $ 1 6 *Main> :r [1 of 1] Compiling Main ( main.hs, interpreted ) Ok, modules loaded: Main. *Main> let functions = composeList succ in take 5 $ map ($1) functions [2,3,4,5,6] *Main>