[Haskell-cafe] Re: Associated Type Synonyms question

2006-02-16 Thread Martin Sulzmann
Stefan Wehr writes: Niklas Broberg [EMAIL PROTECTED] wrote:: On 2/10/06, Ross Paterson [EMAIL PROTECTED] wrote: On Fri, Feb 10, 2006 at 05:20:47PM +0100, Niklas Broberg wrote: - when looking at the definition of MonadWriter the Monoid constraint is not strictly necessary, and

[Haskell-cafe] enforcing strictness on arbitrary subexpressions

2006-02-16 Thread Matthias Fischmann
hei, I want to force evaluation on an arbitrary expression. What I have found is only strict datatypes (the '!' thing), but not a strictness idiom for arbitrary subexpressions. (I want this for debugging mostly, so if there is a better way to unsafePerformIO something in one piece I would be

[Haskell-cafe] module for probability distributions

2006-02-16 Thread Matthias Fischmann
hei again, (-: I wrote a module for sampling arbitrary probability distribution, so far including normal (gaussian) and uniform. http://www.wiwi.hu-berlin.de/~fis/code/ For those who need something like this: feel free to take it, it's BSD. For those who feel like growing their karma:

[Haskell-cafe] Decidable type systems? (WAS: Associated Type Synonyms question)

2006-02-16 Thread Miles Sabin
Martin Sulzmann wrote, By possible you mean this extension won't break any of the existing ATS inference results? You have to be very careful otherwise you'll loose decidability. Can someone explain to me why decidability is of any practical interest at all? What's the (practical) difference

Re: [Haskell-cafe] enforcing strictness on arbitrary subexpressions

2006-02-16 Thread Udo Stenzel
Matthias Fischmann wrote: I want to force evaluation on an arbitrary expression. [...] main :: IO () main = do hPutStr stdout veryLongString -- lazy veryLongString `seq` hPutStr stdout veryLongString -- still lazy? (StrictThingy veryLongString) `seq` hPutStr stdout

Re: [Haskell-cafe] Decidable type systems? (WAS: Associated Type Synonyms question)

2006-02-16 Thread Andres Loeh
Can someone explain to me why decidability is of any practical interest at all? What's the (practical) difference between a decision procedure which might never terminate and one which might take 1,000,000 years to terminate? Actually, why push it out to 1,000,000 years: in the context of

Re: [Haskell-cafe] Badly designed Parsec combinators?

2006-02-16 Thread Juan Carlos Arevalo Baeza
Tomasz Zielonka wrote: On Sun, Feb 12, 2006 at 06:22:46AM -0800, Juan Carlos Arevalo Baeza wrote: This brings me to wonder also if it'd be possible for the compilers to add a little bit more smarts to the do notation syntax, so that it'll add the return () at the end if it's missing.

Re: [Haskell-cafe] Decidable type systems? (WAS: Associated TypeSynonyms question)

2006-02-16 Thread Robin Green
Miles Sabin [EMAIL PROTECTED] wrote: Can someone explain to me why decidability is of any practical interest at all? procedure which might never terminate and one which might take 1,000,000 years to terminate? Actually, why push it out to 1,000,000 years: in the context of a compiler for a

Re: [Haskell-cafe] Decidable type systems? (WAS: Associated Type Synonyms question)

2006-02-16 Thread Miles Sabin
Andres Loeh wrote, If a problem is decidable, it has the nice property that the problem (*not* the algorithm) can be used as a specification. Implementors are free to implement different algorithms, as long as they all solve the problem. If the problem is undecidable, how do you make sure that

Re: [Haskell-cafe] Code completion? (IDE)?

2006-02-16 Thread Thiago Arrais
Marc, On 2/16/06, Marc Weber [EMAIL PROTECTED] wrote: vim7 has introduced omni-completion... So I'm interested wether there are any projects which support any kind of completion.? I have been working on some code completion support for EclipseFP. It is right now in a really infant stage, but

Re: [Haskell-cafe] Decidable type systems? (WAS: Associated TypeSynonyms question)

2006-02-16 Thread Miles Sabin
Robin Green wrote, But are there any decidable type checking algorithms that have been seriously proposed or used which would take far too long to terminate for real code? If not, then decidability is the only thing that matters. Surely what matters is that they don't take far too long to

Re: [Haskell-cafe] Code completion? (IDE)?

2006-02-16 Thread Thiago Arrais
On 2/16/06, Thiago Arrais [EMAIL PROTECTED] wrote: Just take a look at the latest integration build that you are able to find at http://eclipsefp.sourceforge.net/download There is also a screenshot at http://eclipsefp.sourceforge.net/images/first-content-assist.png Cheers, Thiago Arrais

[Haskell-cafe] Re: Badly designed Parsec combinators?

2006-02-16 Thread Christian Maeder
Juan Carlos Arevalo Baeza wrote: Another case where I encounter this is with the when function: myParser2 :: Bool - Parser () myParser2 all = do string Hello when all $ do string , world string ! I made a function (did I miss one in the base

[Haskell-cafe] Cyclical Type Synonyms

2006-02-16 Thread Tom Hawkins
I want to define a type for a function that returns its own type... type F a = a - (F a,a) But the compiler gives me an error: Cycle in type synonym declaration: Why is this a restriction? Of course I can create a user defined type, but then I need an extra mechanism to call the embedded

[Haskell-cafe] Lazy read

2006-02-16 Thread Neil Mitchell
Hi, I have a nice big data structure that I serialise to a file using show, and read back in using read. This data structure has deriving (Read, Show), which makes it all nice and easy to save and load this data structure, without worrying about parsing code etc. The problem is that this data

Re: [Haskell-cafe] Badly designed Parsec combinators?

2006-02-16 Thread Udo Stenzel
Juan Carlos Arevalo Baeza wrote: myParser :: Parser () myParser = do string Hello optional (string , world!) It makes no sense for myParser to generate any values, especially not the result from the optional statement, so it is set to return (). Don't you think this

Re: [Haskell-cafe] Cyclical Type Synonyms

2006-02-16 Thread Cale Gibbard
This is because 'type' only allows you to define synonyms for existing types, not create new types altogether (for that, use newtype). The synonyms are expanded to their definitions early on in compilation. In this case, that expansion process would not terminate (but the compiler is clever enough

[Haskell-cafe] monad combinator

2006-02-16 Thread Christian Maeder
Udo Stenzel wrote: (*) :: Monad m = m a - m b - m a m * n = do a - m ; n ; return a Right, that one is really useful. I named it (), though, conforming to (=) versus (=). Christian ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

[Haskell-cafe] library sort

2006-02-16 Thread Radu Grigore
Is there a sort function in the libraries that come with GHC (6.4)? My search at http://www.haskell.org/ghc/docs/latest/html/libraries/index.html has failed, but I can't believe there is none. -- regards, radu http://rgrig.blogspot.com/ ___

RE: [Haskell-cafe] library sort

2006-02-16 Thread Bayley, Alistair
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Radu Grigore Is there a sort function in the libraries that come with GHC (6.4)? My search at http://www.haskell.org/ghc/docs/latest/html/libraries/index.html has failed, but I can't believe there is none. Data.List.sort

Re: [Haskell-cafe] library sort

2006-02-16 Thread J. Garrett Morris
Data.List contains sort :: Ord a = [a] - [a] and sortBy :: (a - a - Ordering) - [a] - [a] I believe they're currently implemented using merge sort, at least in GHC. /g On 2/16/06, Radu Grigore [EMAIL PROTECTED] wrote: Is there a sort function in the libraries that come with GHC (6.4)? My

Re: [Haskell-cafe] library sort

2006-02-16 Thread Neil Mitchell
Hi Radu, Is there a sort function in the libraries that come with GHC (6.4)? import Data.List Or just hit Hoogle with sort http://haskell.org/hoogle/?q=sort Thanks Neil On 16/02/06, Radu Grigore [EMAIL PROTECTED] wrote: My search at

Re: [Haskell-cafe] library sort

2006-02-16 Thread Cale Gibbard
Yes, it's in Data.List, and called 'sort'. You can use the index (see top right) to look for it under 'S'. - Cale On 16/02/06, Radu Grigore [EMAIL PROTECTED] wrote: Is there a sort function in the libraries that come with GHC (6.4)? My search at

Re: [Haskell-cafe] monad combinator

2006-02-16 Thread Tomasz Zielonka
On Thu, Feb 16, 2006 at 04:36:06PM +0100, Christian Maeder wrote: Udo Stenzel wrote: (*) :: Monad m = m a - m b - m a m * n = do a - m ; n ; return a Right, that one is really useful. I named it (), though, conforming to (=) versus (=). But = first executes the second argument... Best

Re: [Haskell-cafe] Lazy read

2006-02-16 Thread Taral
On 2/16/06, Neil Mitchell [EMAIL PROTECTED] wrote: What is the best way to modify the code to have read operate lazily? Is there any method that doesn't require writing a custom parser? Is there any standard way for solving a problem like this? Honestly, don't use read. It's icky. Check out

Re: [Haskell-cafe] Lazy read

2006-02-16 Thread Neil Mitchell
Honestly, don't use read. It's icky. Check out ReadP or parsec, they are far superior in general. I think there was a suggestion of replacing Read with ReadP? The whole point is not about writing a parser, its about having a parser written for me with deriving Read - unfortunately their is no

Re: [Haskell-cafe] Badly designed Parsec combinators?

2006-02-16 Thread Juan Carlos Arevalo Baeza
Udo Stenzel wrote: Juan Carlos Arevalo Baeza wrote: myParser :: Parser () myParser = do string Hello optional (string , world!) It makes no sense for myParser to generate any values, especially not the result from the optional statement, so it is set to return ().

Re: [Haskell-cafe] Badly designed Parsec combinators?

2006-02-16 Thread Udo Stenzel
Juan Carlos Arevalo Baeza wrote: Udo Stenzel wrote: Don't you think this will interfere somehow with type inference? With type inference? No, why? I mean... specifying the type of a function [...] Okay, so want an implicit (return ()) only if the type of the do-block has been explicitly

Re: [Haskell-cafe] Lazy read

2006-02-16 Thread Malcolm Wallace
Neil Mitchell [EMAIL PROTECTED] writes: Check out ReadP or parsec, they are far superior in general. I think there was a suggestion of replacing Read with ReadP? The whole point is not about writing a parser, its about having a parser written for me with deriving Read - unfortunately

Re: [Haskell-cafe] Decidable type systems? (WAS: Associated Type Synonyms question)

2006-02-16 Thread John Meacham
On Thu, Feb 16, 2006 at 12:45:03PM +, Miles Sabin wrote: Andres Loeh wrote, If a problem is decidable, it has the nice property that the problem (*not* the algorithm) can be used as a specification. Implementors are free to implement different algorithms, as long as they all solve the

Re: [Haskell-cafe] Badly designed Parsec combinators?

2006-02-16 Thread John Meacham
On Thu, Feb 16, 2006 at 04:22:40AM -0800, Juan Carlos Arevalo Baeza wrote: But... the thing is, if we have any do statement, or any monad whatsoever, which does not return (), and the program needs it to return () in order to be able to match its type, that transformation is always

Re: [Haskell-cafe] Decidable type systems? (WAS: Associated Type Synonyms question)

2006-02-16 Thread Miles Sabin
John Meacham wrote, Again, I'm not sure that decidability helps practically here: we're not interested in compiler A and compiler B accept the same programs, we're interested in compiler A and compiler B accept some well defined subset of possible programs in a reasonable amount of time

Re: [Haskell-cafe] Haskell as scripting language?

2006-02-16 Thread Marc Weber
Wow, that easy? Just eval ...? Can't believe it.. Will have look at those examples.. Marc ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Constructor classes implementation

2006-02-16 Thread Sean Seefried
Hey all, If you're interested in an implementation of constructor classes (type classes which can take constructors as arguments; already implemented in Haskell) please see: http://www.cse.unsw.edu.au/~sseefried/code.html This should help understanding the paper by Mark P. Jones called A

[Haskell-cafe] GADTs and bar :: Foo t1 - Foo t2

2006-02-16 Thread Daniel McAllansmith
Hello, I have a recursive type data Foo = A | B [Foo] | C [Foo] that I would like to restrict so that a C can only contain Bs, and a B can only contain As. If I use a GADT as follows the bar function, understandably, will not type check. data AType data BType data CType data Foo a