Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.haskell > #384 > unrolled thread
| Started by | meInvent bbird <jobmattcon@gmail.com> |
|---|---|
| First post | 2016-07-18 02:30 -0700 |
| Last post | 2016-07-18 20:29 -0700 |
| Articles | 3 — 2 participants |
Back to article view | Back to comp.lang.haskell
possibly incorrect indentation or mismatched brackets meInvent bbird <jobmattcon@gmail.com> - 2016-07-18 02:30 -0700
Re: possibly incorrect indentation or mismatched brackets Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-07-18 15:20 +0100
Re: possibly incorrect indentation or mismatched brackets meInvent bbird <jobmattcon@gmail.com> - 2016-07-18 20:29 -0700
| From | meInvent bbird <jobmattcon@gmail.com> |
|---|---|
| Date | 2016-07-18 02:30 -0700 |
| Subject | possibly incorrect indentation or mismatched brackets |
| Message-ID | <a799e2e5-7538-4d9c-a74c-9ea0356adae0@googlegroups.com> |
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]
op1 :: Map (Double, Double) Double
op1 = Map.fromList [((allparams!!i!!0, allparams!!i!!1), a1!!i) | i <- [0..3] ]
op2 :: Map (Double, Double) Double
op2 = Map.fromList [((allparams!!i!!0, allparams!!i!!1), a2!!i) | i <- [0..3] ]
op3 :: Map (Double, Double) Double
op3 = Map.fromList [((allparams!!i!!0, allparams!!i!!1), a3!!i) | i <- [0..3] ]
[toc] | [next] | [standalone]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2016-07-18 15:20 +0100 |
| Message-ID | <87oa5vhvtw.fsf@bsb.me.uk> |
| In reply to | #384 |
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.
[toc] | [prev] | [next] | [standalone]
| From | meInvent bbird <jobmattcon@gmail.com> |
|---|---|
| Date | 2016-07-18 20:29 -0700 |
| Message-ID | <9575ab7c-f2c5-408b-9cea-d4ace2b64b4a@googlegroups.com> |
| In reply to | #385 |
thanks , after remove let , it succeed to run On Monday, July 18, 2016 at 10:20:12 PM UTC+8, Ben Bacarisse wrote: > 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.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.haskell
csiph-web