Re: Stronger static types, was Re: [Haskell-cafe] Re: Versioning

2006-12-22 Thread Jan-Willem Maessen
On Dec 21, 2006, at 5:03 PM, Jacques Carette wrote: ... What must be remembered is that full dependent types are NOT needed to get a lot of the benefits of dependent-like types. This is what some of Oleg's type gymnastics shows (and others too). My interest right now lies in figuring

Re: Stronger static types, was Re: [Haskell-cafe] Re: Versioning

2006-12-22 Thread Lennart Augustsson
Yes, Bluespec has efficient type level naturals. But it only has arithmetic and some trivial decision procedures. The slogan is the type checker knows arithmetic, not algebra. It worked pretty well. But you soon get into situations where you need polymorphic recursion of functions with

Re: [Haskell-cafe] Shrinking the Prelude: The categorical approach

2006-12-22 Thread Henning Thielemann
On Thu, 21 Dec 2006, Ross Paterson wrote: On Thu, Dec 21, 2006 at 07:16:16PM +0100, Henning Thielemann wrote: About the question, whether functions should be provided in the most general context, I refer to http://www.haskell.org/haskellwiki/Slim_instance_declaration Certainly we

Re: Stronger static types, was Re: [Haskell-cafe] Re: Versioning

2006-12-22 Thread Jacques Carette
Brian Hulley wrote: Would it be possible to augment Haskell's type system so that it was the same as that used in Epigram? No, no! Epigram is a wonderfully pure research experiment in one corner of the design space. The corner it is exploring is not particularly Haskell like, though the

[Haskell-cafe] Re: Getting my feet wet - not in Haskell though

