Re: [Haskell] Announcing Djinn, version 2004-12-11, a coding wizard

2011-04-07 Thread Lennart Augustsson
Djinn takes a type, what you have written does not appear to be a type. -- Lennart On Thu, Apr 7, 2011 at 3:35 PM, Martin wrote: > > After reading this post, i can only see a -> b > > how to define more specific such as > > flow 0 y = y > flow z flow x, y = flow z+x, y > > could you demonstra

Re: [Haskell] Marketing Haskell

2009-04-01 Thread Lennart Augustsson
Koalas are slow and lazy animals. I think the choice is highly appropriate. -- Lennart On Wed, Apr 1, 2009 at 8:22 AM, Colin Paul Adams wrote: >> "Simon" == Simon Peyton-Jones writes: > >    Simon> So I hereby declare the official Haskell mascot to be the >    Simon> koala, in the form o

[Haskell] Re: [Haskell-cafe] ANN: cmonad 0.1.1

2009-03-29 Thread Lennart Augustsson
. With that in place I think the code could be quite performant. -- Lennart On Sun, Mar 29, 2009 at 3:13 PM, Jason Dusek wrote: > 2009/03/29 Lennart Augustsson : >> ...GHC lacks certain optimizations to make efficient code when >> using CMonad, so instead of C speed you get low spee

[Haskell] ANN: cmonad 0.1.1

2009-03-29 Thread Lennart Augustsson
I've uploaded my CMonad package to Hackage. It allows you to write Haskell code in a C style. Unfortunately, GHC lacks certain optimizations to make efficient code when using CMonad, so instead of C speed you get low speed. Example: Computing some Fibonacci numbers: fib = do { a <- arrayU[40]

[Haskell] Re: [Haskell-cafe] Haskell Weekly News: Issue 111 - March 28, 2009

2009-03-28 Thread Lennart Augustsson
The quote has been around since at least the early 80s, but I don't know who it's from. 2009/3/28 Krzysztof Skrzętnicki : > This paper from 1994: > http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.36.5611 > begins point 1.1 with exactly that sentence. It doesn't seem to be > quoted there, s

Re: [Haskell] Lazy IO breaks purity

2009-03-05 Thread Lennart Augustsson
I don't see any breaking of referential transparence in your code. Every time you do an IO operation the result is basically non-deterministic since you are talking to the outside world. You're assuming the IO has some kind of semantics that Haskell makes no promises about. I'm not saying that thi

[Haskell] Re: [Haskell-cafe] Gtk2HS 0.10.0 Released

2009-02-11 Thread Lennart Augustsson
Does this version work from ghci? -- Lennart On Wed, Feb 11, 2009 at 5:40 AM, Peter Gavin wrote: > Hi everyone, > > Oh, dear... it seems I've forgotten how to spell "cafe", and sent this > message to haskell-c...@haskell.org the first time around. I resent it to > all the lists again (just to

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 wrote: > Doug McIlroy wrote: >> A fragment of an attempt to make pairs serve as complex numbers, >> using ghc/hugs extensions: >> >> instance Num a => Num (a,a) w

[Haskell] ANN: llvm-0.4.0.1

2008-12-21 Thread Lennart Augustsson
gt; IO 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

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 wrote: > Hi, > > I am pleased to announce HLint, a tool for making suggestions to > improve your Haskell code. Previously t

Re: [Haskell] ANN: HLint 1.0

2008-12-20 Thread Lennart Augustsson
It would be nice if HLint didn't suggest things that it will object to in the next round. Like LLVM/Core/CodeGen.hs:176:1: Eta reduce Found: applyArgs f g = apArgs 0 f g Why not: applyArgs f = apArgs 0 f BTW, great tool! -- Lennart ___ Haskell ma

