Send Beginners mailing list submissions to
        beginners@haskell.org

To subscribe or unsubscribe via the World Wide Web, visit
        http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        beginners-requ...@haskell.org

You can reach the person managing the list at
        beginners-ow...@haskell.org

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


Today's Topics:

   1. Re:  Exercise of "Programming with Arrows" (Kim-Ee Yeoh)
   2. Re:  Exercise of "Programming with Arrows" (Kim-Ee Yeoh)
   3. Re:  Exercise of "Programming with Arrows" (Thiago Negri)
   4. Re:  Exercise of "Programming with Arrows" (Kim-Ee Yeoh)
   5.  capital letter name in record syntax (parsing    json) (Miro Karpis)


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

Message: 1
Date: Wed, 16 Oct 2013 23:47:02 +0700
From: Kim-Ee Yeoh <k...@atamo.com>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <beginners@haskell.org>
Subject: Re: [Haskell-beginners] Exercise of "Programming with Arrows"
Message-ID:
        <capy+zdtmu8okq9y-adpeflmscdvz-vu3s1wg9c7wlp4sf6+...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

On Wed, Oct 16, 2013 at 10:33 PM, Thiago Negri <evoh...@gmail.com> wrote:

> Okay, I solved the exact test case the paper proposed.
>

Awesome!

Now I've hit another problem:
>
> > loop_bufid :: SP a a
> > loop_bufid = loop (Get (\a -> Get (\b -> Put a (Put b id))))
>

Even better! I was kinda worried that you weren't going to get to this
stage.

So here's what I see:

* this is a problem harder than it look (duh!)

* that you've got this far is super-impressive: search "instance ArrowLoop
SP" to see what others have attempted

And you know what? I don't think there's a solution, not in this generality
at least.

Let's break up the problem a bit:

(A) the fifo/buffer/queue suggested by the problem needs to have
Time-Travelling Superpowers. Even when it's empty, you can query values
(supplied from the future) to keep your computation running. Oh, and
obviously, it's gotta be infinite, i.e. no fixed capacity.

(B) some SPs simply won't evaluate to anything meaningful (relative to
standard metaphysics) under loop, e.g.

existentialism :: SP (String, Bool) (String, Bool)
existentialism = let r = Get( \(_,x) -> Put( if x then "Heaven" else
"Hell", not x ) r ) in r

Either of (A) or (B) is worthy of pursuit.

(A) is very haskell-y because one can't even imagine these things using
other languages, all of which fall under strict semantics. Good evidence of
Sapir-Whorf, don't you think?

For (B), I'd think about restricting the space of SPs to get rid of some of
the junk. E.g. allow SPs such as Get...Put...Get...Get...Get..., but not
those that whose constructors VARY according to the Get binding,
essentially the Applicatives vs Monads distinction.

(B), whose mantra is Make the Meaningless/Buggy Un-Codeable, is immediately
useful in all PLs, but Haskell's type system gives the programmer uniquely
powerful leverage in that direction.

-- Kim-Ee
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20131016/9e0ff2a7/attachment-0001.html>

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

Message: 2
Date: Thu, 17 Oct 2013 00:33:14 +0700
From: Kim-Ee Yeoh <k...@atamo.com>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <beginners@haskell.org>
Subject: Re: [Haskell-beginners] Exercise of "Programming with Arrows"
Message-ID:
        <capy+zdq7cwj5awvrf7qxs_t9fhdvb8a3k46esxit9o6zixu...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

On Wed, Oct 16, 2013 at 10:33 PM, Thiago Negri <evoh...@gmail.com> wrote:
> Updated gist: https://gist.github.com/thiago-negri/2e541a9f9762c727bdd4

Here:

prop_SP_first :: SP Int Int -> [(Int,Int)] -> Bool
prop_SP_first f xs = x1 == x2
  where x1 = map snd xs
        x2 = map snd (runSP (first f) xs)

you check that the second half of the coupled stream are equal, i.e. the
(arr id) input of (***) is equivalent across the equal sign:

g *** (arr id) = first g

What about the first half?

-- Kim-Ee
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20131017/9445f346/attachment-0001.html>

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

Message: 3
Date: Wed, 16 Oct 2013 14:41:57 -0300
From: Thiago Negri <evoh...@gmail.com>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <beginners@haskell.org>
Subject: Re: [Haskell-beginners] Exercise of "Programming with Arrows"
Message-ID:
        <cablnezu++kcdwh8sgjysbuo7mh9zkbxzcb9bqhmwxhc2vt5...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Thanks for your words.

The only hit I get in DuckDuckGo was this:
http://sigkill.dk/programs/arrows/

