Re: [Haskell-cafe] evaluation semantics of bind

2009-02-10 Thread Lennart Augustsson
The result of an evaluation is always in WHNF (weak head normal form). So if it's a function, it's been evaluated to \ x - ..., but no evaluation under lambda. Similarely, if it's a data type it has been evaluated so the outermost form is a constructor, but no evaluation inside the constructor.

Re: [Haskell-cafe] Monad explanation

2009-02-09 Thread Lennart Augustsson
Not it doesn't. getChar has the type signature IO Char. The IO type is abstract. GHC happens to implement it by a state monad. But in, e.g., hbc it is implemented in a totally different way, more like a continuation monad. Peeking inside an implementation of IO can be illuminating, but one must

Re: [Haskell-cafe] Monad explanation

2009-02-09 Thread Lennart Augustsson
getChar ... has the type signature of a value. It clearly does not. Lennart Augustsson wrote: Not it doesn't. getChar has the type signature IO Char. The IO type is abstract. GHC happens to implement it by a state monad. But in, e.g., hbc it is implemented in a totally different way, more

Re: [Haskell-cafe] Monad explanation

2009-02-09 Thread Lennart Augustsson
a distinction that does not exist. I deliberately avoided that topic. A thing cannot be both a value and a function, but e,g, getChar My original intent was to hope the poster reconsidered the whole post. You've blown my cover :) Lennart Augustsson wrote: But an (IO Char) is a value. You can do all

Re: [Haskell-cafe] Monad explanation

2009-02-09 Thread Lennart Augustsson
Huh? The getChar function does yield a value of type (IO Char), exactly as the type signature says. If you want access to the Char you must use a =, just like in any other monad. 2009/2/9 Gregg Reynolds d...@mobileink.com: On Mon, Feb 9, 2009 at 4:38 AM, Tony Morris tmor...@tmorris.net wrote:

Re: [Haskell-cafe] evaluation semantics of bind

2009-02-09 Thread Lennart Augustsson
Just to clarify a little. If you implement the IO monad in a sane way (as some kind of state monad or continuation monad) then the compiler can optimize e=f even for the IO monad. The implementation of = will ensure the sequencing of effects in e before effects in f. The IO monad is less magic

Re: [Haskell-cafe] Haddock Markup

2009-02-06 Thread Lennart Augustsson
It doesn't really matter if TeX is a good or bad idea for writing maths. For our users, they might do a formula if it's TeX, they won't if it's something else. -- Lennart On Fri, Feb 6, 2009 at 4:03 PM, Wolfgang Jeltsch g9ks1...@acme.softbase.org wrote: Am Freitag, 6. Februar 2009 11:31

Re: [Haskell-cafe] evaluation semantics of bind

2009-02-05 Thread Lennart Augustsson
There's nothing magic about IO when it comes to monad semantics. If you take ghc's implementation of IO, it's a state monad. The new state generated by x is passed to f, so there's no way to skip x. (Well, if the compiler can show that the state is not used anywhere then it can start removing

Re: [Haskell-cafe] Monad explanation

2009-02-05 Thread Lennart Augustsson
You are absolutely right. The statement The values of the IO monad are programs that do IO. is somewhat nonsensical. Values don't do anything, they just are. But values of the IO monad *describe* how to do IO; they can be seen as a recipe for doing IO. A recipe doesn't cook a dish, but when

Re: [Haskell-cafe] Re: evaluation semantics of bind

2009-02-05 Thread Lennart Augustsson
Perhaps you meant the type correct expression return 7 = \ x - return 42 which the compiler will probably optimize to return 42, because by seeing the definition of return the compiler can see that it has no effects in the monad. This expression is very different from getChar = \ x - return

Re: [Haskell-cafe] type metaphysics

2009-02-02 Thread Lennart Augustsson
Thinking of types as sets is not a bad approximation. You need to add _|_ to your set of values, though. So, Bool={_|_, False, True}, Nat={_|_,Zero,Succ _|_, Succ Zero, ...} 2009/2/2 Gregg Reynolds d...@mobileink.com: Hi Martijn, On Mon, Feb 2, 2009 at 9:49 AM, Martijn van Steenbergen

Re: [Haskell-cafe] type metaphysics

2009-02-02 Thread Lennart Augustsson
-termination is less information than a definite False or True. Domain theory deals with this kind of ordered sets. -- Lennart On Mon, Feb 2, 2009 at 4:51 PM, Gregg Reynolds d...@mobileink.com wrote: Hi and thanks for the response, On Mon, Feb 2, 2009 at 10:32 AM, Lennart Augustsson lenn

Re: [Haskell-cafe] type metaphysics

2009-02-02 Thread Lennart Augustsson
all mathematical functions of type (Integer - Bool), but it does include the ones we usually mean by the type (Integer - Bool) in Haskell. -- Lennart On Mon, Feb 2, 2009 at 4:47 PM, Martijn van Steenbergen mart...@van.steenbergen.nl wrote: Lennart Augustsson wrote: The Haskell function space

Re: [Haskell-cafe] type metaphysics

2009-02-02 Thread Lennart Augustsson
. Most importantly Haskell functions have to be monotonic (in the domain theoretic sense), so that limits the number of possible functions. http://en.wikipedia.org/wiki/Domain_theory -- Lennart On Mon, Feb 2, 2009 at 4:28 PM, Lennart Augustsson lenn...@augustsson.net wrote: The Haskell function

Re: [Haskell-cafe] type metaphysics

2009-02-02 Thread Lennart Augustsson
The Haskell function space, A-B, is not uncountable. There is only a countable number of Haskell functions you can write, so how could there be more elements in the Haskell function space? :) The explanation is that the Haskell function space is not the same as the functions space in set theory.