[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 yo

Re: [Haskell] IVars

2007-12-09 Thread Lennart Augustsson
Before we can talk about what right and wrong we need to know what the semantics of IVars should be. On Dec 8, 2007 7:12 PM, Marc A. Ziegert <[EMAIL PROTECTED]> wrote: > many many answers, many guesses... > let's compare these semantics: > > readIVar :: IVar a -> IO a > readIVar' :: IVar a -> a >

Re: [Haskell] IVars

2007-12-04 Thread Lennart Augustsson
; out. If the operation was pure (no IO) then you'd have a lot less control > over when it happened. > > > > Simon > > > > *From:* [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] *On > Behalf Of *Lennart Augustsson > *Sent:* 04 December 2007 08:19 > *To:* Cona

Re: [Haskell] IVars

2007-12-04 Thread Lennart Augustsson
question: why the IO in readIVar :: IVar a -> IO a, instead of > just readIVar :: IVar a -> a? After all, won't readIVar iv yield the same > result (eventually) every time it's called? > > > On Dec 3, 2007 12:29 AM, Lennart Augustsson <[EMAIL PROTECTED]> >

Re: [Haskell] IVars

2007-12-03 Thread Lennart Augustsson
You can make them from MVars. On Dec 2, 2007 8:03 PM, Conal Elliott <[EMAIL PROTECTED]> wrote: > what became of (assign-once) IVars? afaict, they were in concurrent > haskell and now aren't. > > ___ > Haskell mailing list > Haskell@haskell.org > http:/

Re: [Haskell] Bang patterns and declaration order

2007-11-18 Thread Lennart Augustsson
I totally agree with Derek. Which exception you get can vary with compiler version, compiler flags, time of day, phase of the moon, ... It will be one in a set of exceptions, but you don't know which one. -- Lennart On Nov 18, 2007 8:34 PM, Derek Elkins <[EMAIL PROTECTED]> wrote: > On Sun, 20

Re: [Haskell] boilerplate boilerplate

2007-05-22 Thread Lennart Augustsson
Oh, so you want the original behaviour of type declarations back. :) In Haskell 1.0, if you didn't specify any deriving, you got as much derived as possible. I quite liked it, but it was changed. -- Lennart On Tue, 22 May 2007, Alex Jacobson wrote: Date: Tue, 22 May 2007 19:07:26 -0

[Haskell] Haskell job

2007-04-18 Thread Lennart Augustsson
Hi all, Credit Suisse has started using Haskell within GMAG, the group that provides financial analytics for the bank. The main use of Haskell is for a Domain Specific Embedded Language that is being used by the people writing the financial analytics (these people typically have a PhD in

Re: [Haskell] haskell communities worthy of academic study?

2007-03-31 Thread Lennart Augustsson
Excellent! It's good too see that the GHC complexities will be appreciated by someone. Yet Dr Tuldoso has much left to discover. Like the near hopeless task of trying to keep a local GHC version with a few patches up to date with darcs without getting totally entangled in conflicts, acce

Re: [Haskell] Num is such a fat and greedy class

2006-12-11 Thread Lennart Augustsson
On Dec 11, 2006, at 03:50 , Johannes Waldmann wrote: let data Bar = ... in ... If you allow this you need to be very careful about type equality. When is Bar equal to Bar? If it's inside a recursive function, does each invocation get its own Bar? (In SML the answer is yes.) If you d

Re: [Haskell] Num is such a fat and greedy class

2006-12-08 Thread Lennart Augustsson
Oh, come on. It's not that bad. Just start every module with import Prelude() import MyPrelude that's what I do. There's nothing sacred about the Prelude (except a few things used for special syntax). It just happens to be in scope. -- Lennart On Dec 8, 2006, at 15:04 , Dan We

Re: [Haskell] ANNOUNCE: Visual Haskell prerelease 0.2

2006-11-29 Thread Lennart Augustsson
That's great! Thanks for the hard work, Krasimir. One question, where can I find the source? I didn't see anything about that on the download page. -- Lennart On Nov 28, 2006, at 02:30 , Krasimir Angelov wrote: Hello Haskellers, I am happy to announce that there is a prerelease

Re: [Haskell] GADT: call for proper terminology

2006-10-11 Thread Lennart Augustsson
Well, Kent Petersson and I proposed them as an addition to Haskell in 1994, so they are not that new. :) -- Lennart http://web.cecs.pdx.edu/~sheard/papers/silly.pdf On Oct 11, 2006, at 09:47 , Paul Hudak wrote: Lennart Augustsson wrote: Well, I think the GADT type definition

Re: [Haskell] GADT: call for proper terminology

2006-10-11 Thread Lennart Augustsson
On Oct 11, 2006, at 03:58 , Bulat Ziganshin wrote: Hello oleg, Wednesday, October 11, 2006, 6:12:23 AM, you wrote: Annotate the data type using a GADT: data MyData a where MyCon :: MyData a It helps to reduce confusion about the merits of various features and additions to Haskell if we u

Re: [Haskell] How to define Y combinator in Haskell

