Re: [Haskell-cafe] signals lib

2007-09-27 Thread Bryan O'Sullivan
brad clawsie wrote: does System.POSIX.Signals bind to OS specific real-time POSIX signal apis? (i.e., kqueue on freebsd). No, just the usual portable signals. http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] signals lib

2007-09-27 Thread brad clawsie
does System.POSIX.Signals bind to OS specific real-time POSIX signal apis? (i.e., kqueue on freebsd). ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] 'data' syntax - a suggestion

2007-09-27 Thread ok
On 28 Sep 2007, at 10:01 am, Thomas Conway wrote: data Tree key val = Leaf key val | Node BST key val BST where type BST = Tree key val data RelaxedTree key val = Leaf Bal [(key,val)] | Node Bal [(key,RelaxedTree key val)] where data Bal = Balanced | Unbalanced

Re: [Haskell-cafe] int to bin, bin to int

2007-09-27 Thread Dan Weston
I might be inclined to use data Bin = Zero | One (or at least type Bin = Bool) to let the type system guarantee that you'll only ever have binary digits in your [Bin], not any old integer. Using [Int] is an abstraction leak, inviting people to abuse the representation behind your back. Rodri

Re: [Haskell-cafe] Postdoctoral Fellowship in Functional Programming

2007-09-27 Thread Christopher Milton
--- Iain Lane <[EMAIL PROTECTED]> wrote: > Bryan Burgers wrote: > > On 9/26/07, Graham Hutton <[EMAIL PROTECTED]> wrote: > > > >> Salary will be within the range 25,134 - 32,796 pounds per year, > >> depending on qualifications and experience. The post is available > >> immediately, and

Re: [Haskell-cafe] int to bin, bin to int

2007-09-27 Thread Rodrigo Queiro
If you don't like explicit recursion (or points): intToBin = map (`mod` 2) . takeWhile (>0) . iterate (`div` 2) binToInt = foldl' (\n d -> n*2+d) 0 or even: binToInt = foldl' ((+).(*2)) 0 On 27/09/2007, PR Stanley <[EMAIL PROTECTED]> wrote: > Hi > intToBin :: Int -> [Int] > intToBin 1 = [1] > in

Re: [Haskell-cafe] Postdoctoral Fellowship in Functional Programming

2007-09-27 Thread Iain Lane
Bryan Burgers wrote: On 9/26/07, Graham Hutton <[EMAIL PROTECTED]> wrote: Salary will be within the range 25,134 - 32,796 pounds per year, depending on qualifications and experience. The post is available immediately, and will be offered on a fixed-term contract for 3 years. I don'

Re: [Haskell-cafe] int to bin, bin to int

2007-09-27 Thread Christopher L Conway
On 9/27/07, PR Stanley <[EMAIL PROTECTED]> wrote: > Hi > intToBin :: Int -> [Int] > intToBin 1 = [1] > intToBin n = (intToBin (n`div`2)) ++ [n `mod` 2] > > binToInt :: [Integer] -> Integer > binToInt [] = 0 > binToInt (x:xs) = (x*2^(length xs)) + (binToInt xs) > Any comments and/or criticisms on th

Re: [Haskell-cafe] 'data' syntax - a suggestion

2007-09-27 Thread Dan Weston
Thomas Conway wrote: Although Richard's proposal was simpler, I reckon it's worth discussing whether the where clause should allow normal type/data/newtype declarations, effectively introducing a new scope. There are obviously some type variable quantification and name resolution issues that shou

Re: [Haskell-cafe] int to bin, bin to int

2007-09-27 Thread Don Stewart
prstanley: > Hi > intToBin :: Int -> [Int] > intToBin 1 = [1] > intToBin n = (intToBin (n`div`2)) ++ [n `mod` 2] > > binToInt :: [Integer] -> Integer > binToInt [] = 0 > binToInt (x:xs) = (x*2^(length xs)) + (binToInt xs) > Any comments and/or criticisms on the above definitions would be > appre

Re: [Haskell-cafe] Packages and "how to load them"

2007-09-27 Thread Stefan O'Rear
On Thu, Sep 27, 2007 at 06:10:37PM -0400, bbrown wrote: > If I have a set of haskell code and I create a directory with the source that > has the following imports. > > (some_dir/MyLib.hs) > module MyLib where > > And then I want to use that set of code at the top level directory, eg: > > MyTes

[Haskell-cafe] Packages and "how to load them"