Re: [Haskell-cafe] C-like Haskell

2009-01-29 Thread Lennart Augustsson
I had a quick look at the code for loop :: Int64 - Int64 - Int64 loop i r = if i == 0 then r else loop (i-1) (r+1) It's quite bad. It's full of C calls. It would be much better to do what gcc does and treat Int64 as a primitive type, and just insert C calls for the tricky operations, like

Re: [Haskell-cafe] bug in System.Mem.StableName

2009-01-26 Thread Lennart Augustsson
I would not trust this weird combination of functions in ghci anyway. 2009/1/26 Alberto G. Corona agocor...@gmail.com: Sometimes the StableName library gives different values for the samr function: Sometines gives two alternate values. I checked it in ghc-6.10.1 under windows and in ghc-6.8.2

Re: Outlaw tabs

2009-01-25 Thread Lennart Augustsson
I don't know what you want it to mean, so I can't answer that. :) I doubt anyone has ever used a VT on purpose. I know I haven't. I regard it as a lexical quirk. -- Lennart On Sun, Jan 25, 2009 at 11:07 AM, Jon Fairbairn jon.fairba...@cl.cam.ac.uk wrote: Lennart Augustsson lenn

Re: [Haskell-cafe] Re: Laws and partial values

2009-01-25 Thread Lennart Augustsson
If all tuples in Haskell were unlifted then () would not be such a special case. But I would argue against unlifted tuples, because that would make tuples (or single constructor data types) different from other data types; adding a constructor to a type could totally wreck laziness of a program

Re: Outlaw tabs

2009-01-24 Thread Lennart Augustsson
But VT is allowed in Haskell. On Sat, Jan 24, 2009 at 10:50 AM, Jon Fairbairn jon.fairba...@cl.cam.ac.uk wrote: Don Stewart d...@galois.com writes: barsoap: I guess everyone knows why. Use -Wwarn-tabs Warnings are the wrong answer to this problem. In fact, they're rarely the right

Re: [Haskell-cafe] Re: Laws and partial values

2009-01-24 Thread Lennart Augustsson
You can dream up any semantics you like about bottom, like it has to be () for the unit type. But it's simply not true. I suggest you do some cursory study of denotational semantics and domain theory. Ordinary programming languages include non-termination, so that has to be captured somehow in

Re: [Haskell-cafe] Re: Laws and partial values

2009-01-24 Thread Lennart Augustsson
I can't argue with your position, because I don't understand it. :) -- Lennart On Sat, Jan 24, 2009 at 10:52 PM, rocon...@theorem.ca wrote: On Sat, 24 Jan 2009, Lennart Augustsson wrote: You can dream up any semantics you like about bottom, like it has to be () for the unit type

git

2009-01-21 Thread Lennart Augustsson
What port is git using for getting the ghc repo via http? I'm getting this message behind our thick firewall: fatal: http://darcs.haskell.org/ghc.git/info/refs download error - Failed connect to darcs.haskell.org:1080; Operation now in progress It makes me think port 1080 is involved, and I

Re: git

2009-01-21 Thread Lennart Augustsson
the 'http_proxy' environment variable to point it at your local proxy server. --sigbjorn On 1/21/2009 07:05, Lennart Augustsson wrote: What port is git using for getting the ghc repo via http? I'm getting this message behind our thick firewall: fatal: http://darcs.haskell.org/ghc.git/info

Re: [Haskell-cafe] Re: ANN: HTTPbis / HTTP-4000.x package available