2006-09-15 Thread Lennart Augustsson
Well, you can do it with the existing recursion in Haskell let yc f = f (yc f) Or you can encode it with type level recursion and no value recursion by using a recursive data type. -- Lennart On Sep 15, 2006, at 08:11 , Haihua Lin wrote: Hi, Writing yc = \f -> (\x -> f(x x

Re: [Haskell] The GHC typechecker is Turing-complete

2006-08-11 Thread Lennart Augustsson
Just a somewhat related fact: A standard Hindley-Milner type checker (deducer) has the same power as a Turing machine with a finite tape. I.e., the same power as a computer, since they have finite memory. :) -- Lennart On Aug 10, 2006, at 22:04 , Robert Dockins wrote: ... __

Re: [Haskell] (.) . (.)

2006-05-28 Thread Lennart Augustsson
Why not ask the computer? -- Lennart bamse% ghci ___ ___ _ / _ \ /\ /\/ __(_) / /_\// /_/ / / | | GHC Interactive, version 6.4.1, for Haskell 98. / /_\\/ __ / /___| | http://www.haskell.org/ghc/ \/\/ /_/\/|_| Type :? for help. Loading package base

Re: [Haskell] Platform-dependent behaviour with functions on NaN

2006-04-14 Thread Lennart Augustsson
Yeah, I think it boils down to different representations of NaN on different platform. I guess I forgot to test for NaN when I wrote (the C code for) decodeFloat. It should generate some consistent result. On the other hand, if you have code that possible divides by 0 and don't check for it, wel

Re: [Haskell] Re: Boxing (Day) Question

2005-12-26 Thread Lennart Augustsson
Ashley Yakeley wrote: In article <[EMAIL PROTECTED]>, Lennart Augustsson <[EMAIL PROTECTED]> wrote: On the whole it looks like you want type variables with kind #. There are very good implementation reasons for not allowing this. If you had type variables of kind # you could have

Re: [Haskell] Boxing (Day) Question

2005-12-26 Thread Lennart Augustsson
Niklas Sorensson wrote: That's what I thought. But I'm still curious when it is used, and why it isn't a suitable solution for unboxed polymorhic functions in most cases. But getting most cases right isn't enough, you have to get all cases right. So if you want to have unboxed polymorphic func

Re: [Haskell] Boxing (Day) Question

2005-12-26 Thread Lennart Augustsson
On the whole it looks like you want type variables with kind #. There are very good implementation reasons for not allowing this. If you had type variables of kind # you could have polymorphic functions over unboxed values. But since the values are unboxed they don't have a uniform representation

Re: [Haskell] Djinn and the inverse of a typechecker

2005-12-15 Thread Lennart Augustsson
[EMAIL PROTECTED] wrote: In the following example we will be using a simplified (and perhaps, more elegant) system than the one used in the class. The typechecker uses only conjunctions and disjunctions. The evaluator of the logic system is complete: if there is a solution, the evaluator will alw

[Haskell] Re: Cabal support for djinn

2005-12-14 Thread Lennart Augustsson
Thanks! It's in the next version. I'll also make the license less restrictive. (With no explicit copyright information in the files the default copyright applies, i.e., I have all rights.) -- Lennart Henning Günther wrote: Hi Lennart, I really like djinn and decided to write a quick

Re: [Haskell] Re: Announcing Djinn, new version 2004-12-13

2005-12-14 Thread Lennart Augustsson
Well, the proof search is terminating (and complete) so it has to stop somewhere. That happens to be result with this particular search strategy. -- Lennart Chung-chieh Shan wrote: Lennart Augustsson <[EMAIL PROTECTED]> wrote in article <[EMAIL PROTE

[Haskell] Announcing Djinn, new version 2004-12-13

2005-12-13 Thread Lennart Augustsson
There is a new version of Djinn available, with two notable new features: Haskell data types can be defined and the found functions are sorted (heuristically) to present the best one first. To play with Djinn do a darcs get http://darcs.augustsson.net/Darcs/Djinn or get http://darcs.augustsso

[Haskell] Announcing Djinn, version 2004-12-11, a coding wizard

2005-12-11 Thread Lennart Augustsson
Howdy, y'all! I've written a small program that takes a (Haskell) type and gives you back a function of that type if one exists. It's kind of fun, so I thought I'd share it. It's probably best explained with a sample session. calvin% djinn Welcome to Djinn version 2005-12-11. Type :h to g

Re: [Haskell] [ANNOUNCE] yhc - York Haskell Compiler

2005-11-15 Thread Lennart Augustsson
Simon Peyton-Jones wrote: | I am aware of some experiments with alternative back-ends for ghc, but I | don't know of any work on a ghc back-end generating portable bytecode. | A few years ago some work was done towards a ghc-hugs fusion, but in the | end hugs remained separate and the ghc people

Re: [Haskell] specification of sum

2005-11-02 Thread Lennart Augustsson
Simon Marlow wrote: On 02 November 2005 00:20, Lennart Augustsson wrote: Furthermore, ghc has a WRONG definition of sum. Surely not... sum is defined by Haskell 98 as: sum = foldl (+) 0 and this is exactly what GHC provides. Furthermore we have specialised strict versions for Int and

Re: [Haskell] specification of sum

2005-11-01 Thread Lennart Augustsson
Cale Gibbard wrote: On 01/11/05, Sebastian Sylvan <[EMAIL PROTECTED]> wrote: On 11/1/05, Scherrer, Chad <[EMAIL PROTECTED]> wrote: I was wondering... In my experience, it's worked much better to use sum' = foldl' (+) 0 than the built-in "sum" function, which leaks memory like crazy for larg

Re: [Haskell] strictness of putChar: report incomplete?

2005-10-06 Thread Lennart Augustsson
Simon Marlow wrote: I agree with you. And that is how it used to be, but then some people didn't think that was convenient enough so now we are stuck with a seq that (IMHO) stinks. :) Having a seq that works on anything is occasionally very useful for fixing space leaks, and the type class ve

Re: [Haskell] strictness of putChar: report incomplete?

2005-10-05 Thread Lennart Augustsson
Wolfgang Jeltsch wrote: Am Mittwoch, 5. Oktober 2005 16:22 schrieb Simon Marlow: [...] Also, GHC's optimiser currently treats (_|_ :: IO a) and (do _|_; return ()) as interchangeable, which is naughty, and people have occasionally noticed, but the benefits can sometimes be huge. It is this

Re: [Haskell] Literal for Infinity

2005-10-02 Thread Lennart Augustsson
Not all FP representations have infinity, and even if they do, they might only have one infinity. -- Lennart Frederik Eaton wrote: I've previously mentioned that I would like to see an 'instance Bounded Double' etc., as part of the standard, which would use 1/0 for maxBound, or the larg

Re: [Haskell] Literal for Infinity

2005-09-29 Thread Lennart Augustsson
The RealFloat class has a number of methods for testing various properties of a FP number: isNaN :: a -> Bool isInfinite :: a -> Bool isDenormalized :: a -> Bool isNegativeZero :: a -> Bool isIEEE :: a -> Bool If you really want to create an Infinity, I suggest 1/0, but not all FP forma

Re: [Haskell] Haskell SOE Question

2005-07-27 Thread Lennart Augustsson
But who said you should remove the import of word32ToInt? It was only fromIntegral that was discussed. -- Lennart Alex Edelsburg wrote: Thanks for your suggestion. --import Word (fromIntegral) --import Word (word32ToInt) I removed both import statements from the code and tried to run ag

Re: [Haskell] offside rule question

2005-07-13 Thread Lennart Augustsson
with {}. Thanks, Frederik On Thu, Jul 14, 2005 at 02:42:53AM +0200, Lennart Augustsson wrote: That's how it is defined in the Haskell definition. But there is a reason. The offside rule (or whatever yoy want to call it) is there to give visual cues. If you were allowed to override these e

Re: [Haskell] offside rule question

2005-07-13 Thread Lennart Augustsson
That's how it is defined in the Haskell definition. But there is a reason. The offside rule (or whatever yoy want to call it) is there to give visual cues. If you were allowed to override these easily just because it's parsable in principle then your code would no longer have these visual cues

Re: [Haskell] Dynamic binding

2005-06-23 Thread Lennart Augustsson
er the typing precision of OO. So I am willing to give in on b) but I maintain a) and I really miss extensible datatypes :-) Ralf (doing too much C# these days I guess) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Lennart Augustsson Sent:

Re: [Haskell] Dynamic binding

2005-06-23 Thread Lennart Augustsson
Andrew Ward wrote: Hi All, In Simon Thompson's The Craft of Functional Programming Second Edition, page 226, it is mentioned that Laufer (1996) describes a Haskell extension to allow dynamic binding. I was wondering if this has been implemented as an extension in any of the haskell compilers,

Re: [Haskell] instance Bounded Double

2005-03-13 Thread Lennart Augustsson
that portability seems like another reason to define a Bounded instance for Double. That way users could call 'maxBound' and 'minBound' rather than 1/0 and -(1/0)... Frederik On Fri, Mar 11, 2005 at 11:10:33AM +0100, Lennart Augustsson wrote: Haskell does not guarantee that 1/0 is w

Re: [Haskell] instance Bounded Double

2005-03-13 Thread Lennart Augustsson
seems like another reason to define a Bounded instance for Double. That way users could call 'maxBound' and 'minBound' rather than 1/0 and -(1/0)... Frederik On Fri, Mar 11, 2005 at 11:10:33AM +0100, Lennart Augustsson wrote: Haskell does not guarantee that 1/0 is well defined

Re: [Haskell] instance Bounded Double

2005-03-11 Thread Lennart Augustsson
Haskell does not guarantee that 1/0 is well defined, nor that -(1/0) is different from 1/0. While the former is true for IEEE floating point numbers, the latter is only true when using affine infinities. -- Lennart Frederik Eaton wrote: Shouldn't Double, Float, etc. be instances of Bounded?

Re: [Haskell] Typing in haskell and mathematics

2005-01-31 Thread Lennart Augustsson
Cale Gibbard wrote: Another common thing which is done whenever convenient is to treat Cartesian product as associative, and naturally identify the spaces (A x A) x A and A x (A x A), along with perhaps A^3 which might be functions f: {0,1,2} -> A, It's fine to identify (A x A) x A with A x (A x A

Re: [Haskell] Newbie : How come that cyclic recursive lists are efficient ?

2005-01-24 Thread Lennart Augustsson
It doesn't have to be a top level definition, it works anyway. -- Lennart Bruno Abdon wrote: 'hamming', in your code, is a top-level definition. When used three times inside its own definition, it's the same variable being used three times. You don't recompute a variable value in order to r

Re: [Haskell] Re: "Never" GADT Function?

2005-01-08 Thread Lennart Augustsson
Well, this compiles: data T a where BoolT :: T Bool IntT :: T Int neverT' :: T a -> x neverT' BoolT = error "Bool" neverT' IntT = error "Int" neverT :: T Char -> x neverT = neverT' But it uses error for the unreachable cases, maybe not what you want. -- Lennart Ashley Yakeley wrot

Re: [Haskell] Real life examples

2004-11-28 Thread Lennart Augustsson
But surely any device driver is parametrized on the exact IO addresses? How would you be able to handle multiple devices otherwise? Adrian Hey wrote: On Friday 26 Nov 2004 11:39 am, Keean Schupke wrote: Adrian Hey wrote: Well it can be written in Haskell, but not using a module that was specifical

Re: [Haskell] Better Exception Handling

2004-11-26 Thread Lennart Augustsson
Tomasz Zielonka wrote: On Thu, Nov 25, 2004 at 07:52:43PM +0100, Lennart Augustsson wrote: As I'm sure you have gathered from all the answers you can't have the latter and keep Haskell pure. But there is an interesting alternative (at least theoretically). You could have a fun

Re: [Haskell] A puzzle and an annoying feature

2004-11-25 Thread Lennart Augustsson
Keean Schupke wrote: Daan Leijen wrote: You are right, I feel like that too: one should expect that the type checker can figure this out, and perhaps it is even really useful. On the other hand, suppose you decide later to export the class, and suddenly your code would no longer type check. I must

Re: [Haskell] A puzzle and an annoying feature

2004-11-25 Thread Lennart Augustsson
Daan Leijen wrote: You are right, I feel like that too: one should expect that the type checker can figure this out, and perhaps it is even really useful. On the other hand, suppose you decide later to export the class, and suddenly your code would no longer type check. The fact that adding an expo

Re: [Haskell] Better Exception Handling

2004-11-25 Thread Lennart Augustsson
Jules Bean wrote: By the same token, you can just stick the function strangeReadFile :: FilePath -> String into the language. As long as it is memoized, always returning the same value, it doesn't break beta-reduction. I call it 'strange' because the time that the file is actually read is not g

Re: [Haskell] Better Exception Handling

2004-11-25 Thread Lennart Augustsson
Tomasz Zielonka wrote: On Thu, Nov 25, 2004 at 07:52:43PM +0100, Lennart Augustsson wrote: As I'm sure you have gathered from all the answers you can't have the latter and keep Haskell pure. But there is an interesting alternative (at least theoretically). You could have a fun

Re: [Haskell] Better Exception Handling

2004-11-25 Thread Lennart Augustsson
John Goerzen wrote: So why do we have: catchJust :: (Exception -> Maybe b) -> IO a -> (b -> IO a) -> IO a instead of: catchJust :: (Exception -> Maybe b) -> (c -> a) -> c -> (b -> a) -> a As I'm sure you have gathered from all the answers you can't have the latter and keep Haskell pure. But there

Re: [Haskell] A puzzle and an annoying feature

2004-11-25 Thread Lennart Augustsson
Graham Klyne wrote: I have a concern with this, if I understand the issue correctly. Suppose I have a source module that compiles and runs correctly. Now suppose I add a restricted (selective) import statement to the file, explicitly introducing a name that I know does not clash with anything in

Re: [Haskell] A puzzle and an annoying feature

2004-11-25 Thread Lennart Augustsson
Of course it can. I might do it myself. :) -- Lennart Keean Schupke wrote: I have already asked Simon PJ if this can be implemented in GHC... So if more people ask for it, it might get done! Keean Lennart Augustsson wrote: Here is a small puzzle. -- The following generates a type