2007-09-27 Thread bbrown
If I have a set of haskell code and I create a directory with the source that has the following imports. (some_dir/MyLib.hs) module MyLib where And then I want to use that set of code at the top level directory, eg: MyTest.hs import MyLib How would I compile with ghc such that it loads the co

[Haskell-cafe] int to bin, bin to int

2007-09-27 Thread PR Stanley
Hi intToBin :: Int -> [Int] intToBin 1 = [1] intToBin n = (intToBin (n`div`2)) ++ [n `mod` 2] binToInt :: [Integer] -> Integer binToInt [] = 0 binToInt (x:xs) = (x*2^(length xs)) + (binToInt xs) Any comments and/or criticisms on the above definitions would be appreciated. Thanks , Paul _

Re: [Haskell-cafe] 'data' syntax - a suggestion

2007-09-27 Thread Thomas Conway
On 9/28/07, David Menendez <[EMAIL PROTECTED]> wrote: > I'm not sure there is a clash. > > data B k v where ... > > is easily distinguished from > > data B k v = ... where ... Indeed. Although Richard's proposal was simpler, I reckon it's worth discussing whether the where clause should allow nor

Re: [Haskell-cafe] 'data' syntax - a suggestion

2007-09-27 Thread David Menendez
On 9/27/07, Albert Y. C. Lai <[EMAIL PROTECTED]> wrote: > > [EMAIL PROTECTED] wrote: > > Data with where? > > You haven't heard about GADTs? > > To avoid clashing with GADT's "where", I propose to rename ok's keyword > to "wherein", or "wheretype", or something > > data B k v = E | F b b wherein ty

Re: [Haskell-cafe] Praise for xmonad :-)

2007-09-27 Thread Don Stewart
mail: > Hi, > > > Am Donnerstag, den 27.09.2007, 21:53 +0100 schrieb Magnus Therning: > > Seems xmonad is feeling the love. The attached mail turned up on the > > debian-user mailing list. It's high time xmonad gets packaged for > > Debian! > > note that there is an Intend To Package filed: >

Re: [Haskell-cafe] Praise for xmonad :-)

2007-09-27 Thread Joachim Breitner
Hi, Am Donnerstag, den 27.09.2007, 21:53 +0100 schrieb Magnus Therning: > Seems xmonad is feeling the love. The attached mail turned up on the > debian-user mailing list. It's high time xmonad gets packaged for > Debian! note that there is an Intend To Package filed: http://bugs.debian.org/cgi

Re: [Haskell-cafe] Praise for xmonad :-)

2007-09-27 Thread Don Stewart
Nice spot, Magnus. We at xmonad.org aim to please :) People might be also interested in a bit of an experience report on developing xmonad (and running an open source Haskell project) I gave at Galois a couple of weeks ago: http://galois.com/~dons/talks/xmonad-galois-0907.pdf Finally, while

[Haskell-cafe] Re: isWHNF :: a -> IO Bool ?

2007-09-27 Thread apfelmus
Tristan Allwood wrote: Does anyone know if there is a function that tells you if a haskell value has been forced or not? e.g. isWHNF :: a -> IO Bool apfelmus wrote: Note that this function [isWHNF :: a -> Bool] is not referentially transparent Indeed. Does it still mess up with the result

[Haskell-cafe] Praise for xmonad :-)

2007-09-27 Thread Magnus Therning
Seems xmonad is feeling the love. The attached mail turned up on the debian-user mailing list. It's high time xmonad gets packaged for Debian! /M -- Magnus Therning (OpenPGP: 0xAB4DFBA4) magnus@therning.org Jabber: magnus.therning@gmail.com http://therni

[Haskell-cafe] Re: PROPOSAL: New efficient Unicode string library.

2007-09-27 Thread Aaron Denney
On 2007-09-27, Duncan Coutts <[EMAIL PROTECTED]> wrote: > In message <[EMAIL PROTECTED]> [EMAIL PROTECTED] writes: >> On 2007-09-27, Deborah Goldsmith <[EMAIL PROTECTED]> wrote: >> > On Sep 26, 2007, at 11:06 AM, Aaron Denney wrote: >> >>> UTF-16 has no advantage over UTF-8 in this respect, because

[Haskell-cafe] Opengl and Haskell GLdouble/GLfloat vs. Double/Float

2007-09-27 Thread bbrown
I am going to be doing a lot of opengl stuff in haskell and so far one thing has irked me. Why does haskell keep the GLFloat and GL types and not just the Haskell types. -- Berlin Brown [berlin dot brown at gmail dot com] http://botspiritcompany.com/botlist/?

Re: [Haskell-cafe] 'data' syntax - a suggestion

