Re: [Haskell-cafe] Signature for non-empty filter

2008-02-07 Thread Henning Thielemann
On Wed, 6 Feb 2008, Jonathan Cast wrote: > On 6 Feb 2008, at 1:54 PM, Matthew Pocock wrote: > > > On Wednesday 06 February 2008, Henning Thielemann wrote: > > > >> If the type checker does not terminate because the checked > >> function does > >> not terminate on the example input, then the funct

Re: [Haskell-cafe] Signature for non-empty filter

2008-02-07 Thread Henning Thielemann
On Thu, 7 Feb 2008, Neil Mitchell wrote: > Hi > > > I think what you want to say now is not just > > > > (filter f l) is type correct when there is some argument on which f > > returns true > > > > but > > > > (filter f l) is type correct when there is some *element of l* on > > which f r

Re[4]: [Haskell-cafe] Signature for non-empty filter

2008-02-07 Thread Bulat Ziganshin
Hello Henning, Thursday, February 7, 2008, 12:29:02 AM, you wrote: >> it's impossible to check for *arbitrary* function call whether it will be >> terminated. seems that you don't have formal CS education? :) >> >> so one can develop set of functions that are guaranteed to be >> terminated or gua

Re[2]: [Haskell-cafe] Mutable arrays

2008-02-07 Thread Bulat Ziganshin
Hello Jeff, Thursday, February 7, 2008, 1:31:59 AM, you wrote: > I noticed that > GHC implements mutable arrays in the IO monad.  This seems odd to > me.  Arrays aren't related to IO.  IO monad isn't only about I/O but about imperative stuff in general. there is also special monad limited to mut

Re: [Haskell-cafe] Signature for non-empty filter

2008-02-07 Thread Neil Mitchell
Hi > Indeed, if Catch or ESC or similar tools can handle such specifications it > would be great. However I suspect that the translation you gave is > different from what I wanted. I consider a function buggy, if it > implements 'const' considerably more complicated than just saying 'const'. > :-)

Re: [Haskell-cafe] Re: Implementing fixed-sized vectors (using datatype algebra?)

2008-02-07 Thread Wolfgang Jeltsch
Am Donnerstag, 7. Februar 2008 02:47 schrieb Alfonso Acosta: > > The other library I use for type-level programming is HList. It has > > type-level booleans already so you might what to take a look at it if > > you're not already familiar with it. > > Thanks I'll have a look at it. I have to admit

Re: [Haskell-cafe] Draft chapters of "Real World Haskell" now publicly available

2008-02-07 Thread Wolfgang Jeltsch
Hello Peter, an answer to an “old” e-mail (from January 25). Sorry for not answering earlier. Am Freitag, 25. Januar 2008 00:23 schrieben Sie: > Wolfgang Jeltsch wrote: > > Indeed. A functional approach to GUIs is nice but at the moment we don’t > > have anything that is suitable for solving r

Re: [Haskell-cafe] problem with collection (container) class

2008-02-07 Thread Daniel Fischer
Am Donnerstag, 7. Februar 2008 08:58 schrieb Leandro Demarco Vedelago: > but when I try to load it in WinHugs I get the following error message: > > - Instance is more general than a dependency allows > *** Instance : Container Abb a b > *** For class: Container a b c > *** Under de

Re: [Haskell-cafe] Best practice for embedding files in a GHC-compiled tool?

2008-02-07 Thread Dave Bayer
On Feb 7, 2008, at 12:27 AM, [EMAIL PROTECTED] wrote: Are you assuming that the various users have GHC/Hugs installed? You know about scripting through the 'runhaskell' binary, right? I do, and I've used this. I don't want to do that here. Let me say this again: I am making no assumptions w

Re[2]: [Haskell-cafe] Signature for non-empty filter

2008-02-07 Thread Bulat Ziganshin
Hello Dan, Thursday, February 7, 2008, 4:04:03 AM, you wrote: > I.e., it's not necessary to restrict the class of functions you consider > if you're willing to give up on full automation. So I disagree with the > "only if" below. ok, read this as "computer can ensure...", because it was exactly

Re[2]: [Haskell-cafe] Mutable arrays