I've tried things like this, and I couldn't make it work.
Yet I've copy&pasted the code, and it worked! Even with the "loop_bufid"
test!

:(

I'll take a deeper look into it.



2013/10/16 Kim-Ee Yeoh <k...@atamo.com>

> On Wed, Oct 16, 2013 at 10:33 PM, Thiago Negri <evoh...@gmail.com> wrote:
>
>> Okay, I solved the exact test case the paper proposed.
>>
>
> Awesome!
>
> Now I've hit another problem:
>>
>> > loop_bufid :: SP a a
>> > loop_bufid = loop (Get (\a -> Get (\b -> Put a (Put b id))))
>>
>
> Even better! I was kinda worried that you weren't going to get to this
> stage.
>
> So here's what I see:
>
> * this is a problem harder than it look (duh!)
>
> * that you've got this far is super-impressive: search "instance ArrowLoop
> SP" to see what others have attempted
>
> And you know what? I don't think there's a solution, not in this
> generality at least.
>
> Let's break up the problem a bit:
>
> (A) the fifo/buffer/queue suggested by the problem needs to have
> Time-Travelling Superpowers. Even when it's empty, you can query values
> (supplied from the future) to keep your computation running. Oh, and
> obviously, it's gotta be infinite, i.e. no fixed capacity.
>
> (B) some SPs simply won't evaluate to anything meaningful (relative to
> standard metaphysics) under loop, e.g.
>
> existentialism :: SP (String, Bool) (String, Bool)
> existentialism = let r = Get( \(_,x) -> Put( if x then "Heaven" else
> "Hell", not x ) r ) in r
>
> Either of (A) or (B) is worthy of pursuit.
>
> (A) is very haskell-y because one can't even imagine these things using
> other languages, all of which fall under strict semantics. Good evidence of
> Sapir-Whorf, don't you think?
>
> For (B), I'd think about restricting the space of SPs to get rid of some
> of the junk. E.g. allow SPs such as Get...Put...Get...Get...Get..., but not
> those that whose constructors VARY according to the Get binding,
> essentially the Applicatives vs Monads distinction.
>
> (B), whose mantra is Make the Meaningless/Buggy Un-Codeable, is
> immediately useful in all PLs, but Haskell's type system gives the
> programmer uniquely powerful leverage in that direction.
>
> -- Kim-Ee
>
> _______________________________________________
> Beginners mailing list
> Beginners@haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20131016/3c544a4a/attachment-0001.html>

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

Message: 4
Date: Thu, 17 Oct 2013 01:16:33 +0700
From: Kim-Ee Yeoh <k...@atamo.com>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <beginners@haskell.org>
Subject: Re: [Haskell-beginners] Exercise of "Programming with Arrows"
Message-ID:
        <capy+zdqs9odna+taos4+h2ohjkffuzdpjrsxn5otx3_wlu5...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

On Thu, Oct 17, 2013 at 12:41 AM, Thiago Negri <evoh...@gmail.com> wrote:

> The only hit I get in DuckDuckGo was this:
> http://sigkill.dk/programs/arrows/
>
> I've tried things like this, and I couldn't make it work.
> Yet I've copy&pasted the code, and it worked! Even with the "loop_bufid"
> test!
>

If it's any consolation, feed 'er this:

arrswap2 :: SP (a,b) (b,a)
arrswap2 = let r = Get(\(a1,b1) -> Get(\(a2,b2) -> Put (b1,a1) (Put (b2,a2)
r))) in r

-- Kim-Ee
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20131017/bdcbfdda/attachment-0001.html>

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

Message: 5
Date: Wed, 16 Oct 2013 23:18:19 +0200
From: Miro Karpis <miroslav.kar...@gmail.com>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <Beginners@haskell.org>
Subject: [Haskell-beginners] capital letter name in record syntax
        (parsing        json)
Message-ID:
        <cajnnbxhtagoh6azvbxmt7qwadotuhweh523bc8rmexqctmn...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Hi, please,...is it possible to use a capital letter in record syntax data
definition? For example

data Car =
  Car { CarName  :: !Text
         ,CarColor   :: !Text
        } deriving (Show,Generic)

When I try this I get: parse error on input `CarName'

The thing is that I'm trying to parse a json file (with Aeson package) that
has records starting with capital letter. After that I would like to parse
the JSON file with following code:

 d <- (eitherDecode <$> getJSON) :: IO (Either String [Car])

where getJSON gets the json file from url

If not, what alternative do I have?

thanks,
m.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20131016/4e2a9adf/attachment.html>

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

Subject: Digest Footer

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners


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

End of Beginners Digest, Vol 64, Issue 27
*****************************************

Reply via email to