2007-09-27 Thread Albert Y. C. Lai
[EMAIL PROTECTED] wrote: Data with where? You haven't heard about GADTs? To avoid clashing with GADT's "where", I propose to rename ok's keyword to "wherein", or "wheretype", or something data B k v = E | F b b wherein type b = B k v data B k v = E | F b b wheretype b = B k v (I also propo

[Haskell-cafe] Re: PROPOSAL: New efficient Unicode string library.

2007-09-27 Thread Aaron Denney
On 2007-09-27, Aaron Denney <[EMAIL PROTECTED]> wrote: > On 2007-09-27, Deborah Goldsmith <[EMAIL PROTECTED]> wrote: >> On Sep 26, 2007, at 11:06 AM, Aaron Denney wrote: UTF-16 has no advantage over UTF-8 in this respect, because of surrogate pairs and combining characters. >>> >>>

Re: [Haskell-cafe] Re: PROPOSAL: New efficient Unicode string library.

2007-09-27 Thread Duncan Coutts
In message <[EMAIL PROTECTED]> Tony Finch <[EMAIL PROTECTED]> writes: > On Thu, 27 Sep 2007, Ross Paterson wrote: > > > > Combining characters are not an issue here, just the surrogate pairs, > > because we're discussing representations of sequences of Chars (Unicode > > code points). > > I dislik

Re: [Haskell-cafe] Data types and field labels and "Show"

2007-09-27 Thread bbrown
On Thu, 27 Sep 2007 11:41:00 -0700, Don Stewart wrote > bbrown: > > I am trying to print the data from a data type and also get the field > > values. How would I reference those values if I am declaring a Show function. > > > > I should probably use a class for this, but so far it is working. >

Re: [Haskell-cafe] Data types and field labels and "Show"

2007-09-27 Thread Don Stewart
bbrown: > I am trying to print the data from a data type and also get the field > values. How would I reference those values if I am declaring a Show function. > > I should probably use a class for this, but so far it is working. > > I have something along the lines of this. > > data SimplePla

Re: [Haskell-cafe] Re: PROPOSAL: New efficient Unicode string library.

2007-09-27 Thread Tony Finch
On Thu, 27 Sep 2007, Ross Paterson wrote: > > Combining characters are not an issue here, just the surrogate pairs, > because we're discussing representations of sequences of Chars (Unicode > code points). I dislike referring to unicode code points as "characters" because that tends to imply a lot

Re: [Haskell-cafe] Data types and field labels and "Show"

