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:  Parse error (emacstheviking)
   2. Re:  Parse error (Brandon Allbery)
   3. Re:  Left vs Right (emacstheviking)
   4. Re:  Using Show (Kostiantyn Rybnikov)
   5. Re:  Left vs Right (Kostiantyn Rybnikov)


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

Message: 1
Date: Wed, 15 Apr 2015 17:24:23 +0100
From: emacstheviking <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Parse error
Message-ID:
        <CAEiEuUJ=xp4h36rm3ma98ddj-lvbltar0tswrj8pdayxy0f...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Either(!) its TAB characters upsetting things or not possible form the
command line. Maybe(!!) try saving to a file then using the load command to
do it instead.

On 15 April 2015 at 17:21, Shishir Srivastava <[email protected]>
wrote:

> Hi,
>
> I am trying to run the following from the GHCi command prompt which
> results in parse error.
>
> --------------
> Prelude> :{
> Prelude| foo :: Maybe String
> Prelude| foo = do
> Prelude|     x <- Just 3
> Prelude|     y <- Just "!"
> Prelude|     Just (show x ++ y)
> Prelude| :}
>
> <interactive>:145:5: parse error on input `='
> ---------------
>
> Any help would be appreciated.
>
> Thanks,
> Shishir
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20150415/540cf508/attachment-0001.html>

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

Message: 2
Date: Wed, 15 Apr 2015 12:26:14 -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] Parse error
Message-ID:
        <CAKFCL4Vo7ub4Mzb3Jt1xOde+5yecOZo0J9mg7hAnX10_=m+...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

On Wed, Apr 15, 2015 at 12:21 PM, Shishir Srivastava <
[email protected]> wrote:

> I am trying to run the following from the GHCi command prompt which
> results in parse error.
>

Urgh, sorry.

ghci is not ghc, and requires `let` even in the multi-line mode.

    :{
    let foo :: Maybe String
        foo = do
          x <- Just 3
          y <- Just "!"
          Just (show x ++ y)
    :}

In general, you are better off using files for definitions, and treat the
prompt as a debugger or desk calculator. Multi-line mode doesn't really
change this.

-- 
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/20150415/bea06f95/attachment-0001.html>

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

Message: 3
Date: Wed, 15 Apr 2015 17:26:05 +0100
From: emacstheviking <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Left vs Right
Message-ID:
        <CAEiEuUJi8wLrEY5bJ6qcXK4ZuNa=ehbvzptfzjxaqabzahf...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

I just love the way Haskell can blow something really simple into something
truly mind blowingly obtuse looking at times!
It's no wonder Haskell won't be "mainstream" for a while yet, but that's
fine, it means the rest of us can charge better rates for now.
:)


On 15 April 2015 at 13:50, Kostiantyn Rybnikov <[email protected]> wrote:

> Adding to others,
>
> For fmapping left value I suggest using fmapLeft from errors package, for
> fmapping both you can use
>
> either (Left . replicate 3) (Right . replicate 3)
> 14 ????. 2015 19:48 "Shishir Srivastava" <[email protected]>
> ????:
>
>> Hi,
>>
>> Can someone please explain the difference in outputs of the following two
>> expressions -
>>
>> --------------
>>
>> ghci> fmap (replicate 3) (Right "blah")
>> Right ["blah","blah","blah"]
>>
>> ghci> fmap (replicate 3) (Left "foo")
>> Left "foo"
>>
>> ---------------
>>
>> Why does 'Right' return a list of Strings whereas 'Left' returns just a
>> String.
>>
>> Thanks,
>> Shishir
>>
>> _______________________________________________
>> Beginners mailing list
>> [email protected]
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>>
>>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20150415/7d100fd8/attachment-0001.html>

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

Message: 4
Date: Wed, 15 Apr 2015 19:50:29 +0300
From: Kostiantyn Rybnikov <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Using Show
Message-ID:
        <caabahfthuaacc2pln5qta-gfw7u63c19i40exzsrp+by1yv...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

+ is a function of two arguments, and applying via (*) against a list would
apply each item as first argument of plus

Doing

pure (+) <*> [1,2,3] <*> [4,5,6]

would work.

What are you trying to achieve?
15 ????. 2015 15:48 "Shishir Srivastava" <[email protected]>
????:

> hi,
>
> I am trying to naively print an applicative functor using 'show' like this
> -
>
> show (pure (+) <*> [1, 2, 3])
>
> I know there is something fundamentally wrong with that expression but not
> sure what.
>
> Can anyone please point it out.
>
> Thanks,
> Shishir
>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20150415/ef5c5a22/attachment-0001.html>

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

Message: 5
Date: Wed, 15 Apr 2015 20:13:54 +0300
From: Kostiantyn Rybnikov <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Left vs Right
Message-ID:
        <caabahfrspzsbvuwqbjq9dtxefpbf1wbg8s88zurke7eiwtv...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

You can still omit monads and keep pair of values in tuple and work with
them easily, but I understand the point you are making.

But I should note that migration from PHP to Python also takes first
impression of complication of many things, where instead of having "just
index.php" with everything inlined you would have some wsgi protocols, wsgi
servers etc, but later you understand that this was "the right thing". Same
with Haskell, it does pay off a lot in future :)
15 ????. 2015 19:27 "emacstheviking" <[email protected]> ????:

> I just love the way Haskell can blow something really simple into
> something truly mind blowingly obtuse looking at times!
> It's no wonder Haskell won't be "mainstream" for a while yet, but that's
> fine, it means the rest of us can charge better rates for now.
> :)
>
>
> On 15 April 2015 at 13:50, Kostiantyn Rybnikov <[email protected]> wrote:
>
>> Adding to others,
>>
>> For fmapping left value I suggest using fmapLeft from errors package, for
>> fmapping both you can use
>>
>> either (Left . replicate 3) (Right . replicate 3)
>> 14 ????. 2015 19:48 "Shishir Srivastava" <[email protected]>
>> ????:
>>
>>> Hi,
>>>
>>> Can someone please explain the difference in outputs of the following
>>> two expressions -
>>>
>>> --------------
>>>
>>> ghci> fmap (replicate 3) (Right "blah")
>>> Right ["blah","blah","blah"]
>>>
>>> ghci> fmap (replicate 3) (Left "foo")
>>> Left "foo"
>>>
>>> ---------------
>>>
>>> Why does 'Right' return a list of Strings whereas 'Left' returns just a
>>> String.
>>>
>>> Thanks,
>>> Shishir
>>>
>>> _______________________________________________
>>> Beginners mailing list
>>> [email protected]
>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>>>
>>>
>> _______________________________________________
>> Beginners mailing list
>> [email protected]
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>>
>>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20150415/5fdac0aa/attachment.html>

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

Subject: Digest Footer

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


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

End of Beginners Digest, Vol 82, Issue 16
*****************************************

Reply via email to