in ghci, run code below , it can run without error
but after put in file test.hs
then :l test.hs
got error
Prelude> :l trees.hs
[1 of 1] Compiling Main ( trees.hs, interpreted )
parse error (possibly incorrect indentation or mismatched brackets) Failed, modules loaded: none.
import Data.List
import Control.Monad
import Math.Combinat
import System.IO
import Data.Map (Map)
import qualified Data.Map as Map
let allparams = replicateM 2 [0.0, 1.0]
let a1 = [0.0, 1.0, 1.0, 1.0]
let a2 = [0.0, 0.0, 0.0, 1.0]
let a3 = [1.0, 1.0, 0.0, 1.0]
meInvent bbird <jobmattcon@gmail.com> writes:
in ghci, run code below , it can run without error
It's complicated. There are two forms of let. One is an expression and
has in 'in' part:
let x = 42 in x*x
The other appears in do blocks and list comprehensions and just
introduced a new binding. This is the form you are using when you type
let at ghci.
but after put in file test.hs
then :l test.hs
got error
Prelude> :l trees.hs
[1 of 1] Compiling Main ( trees.hs, interpreted )
parse error (possibly incorrect indentation or mismatched brackets) Failed, modules loaded: none.
import Data.List
import Control.Monad
import Math.Combinat
import System.IO
import Data.Map (Map)
import qualified Data.Map as Map
let allparams = replicateM 2 [0.0, 1.0]
let a1 = [0.0, 1.0, 1.0, 1.0]
let a2 = [0.0, 0.0, 0.0, 1.0]
let a3 = [1.0, 1.0, 0.0, 1.0]
These should be top-level definitions (i.e. just remove the let
keyword).
<snip>
--
Ben.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 486 |
Nodes: | 16 (2 / 14) |
Uptime: | 135:51:36 |
Calls: | 9,657 |
Calls today: | 5 |
Files: | 13,707 |
Messages: | 6,166,935 |