Re: [Haskell-cafe] Why the Prelude must die

2007-03-23 Thread Chris Eidhof
Given all these issues, I consider the only reasonable option is to discard the Prelude entirely. There will be no magic modules. Everything will be an ordinary library. HOFs like (.) are available from Control.Function. List ops come from Data.List. Any general abstractions can be added in ab

Re: [Haskell-cafe] Why the Prelude must die

2007-03-23 Thread Donald Bruce Stewart
stefanor: > This is a ranty request for comments, and the more replies the better. Use -fno-implicit-prelude and roll your own Prelude. Stick it on hackage and everyone can use it. -- Don ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www

[Haskell-cafe] Why the Prelude must die

2007-03-23 Thread Stefan O'Rear
This is a ranty request for comments, and the more replies the better. 1. Namespace pollution The Prelude uses many simple and obvious names. Most programs don't use the whole Prelude, so names that aren't needed take up namespace with no benefit. 2. Monomorphism The Prelude defines many data

[Haskell-cafe] Re: Bouncing ball in Gtk2Hs

2007-03-23 Thread Duncan Coutts
On Fri, 2007-03-23 at 20:24 +0300, Thach Si Lam wrote: > I'm trying to write Bouncing Ball demo in Gtk2hs. But i coudn't find > timer class (like in wxhaskell demo) in Gtk2hs. There is timeoutAdd: http://haskell.org/gtk2hs/docs/gtk2hs-docs-0.9.10/System-Glib-MainLoop.html#v%3AtimeoutAdd used li

[Haskell-cafe] Re: Rank-2-polymorphism problem

2007-03-23 Thread Martin Huschenbett
Hi again, the solutions/proposals of Ian and Iavor seem to be exactly what I need at a first glance. But looking at them more in detail reveals some other problems. I also have got a function > getFieldValueMB :: SqlBind s => Statement -> String -> Maybe s To get Ians approach working I wou

[Haskell-cafe] Can we do better than duplicate APIs? [was: Data.CompactString 0.3]

2007-03-23 Thread Benjamin Franksen
[sorry for the somewhat longer rant, you may want to skip to the more technical questions at the end of the post] Twan van Laarhoven wrote: > I would like to announce version 0.3 of my Data.CompactString library. > Data.CompactString is a wrapper around Data.ByteString that represents a > Unicod

Re: [Haskell-cafe] AI Strike Force!

2007-03-23 Thread Andrzej Jaworski
Hi Andrew and all the involved, The idea is great. It will allow programming with a rewording feeling of depth to the exercise right from the start. However tackling some of the topics you mentioned, like GA, one first needs to develop new solid programming techniques that would circumvent Haskell

Re: [Haskell-cafe] Application of iterate

2007-03-23 Thread John Meacham
On Fri, Mar 23, 2007 at 01:04:47PM +0200, Logesh Pillay wrote: > my_sqrt t = last (take 20 (iterate (\n -> n/2 + t/(2 * n)) t)) > > It is a bit crude though. 20 iterations is a bit arbitrary. I don't suppose > there is a easy way to iterate until the results stop changing. > perhaps > sqrt t =

Re: [Haskell-cafe] AI Strike Force!

2007-03-23 Thread Andrzej Jaworski
Hi Andrew and all the involved, The idea is great. It will allow programming with a rewording feeling of depth to the exercise right from the start. However tackling some of the topics you mentioned, like GA, one first needs to develop new solid programming techniques that would circumvent Haskell

Re: [Haskell-cafe] Re: Rank-2-polymorphism problem

2007-03-23 Thread Iavor Diatchki
Hello, What Ian suggested is a very GHC 6.6 specific solution that uses much more that simply rank-2 types. Here is another solution that uses just rank-2 types (and, by the way, all type signatures are optional, as in ordinary Haskell): module Value where class SqlBind a where fromSqlValue ::

[Haskell-cafe] Re: Rank-2-polymorphism problem

2007-03-23 Thread Martin Huschenbett
Ian Lynagh schrieb: readValue' :: Field -> Maybe (forall s. SqlBind s => s) -> Value readValue' fld s = if isJust s then readValue fld (fromJust s) else emptyValue fld Thank you very much, that's exactly what I wanted. After reading in the GHC users guide about rank 2 polymorphism I thoug

