Re: [Haskell-cafe] How to write a pure String to String function in Haskell FFI to C++

2013-06-02 Thread Thomas Davie
On 2 Jun 2013, at 16:48, Brandon Allbery wrote: > On Sun, Jun 2, 2013 at 7:22 PM, Ting Lei wrote: > In particular, I wanted to avoid having an IO in the return type because > introducing the impurity > (by that I mean the IO monad) for this simple task is logically unnecessary. > All examples

Re: [Haskell-cafe] Calling OpenGL functions from multiple threads

2012-02-11 Thread Thomas Davie
Just for reference – glX functions are not OpenGL functions at all, they're also not extensions to OpenGL, so I'd be very surprised if they could be got at from the Haskell GL bindings. glX is instead a library for creating OpenGL contexts (and working with them) for X11. As the Haskell bindin

Re: [Haskell-cafe] Poll: Do you want a mascot?

2011-11-23 Thread Thomas Davie
Yes Reasoning: Haskell has the image of being unfriendly, assenine, filled with crazy symbols, and the dreaded MATHS! A mascot would say "you know what, this is fun!" if (*ra4 != 0xffc78948) { return false; } On 23 Nov 2011, at 19:40, Alexander Bernauer wrote: > Yes > > PS: Why not usi

Re: [Haskell-cafe] A Mascot

2011-11-22 Thread Thomas Davie
On 22 Nov 2011, at 15:40, Karol Samborski wrote: > And what about a cat? The cat is associated with elegance and a kind of magic. > Please take a look: http://origami.bieszczady.pl/images/kot.png My biggest criticism of the more recent ones is simply not to get carried away with magic haskell ex

Re: [Haskell-cafe] bitSize

2011-08-30 Thread Thomas Davie
That's reasonably believable – streaming units on current CPUs can execute multiple floating point operations per cycle. if (*ra4 != 0xffc78948) { return false; } On 30 Aug 2011, at 02:30, Richard O'Keefe wrote: > > On 29/08/2011, at 10:32 PM, Maciej Marcin Piechotka wrote: >> >> According to

Re: [Haskell-cafe] Automatic Reference Counting

2011-07-02 Thread Thomas Davie
On 2 Jul 2011, at 17:52, Chris Smith wrote: > On Sat, 2011-07-02 at 17:35 +0100, Thomas Davie wrote: >> It's interesting that you cite that GC is both faster and lower memory >> overhead – Apple's stated reasons for implementing this were that GC >> was both too s

Re: [Haskell-cafe] Automatic Reference Counting

2011-07-02 Thread Thomas Davie
On 2 Jul 2011, at 17:18, Thomas Schilling wrote: > Reference counting usually has much higher overheads than garbage > collection and is tricky to parallise. It's main advantage is quicker > release of memory. > > I believe the main feature of ARC is that the user does not need to > manually ke

[Haskell-cafe] Automatic Reference Counting

2011-07-02 Thread Thomas Davie
Hi guys, Apple recently announced a new static analysis in Clang called ARC (Automatic Reference Counting). The idea is to provide what GC provides (zero memory management code by the programmer), but not to incur the runtime penalty of having to have the GC run. It seems to be extremely effe

Re: [Haskell-cafe] Python is lazier than Haskell

2011-04-29 Thread Thomas Davie
On 29 Apr 2011, at 10:42, Ben Lippmeier wrote: > > On 29/04/2011, at 6:08 PM, Malcolm Wallace wrote: > >> On 29 Apr 2011, at 05:38, Ben Lippmeier wrote: >> >>> Laziness at the value level causes space leaks, >> >> This is well-worn folklore, but a bit misleading. > > :-) Like permanent m

Re: [Haskell-cafe] Python is lazier than Haskell

2011-04-27 Thread Thomas Davie
On 27 Apr 2011, at 10:30, Henning Thielemann wrote: > > I like to apply for the quote of the week. :-) > > "If Haskell is great because of its laziness, > then Python must be even greater, > since it is lazy at the type level." > > Dynamically typed languages only check types if they have

Re: [Haskell-cafe] bug in Prelude.words?

2011-03-28 Thread Thomas Davie
On 28 Mar 2011, at 17:20, malcolm.wallace wrote: >> Consider an HTML page with that "sentence" displayed on it. If you ask the >> viewer of the page how many words are in the sentence, then surely you will >> get the answer 3? > > > But what about the author? Surely there is no reason to us

Re: [Haskell-cafe] Type problem

2011-02-26 Thread Thomas Davie
Because applying f to the list is not the same thing is applying bind to the list and f. Bob On 26 Feb 2011, at 20:17, michael rice wrote: > Why? Shouldn't this work for any type a? > > Michael > > == > > f :: [a] -> [a] > f l = do x <- l > return x > > == > > *Mai

[Haskell-cafe] ghci command line execution

2011-02-10 Thread Thomas Davie
A while ago I remember someone showing me some tool, I *think* ghci that allowed you to pass it a function of type String -> String as an input, and have it simply run that function on stdin (presumably using interact) to achieve useful things like this... $ cat myFile.txt | ghci -e 'unlines .