2009-01-21 Thread Lennart Augustsson
Yeah, the .pac files are a major pain. :( On Wed, Jan 21, 2009 at 3:32 PM, ChrisK hask...@list.mightyreason.com wrote: Duncan Coutts wrote: Proxy auto-configuration files are JavaScript. It uses more or less the full JavaScript language (ECMA these days), though with a small subset of the

Re: [Haskell-cafe] Re: Why monoids will abide...

2009-01-21 Thread Lennart Augustsson
You're too late, they already have guru status. :) On Wed, Jan 21, 2009 at 11:09 PM, Andrzej Jaworski hims...@poczta.nom.pl wrote: Let me also suggest to bestow the official guru status on Dan Piponi and Heinrich Apfelmus:-) ___ Haskell-Cafe mailing

Re: [Haskell-cafe] Existencial quantification and polymorphic datatypes

2009-01-20 Thread Lennart Augustsson
Do you mean difference between data A a = A a and data B = B a -- leaving out the forall ? On Tue, Jan 20, 2009 at 10:02 AM, Mauricio briqueabra...@yahoo.com wrote: Hi, I'm trying, without success, to understand the difference between existencial quantification and polymorphic

Re: [Haskell-cafe] some ideas for Haskell', from Python

2009-01-20 Thread Lennart Augustsson
Yes, the Agda modules remind me of Cayenne. :) On Tue, Jan 20, 2009 at 12:54 PM, Bas van Dijk v.dijk@gmail.com wrote: On Wed, Jan 14, 2009 at 3:59 PM, Manlio Perillo manlio_peri...@libero.it wrote: 2) In Python it is possible to import modules inside a function. In Haskell something

Re: [Haskell-cafe] Re: Comments from OCaml Hacker Brian Hurt

