ghci

Load a module in GHCi by module name when module name doesn't match file name

Suppose I am given a source file called MyModule.hs and inside it the module declaration is module My.Module where ... (note: not module MyModule where ... ). I am not permitted to alter this source file or change the directory structure where the file resides. From reading some docs about importing...

Why does `peek` with a polymorphic Ptr return GHC.Prim.Any when used with a bind?

Using the low-level GNU Science Library bindings Bindings.Gsl.RandomNumberGeneration , I'm running into this odd type behavior in GHCi where binding changes return type from a peek into GHC.Prim.Any . I'm trying to understand why since I can't use the c'rng_alloc unless I retain the type of pointer...

Why can ghci see non-exported types and constructors? How can I fix it?

I am a novice in Haskell. Here's some simple code: module Src ( -- The 'Answer' type isn't exported Shape(Circle), -- i.e 'Rectangle' data constructor isn't exported Point(..), area, nudge ) where data Answer = Yes | No deriving (Show) data Point = Point Float Float deriving (Show) data Shape =...

Using ghci to find type

When I do something simple in ghci, like the following: let x = 7 + 2 I expect ghci to give a response of the type that x holds, like: x :: Integer When I run ghci, I do not get that the above line. How do I get that response? To show types automatically use :set +t : μ> :set +t μ> let x = 7 + 2 x :...