2006-12-22 Thread Joachim Durchholz
OK, just to let everybody know why I'm dropping Haskell. Basically, the reasoning is this: * I want to write a process that doesn't terminate. * Since the environment can and will enforce termination occasionally, the process must be able to write its state to some external storage (serialize

[Haskell-cafe] ST and Transformers

2006-12-22 Thread J. Garrett Morris
Hello everyone, I recently found myself attempting to use ST at the base of a stack of transformers, ala: type Test t r = ErrorT String (ST t) r I imagined, given the type of ST, that I would need a run function along the lines of: runTest :: (forall t. Test t r) - Either String r (which

Re: [Haskell-cafe] State separation/combination pattern question

2006-12-22 Thread Udo Stenzel
Reto Kramer wrote: What I'm really looking for is not so much the chaining of StateT compositions, but rather the isolation of StateA from StateB while they both flow from the search loop into the respective library calls (foo, bar) transparently to the application programmer. How about

Re: [Haskell-cafe] ST and Transformers

2006-12-22 Thread Pepe Iborra
Hi J Garrett, I don't see any problem in GHC 6.6. with: runTest c = runST (runErrorT c) *Main runTest (return True) Loading package mtl-1.0 ... linking ... done. Right True *Main On the other hand, I try to define it firstly as below and got the following error. runTest = runST .

[Haskell-cafe] Re: automonadization of code?

2006-12-22 Thread Adam Megacz
Chung-chieh Shan [EMAIL PROTECTED] writes: Adam Megacz [EMAIL PROTECTED] wrote in article [EMAIL PROTECTED] in gmane.comp.lang.haskell.cafe: Is there any work on automatic translation of code in some tiny imperative language into Haskell code that uses the ST and/or IO monads (or perhaps

Re: [Haskell-cafe] Showing the 1 element tuple

2006-12-22 Thread Dan Weston
More generally, is there an operator version of dotted pair notation (gasp, did I just lisp?) that works like: data Tuple a b = () | Tuple a b ()== () ( ) 1 == Tuple 1 () (2,'a',hello) == Tuple 2 (Tuple 'a' (Tuple hello ())) And is there anyway in Haskell to restrict the type definition

Re: [Haskell-cafe] Re: How to serialize thunks?

2006-12-22 Thread Bulat Ziganshin
Hello Joachim, Friday, December 22, 2006, 2:30:32 AM, you wrote: There is an interesting technique thay allows you to serialize infinite, lazy or functional values: don't try to describe how those values look, but how they came to be. Ah, that's an interesting approach that I haven't

Re: [Haskell-cafe] ST and Transformers

2006-12-22 Thread Stefan O'Rear
On Fri, Dec 22, 2006 at 06:44:54PM +0100, Pepe Iborra wrote: Rank-2 types seem to interact badly with (.) and ($), but my type theory educated neuron doesn't know why. I think this is folklore knowledge? You say: runErrSt = (.) runST runErrorT runErrorT has type ErrorT e m a - m (Either

Re: [Haskell-cafe] ST and Transformers

2006-12-22 Thread J. Garrett Morris
Hmm, that was simpler than I had imagined. Thank you both! /g On 12/22/06, Stefan O'Rear [EMAIL PROTECTED] wrote: On Fri, Dec 22, 2006 at 06:44:54PM +0100, Pepe Iborra wrote: Rank-2 types seem to interact badly with (.) and ($), but my type theory educated neuron doesn't know why. I think

Re: [Haskell-cafe] Re: A suggestion for the next high profile Haskell project

2006-12-22 Thread ajb
G'day all. Bulat Ziganshin [EMAIL PROTECTED] writes: of course, we can fool any topic by changing the names. no one will say that Haskell is small productive language, the topic was just about speed of code generated Actually, the topic was performance. What performance means to a modern

[Haskell-cafe] partial functions / failure, Maybe and MonadError and good style

2006-12-22 Thread Steve Downey
Although terse, the subject really says it all. If i've a partial function, like a parser, what is considered good style for a library. The tradeoffs that I can see are that Maybe is a binary operation, while Error can communicate more information in the type of the error case. Is there some way

Re: [Haskell-cafe] Showing the 1 element tuple

2006-12-22 Thread John Meacham
On Fri, Dec 22, 2006 at 11:13:50AM -0800, Dan Weston wrote: More generally, is there an operator version of dotted pair notation (gasp, did I just lisp?) that works like: data Tuple a b = () | Tuple a b ()== () ( ) 1 == Tuple 1 () (2,'a',hello) == Tuple 2 (Tuple 'a' (Tuple hello

Re: [Haskell-cafe] partial functions / failure, Maybe and MonadError and good style

2006-12-22 Thread Lennart Augustsson
I would not advocate using the fail operation in a monad. It doesn't belong there, and hopefully it will go away some day. :) -- Lennart On Dec 23, 2006, at 02:21 , Stefan O'Rear wrote: On Fri, Dec 22, 2006 at 08:05:08PM -0500, Steve Downey wrote: Although terse, the subject

[Haskell-cafe] Re: partial functions / failure, Maybe and MonadError and good style

2006-12-22 Thread Steve Downey
OK, but is msg always a string? Admidtedly, in the concrete case I have at hand (follow up posting RSN), that would be fine. I think I've also been looking at the map lookup case, where not only is lookup failure to be expected, it's almost an imposition to say something other than Nothing. On

Re: [Haskell-cafe] Cabal licence files

2006-12-22 Thread John Meacham
On Fri, Dec 15, 2006 at 03:14:32AM +, Dougal Stanton wrote: The cabal setup recognises a small set of licences which I don't think are well explained. I'm trying to put together a canonical list for setting up new projects. This has bugged me about cabal, why does it have a built in

Re: [Haskell-cafe] partial functions / failure, Maybe and MonadError and good style

2006-12-22 Thread Daniel McAllansmith
On Saturday 23 December 2006 14:21, Stefan O'Rear wrote: On Fri, Dec 22, 2006 at 08:05:08PM -0500, Steve Downey wrote: Although terse, the subject really says it all. If i've a partial function, like a parser, what is considered good style for a library. The tradeoffs that I can see are

Re: [Haskell-cafe] Re: partial functions / failure, Maybe and MonadError and good style

2006-12-22 Thread Ross Paterson
On Fri, Dec 22, 2006 at 08:37:05PM -0500, Steve Downey wrote: On 12/22/06, Stefan O'Rear [EMAIL PROTECTED] wrote: All monads provide a fail operation, and any function that uses fail will be able to work with any monad's error handling mechanism. * Maybe - fail msg is Nothing (ignores

Re: [Haskell-cafe] partial functions / failure, Maybe and MonadError and good style

2006-12-22 Thread Stefan O'Rear
On Sat, Dec 23, 2006 at 02:33:51AM +0100, Lennart Augustsson wrote: I would not advocate using the fail operation in a monad. It doesn't belong there, and hopefully it will go away some day. :) On Fri, Dec 22, 2006 at 08:37:05PM -0500, Steve Downey wrote: OK, but is msg always a string?

[Haskell-cafe] Re: partial functions / failure, Maybe and MonadError and good style

2006-12-22 Thread Steve Downey
'normal execution path' is a key phrase here. If we're truely thinking functionally, there is no execution path. At most there are evaluation strategies. I suppose this is why Maybe is a monad rather than just another algebraic data type. Perhaps I'm thinking of the strategy of 'replacing

[Haskell-cafe] Re: partial functions / failure, Maybe and MonadError and good style

2006-12-22 Thread Steve Downey
Actually, that is the version of Error I was looking at. On 12/22/06, Stefan O'Rear [EMAIL PROTECTED] wrote: On Sat, Dec 23, 2006 at 02:33:51AM +0100, Lennart Augustsson wrote: I would not advocate using the fail operation in a monad. It doesn't belong there, and hopefully it will go away

Re: [Haskell-cafe] Re: partial functions / failure, Maybe and MonadError and good style

2006-12-22 Thread Stefan O'Rear
On Fri, Dec 22, 2006 at 09:44:35PM -0500, Steve Downey wrote: I suppose this is why Maybe is a monad rather than just another algebraic data type. Maybe is an algebraic datatype. A monad is simply a structure defined on the datatype, reflecting a normal pattern of use. This is exactly where