[Haskell-cafe] Typechecker to GADT: the full implementation of a typed DSL

2007-10-04 Thread oleg
Pasqualino 'Titto' Assini wrote: I am trying to write an interpreter for a little functional language but I am finding very problematic to dynamically create a typed representations of the language terms. The problem is to write a function that converts between Exp and Term t as in:

[Haskell-cafe] Re: Function composition

2007-10-04 Thread Dominic Steinitz
Look at the type of (.).(.).(.) Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: The Exp - Term a problem (again), how to dynamically create (polymorphic) typed terms in Haskell ??

2007-10-04 Thread Dominic Steinitz
Did you look at Ralf Hinze's paper Fun with Phantom Types? Dominic. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Why not assign a type to unsafePerformIO?

2007-10-04 Thread Bulat Ziganshin
Hello Justin, Thursday, October 4, 2007, 1:47:00 AM, you wrote: Which could be stripped off it you wanted:   evilDictatator :: a   evilDictator = runUnsafe $ launchMissiles just imagine using ByteString library with all these runUnsafe calls flying around :))) or using immutable arrays -

Re[2]: [Haskell-cafe] Haskell FFI and finalizers

2007-10-04 Thread Bulat Ziganshin
Hello Maxime, Thursday, October 4, 2007, 2:55:41 AM, you wrote: If I write a small C function for doing the finalizer myself, I still wouldn't get passed the FILE * to close, only the struct foo * pointer which is of no use. you can use global assocs list -- Best regards, Bulat

Re: [Haskell-cafe] The Exp - Term a problem (again), how to dynamically create (polymorphic) typed terms in Haskell ??

2007-10-04 Thread Tomasz Zielonka
On 10/4/07, Pasqualino 'Titto' Assini [EMAIL PROTECTED] wrote: It does not seem to be possible to define typecheck on EApp in a generic way and is also not possible to distinguish between the different cases: You want to pattern-match on types and the easiest way to do it is to introduce a

Re: [Haskell-cafe] Re: Function composition

2007-10-04 Thread Stuart Cook
On 10/4/07, Dominic Steinitz [EMAIL PROTECTED] wrote: Look at the type of (.).(.).(.) Indeed, this generalizes to functions of any arity on the RHS: Prelude :t (.) (.) :: (b - c) - (a - b) - a - c Prelude :t (.).(.) (.).(.) :: (b - c) - (a - a1 - b) - a - a1 - c Prelude :t

Re: [Haskell-cafe] GHC doesn't work

2007-10-04 Thread Salvatore Insalaco
2007/10/3, Andrew Coppin [EMAIL PROTECTED]: The entry point OpenThread could not be found in KERNEL32.dll. Are you using NT 4? Probably GHC 6.6.1 dropped support for it (or maybe the binary you downloaded was compiled without the support for it), as this error message means more or less your

Re: [Haskell-cafe] Re: bizarre memory usage with data.binary

2007-10-04 Thread Thomas Conway
On 10/4/07, Jules Bean [EMAIL PROTECTED] wrote: ...and indeed it can't be done, except by the naive brute-force method of comparing every subtree, possibly optimised by cryptographically hashing a representation of every subtree, since sharing isn't an observable property. At least one Prolog

Re: [Haskell-cafe] Re: bizarre memory usage with data.binary

2007-10-04 Thread Jules Bean
Thomas Conway wrote: On 10/4/07, Jules Bean [EMAIL PROTECTED] wrote: ...and indeed it can't be done, except by the naive brute-force method of comparing every subtree, possibly optimised by cryptographically hashing a representation of every subtree, since sharing isn't an observable property.

Re: [Haskell-cafe] Haskell FFI and finalizers

2007-10-04 Thread Jules Bean
Stefan O'Rear wrote: Calling Haskell code from the garbage collector is essentially impossible to do efficiently and correctly. Don't even try it, your sanity is not worth saving 3 lines of C coding. It is a sad thing indeed if that is correct advice. Jules

Re: [Haskell-cafe] Haskell FFI and finalizers

2007-10-04 Thread Maxime Henrion
Stefan O'Rear wrote: On Thu, Oct 04, 2007 at 12:55:41AM +0200, Maxime Henrion wrote: When writing the binding for foo_new(), I need to open a file with fopen() to pass it the FILE *. Then I get a struct foo * that I can easily associate the the foo_destroy() finalizer. However, when