Re: [Haskell] A puzzle and an annoying feature

2004-11-25 Thread Lennart Augustsson
Daan Leijen wrote: Keean Schupke wrote: No, closed classes are different, here we are talking about lazy overlap resolution, so if at _call_ time only one instance fits we choose it. Closing a class is different. A "closed class" directive however is an explicit specification that makes the inte

Re: [Haskell] Real life examples

2004-11-25 Thread Lennart Augustsson
ECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marcin 'Qrczak' Kowalczyk Sent: den 25 november 2004 11:49 To: [EMAIL PROTECTED] Subject: Re: [Haskell] Real life examples Lennart Augustsson <[EMAIL PROTECTED]> writes: An "easy" way to prove it is to provide an equivalent imp

Re: [Haskell] Real life examples

2004-11-25 Thread Lennart Augustsson
I don't necessarily agree that you can do this trick in all implementations of Dynamic and Typable. You're relying on more things than the interface to Dynamic promises. Your fromDynamic could very well return Nothing. And should! But that doesn't matter. The unsafeCast function doesn't really w

Re: [Haskell] A puzzle and an annoying feature

2004-11-25 Thread Lennart Augustsson
[EMAIL PROTECTED] wrote: G'day all. Quoting Lennart Augustsson <[EMAIL PROTECTED]>: Here is a small puzzle. You can understand this one because the closed world hypothesis doesn't apply to type context inference. I have no problem understanding the technical reason for this.

