Donald Bruce Stewart | 1 Dec 01:24 2005
Picon
Picon

Re: fptools mirror in darcs ready for testing

Hooray!! Thanks John

jgoerzen:
> Hello everyone,
> 
> Finally!  Simon Marlow's plan[1] for moving from CVS to darcs for
> fptools, GHC, etc. is happening.  Thanks to some feedback from him and
> the author of Tailor, as well as some free time finally, I've been
> able to convert things from CVS to darcs according to the plan.
> 
> So, the first phase is to have live, updated darcs mirrors of CVS
> repos as appropriate.  We now have that.
> 
> Please feel free to darcs get --partial any of these.  (Trust me, you
> *REALLY* want to use --partial.  You'd be downloading over 13,000
> patches otherwise on some of these.)
> 
> http://cvs.haskell.org/darcs/ghc
>   GHC HEAD
> http://cvs.haskell.org/darcs/ghc.ghc-6.4
>   GHC ghc-6-4-branch
> http://cvs.haskell.org/darcs/libraries
>   libraries dir from fptools, HEAD
> http://cvs.haskell.org/darcs/libraries.ghc-6.4
>   libraries dir from fptools, ghc-6-4-branch
> http://cvs.haskell.org/darcs/nofib
>   nofib dir from fptools, HEAD  (there were no commits on
>   ghc-6-4-branch for nofib)
> http://cvs.haskell.org/darcs/testsuite
>   testsuite dir from fptools, HEAD
(Continue reading)

Louis-Julien Guillemette | 1 Dec 01:48 2005
Picon

Functional dependencies and type inference (2)


Say we are using a GADT to represent a simple language of boolean 
constants and conditionals,

data Term a where
   B    :: Bool -> Term Bool
   Cnd  :: Term Bool -> Term t -> Term t -> Term t

and we would like to perform a type-safe CPS conversion over this language. We 
encode the relationship between the types in the source language and those in 
the CPS-converted language using a class and a fundep:

class CpsForm a b | a -> b
instance CpsForm Bool Bool

A natural formulation of the type of the CPS transformation would be

cps :: CpsForm t cps_t => Term t -> (Term cps_t -> Term ()) -> Term ()

cps (B b) c = c (B b)  -- doesn't type-check!
cps (Cnd p q r) c = cps p (\p' -> Cnd p' (cps q c) (cps r c))
                        -- type-checks OK

but the first clause of the function doesn't type-check:

     Couldn't match the rigid variable `cps_t' against `Bool'
       `cps_t' is bound by the type signature for `cps'
       Expected type: Term cps_t
       Inferred type: Term Bool
     In the application `B b'
(Continue reading)

Robert Dockins | 1 Dec 04:48 2005

cabal and ghcconfigure.h

I've just run across a problem with my cabal build system -- I'm not yet sure 
if this is a cabal problem or a system configuration problem.

I've been developing a package on OSX using the ghc 6.4.1 and cabal from 
darwinports.  All is fine and dandy.  However, today I've sucked my darcs 
repo down to my machine at home (running Gentoo linux) and now my package 
won't build.  (this time with GHC 6.4.1 from portage and cabal 1.1.3)

It halts while apparently running an Alex generated lexer through CPP, with 
the error:

ghcconfig.h: No such file or directory

My GHC install has this file at /usr/lib/ghc-6.4.1/include, but it clearly 
isn't in the include path that cabal is using.

So the question is -- is this a cabal bug of some kind, or is the gentoo setup 
messed up some how?  How should I proceed?

Thanks
Rob Dockins
kahl | 1 Dec 05:05 2005
Picon
Picon

Re: Functional dependencies and type inference (2)

 Louis-Julien Guillemette <guillelj <at> iro.umontreal.ca> wrote:

 > Say we are using a GADT to represent a simple language of boolean 
 > constants and conditionals,
 > 
 > data Term a where
 >    B    :: Bool -> Term Bool
 >    Cnd  :: Term Bool -> Term t -> Term t -> Term t
 > 
 > and we would like to perform a type-safe CPS conversion over this language. We 
 > encode the relationship between the types in the source language and those in 
 > the CPS-converted language using a class and a fundep:
 > 
 > class CpsForm a b | a -> b
 > instance CpsForm Bool Bool
 > 
 > A natural formulation of the type of the CPS transformation would be
 > 
 > cps :: CpsForm t cps_t => Term t -> (Term cps_t -> Term ()) -> Term ()
 > 
[...]
 >      Couldn't match the rigid variable `cps_t' against `Bool'