Re: [Haskell-cafe] Reader monad wrapping State monad

2011-02-03 Thread Thomas Davie
Is the idea here merely an exercise in using the state monad? This can be easily performed using pure code. Bob On 3 Feb 2011, at 19:18, michael rice wrote: > Given the first program, it seems that the unchanging first element of the > tuple could be handled by a Reader monad, leading to the

Re: [Haskell-cafe] GHC optimizations and unsafePerformIO - Was: Data.Typeable TypeRep Ord instance.

2011-01-01 Thread Thomas Davie
On 1 Jan 2011, at 12:38, Andreas Baldeau wrote: > Thinking about this there might be one problem: > > Without having looked further into this I think perfomance might not > be as expected. Using unsafePerformIO affects ghc's optimzations, > doesn't it? > > So I wonder if it's a good idea (from

Re: [Haskell-cafe] Why is Haskell flagging this?

2010-12-18 Thread Thomas Davie
On 17 Dec 2010, at 21:44, Christopher Done wrote: > On 17 December 2010 18:04, michael rice wrote: > === > > f :: [Int] -> IO [Int] > f lst = do return lst > > main = do let lst = f [1,2,3,4,5] > fmap (+1) lst > > The problem is that you are applying fmap to a type

Re: [Haskell-cafe] Serialization of (a -> b) and IO a

2010-11-11 Thread Thomas Davie
On 11 Nov 2010, at 08:36, Luke Palmer wrote: > On Thu, Nov 11, 2010 at 12:53 AM, Jesse Schalken > wrote: >> I have had a look at hs-plugins, but it is unclear how to derive a simple >> pair of functions `(a -> b) -> ByteString` and `ByteString -> Either >> ParseError (a -> b)`, for example, from

Re: [Haskell-cafe] ANNOUNCE: tls, native TLS/SSL protocolimplementation

2010-10-11 Thread Thomas Davie
> > While I agree with the potential benefits, I also worry that you will > end up making something that is far less well tested in practice. For > widely used and fairly low-level libraries like gnutls, openssl and > zlib, I'm just skeptical that the benefits outweigh the risks and costs. > > An

Re: [Haskell-cafe] Generating arbitrary functions with QuickCheck?

2010-09-15 Thread Thomas Davie
On 15 Sep 2010, at 16:29, Matias Eyzaguirre wrote: > Hi, > I'v been reading a small paper/lesson on writing parser combinators in > Haskell, and it seems more or less straightforward. In this case a parser is > defined thusly: >> type Parser a = String -> Maybe (a, String) > And then it goes on

Re: [Haskell-cafe] Re: Do expression definition

2010-09-13 Thread Thomas Davie
On 13 Sep 2010, at 10:28, Gleb Alexeyev wrote: > On 09/13/2010 12:23 PM, Michael Lazarev wrote: >> 2010/9/13 Henning Thielemann: >>> It means that variables bound by let, may be instantiated to different types >>> later. >> >> Can you give an example, please? > > testOk = let f = id in (f 42, f

Re: [Haskell-cafe] On to applicative

2010-08-26 Thread Thomas Davie
On 26 Aug 2010, at 08:01, michael rice wrote: > Hmm... it was my understanding that the example was showing how to *avoid* > having to create a lot of functions that do the same thing but have > different numbers of arguments. > > From the Wiki page: > > "Anytime you feel the need to define

Re: [Haskell-cafe] Re: Can we come out of a monad?

2010-08-11 Thread Thomas Davie
On 11 Aug 2010, at 14:17, Ertugrul Soeylemez wrote: > > There is a fundamental difference between an IO computation's result and > a Haskell function's result. The IO computation is simply a value, not > a function. That's a rather odd distinction to make – a function is simply a value in a fu

Re: [Haskell-cafe] Re: Can we come out of a monad?

2010-08-11 Thread Thomas Davie
On 11 Aug 2010, at 12:39, Ertugrul Soeylemez wrote: > Martijn van Steenbergen wrote: > >> On 8/2/10 7:09, Ertugrul Soeylemez wrote: >>> Given the definition of a Haskell function, Haskell is a pure >>> language. The notion of a function in other languages is not: >>> >>> int randomNumber();

Re: [Haskell-cafe] Re: Can we come out of a monad?

2010-08-01 Thread Thomas Davie
On 1 Aug 2010, at 11:43, Ertugrul Soeylemez wrote: > Ivan Lazar Miljenovic wrote: > >> No, a pure function is one without any side effects. > > There are no functions with side effects in Haskell, unless you use > hacks like unsafePerformIO. Every Haskell function is perfectly > referentially

Re: [Haskell-cafe] lists of arbitrary depth

2010-07-13 Thread Thomas Davie
On 13 Jul 2010, at 10:11, Shlomi Vaknin wrote: > Thank you all for replying! > > I am really beginning my baby steps in this fascinating language, and was > just wondering if it was possible to naturally scan lists with arbitrary > lists (aka trees :) ). Trees aren't lists, Trees are trees...