2009-01-20 Thread Lennart Augustsson
A very nice writeup about the use of monoid with finger tree. But please, use the names of the monoid operations that the rest of the Haskell libraries use. By using different names you are just confusing readers (even if you don't like the standard names). Also, you can replace Infinity by

Re: [Haskell-cafe] Pure Haskell implementation of Float type?

2009-01-20 Thread Lennart Augustsson
Do you have Integer? On Wed, Jan 21, 2009 at 12:23 AM, Tim Chevalier catamorph...@gmail.com wrote: On 1/20/09, Don Stewart d...@galois.com wrote: catamorphism: Hello, Is there a pure Haskell implementation of Floats, i.e., one that (unlike GHC.Float) doesn't use foreign calls for

Re: [Haskell-cafe] Pure Haskell implementation of Float type?

2009-01-20 Thread Lennart Augustsson
catamorph...@gmail.com wrote: On 1/20/09, Lennart Augustsson lenn...@augustsson.net wrote: Do you have Integer? Yes (with the integer-simple library -- I was hoping there was some analogue of integer-simple for Float, although Don didn't think there was one). -t -- Tim Chevalier * http

Re: [Haskell] type inference instance extensions

2009-01-19 Thread Lennart Augustsson
A loop without turning on a flag to allow it must be a bug. -- Lennart On Mon, Jan 19, 2009 at 2:04 PM, Sittampalam, Ganesh ganesh.sittampa...@credit-suisse.com wrote: Doug McIlroy wrote: A fragment of an attempt to make pairs serve as complex numbers, using ghc/hugs extensions:

Re: [Haskell-cafe] Factoring into type classes

2009-01-19 Thread Lennart Augustsson
The desugaring of (, a) would involve some type level lambda, and that's not something that is available (yet). -- Lennart On Mon, Jan 19, 2009 at 1:49 PM, Holger Siegel holgersiege...@yahoo.de wrote: Am Montag, den 19.01.2009, 14:47 +0100 schrieb Daniel Fischer: Am Montag, 19. Januar 2009

Re: [Haskell-cafe] Comments from OCaml Hacker Brian Hurt

2009-01-17 Thread Lennart Augustsson
Thinking that Functor allows you to apply a function to all elements in a collection is a good intuitive understanding. But fmap also allows applying a function on elements of things that can't really be called collections, e.g., the continuation monad. -- Lennart On Sat, Jan 17, 2009 at

Re: [Haskell-cafe] Comments from OCaml Hacker Brian Hurt

2009-01-15 Thread Lennart Augustsson
I have replied on his blog, but I'll repeat the gist of it here. Why is there a fear of using existing terminology that is exact? Why do people want to invent new words when there are already existing ones with the exact meaning that you want? If I see Monoid I know what it is, if I didn't know I

Re: [Haskell-cafe] Comments from OCaml Hacker Brian Hurt

2009-01-15 Thread Lennart Augustsson
with just a little effort. -- Lennart On Thu, Jan 15, 2009 at 4:15 PM, John Goerzen jgoer...@complete.org wrote: Lennart Augustsson wrote: I have replied on his blog, but I'll repeat the gist of it here. Why is there a fear of using existing terminology that is exact? Why do people want to invent

Re: [Haskell-cafe] Comments from OCaml Hacker Brian Hurt

2009-01-15 Thread Lennart Augustsson
ganesh.sittampa...@credit-suisse.com wrote: Lennart Augustsson wrote: I have replied on his blog, but I'll repeat the gist of it here. Why is there a fear of using existing terminology that is exact? Why do people want to invent new words when there are already existing ones with the exact meaning

Re: [Haskell-cafe] Comments from OCaml Hacker Brian Hurt

2009-01-15 Thread Lennart Augustsson
: Lennart Augustsson wrote: a name that anyone can figure out with just a little effort. I think the problem is that all these pieces of little effort soon mount up. It's not just the cost of looking it up, but also of remembering it the next time and so on. It's fine when you only encounter

Re: [Haskell-cafe] Comments from OCaml Hacker Brian Hurt

2009-01-15 Thread Lennart Augustsson
and then finally realizing that it means appendable (and other similar things), or grovelling through the library source code seeing how the instance is implemented. My 2 cents, -Ross On Jan 15, 2009, at 11:36 AM, Lennart Augustsson wrote: Most people don't understand pure functional

Re: [Haskell-cafe] Comments from OCaml Hacker Brian Hurt

2009-01-15 Thread Lennart Augustsson
I think the documentation should be reasonably newbie-friendly too. But that doesn't mean we should call Monoid Appendable. Appendable is just misleading, since Monoid is more general than appending. -- Lennart On Thu, Jan 15, 2009 at 4:51 PM, John Goerzen jgoer...@complete.org wrote: Lennart

Re: [Haskell-cafe] Comments from OCaml Hacker Brian Hurt

2009-01-15 Thread Lennart Augustsson
I'm totally with you on the instance documentation. I wish haddock allowed it. On Thu, Jan 15, 2009 at 4:56 PM, Ross Mellgren rmm-hask...@z.odi.ac wrote: Of course not, the wikipedians would probably have your head for notability guidelines or something ;-) But seriously, I would have saved

Re: [Haskell-cafe] Comments from OCaml Hacker Brian Hurt

2009-01-15 Thread Lennart Augustsson
Beats me. As I said, I don't think Haskell gets all the names right. :) On Thu, Jan 15, 2009 at 5:15 PM, Sittampalam, Ganesh ganesh.sittampa...@credit-suisse.com wrote: Lennart Augustsson wrote: I think the documentation should be reasonably newbie-friendly too. But that doesn't mean we

Re: [Haskell-cafe] Comments from OCaml Hacker Brian Hurt

2009-01-15 Thread Lennart Augustsson
That's very true. But programming is one where mathematical precision is needed, even if you want to call it something else. On Thu, Jan 15, 2009 at 6:04 PM, Paul Moore p.f.mo...@gmail.com wrote: Mathematical precision isn't appropriate in all disciplines.

Re: [Haskell-cafe] Re: Type errors, would extensions help?

2009-01-15 Thread Lennart Augustsson
The - binding is lambda binding (look at how it desugars). Lambda bindings are monomorphic without any type extensions. The monadic 'let' binding is like regular 'let', so it's a point where the type checker does generalization, and so you get (possibly) polymorphic bindings from let. --

Re: [Haskell-cafe] some ideas for Haskell', from Python

2009-01-14 Thread Lennart Augustsson
When Haskell was designed there was a bried discussion (if my memory serves me) to have import be a decl, so it could occur anywhere a normal declaration can occur. I kinda like the idea, but some people didn't and it never happened. -- Lennart On Wed, Jan 14, 2009 at 3:12 PM, Neil Mitchell

Re: [Haskell-cafe] some ideas for Haskell', from Python

2009-01-14 Thread Lennart Augustsson
With macros you can define new variable binding constructs. That's something I occasionally miss in Haskell. -- Lennart On Wed, Jan 14, 2009 at 6:48 PM, Jonathan Cast jonathancc...@fastmail.fm wrote: On Wed, 2009-01-14 at 12:39 -0600, Tim Wawrzynczak wrote: You're probably right.

Re: [Haskell-cafe] Re: System.CPUTime and picoseconds

2009-01-11 Thread Lennart Augustsson
It was suggested that it should be ns, and I complained that ns would be obsolete in a while. What I really wanted was a switch to Double (and just using seconds), instead we got ps. At least ps won't get obsolete in a while. -- Lennart On Sun, Jan 11, 2009 at 12:06 AM, ChrisK

Re: [Haskell-cafe] Re: Monads aren't evil

2009-01-11 Thread Lennart Augustsson
Agda has made the choice that you can have (almost) any sequence of characters in identifiers. It works fine, but forces you to use white space (which I do anyway). -- Lennart On Sun, Jan 11, 2009 at 4:28 PM, Martijn van Steenbergen mart...@van.steenbergen.nl wrote: minh thu wrote: I

Re: [Haskell-cafe] Re: System.CPUTime and picoseconds

2009-01-11 Thread Lennart Augustsson
the number of CPU ticks, and another that returns the frequency (number of ticks per second)... This gives you an API that works for whatever clock speed... On Sun, Jan 11, 2009 at 11:23 AM, Lennart Augustsson lenn...@augustsson.net wrote: It was suggested that it should be ns, and I complained

Re: [Haskell-cafe] Re: System.CPUTime and picoseconds

2009-01-11 Thread Lennart Augustsson
. Lennart Augustsson wrote: A double has 53 bits in the mantissa which means that for a running time of about 24 hours you'd still have picoseconds. I doubt anyone cares about picoseconds when the running time is a day. The above is an unfounded claim about the rest of humanity. It's

Re: [Haskell-cafe] ANN: HLint 1.2

2009-01-11 Thread Lennart Augustsson
Does GHC specialize map? If it doesn't, then hand crafted version could be faster. On Sun, Jan 11, 2009 at 11:44 PM, Henning Thielemann lemm...@henning-thielemann.de wrote: On Sun, 11 Jan 2009, Neil Mitchell wrote: HLint will automatically detect if you should have used a map, a foldr or a

Re: [Haskell-cafe] How to give unique name/id to nodes outside any monad ?

2009-01-08 Thread Lennart Augustsson
Of course you don't need a monad, but you need to do the same operations as you would with a state monad to number the nodes. This is the only way in (pure) Haskell. There is no object identity in Haskell, so if you want the nodes to have identity you need to provide it. GHC does have a library

Re: [Haskell-cafe] Re: How to give unique name/id to nodes outside any monad ?

2009-01-08 Thread Lennart Augustsson
are a bit too much for me. I find Haskell a nice language even for imperative programming... Cheers, Thu Greets, Ertugrul. Thank you, Thu 2009/1/8 Lennart Augustsson lenn...@augustsson.net: Look at http://www.haskell.org/ghc/docs/latest/html/libraries/base/System-Mem-StableName.html

Re: [Haskell-cafe] shortest paths, prioritiy queues

2008-12-24 Thread Lennart Augustsson
Couldn't Data.Sequence be augmented with the PSQ operations? On Wed, Dec 24, 2008 at 1:40 PM, Ross Paterson r...@soi.city.ac.uk wrote: On Wed, Dec 24, 2008 at 12:23:47PM +, Johannes Waldmann wrote: Hello. I am looking for a single-source shortest-path implementation (Dijkstra's algorithm,

Re: [Haskell-cafe] shortest paths, prioritiy queues

2008-12-24 Thread Lennart Augustsson
Fair enough. On Wed, Dec 24, 2008 at 2:58 PM, Ross Paterson r...@soi.city.ac.uk wrote: On Wed, Dec 24, 2008 at 02:27:26PM +0100, Lennart Augustsson wrote: Couldn't Data.Sequence be augmented with the PSQ operations? Data.Fingertree could be specialized as a PSQ, but I don't see how

[Haskell] ANN: llvm-0.4.0.1

2008-12-21 Thread Lennart Augustsson
Int32)) cgplus = createFunction InternalLinkage $ \ x y - do r - add x y ret r main = do ioplus - simpleFunction cgplus let plus = unsafePurify ioplus print $ plus 20 22 Enjoy! Bryan O'Sullivan Lennart Augustsson

