Send Beginners mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1. Re:  case statement (Imants Cekusins)
   2. Re:  case statement (Brandon Allbery)
   3. Re:  case statement (Imants Cekusins)
   4.  Loch package builds? (Imants Cekusins)
   5. Re:  Loch package builds? (Brandon Allbery)
   6. Re:  Loch package builds? (Imants Cekusins)


----------------------------------------------------------------------

Message: 1
Date: Tue, 7 Jul 2015 14:04:34 +0200
From: Imants Cekusins <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] case statement
Message-ID:
        <cap1qinbjjkws4xw3ocvlo8je47mhkzohbjankekwsvtq7g3...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

> There're several other ways to solve this:

Thank you.

You are right, GHC warns about shadowed variables.

This "case" behaviour (patterns allow no access to outer scope
variables) is different from some other languages.

Well, I'll remember this from now on.


------------------------------

Message: 2
Date: Tue, 7 Jul 2015 09:24:56 -0400
From: Brandon Allbery <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] case statement
Message-ID:
        <CAKFCL4UbxAxVhNo+EMP=vfxk+zchgxsw027qiqfyjmyq0xb...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

On Tue, Jul 7, 2015 at 8:04 AM, Imants Cekusins <[email protected]> wrote:

> This "case" behaviour (patterns allow no access to outer scope
> variables) is different from some other languages.
>

In most functional languages, "case" is about structure, not values. You
specify the structure in terms of constructors, which must be literal.
Variables in patterns always capture values associated with those
constructors, never to values outside the case expression.

That said, doing a value-based comparison ("switch"-type construct) is
rather annoying, and most of Haskell's (and ghc extension) mechanisms only
reduce the pain somewhat. :/

-- 
brandon s allbery kf8nh                               sine nomine associates
[email protected]                                  [email protected]
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20150707/ffe4893a/attachment-0001.html>

------------------------------

Message: 3
Date: Tue, 7 Jul 2015 16:06:47 +0200
From: Imants Cekusins <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] case statement
Message-ID:
        <cap1qinz3cbsvxdy6cnugjkv1ep+_p+d7_dnp6kga2ilbakn...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

Thank you Brandon.

Well in Erlang you can mix and match patterns with outer scope
variables. It is very handy, I agree. Here is an example.

You can try this code in browser here:
http://tryerl.seriyps.ru/#id=e3f2


% -*- coding: utf8 -*-
-module(main).
-export([main/0]).

main() ->
    check(2),
    check({other,4}).


check(X)->
    A1 = 1,
    A2 = 2,
    case X of
        A1 ->  io:format("A1~n");
        A2 ->  io:format("A2~n");
        {other,X1} -> io:format("~p~n",[X1])
    end.


------------------------------

Message: 4
Date: Tue, 7 Jul 2015 20:15:46 +0200
From: Imants Cekusins <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: [Haskell-beginners] Loch package builds?
Message-ID:
        <CAP1qinZbKT=q+v73wamed628as2tgxkpyt6pyygj74asfns...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

Did anyone try to install loch package recently:

https://wiki.haskell.org/Debugging#Source-located_errors


This error comes up on install:

Debug/Trace/Location.hs:70:8:
    Expecting one more argument to ?C.Exception?
    Expected a type, but ?C.Exception? has kind ?* -> Constraint?
    In the type signature for ?ppr?: ppr :: C.Exception -> String
Failed to install loch-0.2
cabal: Error: some packages failed to install:
loch-0.2 failed during the building phase. The exception was:
ExitFailure 1

?


------------------------------

Message: 5
Date: Tue, 7 Jul 2015 14:19:34 -0400
From: Brandon Allbery <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Loch package builds?
Message-ID:
        <cakfcl4vghvzgy9vhy_w9ykepapmwak+esmx6b2uqckh_jic...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

On Tue, Jul 7, 2015 at 2:15 PM, Imants Cekusins <[email protected]> wrote:

> Did anyone try to install loch package recently:


It's from 2007 with no updates, and that error indicates that it's using
old-style exceptions.

-- 
brandon s allbery kf8nh                               sine nomine associates
[email protected]                                  [email protected]
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20150707/9ff6a3f6/attachment-0001.html>

------------------------------

Message: 6
Date: Tue, 7 Jul 2015 20:32:28 +0200
From: Imants Cekusins <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Loch package builds?
Message-ID:
        <cap1qiny9-7vkjkdvdxxzqk2xyfzktgg1_raqjhqdpfczfvf...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

Thank you Brandon.

loch-th seems to be more recent. I'll try that


------------------------------

Subject: Digest Footer

_______________________________________________
Beginners mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners


------------------------------

End of Beginners Digest, Vol 85, Issue 2
****************************************

Reply via email to