Re: [Haskell-cafe] Are you a Haskell expert? [How easy is it to hire Haskell programmers]

2010-07-03 Thread Thomas Davie
On 3 Jul 2010, at 11:04, Brandon S Allbery KF8NH wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On 7/3/10 05:57 , Andrew Coppin wrote: >> Agreed. So let me rephrase: Why should _every_ Haskell library involve C? ;-) > > Who says they do, or should? Dons rather implied it... The s

Re: [Haskell-cafe] How easy is it to hire Haskell programmers

2010-07-03 Thread Thomas Davie
On 3 Jul 2010, at 03:39, Don Stewart wrote: > ivan.miljenovic: Hmm, interesting. Applicative and Traversable are two classes I've never used and don't really understand the purpose of. I have no idea what hsc2hs is. I keep hearing finger trees mentioned, but only in connection

Re: [Haskell-cafe] Physical equality

2010-06-28 Thread Thomas Davie
On 28 Jun 2010, at 09:38, José Romildo Malaquias wrote: > Is there in Haskell a non monadic function of type a -> a -> Bool which > test for physical equality of two values? It would return True if only > if both values are the same object in memory. > > For instance: > > value1 = "good" > va

Re: [Haskell-cafe] Proposal: Sum type branches as extended types (as Type!Constructor)

2010-06-03 Thread Thomas Davie
On 3 Jun 2010, at 16:14, Gabriel Riba wrote: > Extending sum types with data constructors would spare runtime errors or > exception control, > > when applying functions to inappropriate branches, as in the example ... > > data List a = Nil | Cons a (List a) -- List!Nil and List!Cons >

Re: [Haskell-cafe] Why Either = Left | Right instead of something like Result = Success | Failure

2010-05-27 Thread Thomas Davie
On 27 May 2010, at 15:25, Ionut G. Stan wrote: > Hi, > > I was just wondering if there's any particular reason for which the two > constructors of the Either data type are named Left and Right. I'm thinking > that something like Success | Failure or Right | Wrong would have been a > little be

Re: [Haskell-cafe] Re: help with Haskell programming

2010-04-18 Thread Thomas Davie
To do this, you need not just fmap (composition), but also ap, or the combined form, liftA2: func = liftA2 (||) Bob On 18 Apr 2010, at 18:21, Keith Sheppard wrote: > Using composition can be tricky with more than one arg. I just want to > be sure you're not really looking for something like: >

Re: [Haskell-cafe] help with Haskell programming

2010-04-18 Thread Thomas Davie
I'm not certain exactly what you mean, but I *think* you mean: func :: (a -> Bool) -> (a -> Bool) func = (not .) Bob On 18 Apr 2010, at 16:35, Mujtaba Boori wrote: > Hello I am kinda newbie in Haskell you can help help me with some programming > > I am trying to make function like for example

[Haskell-cafe] Re: instance Eq (a -> b)

2010-04-14 Thread Thomas Davie
On 14 Apr 2010, at 09:39, Ashley Yakeley wrote: > Thomas Davie wrote: >> I guess this further reinforces my point though – we have a mixture of >> places where we consider _|_ when considering laws, and places where we >> don't consider _|_. This surely need

Re: [Haskell-cafe] Re: instance Eq (a -> b)

2010-04-14 Thread Thomas Davie
On 14 Apr 2010, at 09:35, Jonas Almström Duregård wrote: >>> what about these? >>> f,g :: Bool -> Int >>> f x = 6 >>> g x = x `seq` 6 >> >> As pointed out on #haskell by roconnor, we apparently don't care, this is a >> shame... We only care that x == y => f x == g y, and x == y can't tell if >>

[Haskell-cafe] Re: instance Eq (a -> b)

2010-04-14 Thread Thomas Davie
On 14 Apr 2010, at 09:31, Ashley Yakeley wrote: > On Wed, 2010-04-14 at 09:29 +0100, Thomas Davie wrote: >> It isn't? >> >> fPrelude> fmap id (undefined :: IO ()) >> *** Exception: Prelude.undefined > > ghci is helpfully running the IO action for yo

[Haskell-cafe] Re: instance Eq (a -> b)

2010-04-14 Thread Thomas Davie
On 14 Apr 2010, at 09:25, Ashley Yakeley wrote: > Thomas Davie wrote: >> Because we consider that the Functor laws must hold for all values in the >> type (including bottom). > > This is not so for IO, which is an instance of Functor. "fmap id undefined" > i

[Haskell-cafe] Re: instance Eq (a -> b)

2010-04-14 Thread Thomas Davie
On 14 Apr 2010, at 09:17, Ashley Yakeley wrote: > Thomas Davie wrote: >> Certainly bottom is a value, and it's a value in *all* Haskell types. > > This is a matter of interpretation. If you consider bottom to be a value, > then all the laws fail. For instance, (==) is s

Re: [Haskell-cafe] Re: instance Eq (a -> b)

