Re: [Haskell-cafe] question about singletons

2013-06-02 Thread TP
Thanks Richard, now I have my answers. Richard Eisenberg wrote: - The type system of Haskell is based on theoretical work that resolutely assumes that types of non-* kind are uninhabited. While it is possible to stretch imagination to allow types like 'Zero to be inhabited, the designers of

[Haskell-cafe] Announce: Leksah 0.13.2.2 (still a bit experimental)

2013-06-02 Thread Hamish Mackenzie
Mostly just a refresh of the current development version binary installers, so people can use it with the latest Haskell Platform (which uses GHC 7.6.3). Unfortunately an official 0.14 release may still be a be a way off. I have been doing some work on getting Code Mirror working, but there are

Re: [Haskell-cafe] Two GHC-related GSoC Proposals

2013-06-02 Thread Boris Lykah
It is not obvious that semantics is preserved for optimisations which remove non-constants like bar a b = a + b - a - b -- the RHS is should be optimized away to 0 Calling bar undefined undefined throws an error, but the optimised bar would return 0. On Sat, Jun 1, 2013 at 8:10 PM, Patrick

Re: [Haskell-cafe] Two GHC-related GSoC Proposals

2013-06-02 Thread Patrick Palka
Right, these optimizations are done on the unboxed level, where bottom is not a concern. GHC would transform bar a b = a + b - a - b to bar (I# a) (I# b) = I# (a +# b -# a -# b) whose RHS could be optimized away to I# 0#. bar is still strict in its two arguments, so calling bar undefined

Re: [Haskell-cafe] [haskell.org Google Summer of Code 2013] Approved Projects

2013-06-02 Thread Dominic Steinitz
Hi Edward, Thanks for this comprehensive answer (and also thanks to participants in the follow-up dissuasion). How is the public good determined? (sounds rather Benthamite). I would have been disappointed if charts using diagrams had not been selected yet I don't recall being canvassed.

Re: [Haskell-cafe] Different answers on different machines

2013-06-02 Thread Gregory Collins
On Sat, Jun 1, 2013 at 7:55 PM, nadine.and.he...@pobox.com wrote: Yesterday I decided to take a look at the most recent Euler problem, number 249, and give it a shot. I have a couple of computers at home, a Dell laptop and a desktop. I compiled this message with ghc -O2 --make ex429.lhs and

[Haskell-cafe] Typeable typeclass and type-level naturals

2013-06-02 Thread TP
Hi all, I try to play with the Typeable typeclass, and I have some difficulties to make it work in this simple case where I use type-level naturals: - {-# LANGUAGE GADTs #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE PolyKinds #-} {-#

Re: [Haskell-cafe] [haskell.org Google Summer of Code 2013] Approved Projects

2013-06-02 Thread Edward Kmett
Public good is a nebulous concept, but it is something that each of the folks who sign up as mentors judges independently when they are rating the projects and talking about them. Most of the folks who are offering to mentor have been involved in the community for quite some time and have a

Re: [Haskell-cafe] Different answers on different machines

2013-06-02 Thread Henry Laxen
Gregory Collins greg at gregorycollins.net writes: On Sat, Jun 1, 2013 at 7:55 PM, nadine.and.henry at pobox.com wrote: Yesterday I decided to take a look at the most recent Euler problem, number 249, and give it a shot.  I have a couple of computers at home, a Dell laptop and a desktop.  

[Haskell-cafe] Int is broken [Was: Different answers on different machines]

2013-06-02 Thread Tommy Thorn
On Jun 2, 2013, at 12:52 , Henry Laxen nadine.and.he...@pobox.com wrote: Yes, that was it. The dell was a 32 bit system, and the desktop a 64. I changed everything from Int to Integer, and now both agree. Thanks for the pointer. Isn't that just terrible? I hate the fact that Haskell was

Re: [Haskell-cafe] Int is broken [Was: Different answers on different machines]

2013-06-02 Thread Tristan Seligmann
On Sun, Jun 2, 2013 at 11:02 PM, Tommy Thorn tt1...@yahoo.com wrote: On Jun 2, 2013, at 12:52 , Henry Laxen nadine.and.he...@pobox.com wrote: Yes, that was it. The dell was a 32 bit system, and the desktop a 64. I changed everything from Int to Integer, and now both agree. Thanks for

Re: [Haskell-cafe] Int is broken [Was: Different answers on different machines]

2013-06-02 Thread Kata
On Sunday, June 2, 2013 at 5:02 PM, Tommy Thorn wrote: On Jun 2, 2013, at 12:52 , Henry Laxen nadine.and.he...@pobox.com (mailto:nadine.and.he...@pobox.com) wrote: Yes, that was it. The dell was a 32 bit system, and the desktop a 64. I changed everything from Int to Integer, and now both

Re: [Haskell-cafe] Int is broken [Was: Different answers on different machines]

2013-06-02 Thread Tommy Thorn
On Jun 2, 2013, at 14:13 , Kata lightqu...@amateurtopologist.com wrote: In addition to Haskell already having an arbitrary-width integer type called Integer But I wasn't asking for arbitrary-width. I was asking for explicit failures (overflow) rather than C-like silent corruption. ,

Re: [Haskell-cafe] Int is broken [Was: Different answers on different machines]

2013-06-02 Thread Stephen Tetley
There was a quite long discussion here: http://conal.net/blog/posts/notions-of-purity-in-haskell On 2 June 2013 22:02, Tommy Thorn tt1...@yahoo.com wrote: ... I wish this fatal flaw would be reconsidered for the next major revision. ___ Haskell-Cafe

Re: [Haskell-cafe] Typeable typeclass and type-level naturals

2013-06-02 Thread Roman Cheplyaka
Try adding deriving instance Typeable 'Zero deriving instance Typeable a = Typeable ('Succ a) to your module. (I haven't tested it — you might need to tweak it a bit.) Roman * TP paratribulati...@free.fr [2013-06-02 18:08:02+0200] Hi all, I try to play with the Typeable typeclass, and

Re: [Haskell-cafe] Int is broken [Was: Different answers on different machines]

2013-06-02 Thread Dan Doel
There is a package that implements an Int that throws an exception on overflow: http://hackage.haskell.org/package/safeint Since Int's existence is pretty much all about trading for performance, I wouldn't recommend holding your breath on the above becoming the default. If you want things

[Haskell-cafe] How to write a pure String to String function in Haskell FFI to C++

2013-06-02 Thread Ting Lei
Hi, I want to implement a function in C++ via Haskell FFI, which should have the (final) type of String - String. Say, is it possible to re-implement the following function in C++ with the exact same signature? import Data.Char toUppers:: String - String toUppers s = map toUpper senter code here

[Haskell-cafe] APLAS 2013 second call for papers

2013-06-02 Thread Chung-chieh Shan
=== APLAS 2013 11th Asian Symposium on Programming Languages and Systems 9-11 December 2013 Melbourne, Australia (colocated with CPP 2013) CALL FOR PAPERS

Re: [Haskell-cafe] How to write a pure String to String function in Haskell FFI to C++

2013-06-02 Thread Brandon Allbery
On Sun, Jun 2, 2013 at 7:22 PM, Ting Lei tin...@gmail.com wrote: In particular, I wanted to avoid having an IO in the return type because introducing the impurity (by that I mean the IO monad) for this simple task is logically unnecessary. All examples involing Anything that comes into or

Re: [Haskell-cafe] How to write a pure String to String function in Haskell FFI to C++

2013-06-02 Thread Thomas Davie
On 2 Jun 2013, at 16:48, Brandon Allbery allber...@gmail.com wrote: On Sun, Jun 2, 2013 at 7:22 PM, Ting Lei tin...@gmail.com wrote: In particular, I wanted to avoid having an IO in the return type because introducing the impurity (by that I mean the IO monad) for this simple task is

Re: [Haskell-cafe] How to write a pure String to String function in Haskell FFI to C++

2013-06-02 Thread Brandon Allbery
On Sun, Jun 2, 2013 at 8:01 PM, Thomas Davie tom.da...@gmail.com wrote: On 2 Jun 2013, at 16:48, Brandon Allbery allber...@gmail.com wrote: (String is a linked list of Char, which is also not a C char; it is a constructor and a machine word large enough to hold a Unicode codepoint. And

Re: [Haskell-cafe] How to write a pure String to String function in Haskell FFI to C++

2013-06-02 Thread Ting Lei
Thanks for your answers so far. It seems that the laziness of String or [char] is the problem. My question boils then down to this. There are plenty of Haskell FFI examples where simple things like sin/cos in math.h can be imported into Haskell as pure functions. Is there a way to extend that to

Re: [Haskell-cafe] How to write a pure String to String function in Haskell FFI to C++

2013-06-02 Thread Chris Wong
The C++/C function (e.g. toUppers) is computation-only and as pure as cos and tan. The fact that marshaling string incurs an IO monad in current examples is kind of unintuitive and like a bug in design. I don't mind making redundant copies under the hood from one type to another.. If you can