[...]
 > 
 > This case seems to be an instance of a problem discussed earlier.
 > (http://www.haskell.org/pipermail/haskell-cafe/2005-August/011053.html)
 > 
 > Any suggestion on a way to get around this problem in current Haskell?
 > 

(Continue reading)

oleg | 1 Dec 06:38 2005
Picon

Re: Functional dependencies and type inference (2)


Louis-Julien Guillemette wrote:
> Say we are using a GADT to represent a simple language of boolean
> constants and conditionals,
>
> data Term a where
>    B    :: Bool -> Term Bool
>    Cnd  :: Term Bool -> Term t -> Term t -> Term t
>
> and we would like to perform a type-safe CPS conversion over this
> language. We encode the relationship between the types in the source
> language and those in the CPS-converted language using a class and a
> fundep:

Here's the code that seems to do what you wished. Liberty is taken
to extend the language so we can CPS convert more interesting terms.

Here are the tests

> term1 = Cnd (Cnd (B True) (B False) (B False)) (B True) (B False)
> test1 = shw (cps term1 id) ""

*CPS> test1
"Cnd (B True)(Cnd (B False)(B True)(B False))(Cnd (B False)(B True)(B False))"

> term2 = Cnd (Cmp (Cnd (B True) (I 1) (I 2)) (I 3)) 
> 	(B True) (Cmp (B True) (B False))
> test2 = shw (cps term2 id) ""

*CPS> test2
(Continue reading)

oleg | 1 Dec 06:57 2005
Picon

GADT type inference problem


Let us consider the following simple code

> {-# OPTIONS -fglasgow-exts #-}
>
> module Foo where
>
> data Term a where
>    B    :: Bool -> Term Bool
>    C    :: Term Bool -> Term t -> Term t 
>    I    :: Int -> Term Int
>
> shw (I t) = ("I "++) . shows t
> shw (B t) = ("B "++) . shows t
> shw (C p q) = ("Cnd "++) . (shw p) . (shw q)

It loads in GHCi 6.4 and 6.4.1:

  Prelude> :l /tmp/g.hs
  Compiling Foo              ( /tmp/g.hs, interpreted )
  Ok, modules loaded: Foo.
  *Foo> :t I 1
  I 1 :: Term Int
  *Foo> :t B True
  B True :: Term Bool

However, when we do

  *Foo> :t shw
  shw :: Term Bool -> String -> [Char]
(Continue reading)

David Menendez | 1 Dec 07:52 2005

Re: GADT type inference problem

oleg <at> pobox.com writes:

> 
> Let us consider the following simple code
> 
> > {-# OPTIONS -fglasgow-exts #-}
> >
> > module Foo where
> >
> > data Term a where
> >    B    :: Bool -> Term Bool
> >    C    :: Term Bool -> Term t -> Term t 
> >    I    :: Int -> Term Int
> >
> > shw (I t) = ("I "++) . shows t
> > shw (B t) = ("B "++) . shows t
> > shw (C p q) = ("Cnd "++) . (shw p) . (shw q)
...
> 
> However, when we do
> 
>   *Foo> :t shw
>   shw :: Term Bool -> String -> [Char]
> 
> The inferred type of shw shows that it takes the values of 
> Term *Bool*. 

As I understand it, GHC can't infer the most general type signature when
GADTs are involved. It should work if shw has an explicit type
signature, e.g. shw :: Term a -> ShowS
(Continue reading)

Simon Peyton-Jones | 1 Dec 09:55 2005
Picon

RE: GADT type inference problem

This is a bug, thank you.

I've added it to the test suite, but I'm in the middle of revising the
GADT impl so I won't fix it right off.

Simon

| -----Original Message-----
| From: haskell-bounces <at> haskell.org [mailto:haskell-bounces <at> haskell.org]
On Behalf Of
| oleg <at> pobox.com
| Sent: 01 December 2005 05:57
| To: haskell <at> haskell.org
| Subject: [Haskell] GADT type inference problem
| 
| 
| Let us consider the following simple code
| 
| > {-# OPTIONS -fglasgow-exts #-}
| >
| > module Foo where
| >
| > data Term a where
| >    B    :: Bool -> Term Bool
| >    C    :: Term Bool -> Term t -> Term t
| >    I    :: Int -> Term Int
| >
| > shw (I t) = ("I "++) . shows t
| > shw (B t) = ("B "++) . shows t
| > shw (C p q) = ("Cnd "++) . (shw p) . (shw q)
(Continue reading)

Jens Petersen | 1 Dec 01:54 2005

Re: Re: ANNOUNCE: hmp3, an ncurses mp3 player

John Goerzen wrote:
> You may find my haskell-magic binding to libmagic useful.

"darcs get http://darcs.complete.org/magic-haskell" seems to work.

Jens
Duncan Coutts | 1 Dec 16:18 2005
Picon
Picon

Re: cabal and ghcconfigure.h

On Wed, 2005-11-30 at 22:48 -0500, Robert Dockins wrote:
> I've just run across a problem with my cabal build system -- I'm not yet sure 
> if this is a cabal problem or a system configuration problem.
> 
> I've been developing a package on OSX using the ghc 6.4.1 and cabal from 
> darwinports.  All is fine and dandy.  However, today I've sucked my darcs 
> repo down to my machine at home (running Gentoo linux) and now my package 
> won't build.  (this time with GHC 6.4.1 from portage and cabal 1.1.3)
> 
> It halts while apparently running an Alex generated lexer through CPP, with 
> the error:
> 
> ghcconfig.h: No such file or directory
> 
> My GHC install has this file at /usr/lib/ghc-6.4.1/include, but it clearly 
> isn't in the include path that cabal is using.
> 
> So the question is -- is this a cabal bug of some kind, or is the gentoo setup 
> messed up some how?  How should I proceed?

Are you using cpphs?

When you use ghc to do the 'cpp'ing it adds -I/usr/lib/ghc-6.4.1/include
but if Cabal is using cpphs then I suspect that it will not.

You can pass -v to Cabal to get it to show you exactly what it is
invoking:

runhaskell Setup.lhs build -v

(Continue reading)


Gmane