2010-04-14 Thread Thomas Davie
On 14 Apr 2010, at 09:12, Jonas Almström Duregård wrote: >> f,g :: Bool -> Int >> f x = 6 >> g x = 6 >> >> We can in Haskell compute that these two functions are equal, without >> solving the halting problem. > > what about these? > f,g :: Bool -> Int > f x = 6 > g x = x `seq` 6 As pointed ou

Re: [Haskell-cafe] Re: instance Eq (a -> b)

2010-04-14 Thread Thomas Davie
On 14 Apr 2010, at 09:08, Jonas Almström Duregård wrote: >> f,g :: Bool -> Int >> f x = 6 >> g x = 6 >> >> We can in Haskell compute that these two functions are equal, without >> solving the halting problem. > > Of course, this is the nature of generally undecidable problems. They > are decid

Re: [Haskell-cafe] Re: instance Eq (a -> b)

2010-04-14 Thread Thomas Davie
On 14 Apr 2010, at 09:01, Jonas Almström Duregård wrote: >> But if one did start considering bottom to be a value, one would have to >> distinguish different ones. For instance, (error "ABC") vs. (error >> "PQR"). Obviously this is not finite. > > Nor is it computable, since it must distinguish

Re: [Haskell-cafe] Re: instance Eq (a -> b)

2010-04-14 Thread Thomas Davie
On 14 Apr 2010, at 08:29, Ashley Yakeley wrote: > On Wed, 2010-04-14 at 08:13 +0100, Thomas Davie wrote: >> Your instances of Finite are not quite right: >> >> bottom :: a >> bottom = doSomethingToLoopInfinitely. >> >> instance Finite () where >>

Re: [Haskell-cafe] Re: instance Eq (a -> b)

2010-04-14 Thread Thomas Davie
Your instances of Finite are not quite right: bottom :: a bottom = doSomethingToLoopInfinitely. instance Finite () where allValues = [(), bottom] instance Finite Nothing where allValues = [bottom] Though at a guess an allValuesExculdingBottom function is also useful, perhaps the class should

Re: [Haskell-cafe] Re: Haskell.org re-design

2010-04-07 Thread Thomas Davie
On 7 Apr 2010, at 02:53, Ben Millwood wrote: > On Wed, Apr 7, 2010 at 2:22 AM, Thomas Schilling > wrote: >> I have >> set a maximum width on purpose so that it doesn't degrade too badly on >> big screens. > > I've never really trusted this argument - it's not required that the > browser window

Re: [Haskell-cafe] Re: Haskellers hate GUIs!!

2010-04-02 Thread Thomas Davie
On 2 Apr 2010, at 21:01, Brandon S. Allbery KF8NH wrote: > On Apr 2, 2010, at 15:21 , Thomas Schilling wrote: >> On 2 April 2010 20:15, Brandon S. Allbery KF8NH wrote: >>> On Apr 2, 2010, at 10:41 , David Leimbach wrote: >>> Having said that, are there any plans to make it really easy to get gtk

Re: [Haskell-cafe] [OT?] Haskell-inspired functions for BASH

2010-04-01 Thread Thomas Davie
Unfortunately though, h4sh seems to be broken, for one, there's no fps package (apparently required), and hsplugins won't build with 6.12.1. Bob On 1 Apr 2010, at 15:41, Jeremy Shaw wrote: > How about: > > http://www.cse.unsw.edu.au/~dons/h4sh.html > > It brings a lot of familiar Haskell func

Re: [Haskell-cafe] Hackape package lackage

2010-03-22 Thread Thomas Davie
I'd love to see that map normalised by the population of the country – would be interesting to see where Haskell is popular. Bob On 22 Mar 2010, at 16:22, Don Stewart wrote: > We're watching *massive* traffic right now due to HP release. > It's not down, just very very busy. > > For fun, here'

Re: [Haskell-cafe] Re: [Haskell-beginners] map question

