Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.haskell > #385

Re: possibly incorrect indentation or mismatched brackets

From Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups comp.lang.haskell
Subject Re: possibly incorrect indentation or mismatched brackets
Date 2016-07-18 15:20 +0100
Organization A noiseless patient Spider
Message-ID <87oa5vhvtw.fsf@bsb.me.uk> (permalink)
References <a799e2e5-7538-4d9c-a74c-9ea0356adae0@googlegroups.com>

Show all headers | View raw


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.

Back to comp.lang.haskell | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

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

csiph-web