Understanding the different behavior of thunks when GHCi let bindings are involved

Because (,) is a constructor, the difference makes no difference to Haskell’s semantics (:sprint gives access to internal thunk implementation details so doesn’t count.) So this is a question of which optimizations and trade-offs GHC does when compiling (x,x) in different positions. Someone else may know the precise reason in these cases.

How to configure GHCi to automatically import modules

GHCi looks for its configuration file at ~/.ghc/ghci.conf on Unix-like systems. %APPDATA%\ghc\ghci.conf on Windows. The configuration file syntax is simple: it’s a list of GHCi commands to execute on startup. For example, your ghci.conf could contain: import Control.Applicative import Data.Char import Data.List :set prompt “> ” The last line sets the prompt to “> ” … Read more

GHCI can’t load module if both package-conf and source path contains it

GHC only knows about packages that are installed. To see which packages are installed, use the ghc-pkg list command: $ ghc-pkg list /usr/lib/ghc-6.12.1/package.conf.d: Cabal-1.7.4 array-0.2.0.1 base-3.0.3.0 base-4.2.0.0 bin-package-db-0.0.0.0 binary-0.5.0.1 bytestring-0.9.1.4 containers-0.2.0.1 directory-1.0.0.2 (dph-base-0.4.0) (dph-par-0.4.0) (dph-prim-interface-0.4.0) (dph-prim-par-0.4.0) (dph-prim-seq-0.4.0) (dph-seq-0.4.0) extensible-exceptions-0.1.1.0 ffi-1.0 filepath-1.1.0.1 (ghc-6.12.1) ghc-prim-0.1.0.0 haskeline-0.6.2 haskell98-1.0.1.0 hpc-0.5.0.2 integer-gmp-0.1.0.0 mtl-1.1.0.2 old-locale-1.0.0.1 old-time-1.0.0.1 pretty-1.0.1.0 process-1.0.1.1 random-1.0.0.1 rts-1.0 syb-0.1.0.0 … Read more

How to make a Haskell cabal project with library+executables that still run with runhaskell/ghci?

Let’s assume you have a mylib library, and mylib-commandline and mylib-server executables. You use hs-source-dirs for the library and each executable so that each has their own project root, avoiding double compilation: mylib/ # Project root mylib.cabal src/ # Root for the library tests/ mylib-commandline/ # Root for the command line utility + helper modules … Read more

ghci ‘Not in scope:’ message

This is not a function code, it’s function signature which can only be saved in a module along with function definition and the be loaded to GHCi. This signature means that you’re going to define a function lucky which gets an Integer and returns a String. However if you’re composing your functions using GHCi as … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)