2009-09-18 Thread Thomas Davie
On 18 Sep 2009, at 04:32, Gregory Propf wrote: Heh, perhaps we should petition to have a new computer key and symbol added to the world's way of writing maths, something like maybe a downward angled slash to mean prefix (-) Such a symbol already exists, but isn't in the ASCII set: (-) (un

Re: [Haskell-cafe] Snow Leopard Breaks GHC

2009-08-29 Thread Thomas Davie
If it is closed, it is fixed in the HEAD. Any ideas how to get hold of a copy of HEAD, when my Haskell compiler currently outputs rubbish? Bob ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-c

Re: [Haskell-cafe] ANNOUNCE: The Haskell Platform 2009.2.0.2

2009-08-02 Thread Thomas Davie
I tried the Mac OS X package yesterday, after getting frustrated with random crashes in my broken GHC 6.9 install... It worked flawlessly, and got me set up in minutes. Great job everyone associated with building this installer -- it's now definitely my preferred way of getting GHC on a ma

Re: [Haskell-cafe] ANN: Leksah 0.6

2009-07-24 Thread Thomas Davie
On 24 Jul 2009, at 18:01, Hamish Mackenzie wrote: 2009/7/25 Thomas Davie : The new detach feature is great, it makes it much more usable for OS X users, but there's a small problem – if you detach the main source window (from the default config), you end up with a window containing

Re: [Haskell-cafe] ANN: Leksah 0.6

2009-07-24 Thread Thomas Davie
On 24 Jul 2009, at 15:52, Hamish Mackenzie wrote: Hi, Just a quick note to let people know we released a new version of Leksah this week. Thanks for the help and feedback on the previous version. We have done our best to add the features we thought were most pressing. Please give it a go an

Re: [Haskell-cafe] what about adding a HIDE pragma ?

2009-07-22 Thread Thomas Davie
On 22 Jul 2009, at 14:53, Bulat Ziganshin wrote: Hello Marc, Wednesday, July 22, 2009, 4:28:49 PM, you wrote: So does it make sense to add this information using pragmas? pragmas shouldn't change program behavior or alter whether program may be compiled of course, LANGUAGE pragmas violate

Re: [Haskell-cafe] Python vs Haskell in tying the knot

2009-07-17 Thread Thomas Davie
On 17 Jul 2009, at 12:41, Cristiano Paris wrote: Thank you all for your answers and sorry for the delay I'm writing this message but before replying, I wanted to be sure to understand your arguments! Now, I'm starting to get into this "tying the knot" thing and understand why the Haskell versi

Re: [Haskell-cafe] Leaner Haskell.org frontpage

2009-07-16 Thread Thomas Davie
On 15 Jul 2009, at 06:03, Richard O'Keefe wrote: On Jul 10, 2009, at 6:14 PM, Thomas Davie wrote: In my mind, the front page is for nothing more than enticing people to use Haskell for long enough to look at a second page where all the useful stuff is if you are a haskell programmer

Re: [Haskell-cafe] RE: Haskell as a first language?

2009-07-14 Thread Thomas Davie
On 14 Jul 2009, at 13:48, Duncan Coutts wrote: On Tue, 2009-07-14 at 03:01 -0700, Michael Vanier wrote: Charles, Haskell is a wonderful language (my favorite language by far) but it is pretty difficult for a beginner. In fact, it is pretty difficult for anyone to learn in my experience,

Re: [Haskell-cafe] What to say about Haskell?

2009-07-14 Thread Thomas Davie
On 14 Jul 2009, at 15:30, Patai Gergely wrote: Hello all, I was asked to give a one-hour 'introductory' seminar on Haskell. The audience is a bunch of very clever people with a wider than usual perspective on programming and mathematics, and my talk should be rather informational than evang

Re: [Haskell-cafe] Leaner Haskell.org frontpage

2009-07-09 Thread Thomas Davie
On 9 Jul 2009, at 18:32, Thomas ten Cate wrote: Are there any kind of hard statistics and analytics that we can base this discussion upon? There is always room for improvement, but stumbling around in the dark making blind guesses may not be the best way to go. Although I personally feel that L

Re: [Haskell-cafe] Alternative IO

2009-07-09 Thread Thomas Davie
To be honest -- that seems rather nice. Can has in Hackage? Bob On 9 Jul 2009, at 15:27, Cristiano Paris wrote: As a joke, I wrote an instance of Alternative for IO actions: {-# LANGUAGE ScopedTypeVariables #-} module Main where import Control.Applicative import Control.Exception instance

Re: [Haskell-cafe] Laziness enhances composability: an example

2009-07-09 Thread Thomas Davie
On 9 Jul 2009, at 14:55, Cristiano Paris wrote: Hi, I'm wondering what a good example of why laziness enhances composability would be. I'm specifically looking for something that can't implemented in Python with iterators (at least not elegantly), but can actually be implemented in Has

Re: [Haskell-cafe] Monoid wants a (++) equivalent

2009-07-01 Thread Thomas Davie
On 1 Jul 2009, at 16:46, Edward Kmett wrote: I'm rather fond of the (<>) suggestion, but would be happy with anything better than mappend! ;) I find it rather ugly, it has a lot of connotations of "does not equals" from other languages. Personally I'm in favor of <+>, simply because it

Re: [Haskell-cafe] Monoid wants a (++) equivalent

2009-06-30 Thread Thomas Davie
On 30 Jun 2009, at 22:19, Daniel Fischer wrote: Am Dienstag 30 Juni 2009 20:56:10 schrieb David Leimbach: On Tue, Jun 30, 2009 at 11:54 AM, Brent Yorgey >wrote: On Tue, Jun 30, 2009 at 09:45:45AM -0700, Bryan O'Sullivan wrote: I've thought for a while that it would be very nice indeed if the

Re: [Haskell-cafe] Which one is right?

2009-06-24 Thread Thomas Davie
This looks like Hugs defaulting to a different type to ghci, specifically, Hugs is defaulting to one of the high precission types like CReal or Rational, while ghci is defaulting to Float or Double. Bob On 24 Jun 2009, at 21:03, Linker wrote: Hi,All, Construct a list: [0,0.1..1] =

Re: [Haskell-cafe] curious about sum

2009-06-18 Thread Thomas Davie
having sum and product be strict is consistent with this. -Keith On Wed, Jun 17, 2009 at 11:15 AM, Thomas Davie wrote: On 17 Jun 2009, at 13:32, Yitzchak Gale wrote: Henk-Jan van Tuyl wrote: reverse maximum minimum Oh yes, please fix those also! import Prelude.Strict? Honestly, these fun

Re: [Haskell-cafe] curious about sum

2009-06-17 Thread Thomas Davie
On 17 Jun 2009, at 13:32, Yitzchak Gale wrote: Henk-Jan van Tuyl wrote: reverse maximum minimum Oh yes, please fix those also! import Prelude.Strict? Honestly, these functions are ones that I've *deffinately* used lazy versions of, in fact, in the cases of minimum/maximum I've even used

Re: [Haskell-cafe] Need some help with an infinite list

2009-06-16 Thread Thomas Davie
letterCombos = map (:[]) ['a'..'z'] ++ concatMap (\c -> map ((c++) . (: [])) ['a'..'z']) letterCombos Not hugely efficient, if you generate the strings in reverse then you can use (c:) rather than ((c++) . (:[])), but that may not be useful to you. Bob On 17 Jun 2009, at 02:28, GüŸnther S

Re: [Haskell-cafe] curious about sum

2009-06-16 Thread Thomas Davie
On 16 Jun 2009, at 05:18, Don Stewart wrote: keithshep: The answer is sometimes (only if you use an optimize flag): You're turning on the strictness analyser. That's enabled with -O or -O2. But sum should be using a tail recursive foldl'. It's a bug in the H98 report, IMO. Not at all, as

Re: [Haskell-cafe] curious about sum

2009-06-14 Thread Thomas Davie
On 14 Jun 2009, at 12:47, Roman Cheplyaka wrote: * Deniz Dogan [2009-06-13 16:17:57+0200] I remember needing a non-strict sum at least once, but I do not remember the exact application. We may agree that lazy sum is sometimes (rarely) needed, but then it can be always written as fold. How

Re: [Haskell-cafe] Logo fun

2009-06-12 Thread Thomas Davie
On 12 Jun 2009, at 11:15, Deniz Dogan wrote: 2009/6/12 Deniz Dogan : 2009/6/12 Tom Lokhorst : There's a SVG version of the logo on the wiki: http://haskell.org/haskellwiki/Thompson-Wheeler_logo I think the biggest problem making the batteries not look like batteries is that they don't look

Re: [Haskell-cafe] Logo fun

2009-06-12 Thread Thomas Davie
On 12 Jun 2009, at 10:27, Loup Vaillant wrote: 2009/6/11 Thomas Davie : Here's the logo, continuing on the batteries included theme: http://www.cs.kent.ac.uk/people/rpg/tatd2/HaskellBatteries.png I'd sugest a thinner and smaller lambda, or bigger (maybe longer) batteries. The +

[Haskell-cafe] Logo fun

2009-06-11 Thread Thomas Davie
We had a lot of "fun" deciding Haskell's new logo, and while I don't agree with the final result, it would be nice if we could now start consistently using it. With that in mind, I realised that the Haskell Platform's logo is totally different, and did a quick mock up of a version reflecti

Re: [Haskell-cafe] Function Returning Type?

2009-05-21 Thread Thomas Davie
Op 21 May 2009, om 21:52 heeft Stefan Holdermans het volgende geschreven: Jochem, rationals n = (putStr . unlines . map show) (take n (nub [x % y | y <- [1..], x <- [1..y], x < y])) rationals n :: Integer -> [Ratio] I meant "Integer -> String" obviously. Er... what about ration

Re: [Haskell-cafe] applicative challenge

2009-05-05 Thread Thomas Davie
I also tried t15 = let grabby = unlines . takeWhile (not . blank) . lines top = ("first time: " ++) . grabby . ("second time: " ++) . grabby in interact top but that didn't work either: thart...@ubuntu:~/haskell-learning/lazy-n-strict>runghc sequencing.hs a first time: second time:

Re: [Haskell-cafe] How to understand the fmap here ?

2009-05-05 Thread Thomas Davie
On 5 May 2009, at 11:27, z_axis wrote: The following code snippets is from xmonad: -- Given a window, find the screen it is located on, and compute -- the geometry of that window wrt. that screen. floatLocation :: Window -> X (ScreenId, W.RationalRect) --... rr <- snd `fmap` floatLocation w

Re: [Haskell-cafe] applicative challenge

2009-05-05 Thread Thomas Davie
On 4 May 2009, at 23:15, Thomas Hartman wrote: {-# LANGUAGE NoMonomorphismRestriction #-} import Data.List import Control.Monad import Control.Applicative -- Can the function below be tweaked to quit on blank input, provisioned in the applicative style? -- which function(s) needs to be rewritt

Re: Is 78 characters still a good option? Was: [Haskell-cafe] breaking too long lines

2009-04-25 Thread Thomas Davie
On 25 Apr 2009, at 21:09, Jason Dusek wrote: There will always be some people who prefer longer lines. The real issue is, how do we deal with the fundamental disagreement here? It's not like we can have both. Also those people who like long lines -- will they all agree to a long line lengt

Re: Is 78 characters still a good option? Was: [Haskell-cafe] breaking too long lines

2009-04-25 Thread Thomas Davie
On 25 Apr 2009, at 10:51, Daniel Fischer wrote: Am Samstag 25 April 2009 08:48:16 schrieb Thomas Davie: On 24 Apr 2009, at 14:37, Loup Vaillant wrote: 2009/4/23 Miguel Mitrofanov : On 23 Apr 2009, at 12:17, Thomas Davie wrote: Haskell is a very horizontal language, and to limit our

Re: Is 78 characters still a good option? Was: [Haskell-cafe] breaking too long lines

2009-04-24 Thread Thomas Davie
On 24 Apr 2009, at 14:37, Loup Vaillant wrote: 2009/4/23 Miguel Mitrofanov : On 23 Apr 2009, at 12:17, Thomas Davie wrote: Haskell is a very horizontal language, and to limit our horizontal space seems pretty weird. +1. I sometimes use lines up to 200 characters long, when I feel they

Re: Is 78 characters still a good option? Was: [Haskell-cafe] breaking too long lines

2009-04-23 Thread Thomas Davie
On 23 Apr 2009, at 10:02, Matthijs Kooijman wrote: Some material I've read on typography -- can't find the reference now -- suggests ~65 is the best number of characters per line. The advice was, if your page is larger than that, you should make columns. That fits my observations. In partic

Re: [Haskell-cafe] Re: Cabal's default install location

2009-04-23 Thread Thomas Davie
The results in the poll seem to have stabilised now, so I'll tell you what happened... For user installs: 103 For global installs: 52 Others: 9 Interesting Ideas: • Claus made the suggestion that there be no default, instead that cabal asks you which you prefer the

[Haskell-cafe] Re: Cabal's default install location

2009-04-23 Thread Thomas Davie
[Moved from the UHC thread – lets stop treading on those guys toes, they did something very very shiny] On 23 Apr 2009, at 07:02, Richard O'Keefe wrote: It's irrelevant, because I _do_ have root access to my machine, How nice to be you. Since the argument is entirely about people who _do

Re: [Haskell-cafe] Being impure within a 'pure' function

2009-04-22 Thread Thomas Davie
On 22 Apr 2009, at 10:38, Daniel K. wrote: Hello, imagine the following situation: You want to implement e.g. Dijkstra's algorithm to find a shortest path between nodes u and v in a graph. This algorithm relies heavily on mutating arrays, so the type signature would look something like

[Haskell-cafe] Cabal's default install location

2009-04-21 Thread Thomas Davie
There seems to be an assumption amongst the community that a user's home directory is the most useful place for cabal to install to by default. A few people have challenged that. I wanted to find out which one most people do actually prefer, so please go and vote on this poll. http://no

Re: [Haskell-cafe] Optimizing unamb by determining the "state" of a thunk?

2009-04-20 Thread Thomas Davie
On 20 Apr 2009, at 10:57, Peter Verswyvelen wrote: On Mon, Apr 20, 2009 at 10:23 AM, Thomas Davie wrote: Really? Is it any less referentially transparent than unamb already is - i.e. it's referentially transparent, as long as the two values really are equal. I think it is. Suppo

Re: [Haskell-cafe] Optimizing unamb by determining the "state" of a thunk?

2009-04-20 Thread Thomas Davie
On 20 Apr 2009, at 09:41, Peter Verswyvelen wrote: I was wandering if it would be possible to optimize unamb by checking if a value is already evaluated to head normal form. So f `unamb` g would then be extremely fast if either f or g is already evaluated to head normal form. Maybe usi

Re: [Haskell-cafe] ANNOUNCE: Utrecht Haskell Compiler (UHC) -- first release

2009-04-19 Thread Thomas Davie
I don't understand what makes user installs more convenient. Certainly, my preference would be for global all the time – I expect something that says it's going to "install" something to install it onto my computer, like any other installation program does. What is it that makes user ins

Re: [Haskell-cafe] ANNOUNCE: Utrecht Haskell Compiler (UHC) -- first release

2009-04-19 Thread Thomas Davie
On 19 Apr 2009, at 11:10, Duncan Coutts wrote: On Sun, 2009-04-19 at 10:02 +0200, Thomas Davie wrote: It really rather makes "cabal install" rather odd – because it doesn't actually install anything you can use without providing extra options! It should work fine, you&

Re: [Haskell-cafe] ANNOUNCE: Utrecht Haskell Compiler (UHC) -- first release

2009-04-19 Thread Thomas Davie
On 19 Apr 2009, at 09:52, Duncan Coutts wrote: On Sun, 2009-04-19 at 00:41 +0200, Thomas Davie wrote: Apparently a "user" install of uuagc and fgl isn't good enough. Fun to know. I've found user installs don't work at all on OS X, various people in #haskell

Re: [Haskell-cafe] ANNOUNCE: Utrecht Haskell Compiler (UHC) -- first release

2009-04-18 Thread Thomas Davie
On 19 Apr 2009, at 00:31, Antoine Latter wrote: On Sat, Apr 18, 2009 at 4:38 PM, Thomas Davie wrote: This looks like the same error I got – see bug report 1 in the bug database – the configure script reports that you have uuagc even if you don't – cabal install it, reconfigure

Re: [Haskell-cafe] ANNOUNCE: Utrecht Haskell Compiler (UHC) -- first release

2009-04-18 Thread Thomas Davie
On 18 Apr 2009, at 22:44, Antoine Latter wrote: On Sat, Apr 18, 2009 at 9:03 AM, wrote: Utrecht Haskell Compiler -- first release, version 1.0.0 The UHC team is happy to announce the first public release of the

Re: [Haskell-cafe] A challenge

2009-04-08 Thread Thomas Davie
On 8 Apr 2009, at 19:05, Josef Svenningsson wrote: On Wed, Apr 8, 2009 at 4:57 PM, Thomas Davie wrote: > > We have two possible definitions of an "iterateM" function: > > iterateM 0 _ _ = return [] > iterateM n f i = (i:) <$> (iterateM (n-1) f =<< f i)

Re: [Haskell-cafe] A challenge

2009-04-08 Thread Thomas Davie
On 8 Apr 2009, at 18:21, Claus Reinke wrote: |iterateM 0 _ _ = return [] |iterateM n f i = (i:) <$> (iterateM (n-1) f =<< f i) |iterateM' n f i = sequence . scanl (>>=) (return i) $ replicate n f These function are not the same (sequence of scanl? try using print in f). Also, I seriously hope

Re: [Haskell-cafe] A challenge

2009-04-08 Thread Thomas Davie
On 8 Apr 2009, at 17:20, Jonathan Cast wrote: On Wed, 2009-04-08 at 16:57 +0200, Thomas Davie wrote: We have two possible definitions of an "iterateM" function: iterateM 0 _ _ = return [] iterateM n f i = (i:) <$> (iterateM (n-1) f =<< f i) iterateM n f i = sequence .

[Haskell-cafe] Re: A challenge

2009-04-08 Thread Thomas Davie
Woops, the second version there applies it one too many times, it should have been replicate (n-1) f. Bob ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] A challenge

2009-04-08 Thread Thomas Davie
We have two possible definitions of an "iterateM" function: iterateM 0 _ _ = return [] iterateM n f i = (i:) <$> (iterateM (n-1) f =<< f i) iterateM n f i = sequence . scanl (>>=) (return i) $ replicate n f The former uses primitive recursion, and I get the feeling it should be better written

Re: [Haskell-cafe] Functions from Data.Hashtable

2009-04-07 Thread Thomas Davie
On 8 Apr 2009, at 00:46, wren ng thornton wrote: Peter Verswyvelen wrote: These functions have their arguments reversed when compare to e.g. Map For example Data.HashTable.lookup :: HashTable key val -> key -> IO (Maybe val) Data.Map.lookup :: Ord key => key -> Map key val -> Maybe val I fin

Re: [Haskell-cafe] replicateM should be called mreplicate?

2009-04-06 Thread Thomas Davie
On 7 Apr 2009, at 07:37, David Menendez wrote: On Mon, Apr 6, 2009 at 1:46 PM, Luke Palmer wrote: On Mon, Apr 6, 2009 at 11:42 AM, David Menendez wrote: Of course, this suggests that mfix should be fixM, so perhaps a better distinction is that mplus and mfix need to be defined per-mon

Re: [Haskell-cafe] Re: Darcs - dependencies between repositories (aka forests)

2009-03-30 Thread Thomas Davie
On 29 Mar 2009, at 22:26, Xiao-Yong Jin wrote: Peter Verswyvelen writes: Mmm, my email was indeed very unclear about my question. A very simple example: suppose a development team is working on a program. This program consist of modules A and B. Each module has it's own Darcs repositor

Re: [Haskell-cafe] The votes are in!

2009-03-24 Thread Thomas Davie
*Launches missiles* Bob (that was my logo) On 24 Mar 2009, at 21:46, Ross Mellgren wrote: Doesn't matter how many times you seq the results, the thunk has been forced. -Ross On Mar 24, 2009, at 4:45 PM, FFT wrote: I demand a recount! The one that launches the missile should have won!

Re: [Haskell-cafe] Ease of Haskell development on OS X?

2009-03-20 Thread Thomas Davie
On 20 Mar 2009, at 18:46, Don Stewart wrote: tom.davie: On 20 Mar 2009, at 18:08, Don Stewart wrote: tom.davie: Other than chose the graphics card carefully, an iMac will do you very well. Hope that helps. This is very useful. Could the Mac users add information (and screenshots?) to

Re: [Haskell-cafe] Ease of Haskell development on OS X?

2009-03-20 Thread Thomas Davie
On 20 Mar 2009, at 18:08, Don Stewart wrote: tom.davie: Other than chose the graphics card carefully, an iMac will do you very well. Hope that helps. This is very useful. Could the Mac users add information (and screenshots?) to the OSX wiki page, http://haskell.org/haskellwiki/OSX

  1   2   3   >