2008-02-07 Thread Bulat Ziganshin
Hello Jeff, Thursday, February 7, 2008, 4:17:27 AM, you wrote: > logical place for mutable arrays.  However, I don't understand the > motivation for implementing it in IO.  Were mutable arrays added to > IO because it would be difficult to write code that does both IO and > manipulates arrays ot

Re[2]: [Haskell-cafe] Signature for non-empty filter

2008-02-07 Thread Henning Thielemann
On Thu, 7 Feb 2008, Bulat Ziganshin wrote: > Thursday, February 7, 2008, 4:04:03 AM, you wrote: > > > I.e., it's not necessary to restrict the class of functions you consider > > if you're willing to give up on full automation. So I disagree with the > > "only if" below. > > ok, read this as "co

Re: [Haskell-cafe] background question about IO monad

2008-02-07 Thread Jonathan Cast
On 6 Feb 2008, at 11:32 PM, Uwe Hollerbach wrote: All right, after a bit of dinner and some time to mess about, here's another attempt to check my understanding: here is a simplified version of the lisp-time example: module Main where import System.Time pure_fn :: Integer -> String pure_fn n

Re: [Haskell-cafe] Re: Implementing fixed-sized vectors (using datatype algebra?)

2008-02-07 Thread Alfonso Acosta
Don't expect anything astonishing yet, but an initial version of the library can be found at http:/code.haskell.org/type-level To make reviewing easier I have put the haddock-generated documentation at http://code.haskell.org/~fons/type-level/doc/ Some remarks: * Only Positive and Natural nume

Re: [Haskell-cafe] Haskell maximum stack depth

2008-02-07 Thread Neil Mitchell
Hi > But the point is that *both* heapGobbler and neilGobbler are likely to > be slower and chew through at least twice as much heap as stackGobbler, > which would be the implementation of choice for both simplicity and > performance if it wasn't for this stack management problem. Sure? That soun

Re: [Haskell-cafe] Haskell maximum stack depth

2008-02-07 Thread Adrian Hey
Adrian Hey wrote: AFAICT neilGobbler isn't even entirely safe as an implementation of an eager take. There's nothing the Haskell standard to stop it being transformed into.. neilGobbler :: Int -> [x] -> [x] neilGobbler n xs = length (take n xs) `seq` take n xs Whoops, I see stackGobbler has th

Re: [Haskell-cafe] :i and :t give different types

2008-02-07 Thread Don Stewart
ryani.spam: > It looks like there is a bug with unparsing of bang-constructors in ghci: > > On 2/7/08, Don Stewart <[EMAIL PROTECTED]> wrote: > >data Stream a = forall s. Unlifted s => > > Stream !(s -> Step a s) -- ^ a stepper > > function > >

Re: [Haskell-cafe] :i and :t give different types

2008-02-07 Thread Ryan Ingram
It looks like there is a bug with unparsing of bang-constructors in ghci: On 2/7/08, Don Stewart <[EMAIL PROTECTED]> wrote: >data Stream a = forall s. Unlifted s => > Stream !(s -> Step a s) -- ^ a stepper function > !s

Re: [Haskell-cafe] Mutable arrays

2008-02-07 Thread John Lato
Ok, I've done some testing on different array accessing strategies, and at this point I believe that, as Stefan previously suggested, using an Oleg-inspired fold for access offers the best performance. My first non-unsafe idea was to try: > import Data.Array.MArray > import Data.Array.IO > import

Re: [Haskell-cafe] :i and :t give different types

2008-02-07 Thread Don Stewart
chad.scherrer: > Hello haskell-cafe, > > In ghci, I tried to get info for Data.Stream.Stream: > > $ ghci > GHCi, version 6.8.2: http://www.haskell.org/ghc/ :? for help > Loading package base ... linking ... done. > Prelude> :m Data.Stream > Prelude Data.Stream> :i Stream > data Stream a where >

[Haskell-cafe] :i and :t give different types

2008-02-07 Thread Chad Scherrer
Hello haskell-cafe, In ghci, I tried to get info for Data.Stream.Stream: $ ghci GHCi, version 6.8.2: http://www.haskell.org/ghc/ :? for help Loading package base ... linking ... done. Prelude> :m Data.Stream Prelude Data.Stream> :i Stream data Stream a where Stream :: forall a s. (