[Haskell-cafe] ANN: llvm-0.4.0.1

2008-12-21 Thread Lennart Augustsson
Int32)) cgplus = createFunction InternalLinkage $ \ x y - do r - add x y ret r main = do ioplus - simpleFunction cgplus let plus = unsafePurify ioplus print $ plus 20 22 Enjoy! Bryan O'Sullivan Lennart Augustsson

Re: [Haskell] ANN: HLint 1.0

2008-12-20 Thread Lennart Augustsson
Another parse error: newtype CodeGenModule a = CGM (StateT CGMState IO a) deriving (Monad, MonadState CGMState, MonadIO) On Sat, Dec 20, 2008 at 9:55 AM, Neil Mitchell ndmitch...@gmail.com wrote: Hi, I am pleased to announce HLint, a tool for making suggestions to improve your Haskell

Re: [Haskell-cafe] non-functions like unsafePerformIO are not technically part of the haskell language!

2008-12-20 Thread Lennart Augustsson
The current official Haskell standard is Haskell-98. There is no unsafePerformIO in there. On Sat, Dec 20, 2008 at 3:33 PM, Jason Dusek jason.du...@gmail.com wrote: From an old thread: non-functions like unsafePerformIO are not technically part of the haskell language! How is this true,

Re: [Haskell-cafe] non-functions like unsafePerformIO are not technically part of the haskell language!

2008-12-20 Thread Lennart Augustsson
Bah! I had nothing to do with that. ;) On Sat, Dec 20, 2008 at 4:22 PM, Duncan Coutts duncan.cou...@worc.ox.ac.uk wrote: On Sat, 2008-12-20 at 15:43 +, Lennart Augustsson wrote: The current official Haskell standard is Haskell-98. There is no unsafePerformIO in there. It's in the FFI

Re: intimidating terminology (was: Re: [Haskell-cafe] Time for a new logo?)

2008-12-19 Thread Lennart Augustsson
When accurate names for Haskell concepts already exist we should use them (as we have tried in the past). There has been too much invention of misleading terminology in computing already. If some people can't handle things having the right names, well, maybe they should try another language.

Re: [Haskell-cafe] lengthOP rewrite rules

2008-12-19 Thread Lennart Augustsson
There is nothing better about terminating more often. Either your transformation has the same semantics as the original, in which case it is correct. Or your transformation has different sematics than the original, in which case it's incorrect. -- Lennart On Fri, Dec 19, 2008 at 3:03 AM,