Re: [Haskell-cafe] Rank-2-polymorphism problem

2007-03-23 Thread Ian Lynagh
On Fri, Mar 23, 2007 at 02:18:50PM +0100, Martin Huschenbett wrote: > > -- The type I want to get. > readValue' :: Field -> (forall s. SqlBind s => Maybe s) -> Value > > -- First trial: > readValue' fld s = > if isJust s then readValue fld (fromJust s) else emptyValue fld Is there a reason you

Re: [Haskell-cafe] Application of iterate

2007-03-23 Thread Neil Mitchell
Hi ? Of course, I would like to get indexed in haskell.org/hoogle - but how to do that? Wait for Hoogle 4, sadly. Once thats done, by adding your package to hackage you'll be indexed by Hoogle. Thanks Neil ___ Haskell-Cafe mailing list Haskell-Ca

Re: [Haskell-cafe] Application of iterate

2007-03-23 Thread Henning Thielemann
On Fri, 23 Mar 2007, Vincent Kraeutler wrote: > as a fellow haskell newbie, i would like to take this opportunity to > encourage library authors to submit their material to the haskell hackage. > > the haskell infrastructure is rather big, complex and "organic". (see > e.g. http://darcs.haskell.o

Re: [Haskell-cafe] Application of iterate

2007-03-23 Thread Vincent Kraeutler
Henning Thielemann wrote: > On Fri, 23 Mar 2007, Neil Mitchell wrote: > > >>> my_sqrt t = last (take 20 (iterate (\n -> n/2 + t/(2 * n)) t)) >>> > > http://darcs.haskell.org/htam/src/Numerics/ZeroFinder/Newton.hs > > with > inverse t (\x->(x^2,2*x)) t > > >> >> I don't know how to ad

Re: [Haskell-cafe] AI Strike Force!

2007-03-23 Thread Andrew Wagner
Sure, it's added! On 3/23/07, Henning Thielemann <[EMAIL PROTECTED]> wrote: On Fri, 23 Mar 2007, Andrew Wagner wrote: > The time has come! Calling all Haskell programmers interested in AI! > I've established a new home base at > http://www.haskell.org/haskellwiki/AI . Functional programming ha

Re: [Haskell-cafe] AI Strike Force!

2007-03-23 Thread Henning Thielemann
On Fri, 23 Mar 2007, Andrew Wagner wrote: > The time has come! Calling all Haskell programmers interested in AI! > I've established a new home base at > http://www.haskell.org/haskellwiki/AI . Functional programming has > long been recognized as an excellent paradigm for Artificial > Intelligence

[Haskell-cafe] AI Strike Force!

2007-03-23 Thread Andrew Wagner
The time has come! Calling all Haskell programmers interested in AI! I've established a new home base at http://www.haskell.org/haskellwiki/AI . Functional programming has long been recognized as an excellent paradigm for Artificial Intelligence. It's time to make Haskell an important language in

Re: [Haskell-cafe] Application of iterate

2007-03-23 Thread Henning Thielemann
On Fri, 23 Mar 2007, Neil Mitchell wrote: > Hi Longesh > > > But I've found learning Haskell so tough (this is my 4th try in the last > > two years) that I feel I have to bore everyone with my first non-trivial > > program. > > Well done on getting something going! > > > my_sqrt t = last (take 20

[Haskell-cafe] Last chance to join the Summer of Code!

2007-03-23 Thread Malcolm Wallace
Haskell.org is currently looking rather short of student proposals for Summer of Code 2007 compared to last year. If you haven't yet thought about submitting an application, why not consider it now? You could be paid $4500 for three months work June-Aug! Apparently, the more proposals we get, th

Re: [Haskell-cafe] ghc warning "Var/Type length mismatch"

2007-03-23 Thread Bulat Ziganshin
Hello Nicolas, Friday, March 23, 2007, 1:44:00 AM, you wrote: > Glasgow Haskell Compiler, Version 6.7.20070214, for Haskell 98, > compiled by GHC version 6.7.20070214 are you really need to use this beta version? 6.6 is last stable one, if you will go to download it, i recommend you to get lates

[Haskell-cafe] Rank-2-polymorphism problem

2007-03-23 Thread Martin Huschenbett
Hi, I'm writing some database code using HSQL and had to stop on a problem with rank-2-polymorphism that I can't solve. The essence of my code is: module Value where import Data.Maybe class SqlBind a where fromSqlValue :: String -> a data Field data Value emptyValue :: Field -> Value em

RE: [Haskell-cafe] Application of iterate

2007-03-23 Thread Bernie Pope
> It is :- > > my_sqrt t = last (take 20 (iterate (\n -> n/2 + t/(2 * n)) t)) > > It is a bit crude though. 20 iterations is a bit arbitrary. I don't > suppose > there is a easy way to iterate until the results stop changing. Here's something for you to play with: my_sqrt t = fix (\n -> n/2

Re: [Haskell-cafe] Application of iterate

2007-03-23 Thread Neil Mitchell
Hi > I don't know how to add it into the one liner though - although I > suspect someone here will :) head . head . filter (\(x:y:_) -> abs (x-y) < 0.1) Doesn't work, I assume you meant (and typo'd): head . head . filter (\(x:y:_) -> abs (x-y) < 0.1) . tails Which does work fine. Thank

Re: [Haskell-cafe] Application of iterate

2007-03-23 Thread Ketil Malde
Neil Mitchell wrote: close (x:y:xs) | abs (x - y) < 0.1 = y close (x:xs) = close xs I don't know how to add it into the one liner though - although I suspect someone here will :) head . head . filter (\(x:y:_) -> abs (x-y) < 0.1) ? -k ___ Haskell-C

Re: [Haskell-cafe] Application of iterate

2007-03-23 Thread Neil Mitchell
Hi Longesh But I've found learning Haskell so tough (this is my 4th try in the last two years) that I feel I have to bore everyone with my first non-trivial program. Well done on getting something going! my_sqrt t = last (take 20 (iterate (\n -> n/2 + t/(2 * n)) t)) last (take 20) can be r

[Haskell-cafe] Application of iterate

2007-03-23 Thread Logesh Pillay
Ordinarily I would not post to a list when I've got a program running. But I've found learning Haskell so tough (this is my 4th try in the last two years) that I feel I have to bore everyone with my first non-trivial program. It is Newton's method adapted to give the square root of a number.

Re: [Haskell-cafe] type refinement to a typeclass constrained type

2007-03-23 Thread Daniil Elovkov
2007/3/23, Daniil Elovkov <[EMAIL PROTECTED]>: Ok, btw, this works :) data Cnd c where In :: (Eq (c a)) => c a -> [c a] -> Cnd c check :: (Eq (c a)) => Cnd c -> Bool Eq constraint isn't even needed here, obviously check (x `In` items) = x `elem` items __

Re: [Haskell-cafe] type refinement to a typeclass constrained type

2007-03-23 Thread Daniil Elovkov
Ok, btw, this works :) data Cnd c where In :: (Eq (c a)) => c a -> [c a] -> Cnd c check :: (Eq (c a)) => Cnd c -> Bool check (x `In` items) = x `elem` items That's nice :) 2007/3/23, Simon Peyton-Jones <[EMAIL PROTECTED]>: | Interesting thing though, it's the same on 6.4.1. | | Wasn't this

Re: [Haskell-cafe] Duplicate instance declaration

2007-03-23 Thread Bas van Dijk
On 3/22/07, Twan van Laarhoven <[EMAIL PROTECTED]> wrote: ... An alternative idea would be to use data types instead of classes for the registers and memory locations ... A very nice solution. Thanks very much! Bas van Dijk ___ Haskell-Cafe mailing l

RE: [Haskell-cafe] ghc warning "Var/Type length mismatch"

2007-03-23 Thread Simon Peyton-Jones
| Also, is there a better list for this question? I half-heartedly tried | haskell.org's list of mailing lists for an appropriate place for GHC | bugs but didn't find one. Yes, there is a mailing list specifically for ghc bugs http://www.haskell.org/ghc/docs/latest/html/users_guide/introduction-G

RE: [Haskell-cafe] type refinement to a typeclass constrained type

2007-03-23 Thread Simon Peyton-Jones
| Interesting thing though, it's the same on 6.4.1. | | Wasn't this brokenness introduced in 6.6, but rather has lingered in | ghc for a while, or since the introduction of GADTs, at all? No it's always been broken. I finally made GADTs and type classes work together in the HEAD a few months ago