Re: [Haskell] Real life examples

2004-11-25 Thread Lennart Augustsson
Ben Rudiak-Gould wrote: Lennart Augustsson wrote: > What do you mean when you say the interface is pure? > > If your module is really pure then there should be an implemenation > of it (which could have really bad complexity) with the same observable > behaviour that uses on

Re: [Haskell] Real life examples

2004-11-24 Thread Lennart Augustsson
Ben Rudiak-Gould wrote: Yes it does. :-) If each Haskell environment ships with a correct implementation of the library, then its interface is the only part that matters. If the unsafePerformIO hack doesn't work in your new Haskell compiler, you can replace it with some other magic that does wor

[Haskell] A puzzle and an annoying feature

2004-11-24 Thread Lennart Augustsson
Here is a small puzzle. -- The following generates a type error: f :: Char -> Char f c = let x = g c in h x -- But this definition does not: f :: Char -> Char f c = let x :: Bool x = g c in h x Furthermore, replacing Bool by any other type in the latter definition will alw

Re: [Haskell] Real life examples

2004-11-24 Thread Lennart Augustsson
George Russell wrote: I think their disadvantages are overstated. Glasgow Haskell uses them lots, And I bet the implementors wish they hadn't used them as much. ;) Now we have some weird division of flags into static and dynamic, for instance. Global (top level) variables can be very convenient,

