Send Beginners mailing list submissions to
        beginners@haskell.org

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
        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:  Pattern Matching for record syntax (Jeon-Young Kang)
   2. Re:  Pattern Matching for record syntax (Imants Cekusins)
   3. Re:  Pattern Matching for record syntax (Magnus Therning)
   4. Re:  Pattern Matching for record syntax (Jeon-Young Kang)
   5.  stack issues (frantisek kocun)
   6. Re:  stack issues (frantisek kocun)


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

Message: 1
Date: Thu, 7 Jan 2016 17:43:19 -0500
From: Jeon-Young Kang <jykan...@gmail.com>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <beginners@haskell.org>
Subject: Re: [Haskell-beginners] Pattern Matching for record syntax
Message-ID:
        <calwtik-ewjv5y+19xo3+fpxbua-rmovy2iydxltptn+5yjc...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

For pattern matching.. I implemented like this.

compareName a (Person name age)
        | (a == name) = age

but, I got stuck how to apply pattern matching for the two lists.
i.e., both names and persons are lists.

I really appreciate your advice..



On Thu, Jan 7, 2016 at 5:37 PM, Imants Cekusins <ima...@gmail.com> wrote:

> > filter is only applicable to list, not "record syntax".
>
> but [Person] is the input, isn't it?
>
> > Do I need functor for this??
>
> no need to define new functor instance to filter over a list of records.
>
> but you could use fmap over list, yes
>
> _______________________________________________
> Beginners mailing list
> Beginners@haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20160107/1c76f0b0/attachment-0001.html>

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

Message: 2
Date: Thu, 7 Jan 2016 23:50:32 +0100
From: Imants Cekusins <ima...@gmail.com>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <beginners@haskell.org>
Subject: Re: [Haskell-beginners] Pattern Matching for record syntax
Message-ID:
        <cap1qinbrdfc891bdulf8btjsehetbxvwy4blkgrsx+tffmk...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Could you filter, then map? I'd try that instead of pattern matching.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20160107/369a0224/attachment-0001.html>

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

Message: 3
Date: Thu, 07 Jan 2016 23:51:59 +0100
From: Magnus Therning <mag...@therning.org>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <beginners@haskell.org>
Subject: Re: [Haskell-beginners] Pattern Matching for record syntax
Message-ID: <87wprlj94g....@therning.org>
Content-Type: text/plain; charset="us-ascii"


Jeon-Young Kang writes:

> For pattern matching.. I implemented like this.
>
> compareName a (Person name age)
>         | (a == name) = age
>
> but, I got stuck how to apply pattern matching for the two lists.
> i.e., both names and persons are lists.
>
> I really appreciate your advice..

Something like this works:

    map age $ filter (\ p -> (name p) `elem` names) persons

/M

--
Magnus Therning              OpenPGP: 0x927912051716CE39
email: mag...@therning.org   jabber: mag...@therning.org
twitter: magthe               http://therning.org/magnus

Finagle's Fifth Law:
Always draw your curves, then plot your readings.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 800 bytes
Desc: not available
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20160107/2b0fc6df/attachment-0001.sig>

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

Message: 4
Date: Thu, 7 Jan 2016 18:02:12 -0500
From: Jeon-Young Kang <jykan...@gmail.com>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <beginners@haskell.org>
Subject: Re: [Haskell-beginners] Pattern Matching for record syntax
Message-ID:
        <CALWtiK_=sb0ar+qkabqrgb8dvo97owte7p45w2h5o8bwpau...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

I  figured out.. Thank you so much.

On Thu, Jan 7, 2016 at 5:51 PM, Magnus Therning <mag...@therning.org> wrote:

>
> Jeon-Young Kang writes:
>
> > For pattern matching.. I implemented like this.
> >
> > compareName a (Person name age)
> >         | (a == name) = age
> >
> > but, I got stuck how to apply pattern matching for the two lists.
> > i.e., both names and persons are lists.
> >
> > I really appreciate your advice..
>
> Something like this works:
>
>     map age $ filter (\ p -> (name p) `elem` names) persons
>
> /M
>
> --
> Magnus Therning              OpenPGP: 0x927912051716CE39
> email: mag...@therning.org   jabber: mag...@therning.org
> twitter: magthe               http://therning.org/magnus
>
> Finagle's Fifth Law:
> Always draw your curves, then plot your readings.
>
> _______________________________________________
> Beginners mailing list
> Beginners@haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20160107/3eb5f0e0/attachment-0001.html>

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

Message: 5
Date: Thu, 7 Jan 2016 22:46:11 -0500
From: frantisek kocun <frantisek.ko...@gmail.com>
To: beginners@haskell.org
Subject: [Haskell-beginners] stack issues
Message-ID:
        <CAMcUN70acPqgjLCTtVkKhoBR==qv4vz_vfva+nb-eqlnsyf...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Hi,

I'm new to cabal/stack. I want to use "stack build" to build my project.

I can not use latest gkt >= 0.14.2 because of
   setup: The pkg-config package 'cairo' version >=1.2.0 is required but it
could

Neither can I now use older version gtk >=0.12.0 && < 0.13

While constructing the BuildPlan the following exceptions were encountered:

--  Failure when adding dependencies:

      gtk: needed (>=0.12.0 && <0.13), 0.14.2 found (latest version
available)

    needed for package: ships-0.1.0.0



What can i do? Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20160107/0eb7205a/attachment-0001.html>

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

Message: 6
Date: Thu, 7 Jan 2016 23:13:36 -0500
From: frantisek kocun <frantisek.ko...@gmail.com>
To: beginners@haskell.org
Subject: Re: [Haskell-beginners] stack issues
Message-ID:
        <camcun73sygdenpc0-um+qmwild2jdb0f2aenrbkbghg2row...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Found that gtk was not installed. So I did
  brew install gtk

but I got different problem

[ 22 of 209] Compiling Graphics.UI.Gtk.Embedding.Plug (
.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/Graphics/UI/Gtk/Embedding/Plug.hs,
.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/Graphics/UI/Gtk/Embedding/Plug.o
)



    Graphics/UI/Gtk/Embedding/Plug.chs:120:6:

        Couldn't match expected type ?Ptr ()?

                    with actual type ?Maybe DrawWindow?

        In the first argument of ?gtk_plug_new?, namely

          ?(fromNativeWindowId (fromMaybe nativeWindowIdNone socketId))?

        In the second argument of ?($)?, namely

          ?gtk_plug_new

             (fromNativeWindowId (fromMaybe nativeWindowIdNone socketId))?

On Thu, Jan 7, 2016 at 10:46 PM, frantisek kocun <frantisek.ko...@gmail.com>
wrote:

> Hi,
>
> I'm new to cabal/stack. I want to use "stack build" to build my project.
>
> I can not use latest gkt >= 0.14.2 because of
>    setup: The pkg-config package 'cairo' version >=1.2.0 is required but
> it could
>
> Neither can I now use older version gtk >=0.12.0 && < 0.13
>
> While constructing the BuildPlan the following exceptions were encountered:
>
> --  Failure when adding dependencies:
>
>       gtk: needed (>=0.12.0 && <0.13), 0.14.2 found (latest version
> available)
>
>     needed for package: ships-0.1.0.0
>
>
>
> What can i do? Thanks
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.haskell.org/pipermail/beginners/attachments/20160107/ed6388d5/attachment.html>

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

Subject: Digest Footer

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners


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

End of Beginners Digest, Vol 91, Issue 12
*****************************************

Reply via email to