ghci

Manual derivation of the type for `f1 x xs = (filter . (<)) x xs`

I want to manually derive the type of: f1 x xs = (filter . (<)) x xs First time we see x , so: x :: t1 Then (<) has this type: (<) :: Ord a1 => a1 -> a1 -> Bool We can only say (< x) if the following types can be unified: t1 ~ a1 Then x :: a1 So (<x) :: Ord a1 => a1 -> Bool Filter has this type...

Any way to add patterns, type signature, to a function in GHCi?

^-- No, it doesn't entirely. My question covers ADDING patterns and type signatures interactively...which is apparently impossible. The most basic things you might try do from early tutorials won't work in GHCi: foo [] = [] foo (x:xs) = x : foo xs That works if you put it into foo.hs and at the GHCi...

problems with trivial number conversions in Haskell

I am attempting to write a trivial function to drop the last digit of a number and return the rest of the number. dropLastDigit :: (Integral b) => b -> b dropLastDigit x = (quot x 10) * (floor $ logBase 10 x) however, when I try to load this into ghci, I get: Could not deduce (Floating b) arising...

Memory exploding upon writing a lazy bytestring to file in ghci

The following program does not explode when the executable (compiled via ghc -O0 Explode.hs ) is run, but does explode when run in ghci (via either ghci Explode.hs or ghci -fobject-code Explode.hs ) : --Explode.hs --Does not explode with : ghc -O0 Explode.hs --Explodes with : ghci Explode.hs -...