Re: length of module name affecting performance??

2008-12-15 Thread Lennart Augustsson
That's a truly awesome feature! I'll shorten all my module names to single letters tomorrow. -- Lennart On Tue, Dec 16, 2008 at 12:43 AM, Don Stewart d...@galois.com wrote: dons: Running time as a function of module name length, http://galois.com/~dons/images/results.png 10 is the

[Haskell] ANN: typehash version 1.3

2008-12-14 Thread Lennart Augustsson
The typehash library allows you to produce a unique identifier (a cryptographic hash) for a type. This is useful if you save values of some type to a file (text, binary, whatever format you wish) and then when you read it back in again you want to verify that the type you want to read is the one

[Haskell-cafe] ANN: typehash version 1.3

2008-12-14 Thread Lennart Augustsson
The typehash library allows you to produce a unique identifier (a cryptographic hash) for a type. This is useful if you save values of some type to a file (text, binary, whatever format you wish) and then when you read it back in again you want to verify that the type you want to read is the one

Re: [Haskell-cafe] Multi-parameter Type Class

2008-12-11 Thread Lennart Augustsson
Since your map function is calling zot to convert an x to a y you must state that this is possible: instance ZOT x y = ZOT [x] [y] where zot xs = map zot xs -- Lennart 2008/12/11 Paul Keir [EMAIL PROTECTED]: Hi all, I've been trying to refactor my tree conversion code to make better use

Re: [Haskell-cafe] A curios monad

2008-12-11 Thread Lennart Augustsson
What ST doesn't provide is a delete operation, otherwise it the rest (but in a safe way). On Thu, Dec 11, 2008 at 9:04 PM, Tillmann Rendel ren...@daimi.au.dk wrote: Andrew Coppin wrote: Except that, AFAIK, ST doesn't provide the hey you can store anything and retrieve it later trick. ;-) I

Re: [Haskell-cafe] Associated data types

2008-12-10 Thread Lennart Augustsson
For an associated data type D, we know that the type function D is injective, i.e., for different indicies given to D we'll get different data types. This makes much more powerful reasoning possible in the type checker. If associated data types are removed there has to be some new mechanism to

Re: [Haskell-cafe] Associated data types

2008-12-10 Thread Lennart Augustsson
: Lennart Augustsson wrote: For an associated data type D, we know that the type function D is injective, i.e., for different indicies given to D we'll get different data types. This makes much more powerful reasoning possible in the type checker. If associated data types are removed there has

Re: [Haskell-cafe] Exact parsing of decimal numbers

2008-12-09 Thread Lennart Augustsson
Yes. On Tue, Dec 9, 2008 at 1:54 PM, Emil Axelsson [EMAIL PROTECTED] wrote: Hello, I don't know enough about the RealFrac class to answer this myself: Can I be sure that Numeric.readFloat :: ReadS Rational never exhibits any rounding errors? Thanks, / Emil

Re: Type checker loops with type families, overlapping and undecidable instances

2008-12-04 Thread Lennart Augustsson
Turning on UndecidableInstances is the same as saying: OK typechcker, you can loop if I make a mistake. I've not looked closely at your code, but if you turn on that flag, looping is probably not a bug. -- Lennart 2008/12/4 José Pedro Magalhães [EMAIL PROTECTED]: Hello all, Please consider

Re: [Haskell-cafe] Re: howto tuple fold to do n-ary cross product?

2008-11-30 Thread Lennart Augustsson
You can have seq and lifted tuples, but the implementation of seq requires parallel evaluation. -- Lennart On Sun, Nov 30, 2008 at 7:00 PM, Luke Palmer [EMAIL PROTECTED] wrote: On Sun, Nov 30, 2008 at 10:43 AM, Max Rabkin [EMAIL PROTECTED] wrote: On Sun, Nov 30, 2008 at 9:30 AM, Luke Palmer

Re: [Haskell-cafe] Re: Go Haskell! - array libraries

2008-11-28 Thread Lennart Augustsson
But I don't want Perl, I want a well designed language and well designed libraries. I think it's find to let libraries proliferate, but at some point you also need to step back and abstract. -- Lennart On Fri, Nov 28, 2008 at 9:46 PM, Don Stewart [EMAIL PROTECTED] wrote: andrewcoppin: What

Re: [Haskell-cafe] What *not* to use Haskell for

2008-11-13 Thread Lennart Augustsson
People have been admitting to using Haskell like that for quite a while now. I think it's an excellent use of Haskell as a DSEL host. -- Lennart On Thu, Nov 13, 2008 at 12:40 AM, [EMAIL PROTECTED] wrote: G'day all. Quoting Tom Hawkins [EMAIL PROTECTED]: Actually, Haskell is an excellent

Re: [Haskell-cafe] Proof that Haskell is RT

2008-11-12 Thread Lennart Augustsson
] wrote: Lennart Augustsson wrote: You can't write a straightforward dynamic semantics (in, say, denotational style) for Haskell. The problem is that with type classes you need to know the types compute the values. You could use a two step approach: first make a static semantics that does

