Re: Error when ($) is used, but no error without
Niklas Broberg wrote: On 4/27/06, Robin Bate Boerop <[EMAIL PROTECTED]> wrote: But, this code: class CC a type C x = CC a => a x f, g :: C a -> Int f _ = 3 g x = f $ x -- the only change The problem is exactly the use of $. $ is an operator, not a built-in language construct, and it has type (a -> b) -> a -> b. No forall's in there, so you cannot give it a function argument that is existentially quantified. Lots of people have been bitten by this when using the magic runST with type "forall a. (forall s. ST s a) -> a". Use parentheses when you have existentially quantified values and everything should be just fine. :-) Just to point out that in this case the problem is even more subtle, because C x is an existential type and therefore is not supported at all in Haskell at present. You cannot even apply 'f' to anything. It is made more confusing by the fact that the type checker appears to accept g x = f x. However this is a red herring, because you can't actually apply 'f' to anything in practice eg f (A1 3) where A1 is an instance of CC, would give an error also. In contrast, (forall s. ST s a) is not a true existential, since we are here just simulating an existential by making use of the ST constructor to store the info about what 's' was used so that it can be recovered by pattern matching. The previous example I posted *does* work with $. Regards, Brian. ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: Error when ($) is used, but no error without
On 4/27/06, Robin Bate Boerop <[EMAIL PROTECTED]> wrote: > But, this code: > > class CC a > type C x = CC a => a x > f, g :: C a -> Int > f _ = 3 > g x = f $ x -- the only change The problem is exactly the use of $. $ is an operator, not a built-in language construct, and it has type (a -> b) -> a -> b. No forall's in there, so you cannot give it a function argument that is existentially quantified. Lots of people have been bitten by this when using the magic runST with type "forall a. (forall s. ST s a) -> a". Use parentheses when you have existentially quantified values and everything should be just fine. :-) /Niklas > > gives this error: > > Inferred type is less polymorphic than expected >Quantified type variable `a' escapes >Expected type: a a1 -> b >Inferred type: C a1 -> Int > In the first argument of `($)', namely `f' > In the definition of `g': g x = f $ x > > What's going on here? > > -- > Robin Bate Boerop > > > > ___ > Glasgow-haskell-users mailing list > Glasgow-haskell-users@haskell.org > http://www.haskell.org/mailman/listinfo/glasgow-haskell-users > ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: ANNOUNCE: GHC vesrion 6.4.2 (Fedora Core)
Simon Marlow wrote: http://haskell.org/ghc/docs/6.4.2/html/users_guide/release-6-4-2.html Thank you! Packages will appear as they are built - if the package for your system isn't available yet, please try again later. Builds for Fedora Core 4 and 5 are now available in Fedora Extras for i386, x86_64 and ppc. Cheers, Jens ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: Error when ($) is used, but no error without
Brian Hulley wrote: Brian Hulley wrote: f,g :: (forall a. CC a => a Int) -> Int -- not allowed delete the "not allowed" comment ;-) It's not so simple as I'd thought so I'd be interested to know the reason for $ making a difference too. Actually I must undelete my "not allowed" comment above: you are trying to use existential types which are not supported in Haskell yet. You can simulate an existential by wrapping it in a single constructor data type eg: data Foo a = forall b. CC b => Foo (b a) Rewriting your example to use this simulation of existentials, everything works: class CC b data Foo a = forall b. CC b => Foo (b a) f :: Foo a -> Int f _ = 3 data A1 c = A1 c data A2 c = A2 c instance CC A1 instance CC A2 p = f (Foo (A1 3)) q = f (Foo (A2 3)) g x = f $ x The reason it works is that the Foo constructor keeps track of which particular 'b' has been used for any particular 'Foo a', so that class methods of the correct 'b' can be used inside the body of 'f'. Regards, Brian. ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: Error when ($) is used, but no error without
Brian Hulley wrote: f,g :: (forall a. CC a => a Int) -> Int -- not allowed delete the "not allowed" comment ;-) It's not so simple as I'd thought so I'd be interested to know the reason for $ making a difference too. Regards, Brian. ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: Error when ($) is used, but no error without
Robin Bate Boerop wrote: This code compiles properly (with -fglasgow-exts on GHC 6.4.1): class CC a type C x = CC a => a x f, g :: C a -> Int f _ = 3 g x = f x But, this code: class CC a type C x = CC a => a x f, g :: C a -> Int f _ = 3 g x = f $ x -- the only change gives this error: Inferred type is less polymorphic than expected Quantified type variable `a' escapes Expected type: a a1 -> b Inferred type: C a1 -> Int In the first argument of `($)', namely `f' In the definition of `g': g x = f $ x What's going on here? I think the type declaration is actually equivalent to: type C x = forall a. CC a => a x so that you are declaring: f,g :: (forall a. CC a => a Int) -> Int -- not allowed instead of: f,g :: forall a. (CC a => a Int ->Int) ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Error when ($) is used, but no error without
This code compiles properly (with -fglasgow-exts on GHC 6.4.1): class CC a type C x = CC a => a x f, g :: C a -> Int f _ = 3 g x = f x But, this code: class CC a type C x = CC a => a x f, g :: C a -> Int f _ = 3 g x = f $ x -- the only change gives this error: Inferred type is less polymorphic than expected Quantified type variable `a' escapes Expected type: a a1 -> b Inferred type: C a1 -> Int In the first argument of `($)', namely `f' In the definition of `g': g x = f $ x What's going on here? -- Robin Bate Boerop ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
GHC 6.4.2 on OS X
Hello, I am wondering if the following patch (or equivalent) made it into GHC 6.4.2. I was hoping it would fix my problem: mjollnir ~/src/ghc/ghc-6.4.2$ ghci `hbdd-config --cudd-libs` ___ ___ _ / _ \ /\ /\/ __(_) / /_\// /_/ / / | | GHC Interactive, version 6.4.2, for Haskell 98. / /_\\/ __ / /___| | http://www.haskell.org/ghc/ \/\/ /_/\/|_| Type :? for help. Loading package base-1.0 ... linking ... done. Loading package haskell98-1.0 ... linking ... done. Loading package boolean-0.3.0 ... linking ... done. Loading package unix-1.0 ... linking ... done. Loading package cudd-0.3.0 ... linking ... ghc-6.4.2: /Users/peteg/lib/hbdd-0.3.0/ghc-6.4.2/cudd//hutil.o: unknown symbol `_fprintf$LDBLStub' ghc-6.4.2: unable to load package `cudd-0.3.0' It is a problem with GCC 4.0 and GHCi - GHC works fine. mjollnir ~/src/ghc/ghc-6.4.2$ gcc --version powerpc-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 5247) Copyright (C) 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Can you give me some idea how to fix it? (The use of fprintf is inessential for my purposes but I'd prefer not to hack the C library too much.) cheers peter Begin forwarded message: From: Wolfgang Thaller <[EMAIL PROTECTED]> Date: 15 July 2005 12:00:16 PM To: [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: cvs commit: fptools configure.ac fptools/ghc/rts Linker.c wolfgang2005/07/14 19:00:15 PDT Modified files: .configure.ac ghc/rts Linker.c Log: Mac OS X/PowerPC: Make GHCi deal with the additional statically linked symbols from libSystemStub.a on Tiger (printf$LDBLStub and friends). MERGE TO STABLE Revision ChangesPath 1.114 +15 -0 fptools/configure.ac 1.201 +51 -0 fptools/ghc/rts/Linker.c ___ Cvs-ghc mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/cvs-ghc ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
The 2006 GHC Hackathon
Dearest GHC hackers, We're considering the possibility of organising a GHC Hackathon around ICFP this year. This wiki page has tentative details, and you can indicate whether you'd be interested in coming, and give us your suggestions: http://hackage.haskell.org/trac/ghc/wiki/Hackathon Cheers, Simon ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: 6.4.2 Build error
Am Montag, 24. April 2006 11:11 schrieb Simon Marlow: > Daniel Fischer wrote: > > When building 6.4.2 today, make died with > >[...] > > If you don't need OpenAL or ALUT, then I suggest you configure with > --disable-openal. > > OpenAL was updated in 6.4.2. I thought the new version handled > compatibility with different versions of the OpenAL library better > (indeed that's why it was updated), but it appears not. I'm hoping Sven > Panne, the author of OpenAL, will be able to shed some light. *sigh* It looks like if the OpenAL package has been built correctly, but now the ALUT package makes some trouble. :-P I'll have a look into it at the weekend, in the meantime "--disable-alut" will probably help, disabling OpenAL itself is not needed. Sorry for all the trouble, but the OpenAL and ALUT libraries have been a moving target in the past, but things have consolidated recently. Alas, some Linux/*BSD/... distributions are still shipping very old stuff. Catching all these differences via autoconf is non-trivial. Cheers, S. ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users