Re: Top Level TWI's again was Re: [Haskell] Re: Parameterized Show

2004-11-24 Thread Lennart Augustsson
Adrian Hey wrote: On Tuesday 23 Nov 2004 9:29 am, Keean Schupke wrote: myDriver :: (Chan in,Chan out) -> State -> IO State myDriver (in,out) state = do -- read commands from in -- process commands -- reply on out myDriver (in,out) new_state How does this solve the pro

Re: Top Level TWI's again was Re: [Haskell] Re: Parameterized Show

2004-11-24 Thread Lennart Augustsson
Adrian Hey wrote: On Tuesday 23 Nov 2004 9:39 am, Lennart Augustsson wrote: I find it hard to argue these things in the abstract. Could you post us a (simplified) signature for a module where you are using top level variables? Maybe that way I can be convinced that you need them. Or vice versa

Re: [Haskell] Real life examples

2004-11-24 Thread Lennart Augustsson
Tomasz Zielonka wrote: On Tue, Nov 23, 2004 at 08:50:45PM -0800, John Meacham wrote: Atom.hs from ginsu.. This is perhaps the best example, and an incredibly useful piece of code for anyone struggling with space problems out there. it provides data Atom = ... (abstract) instance Ord Atom in

Re: [Haskell] Re: Global Variables and IO initializers