2007-09-27 Thread Brandon S. Allbery KF8NH
On Sep 27, 2007, at 14:14 , bbrown wrote: instance Show SimplePlayer where show a = " posX [" ++ show a{posX} ++ "]" instance Show SimplePlayer where show a = " posX [" ++ show (posX a) ++ "]" You might also want to consider deriving(Show). -- brandon s. allbery [solaris,freebsd,p

[Haskell-cafe] Data types and field labels and "Show"

2007-09-27 Thread bbrown
I am trying to print the data from a data type and also get the field values. How would I reference those values if I am declaring a Show function. I should probably use a class for this, but so far it is working. I have something along the lines of this. data SimplePlayer = SimplePlayer {

Re: [Haskell-cafe] Re: isWHNF :: a -> IO Bool ?

2007-09-27 Thread Jonathan Cast
On Thu, 2007-09-27 at 16:57 +0100, Tristan Allwood wrote: > On Thu, Sep 27, 2007 at 05:31:51PM +0200, apfelmus wrote: > > Tristan Allwood wrote: > >> Does anyone know if there is a function that tells you if a haskell > >> value has been forced or not? e.g. isWHNF :: a -> IO Bool let x = > >> (map

[Haskell-cafe] Re: isWHNF :: a -> IO Bool ?

2007-09-27 Thread Jon Fairbairn
apfelmus <[EMAIL PROTECTED]> writes: > Tristan Allwood wrote: >> Does anyone know if there is a function that tells you if a haskell >> value has been forced or not? >> >> e.g. isWHNF :: a -> IO Bool >> >> let x = (map succ [0..]) in do >> putStrLn . show (isWHNF x)-- False >>

Re: [Haskell-cafe] Re: isWHNF :: a -> IO Bool ?

2007-09-27 Thread Tristan Allwood
On Thu, Sep 27, 2007 at 05:31:51PM +0200, apfelmus wrote: > Tristan Allwood wrote: >> Does anyone know if there is a function that tells you if a haskell >> value has been forced or not? e.g. isWHNF :: a -> IO Bool let x = >> (map succ [0..]) in do putStrLn . show (isWHNF x)-- >> F

[Haskell-cafe] Re: isWHNF :: a -> IO Bool ?

2007-09-27 Thread apfelmus
Tristan Allwood wrote: Does anyone know if there is a function that tells you if a haskell value has been forced or not? e.g. isWHNF :: a -> IO Bool let x = (map succ [0..]) in do putStrLn . show (isWHNF x)-- False putStrLn . show . head $ x putStrLn . show (isWHNF x)

Re: [Haskell-cafe] isWHNF :: a -> IO Bool ?

2007-09-27 Thread Pepe Iborra
Very cool. This is much nicer than when I asked much the same question a few years back (and I can think of all sorts of interesting things I can learn from the interface in that module). But what about indirection chasing? Surely we want isWHNF to return True if we have an indirection t

Re: [Haskell-cafe] isWHNF :: a -> IO Bool ?

2007-09-27 Thread Jan-Willem Maessen
On Sep 27, 2007, at 9:14 AM, Pepe Iborra wrote: Actually, in 6.8 we can build isWHNF on top of the GHC-API. First, you need to import the ghc package: ghci -package ghc GHCi, version 6.7: http://www.haskell.org/ghc/ :? for help Then, you can define the isWHNF function as follows: Prelud

Re: [Haskell-cafe] Desugaring of infix operators is (always?) the wrong way round

2007-09-27 Thread Brian Hulley
Sam Hughes wrote: Brian Hulley wrote: ... For example, with the prefix definition of a function with multiple clauses, the function name at the start of each clause is already lined up since it must appear at the margin of the current layout block ... Or you could have everything be backwar

Re: [Haskell-cafe] isWHNF :: a -> IO Bool ?

2007-09-27 Thread Pepe Iborra
Actually, in 6.8 we can build isWHNF on top of the GHC-API. First, you need to import the ghc package: ghci -package ghc GHCi, version 6.7: http://www.haskell.org/ghc/ :? for help Then, you can define the isWHNF function as follows: Prelude> :m +RtClosureInspect Prelude RtClosureInspect> l

Re: [Haskell-cafe] 'data' syntax - a suggestion

2007-09-27 Thread Isaac Dupree
Tomasz Zielonka wrote: On 9/27/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: Thomas Conway writes: On 9/27/07, ok <[EMAIL PROTECTED]> wrote: I have often found myself wishing for a small extension to the syntax of Haskell 'data' declarations. It goes like this: ['where' clause to all

Re: [Haskell-cafe] isWHNF :: a -> IO Bool ?

2007-09-27 Thread Bernie Pope
Hi Tristan, I've implemented it for earlier versions of GHC, by calling some C code which then peeps at the internal representation of a value. From memory, I needed to pass a stable pointer to the value to the C code, so that it can be polymorphic, without having to make it a primitive i

[Haskell-cafe] isWHNF :: a -> IO Bool ?

2007-09-27 Thread Tristan Allwood
Hi, Does anyone know if there is a function that tells you if a haskell value has been forced or not? e.g. isWHNF :: a -> IO Bool let x = (map succ [0..]) in do putStrLn . show (isWHNF x)-- False putStrLn . show . head $ x putStrLn . show (isWHNF x)-- True

Re: [Haskell-cafe] Re: PROPOSAL: New efficient Unicode string library.

2007-09-27 Thread Johan Tibell
> Well, if you never heard anyone complaining about [Char] and never had > any problem with it's slowness, you're probably not in a field where > the efficiency of a Unicode library is really a concern, that's for > sure. (I know that the _main_ problem with [Char] wasn't random > access, but you m

Re: [Haskell-cafe] 'data' syntax - a suggestion

2007-09-27 Thread Tomasz Zielonka
On 9/27/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Thomas Conway writes: > > > On 9/27/07, ok <[EMAIL PROTECTED]> wrote: > >> I have often found myself wishing for a small extension to the syntax of > >> Haskell 'data' declarations. It goes like this: > > ['where' clause to allow loc

Re: [Haskell-cafe] Re: PROPOSAL: New efficient Unicode string library.

2007-09-27 Thread Chaddaï Fouché
2007/9/27, Duncan Coutts <[EMAIL PROTECTED]>: > > Infrequent, but they exist, which means you can't seek x/2 bytes ahead > > to seek x characters ahead. All such seeking must be linear for both > > UTF-16 *and* UTF-8. > > And in [Char] for all these years, yet I don't hear people complaining. Most

Re: [Haskell-cafe] unsafePerformIO: are we safe?

2007-09-27 Thread Adrian Hey
Chaddaï Fouché wrote: 2007/9/26, Adrian Hey <[EMAIL PROTECTED]>: Chaddaï Fouché wrote: There can't be alternatives, unsafeIO throw by the window most guarantee that Haskell can give you and you have to provide them yourself (with a proof of this part of your program), but it's inherent to the n

Re: [Haskell-cafe] Re: PROPOSAL: New efficient Unicode string library.

2007-09-27 Thread Duncan Coutts
In message <[EMAIL PROTECTED]> [EMAIL PROTECTED] writes: > On 2007-09-27, Deborah Goldsmith <[EMAIL PROTECTED]> wrote: > > On Sep 26, 2007, at 11:06 AM, Aaron Denney wrote: > >>> UTF-16 has no advantage over UTF-8 in this respect, because of > >>> surrogate > >>> pairs and combining characters. >

Re: [Haskell-cafe] 'data' syntax - a suggestion

2007-09-27 Thread jerzy . karczmarczuk
Thomas Conway writes: On 9/27/07, ok <[EMAIL PROTECTED]> wrote: I have often found myself wishing for a small extension to the syntax of Haskell 'data' declarations. It goes like this: ['where' clause to allow locally defined names in type declarations] Nice. Quite a few times I've

Re: [Haskell-cafe] 'data' syntax - a suggestion

2007-09-27 Thread Thomas Conway
On 9/27/07, ok <[EMAIL PROTECTED]> wrote: > I have often found myself wishing for a small extension to the syntax of > Haskell 'data' declarations. It goes like this: ['where' clause to allow locally defined names in type declarations] Nice. Quite a few times I've found myself declaring type

Re: [Haskell-cafe] distghc possible?

2007-09-27 Thread Victor Nazarov
> i am a newbie in haskell. > i have read about the tool distcc, http://distcc.samba.org/. > so i was wondering, does something like this already exist for > haskell? > would it be possible to implement a similar tool based on ghc for > haskell or does this not make sense as a haskell program has t

[Haskell-cafe] Re: PROPOSAL: New efficient Unicode string library.

2007-09-27 Thread Aaron Denney
On 2007-09-27, Ross Paterson <[EMAIL PROTECTED]> wrote: > On Thu, Sep 27, 2007 at 07:26:07AM +, Aaron Denney wrote: >> On 2007-09-27, Ross Paterson <[EMAIL PROTECTED]> wrote: >> > Combining characters are not an issue here, just the surrogate pairs, >> > because we're discussing representations

Re: [Haskell-cafe] PROPOSAL: New efficient Unicode string library.

2007-09-27 Thread Juanma Barranquero
On 9/27/07, ok <[EMAIL PROTECTED]> wrote: > (What the heck _is_ Tangut, anyway?) http://en.wikipedia.org/wiki/Tangut_language Juanma ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-caf

[Haskell-cafe] distghc possible?

2007-09-27 Thread wp
hi, i am a newbie in haskell. i have read about the tool distcc, http://distcc.samba.org/. so i was wondering, does something like this already exist for haskell? would it be possible to implement a similar tool based on ghc for haskell or does this not make sense as a haskell program has to be co

Re: [Haskell-cafe] Re: PROPOSAL: New efficient Unicode string library.

2007-09-27 Thread Ross Paterson
On Thu, Sep 27, 2007 at 06:39:24AM +, Aaron Denney wrote: > On 2007-09-27, Deborah Goldsmith <[EMAIL PROTECTED]> wrote: > > Well, not so much. As Duncan mentioned, it's a matter of what the most > > common case is. UTF-16 is effectively fixed-width for the majority of > > text in the majori

Re: [Haskell-cafe] Re: PROPOSAL: New efficient Unicode string library.

2007-09-27 Thread Ross Paterson
On Thu, Sep 27, 2007 at 07:26:07AM +, Aaron Denney wrote: > On 2007-09-27, Ross Paterson <[EMAIL PROTECTED]> wrote: > > Combining characters are not an issue here, just the surrogate pairs, > > because we're discussing representations of sequences of Chars (Unicode > > code points). > > You'll

[Haskell-cafe] Re: PROPOSAL: New efficient Unicode string library.

2007-09-27 Thread Aaron Denney
On 2007-09-27, Ross Paterson <[EMAIL PROTECTED]> wrote: > Combining characters are not an issue here, just the surrogate pairs, > because we're discussing representations of sequences of Chars (Unicode > code points). You'll never want to combine combining characters or vice-versa? Never want to