Re: [Haskell-cafe] :i and :t give different types

2008-02-07 Thread Chad Scherrer
On Feb 7, 2008 11:57 AM, Don Stewart <[EMAIL PROTECTED]> wrote: > Ah, yes, missing parens! Well spotted. > > So a pretty printer wibble in GHC? > > -- Don Yeah, that was my first concern, but then I noticed the quantification was different, so I'm still working through that one. It was confusing,

Re: [Haskell-cafe] Re: Implementing fixed-sized vectors (using datatype algebra?)

2008-02-07 Thread Alfonso Acosta
On Feb 7, 2008 9:01 PM, Dan Weston <[EMAIL PROTECTED]> wrote: > This may be a GHC bug, but even though in the module > Data.TypeLevel.Num.Reps has the header > > {-# LANGUAGE EmptyDataDecls, TypeOperators #-} > > I still get an error with both ghc and ghci version 6.8.2 unless I throw > in the -XTy

Re: [Haskell-cafe] Re: Implementing fixed-sized vectors (using datatype algebra?)

2008-02-07 Thread Dan Weston
I know that naming is arbitrary, but... Digits in types seems ugly to me. In this case, it is also redundant. Everyone but FORTRAN programmers counts from 0, not 1. Nat and Pos seem clear. Nat0 could even mean Nat \ {0}, the opposite of what is proposed, so confusion is even increased with Nat

Re: [Haskell-cafe] Mutable arrays

2008-02-07 Thread Chaddaï Fouché
2008/2/7, Jeff φ <[EMAIL PROTECTED]>: > I played with your foldl1MArray' last night. I noticed it can be reduced to > . . . > > foldl1MArray' :: (MArray a e m, Ix i) => (e -> e -> e) -> a i e -> m e > foldl1MArray' f a = do > (l,u) <- getBounds a > foldl1' (liftM2 f) (map (readArray a) (r

Re: [Haskell-cafe] Re: Implementing fixed-sized vectors (using datatype algebra?)

2008-02-07 Thread Dan Weston
This may be a GHC bug, but even though in the module Data.TypeLevel.Num.Reps has the header {-# LANGUAGE EmptyDataDecls, TypeOperators #-} I still get an error with both ghc and ghci version 6.8.2 unless I throw in the -XTypeOperators flag. > cat Go.hs import Data.TypeLevel.Num.Reps main = r

Re: [Haskell-cafe] FP and Quality

2008-02-07 Thread Clifford Beshers
ICFP 2007 introduced a new category of paper called an "Experience Report", which is not required to add to the body of research knowledge, but rather report on the effectiveness of functional tools and methods in full-scale projects. You can read the official description in the call for papers: h

Re: [Haskell-cafe] Haskell maximum stack depth

2008-02-07 Thread Adrian Hey
Neil Mitchell wrote: Hi But the point is that *both* heapGobbler and neilGobbler are likely to be slower and chew through at least twice as much heap as stackGobbler, which would be the implementation of choice for both simplicity and performance if it wasn't for this stack management problem.

Re: [Haskell-cafe] Haskell maximum stack depth

2008-02-07 Thread Adrian Hey
Neil Mitchell wrote: Hi I have already partially scanned the list looking for the first element that satisfies some condition, using a tail recursive search. If such an element is found I want to split the list at that point. span/break? I really can't believe the memory overhead of span is

Re: [Haskell-cafe] Re: Implementing fixed-sized vectors (using datatype algebra?)

2008-02-07 Thread Wolfgang Jeltsch
Am Donnerstag, 7. Februar 2008 15:56 schrieben Sie: > Don't expect anything astonishing yet, but an initial version of the > library can be found at > > http:/code.haskell.org/type-level > > To make reviewing easier I have put the haddock-generated documentation at > > http://code.haskell.org/~fons

[Haskell-cafe] question concerning ANSI "void *"

2008-02-07 Thread Galchin Vasili
Hello, Ok .. I am writing a Haskell function that will call down into the ANSI C library .. blah :: -> Ptr Word8 -> The underlying C function that "blah" is calling has a "void *" so I am using "Ptr Word 8" to model the "void *". I propose to have the callers of function "blah"

[Haskell-cafe] Two Lectureships in Nottingham

2008-02-07 Thread Graham Hutton
Dear all, We are advertising two new Lectureships (Assistant Professorships) in Computer Science at the University of Nottingham in England. Applications in the area of functional programming are particularly welcome. Further details are available from: http://jobs.nottingham.ac.uk/vacancies.

RE: [Haskell-cafe] Draft chapters of "Real World Haskell" now publicly available

2008-02-07 Thread Peter Verswyvelen
Interesting. Thanks for the reply. It might be nice to have some performance benchmarks for all these experimental systems, so we can compare them. I could understand that performance might be an issue for games, but for GUIs? I mean many imperative GUI systems use rather slow message dispatchi

Re: [Haskell-cafe] Mutable arrays

2008-02-07 Thread Jeff φ
On Feb 2, 2008 12:11 PM, Chaddaï Fouché <[EMAIL PROTECTED]> wrote: > To address this I propose this function : > foldl1MArray' :: (MArray a e m, Ix i) => (e -> e -> e) -> a i e -> m e > foldl1MArray' f a = do > (l,u) <- getBounds a > firstElem <- readArray a l > foldM (\a mb -> a `seq` mb >>= r

[Haskell-cafe] User groups meeting all over the world

2008-02-07 Thread Don Stewart
The community might be interested to know that there are (at least) 7 Haskell/FP user groups meeting across the world in the next two weeks! FringeDCWashington DC/USAFebruary 9 PDXFunc Portland/USA February 11 Fun in

Re: [Haskell-cafe] Re: Implementing fixed-sized vectors (using datatype algebra?)

2008-02-07 Thread Alfonso Acosta
On Feb 7, 2008 4:16 PM, Wolfgang Jeltsch <[EMAIL PROTECTED]> wrote: > Nat means "all natural numbers except zero" while Nat0 means "all natural > numbers (including zero)". Since in computer science, natural numbers > usually cover zero, we should use Pos instead of Nat and Nat instead of Nat0. S

Re: [Haskell-cafe] Signature for non-empty filter

2008-02-07 Thread Jonathan Cast
On 7 Feb 2008, at 12:07 AM, Henning Thielemann wrote: On Wed, 6 Feb 2008, Jonathan Cast wrote: On 6 Feb 2008, at 1:54 PM, Matthew Pocock wrote: On Wednesday 06 February 2008, Henning Thielemann wrote: If the type checker does not terminate because the checked function does not terminate o

Re[3]: [Haskell-cafe] Signature for non-empty filter

2008-02-07 Thread Bulat Ziganshin
Hello Henning, Thursday, February 7, 2008, 4:27:30 PM, you wrote: >> ok, read this as "computer can ensure...", because it was exactly the >> original question - "can computer check that any given function in >> turing-complete language is non-trivial?" > My original question according to > > h

Re: [Haskell-cafe] background question about IO monad

2008-02-07 Thread Ryan Ingram
On 2/6/08, Uwe Hollerbach <[EMAIL PROTECTED]> wrote: > And, coming back to my scheme interpreter, this is at least somewhat > irrelevant, because, since I am in a REPL of my own devising, I'm > firmly in IO-monad-land, now and forever. This is not entirely true; a REPL can be pure. Consider the f

Re: [Haskell-cafe] User groups meeting all over the world

2008-02-07 Thread PR Stanley
I will only consider events where they serve free tea and sandwiches, plus if there's a landing pad for the chopper nearby. :-) At 23:11 07/02/2008, you wrote: The community might be interested to know that there are (at least) 7 Haskell/FP user groups meeting across the world in the next two

Re: [Haskell-cafe] question concerning ANSI "void *"

2008-02-07 Thread Adam Langley
2008/2/7 Galchin Vasili <[EMAIL PROTECTED]>: > Ok .. I am writing a Haskell function that will call down into the ANSI > C library .. blah :: -> Ptr Word8 -> The underlying C function > that "blah" is calling has a "void *" so I am using "Ptr Word 8" to model > the "void *". De

Re: [Haskell-cafe] Signature for non-empty filter

2008-02-07 Thread Dan Licata
Hi Bulat, Once again, let's be careful about what "check arbitrary functions for termination/non-trivialness" means. If you mean, "decide via an algorithm whether a function is terminating on all inputs", then yes, you need to restrict the class of functions. If you mean "prove in some logic tha

Re: [Haskell-cafe] Re: Implementing fixed-sized vectors (using datatype algebra?)

2008-02-07 Thread Alfonso Acosta
On Feb 7, 2008 8:38 PM, Dan Weston <[EMAIL PROTECTED]> wrote: > I know that naming is arbitrary, but... > > Digits in types seems ugly to me. In this case, it is also redundant. > Everyone but FORTRAN programmers counts from 0, not 1. Nat and Pos seem > clear. Nat0 could even mean Nat \ {0}, the op

Re: [Haskell-cafe] Re: Implementing fixed-sized vectors (using datatype algebra?)

2008-02-07 Thread Richard A. O'Keefe
On 8 Feb 2008, at 8:38 am, Dan Weston wrote: I know that naming is arbitrary, but... Digits in types seems ugly to me. In this case, it is also redundant. Everyone but FORTRAN programmers counts from 0, not 1. Nat and Pos seem clear. Nat0 could even mean Nat \ {0}, the opposite of what i

Re: [Haskell-cafe] User groups meeting all over the world

2008-02-07 Thread Keith Fahlgren
On 2/7/08 3:21 PM, PR Stanley wrote: > I will only consider events where they serve free tea and sandwiches, > plus if there's a landing pad for the chopper nearby. :-) BayFP's next one _might_ be at a place rhyming with "Loogle"[1], so that'd be organic tea and I'm certain there's a landing pad..

[Haskell-cafe] Re: modeling ANSI C structs in Haskell?

2008-02-07 Thread Ben Franksen
Galchin Vasili wrote: > I am reading through the FFI doc. Any suggestions on enabling > Haskell > programmers to model ANSI C structs that will be passed down to C > run-time? If you have a C function that needs to be passed a struct, then there are three scenarios: (a) A common situa

Re: [Haskell-cafe] :i and :t give different types

2008-02-07 Thread Jonathan Cast
On 7 Feb 2008, at 12:30 PM, Chad Scherrer wrote: On Feb 7, 2008 11:57 AM, Don Stewart <[EMAIL PROTECTED]> wrote: Ah, yes, missing parens! Well spotted. So a pretty printer wibble in GHC? -- Don Yeah, that was my first concern, but then I noticed the quantification was different, so I'm stil

Re: [Haskell-cafe] background question about IO monad

2008-02-07 Thread Uwe Hollerbach
Thanks, I'm going to have to study this a bit... Uwe On 2/7/08, Ryan Ingram <[EMAIL PROTECTED]> wrote: > On 2/6/08, Uwe Hollerbach <[EMAIL PROTECTED]> wrote: > > And, coming back to my scheme interpreter, this is at least somewhat > > irrelevant, because, since I am in a REPL of my own devising,

Re: [Haskell-cafe] I love purity, but it's killing me.

2008-02-07 Thread Alfonso Acosta
As I pointed out a few days ago in another thread, you can benefit from using Observable sharing [1] Be warned that Observable sharing is a non-conservative extension of Haskell and it breaks referential transparency. [1] http://www.cs.chalmers.se/~koen/pubs/entry-asian99-lava.html On Feb 8, 200

[Haskell-cafe] I love purity, but it's killing me.

2008-02-07 Thread Tom Hawkins
I've been programming with Haskell for a few years and love it. One of my favorite applications of Haskell is using for domain specific languages. However, after designing a handful of DSLs, I continue to hit what appears to be a fundamental hurdle -- or at least I have yet to find an adequate so

Re: [Haskell-cafe] I love purity, but it's killing me.

2008-02-07 Thread Emil Axelsson
I know of a few of ways to express sharing in a pure language: 1) "Observable sharing", which, in general, is unsafe. http://www.cs.chalmers.se/~koen/pubs/entry-asian99-lava.html 2) Using Template Haskell http://www.dcs.gla.ac.uk/publications/PAPERS/7524/EmbedHDLinTH.ps 3) Matthew Naylor