2004-11-23 Thread Lennart Augustsson
[EMAIL PROTECTED] wrote: No. I mean by the "Haskell language" what is described in the Haskell 98 Report. unsafePerformIO is not part of the language, it is a value defined by one of the standard hierarchical libraries. unsafePerformIO is part of the FFI addendum to the H98 report. So I think

Re: [Haskell] Global Variables and IO initializers

2004-11-23 Thread Lennart Augustsson
George Russell wrote: (3) It needs no extensions to the Haskell language, and only fairly standard hierarchical libraries like Data.IORef. It uses unsafePerformIO which is very much an extension to Haskell. :) -- Lennart ___ Haskell mailing list [

Re: Top Level TWI's again was Re: [Haskell] Re: Parameterized Show

2004-11-23 Thread Lennart Augustsson
Adrian Hey wrote: As for openDevice, if a device should only allow a single open I would assume this is part of the device driver in the operating system? (I know this is shifting blame. But I think it shifts it to where it belongs. In the OS there will be an "open" flag per device.) IOW there i

Re: Top Level TWI's again was Re: [Haskell] Re: Parameterized Show

2004-11-22 Thread Lennart Augustsson
Adrian Hey wrote: But toplevel things with identity (TWI) are evil as well, *especially* if they are easy to use. Just repeating this again and again doesn't make it any more true. Neither you or any of the other nay-sayers have provided any evidence or credible justification for this assertion, n

Re: [Haskell] Re: Parameterized Show

2004-11-16 Thread Lennart Augustsson
George Russell wrote: Since it hasn't been mentioned yet I should also point people once again to "Functional Pearl: Implicit Configurations" by Oleg and Chung-chieh Shan, which ingeniously uses polymorphic recursion to construct type class instances at run time. If there's a safe and sane way t

Re: [Haskell-cafe] Re: [Haskell] Re: Global Variables and IO initializers

2004-11-08 Thread Lennart Augustsson
Jules Bean wrote: Yes... a lot of the example we have seen here are 'just' handles. newIORef creates handles. Something many programmers would like is the ability to create fresh handles at the toplevel... Yes, I hear what they want. That doesn't mean I think it's a good idea. Top level things

Re: [Haskell-cafe] Re: [Haskell] Re: Global Variables and IO initializers

2004-11-08 Thread Lennart Augustsson
Keean Schupke wrote: Adrian Hey wrote: The first step to solving a problem is to at least recognise that it exists. What is "bizarre" is that so many folk seem to be in denial over this. Perhaps you would like to show me your solution to the "oneShot" problem. Why are you unable to give a concre

Re: [Haskell-cafe] Re: [Haskell] Re: Global Variables and IO initializers

2004-11-08 Thread Lennart Augustsson
Adrian Hey wrote: 4- They already exist (stdin,stout,stderr) and I don't recall anybody ever complaining about this. stdin, stdout, and stderr are not global variables. They are just handles. One possible implementation of handles is as an Int. So stdin is no more a global variable than 0. Of

Re: [Haskell] Re: Global Variables and IO initializers

2004-11-08 Thread Lennart Augustsson
Adrian Hey wrote: Why are top level IORefs any worse than other IORefs (for example)? Because global variables are just BAD. They have been considered bad a long time, it's not a Haskell thing. If you really grok the functional way of doing things there should be *very*, *very* few times you need

Re: [Haskell] Correct interpretation of the curry-howard isomorphism

2004-04-23 Thread Lennart Augustsson
JP Bernardy wrote: I'd say, check what any primitive 'proves' before using it. Besides that, calling other functions is ok. Except for general recursion. coerce :: a -> b coerce = coerce -- Lennart ___ Haskell mailing list [EMAIL PROTECTED] http://www.h

Re: [Haskell] Re: Data.Set whishes

2004-02-20 Thread Lennart Augustsson
I think it's because of tradition. Originally Haskell didn't have qualified names, only renaming. (Which, IMHO, was a wrong decision in the original Haskell design.) -- Lennart Koen Claessen wrote: | http://www.haskell.org/hierarchical-modules/libraries/library-design.html I have always wonde

Re: getting the path to the executing program

2004-01-08 Thread Lennart Augustsson
Hal Daume III wrote: is there a function, related to getProgName, which returns the (absolute) path to the current program? Well, the absolute path name is not necessarily unique, nor is it guaranteed to exist. :) -- Lennart ___ Haskell mailing list [E

Re: no continuations

2003-12-30 Thread Lennart Augustsson
I'm not sure what your question means. You can make your own continuations, so in that sense Haskell has them. But perhaps you're asking why Haskell lacks something like call/cc in Scheme which allows you to grab the current continuation? This doesn't play very well with graph reduction (which mos

Re: Haskell naming conventions

2003-12-25 Thread Lennart Augustsson
Sean L. Palmer wrote: class Eq a where (==) :: a -> a -> Bool That actually declares a /type class/, not a class. So why the use of the keyword class? Is it done merely to confuse C++ and Java programmers? The concept of type class in Haskell apparently roughly corresponds to the c

Re: Why are strings linked lists?

2003-11-28 Thread Lennart Augustsson
Glynn Clements wrote: What Unicode support? Simply claiming that values of type Char are Unicode characters doesn't make it so. Just because some implementations lack toUpper etc. doesn't mean they all do. Hbc has had those implemented for maybe 10 years. -- Lennart __

Re: a type question

2003-11-26 Thread Lennart Augustsson
rui yang wrote: Suppose I have a function: funcmap :: a->b->c can I use type synonyms to describe a new type like this: Type Funcmap = a->b>c ? First, it's 'type' not 'Type'. Second, you want '->' not '>'. Third, all type variables in the RHS must be on the LHS. So, we get type Funcmap a b c

Re: Enum on Float/Double

2003-10-22 Thread Lennart Augustsson
t positive float? On Tue, 21 Oct 2003, Lennart Augustsson wrote: So this has been a while, but i think that decodeFloat, incrementing the mantissa, encodeFloat might work. But then again, it might not. :) -- Lennart Hal Daume III wrote: My preference would be for succ (+-0) to return the smalles