[Haskell-cafe] Re: bizarre memory usage with data.binary

2007-10-04 Thread Aaron Denney
On 2007-10-04, Jules Bean [EMAIL PROTECTED] wrote: Thomas Conway wrote: On 10/4/07, Jules Bean [EMAIL PROTECTED] wrote: ...and indeed it can't be done, except by the naive brute-force method of comparing every subtree, possibly optimised by cryptographically hashing a representation of every

[Haskell-cafe] Re: Space and time leaks

2007-10-04 Thread Aaron Denney
On 2007-10-04, Ronald Guida [EMAIL PROTECTED] wrote: I need some help with space and time leaks. I know of two types of space leak. The first type of leak occurs when a function uses unnecessary stack or heap space. GHCi sum [1..10^6] *** Exception: stack overflow Apparently, the default

[Haskell-cafe] Re: Typechecker to GADT: the full implementation of a typed DSL

2007-10-04 Thread Pasqualino 'Titto' Assini
Oleg, thank you so much for taking the time to provide the example code and the explanation, it really helps. My mental typechecker seems to diverge on the data EQ a b where Refl :: EQ a a bit so I am now reading the typing dynamic typing paper, hoping for further enlightment. If you

Re: [Haskell-cafe] The Exp - Term a problem (again), how to dynamically create (polymorphic) typed terms in Haskell ??

2007-10-04 Thread Pasqualino 'Titto' Assini
Hello Tomasz, thank you very much for your advice. Just a quick question, why using your own Dyn rather than Data.Dynamic? Regards, titto On Thursday 04 October 2007 08:57:11 Tomasz Zielonka wrote: On 10/4/07, Pasqualino 'Titto' Assini [EMAIL PROTECTED] wrote: It does not seem to

[Haskell-cafe] gtk2hs in Ubuntu Gutsy

2007-10-04 Thread Chad Scherrer
I just installed the beta release for Ubuntu Gutsy, and I noticed that gtk2hs (provided by libghc6-gtk-dev) is still at version 0.9.10.5-1ubuntu1. Worse, it's apparently not installable; when I try I get this message: libghc6-gtk-dev: Depends: ghc6 (6.6+) but 6.6.1-2ubuntu2 is to be installed

[Haskell-cafe] New slogan for haskell.org

2007-10-04 Thread Don Stewart
It was raised at CUFP today that while Python has: Python is a dynamic object-oriented programming language that can be used for many kinds of software development. It offers strong support for integration with other languages and tools, comes with extensive standard libraries,

Re: [Haskell-cafe] Re: Function composition