Re: [Haskell-cafe] Proof that Haskell is RT

2008-11-12 Thread Lennart Augustsson
Actually, unsafeInterleaveIO is perfectly fine from a RT point of view. Since you are talking to the outside world any behaviour is acceptable. All the weird interactions between getContents and writing the same file from the same program could, in principle, happen if a different program wrote

Re: [Haskell-cafe] Proof that Haskell is RT

2008-11-12 Thread Lennart Augustsson
You can't write a straightforward dynamic semantics (in, say, denotational style) for Haskell. The problem is that with type classes you need to know the types compute the values. You could use a two step approach: first make a static semantics that does type inference/checking and translates

Re: [Haskell-cafe] Proof that Haskell is RT

2008-11-12 Thread Lennart Augustsson
But how can you tell something being causal or not? Assuming that all IO operations return random result, of course. :) From a practical point of view unsafeInterleaveIO can give suspect results. But theoretically you can't fault it until you have given a semantics for the IO monad operations so

Re: [Haskell-cafe] Problems with strictness analysis?

2008-11-06 Thread Lennart Augustsson
I tried your example in GHC 6.10 and isum appears to work fine. The type of 1000 gets defaulted to Integer, a specialized version of isum for Integer is then created, the strictness analyzer determines that isum is strict in s, and the code generator produces a loop. (If you want to look at

Re: [Haskell-cafe] Problems with strictness analysis?

2008-11-04 Thread Lennart Augustsson
Nonsense, isum is strict in s. If s is bottom, isum will always return bottom. This is the definition of being strict. -- Lennart On Mon, Nov 3, 2008 at 10:35 PM, Don Stewart [EMAIL PROTECTED] wrote: frantisek.kocun: yet I need to add a $! to the recursive call of isum to get a truly

Re: [Haskell-cafe] Re: Why 'round' does not just round numbers ?

2008-10-28 Thread Lennart Augustsson
You're assuming newbies from a bad educational system that hasn't taught them how to round properly. :) -- Lennart On Mon, Oct 27, 2008 at 10:15 PM, Bart Massey [EMAIL PROTECTED] wrote: I think given that the Haskell 98 Report is pretty explicit about the behavior of round, we're stuck with

Re: [Haskell-cafe] Re: Why 'round' does not just round numbers ?

2008-10-28 Thread Lennart Augustsson
: Lennart Augustsson lennart at augustsson.net writes: On Mon, Oct 27 2008, Bart Massey bart at cs.pdx.edu wrote: I think given that the Haskell 98 Report is pretty explicit about the behavior of round, we're stuck with it, but I don't like it. It's yet another tiny impediment to Haskell

Re: [Haskell-cafe] Why 'round' does not just round numbers ?

2008-10-27 Thread Lennart Augustsson
It is certainly what I learnt in school. But that was another school. On Mon, Oct 27, 2008 at 12:15 PM, Janis Voigtlaender [EMAIL PROTECTED] wrote: Henning Thielemann wrote: On Mon, 27 Oct 2008, L.Guo wrote: I think this is unresonable. then try it in GHC 6.8.3. Prelude round 3.5 4

Re: [Haskell-cafe] Re: Why 'round' does not just round numbers ?

2008-10-27 Thread Lennart Augustsson
But you shouldn't use the common round function, you should use the Haskell round function. That's the one that is mathematically better and has hardware support. On Mon, Oct 27, 2008 at 2:05 PM, L.Guo [EMAIL PROTECTED] wrote: Thank you all for instructions. I am not the same education route

Re: [Haskell-cafe] Why 'round' does not just round numbers ?

2008-10-27 Thread Lennart Augustsson
: Lennart Augustsson wrote: It is certainly what I learnt in school. But that was another school. Hmm, on reflection, taking Neil's explanation into account and the fact that this rounding mode was referred to as banker's rounding, the point may be that it was not only another school

Re: [Haskell-cafe] Object-oriented programming, Haskell and existentials

2008-10-16 Thread Lennart Augustsson
, [EMAIL PROTECTED] wrote: Lennart Augustsson wrote: We don't need them [existentials] from a theoretical perspective, but in practice I'd rather use existentials than encodinging them in some tricky way. If the claim that we don't need existentials theoretically is obvious, I don't have

Re: Strictness in data declaration not matched in assembler?

2008-10-15 Thread Lennart Augustsson
I totally agree. Getting the value of the field should just evaluate x and then use a pointer indirection; there should be no conditional jumps involved in getting the value. GHC is just doing the wrong thing. -- Lennart On Wed, Oct 15, 2008 at 3:58 PM, Tyson Whitehead [EMAIL PROTECTED]

Re: Strictness in data declaration not matched in assembler?

2008-10-15 Thread Lennart Augustsson
True, if there can be indirections then that's bad news. That would make strict fields much less efficient. But I don't see why indirections should be needed. Simon? On Wed, Oct 15, 2008 at 4:21 PM, Jan-Willem Maessen [EMAIL PROTECTED] wrote: On Oct 15, 2008, at 11:08 AM, Lennart Augustsson