Re: Enum on Float/Double

2003-10-21 Thread Lennart Augustsson
So this has been a while, but i think that decodeFloat, incrementing the mantissa, encodeFloat might work. But then again, it might not. :) -- Lennart Hal Daume III wrote: My preference would be for succ (+-0) to return the smallest positive real, since then you could define succ x to be the uniq

Re: IO behaves oddly if used nested

2003-10-02 Thread Lennart Augustsson
Derek Elkins wrote: If I'm not mistaken, the Report restricts main's type to be, at least, IO a. Anyways, it's perfectly sensible to return anything. The RTS simply discards it. The above example as an entire program is an IO action that returns an IO action that is discarded by the RTS. You're

Re: IO behaves oddly if used nested

2003-10-02 Thread Lennart Augustsson
Alastair Reid wrote: Another question with a trivial answer, what is the result of: main :: IO (IO ()) main = return (putStr "Hello World!") It is a computation which, if executed, will print "Hello World" Clearly it also shows the relation between IO and chosen evaluation strategy. This

Re: loop through the list...

2003-08-10 Thread Lennart Augustsson
This really sounds a lot like home work. :) -- Lennart Fredrik Petersson wrote: hi again... :) Ok assume i got this list of tuples [(10,1),(20,2),(30,3)] where i in (i,j) is a index, i want to go through the list and add a number witch matches the best index. Like 18 should give me [(10,1),(

Re: Typesafe MRef with a regular monad

2003-06-09 Thread Lennart Augustsson
Simon Marlow wrote: Simon P.J. writes: ... So it's reasonable that there should be some language extension. I'm just looking for the minimal such extension. unsafeCoerce# is quite a minimal extension :-) It's a minimal extension, but it's not an extension that provides any insight. :)

Re: int to float problem

2003-02-28 Thread Lennart Augustsson
Use the Prelude function realToFrac. -- Lennart Mike T. Machenry wrote: Hello, I am having a problem. I recently desided I wanted a bunch function to return float instead of Int. I changed their type and wrote a new function that returned a float. I figured it'd be okay if all the others st

Re: ANNOUNCE: 0th International Obfuscated Haskell Code Contest

2003-02-14 Thread Lennart Augustsson
Shae Matijs Erisson wrote: The following message is a courtesy copy of an article that has been posted to comp.lang.functional as well. In the spirit of http://ioccc.org/ Bring us your poor, weary, downtrodden, and unreadable source code. Come to the 0th INTERNATIONAL OBFUSCATED HASKELL C

Re: Time library underspecified

2002-11-14 Thread Lennart Augustsson
Yes, I totally agree. The current time library is pretty broken. -- Lennart John Meacham wrote: yes! I was just wrestling with this yesterday. I finally gave up and looked inside ghc's (TOD Integer Integer) directly because the Time library as it currently stands is somewhat less than usefu

  1   2   3   4   >