Send Beginners mailing list submissions to
        [email protected]

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
        [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:  Problem with GADTs and Parsec (Brent Yorgey)
   2.  problems loading zeromq (fa-ml)


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

Message: 1
Date: Sun, 9 Feb 2014 14:03:33 -0500
From: Brent Yorgey <[email protected]>
To: [email protected]
Subject: Re: [Haskell-beginners] Problem with GADTs and Parsec
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii

On Sun, Feb 09, 2014 at 09:21:15AM +0100, Lorenzo wrote:
> > In my opinion, this is one of the few places where existential
> > wrappers are really what you want.  If I were you, I would do
> > something like this:
> > 
> >   data ExprE where
> >     ExprE :: Expr a -> ExprE   -- existentially hides the expression
> > type
> > 
> > Now you can write your parser to return an ExprE, with the type of the
> > expression hidden inside. In order to be able to use the resulting
> > ExprE values, you will also want a function like
> > 
> >   withExprE :: ExprE -> (Expr a -> r) -> r
> >   withExprE (ExprE expr) k = k expr
> 
> Thanks. This is the kind of solution I was looking for.
> The problem is, when I try to access the "hidden" Expr type the compiler
> complains:
> 

Whoops! Sorry, I gave you the wrong type for withExprE.  And you can
see why it is wrong, based on the earlier explanation: the *caller* of
withExprE gets to choose the type a, but there is some particular
(unknown) type inside the ExprE, so there is no guarantee they will
match up.  Instead, we must write

  withExprE :: ExprE -> (forall a. Expr a -> r) -> r

(note you have to enable the Rank2Types extension).  This says that
the caller of ExprE must provide a function which works *no matter
what* the type a is, i.e. the implementation of withExprE gets to
choose the type a, rather than the caller.

-Brent


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

Message: 2
Date: Mon, 10 Feb 2014 05:11:49 +0100
From: fa-ml <[email protected]>
To: [email protected]
Subject: [Haskell-beginners] problems loading zeromq
Message-ID: <[email protected]>
Content-Type: text/plain; charset="us-ascii"

Hello list,
        I am trying to cabal install hbro. After a bit of fiddling I
stumbled on this:

        Resolving dependencies...
        Configuring hbro-1.1.2.1...
        Building hbro-1.1.2.1...
        Preprocessing library hbro-1.1.2.1...
        [ 1 of 19] Compiling Paths_hbro       ( 
dist/build/autogen/Paths_hbro.hs, dist/build/Paths_hbro.o )
        [ 2 of 19] Compiling Hbro.Keys        ( Hbro/Keys.hs, 
dist/build/Hbro/Keys.o )
        Loading package ghc-prim ... linking ... done.
        [omissis]
        Loading package semigroups-0.12.2 ... linking ... done.
        Loading package zeromq3-haskell-0.5.1 ... linking ... ghc: 
/home/user/.cabal/lib/zeromq3-haskell-0.5.1/ghc-7.4.1/HSzeromq3-haskell-0.5.1.o:
 unknown symbol `zmq_ctx_new'
        ghc: unable to load package `zeromq3-haskell-0.5.1'
        cabal: Error: some packages failed to install:
        hbro-1.1.2.1 failed during the building phase. The exception was:
        ExitFailure 1

I am puzzled because I cabal installed zeromq3-haskell *and*
downloaded/installed 0mq3 (./configure; make; su; make install).
0mq version is 3.2.5 and I am running debian/stable(i386).

Any idea on what is happening here?
Thanks in advance
-F
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20140210/df0516c4/attachment-0001.sig>

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

Subject: Digest Footer

_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners


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

End of Beginners Digest, Vol 68, Issue 8
****************************************

Reply via email to