Re: Repair to floating point enumerations?

2008-10-15 Thread Lennart Augustsson
I'm sorry, but people who write [0.0,0.1 .. x] where x is a multiple of 0.1 get exactly what they deserve if x is not included. Floating point numbers are not the real numbers, and the sooner they learn that the better. We can fudge this all we like, but 0.1 is never going to be exactly

Re: [Haskell-cafe] Re: What I wish someone had told me...

2008-10-15 Thread Lennart Augustsson
The (=) operation for the state monad can be implemented with no understanding at all. Just watch djinn make the code for it. And djinn doesn't understand the state monad, I promise. :) -- Lennart 2008/10/15 David Leimbach [EMAIL PROTECTED]: On Wed, Oct 15, 2008 at 8:08 AM, John Lato

Re: [Haskell-cafe] Object-oriented programming, Haskell and existentials

2008-10-15 Thread Lennart Augustsson
What do you mean by need? From a theoretical or practical perspective? We don't need them from a theoretical perspective, but in practice I'd rather use existentials than encodinging them in some tricky way. On Wed, Oct 15, 2008 at 11:05 AM, [EMAIL PROTECTED] wrote: The web page begs a

Re: [Haskell-cafe] What I wish someone had told me...

2008-10-14 Thread Lennart Augustsson
this issue at all? John On Tue, Oct 14, 2008 at 5:03 PM, Lennart Augustsson [EMAIL PROTECTED] wrote: You can do equivalent of // List and MyList are different classes if (something) { return new List(); } else { return new MyList(); } in Haskell as well. But to do that you have to introduce

Re: [Haskell-cafe] What I wish someone had told me...

2008-10-14 Thread Lennart Augustsson
You can do equivalent of // List and MyList are different classes if (something) { return new List(); } else { return new MyList(); } in Haskell as well. But to do that you have to introduce an existential wrapper in the return type. In OO languages the existential wrapper is built in to OO

Re: [Haskell-cafe] Announcing OneTuple-0.1.0

2008-10-03 Thread Lennart Augustsson
Let me pick one example. Let's make a class that can convert between tuples and lists. Of course there are restriction when this works, but it can still be useful. class TupleList t l | t - l where tupleToList :: t - l listToTuple :: l - t instance TupleList () [a] where tupleToList

Re: [Haskell-cafe] Announcing OneTuple-0.1.0

2008-10-03 Thread Lennart Augustsson
But (a) is not a lifted version of a, whereas (a,b) is a lifted version of the a b product. So it's not consistent, and thereby wrong. -- Lennart On Fri, Oct 3, 2008 at 6:07 PM, Jason Dusek [EMAIL PROTECTED] wrote: Lennart Augustsson [EMAIL PROTECTED] wrote: Let me pick one example. Let's

Re: [Haskell-cafe] Announcing OneTuple-0.1.0

2008-10-02 Thread Lennart Augustsson
Just FYI, at Credit Suisse I wrote a 1-tuple type a few years ago. It was the only way to get a consistent way of dealing with certain things. But I called it One. I think the OneTuple should be in the base library, I mean, ask an 8 year old what number is missing in this sequence

Re: [Haskell-cafe] Lazy vs correct IO [Was: A round of golf]

2008-09-19 Thread Lennart Augustsson
at 7:51 AM, [EMAIL PROTECTED] wrote: Lennart Augustsson wrote main = do name:_ - getArgs file - readFile name print $ length $ lines file Given the stance against top-level mutable variables, I have not expected to see this Lazy IO code. After all, what could be more against

Re: [Haskell-cafe] A round of golf

2008-09-18 Thread Lennart Augustsson
Without any fancy byte strings: main = do name:_ - getArgs file - readFile name print $ length $ lines file On Thu, Sep 18, 2008 at 6:02 PM, Creighton Hogg [EMAIL PROTECTED] wrote: Hey Haskell, So for a fairly inane reason, I ended up taking a couple of minutes and writing a program

Re: [Haskell-cafe] Re: Float instance of 'read'

2008-09-17 Thread Lennart Augustsson
Given examples like (1,2,3) I don't see how comma could ever be used instead of dot, unless you insist on whitespace around all commas. And that doesn't look like the right way forward. -- Lennart On Wed, Sep 17, 2008 at 4:20 PM, Mauricio [EMAIL PROTECTED] wrote: Do you think 'read'

Re: [Haskell-cafe] Hugs on the iphone

2008-09-15 Thread Lennart Augustsson
I have the same problems. Looks like the configure script needs some updating to run on the iPhone. On Mon, Sep 15, 2008 at 6:47 AM, Alberto R. Galdo [EMAIL PROTECTED] wrote: Cool! That's such a proof that it can be done... I had lots of problems trying to cross compile hugs from my mac to

<    1   2   3   4   5   6   7   8   9   10   >