2007-10-04 Thread Jorge Marques Pelizzoni
Adapting my previous class sample with these ideas, we have: class Multicompose t1 t2 t3 | t1 t2 - t3 where infixr 9 +. (+.)::t1 - t2 - t3 instance Multicompose t1 t2 t3 = Multicompose t1 (a - t2) (a - t3) where (+.) = (.).(+.) instance Multicompose (b - c) (a - b) (a -

Re: [Haskell-cafe] Space and time leaks

2007-10-04 Thread Dan Weston
Ronald Guida wrote: I need some help with space and time leaks. I know of two types of space leak. The first type of leak occurs when a function uses unnecessary stack or heap space. GHCi sum [1..10^6] *** Exception: stack overflow Apparently, the default definition for sum has a space leak.

Re: [Haskell-cafe] GHC doesn't work

2007-10-04 Thread Andrew Coppin
Salvatore Insalaco wrote: 2007/10/3, Andrew Coppin [EMAIL PROTECTED]: The entry point OpenThread could not be found in KERNEL32.dll. Are you using NT 4? Affirmative. Windows NT 4.0 Service Pack 6a. Probably GHC 6.6.1 dropped support for it (or maybe the binary you downloaded was

[Haskell-cafe] Re: Space and time leaks

2007-10-04 Thread Peter Hercek
Ronald Guida wrote: Now for the hard questions. 1. How do I go about detecting space and time leaks? 2. Once I find a leak, how do I fix it? 3. Are there any programming techniques I can use to avoid leaks? I'm hard time to believe I'll write something you do not know but I had similar

[Haskell-cafe] Is this a known problem?

2007-10-04 Thread ok
UltraSPARC II, Solaris 2.10, gcc 4.0.4 (gccfss), Haskell GHC 6.6.1 binary release. Trying to compile a simple file gives me oodles of errors because ghc is generating something that makes gcc generate lots of these: sethi %hi(some register),another register For people unfamiliar with

Re: [Haskell-cafe] Curry and uncurry

2007-10-04 Thread PR Stanley
No, still no idea! I tried curry f where f :: (Num a) = (a, a) - a and it didn't like it. For some reason I'm finding this a little chalenging. Thanks, Paul At 17:03 03/10/2007, you wrote: On 10/3/07, PR Stanley mailto:[EMAIL PROTECTED][EMAIL PROTECTED] wrote: I didn't even know about the curry

Re: [Haskell-cafe] gtk2hs in Ubuntu Gutsy

2007-10-04 Thread Stefan O'Rear
On Thu, Oct 04, 2007 at 09:31:56AM -0700, Chad Scherrer wrote: I just installed the beta release for Ubuntu Gutsy, and I noticed that gtk2hs (provided by libghc6-gtk-dev) is still at version 0.9.10.5-1ubuntu1. Worse, it's apparently not installable; when I try I get this message:

[Haskell-cafe] Re: [Haskell] reading from stdin

2007-10-04 Thread Stefan O'Rear
On Thu, Oct 04, 2007 at 05:46:09PM +0100, Axel Simon wrote: Hi, I'm trying to continuously output data to a file handle while reading single characters from the user to adjust the speed at which things are output. I'm interested to get this to work in Hugs on Windows. I successfully used

Re: [Haskell-cafe] New slogan for haskell.org

2007-10-04 Thread Andrew Wagner
Wasn't this the point of the elevator speech thread a few weeks ago? Saying in 30 seconds why haskell is good and what it can do for you? On 10/4/07, Don Stewart [EMAIL PROTECTED] wrote: It was raised at CUFP today that while Python has: Python is a dynamic object-oriented programming

Re: [Haskell-cafe] Curry and uncurry

2007-10-04 Thread Dan Weston
Here is one trick I have found useful on occasion: Prelude :t let f = undefined :: (Num a) = (a,a) - a in curry f let f = undefined :: (Num a) = (a,a) - a in curry f :: (Num a) = a - a - a undefined (also called bottom) is an element of every type, so if you just need

Re: [Haskell-cafe] The Exp - Term a problem (again), how to dynamically create (polymorphic) typed terms in Haskell ??

2007-10-04 Thread Tomasz Zielonka
On Thu, Oct 04, 2007 at 05:05:23PM +0100, Pasqualino 'Titto' Assini wrote: Hello Tomasz, thank you very much for your advice. Just a quick question, why using your own Dyn rather than Data.Dynamic? Well, it's a bit different from Data.Dynamic. You have a guarantee that (Dyn Term) contains

Re: [Haskell-cafe] New slogan for haskell.org

2007-10-04 Thread Stefan O'Rear
On Thu, Oct 04, 2007 at 10:36:40AM -0700, Don Stewart wrote: The Haskell website has the rather strange motivational text: Haskell is a general purpose, purely functional programming language featuring static typing, higher order functions, polymorphism, type classes, and monadic

Re: [Haskell-cafe] New slogan for haskell.org

2007-10-04 Thread Don Stewart
Yep, its similar to the elevator pitch, but a little shorter, and mentions why as a programmer this is worth your time. I'm not sure monadic effects is terribly motivating for someone who's heard about Haskell, and just wants to get things done faster, and more reliably -- which is really what

Re: [Haskell-cafe] New slogan for haskell.org

2007-10-04 Thread Tim Chevalier
On 10/4/07, Don Stewart [EMAIL PROTECTED] wrote: It was raised at CUFP today that while Python has: Python is a dynamic object-oriented programming language that can be used for many kinds of software development. It offers strong support for integration with other languages and

Re: [Haskell-cafe] New slogan for haskell.org

2007-10-04 Thread Don Stewart
catamorphism: On 10/4/07, Don Stewart [EMAIL PROTECTED] wrote: It was raised at CUFP today that while Python has: Python is a dynamic object-oriented programming language that can be used for many kinds of software development. It offers strong support for integration with