Re: [Haskell-cafe] Why are field selectors functions?

2013-08-08 Thread Jon Fairbairn
AntC writes: > No! This isn't more bikeshedding about notation. > > It's a bit of Haskell archaeology. > >> On Sun, Jun 30, 2013 at 2:59 AM, Judah Jacobson wrote: > [This isn't exactly what Judah wrote.] >> ... >> >> Instead of `x f` (to access field x of record f), >> maybe we could write `f{x}`

Re: [Haskell-cafe] Lambda Calculus question on equivalence

2013-05-04 Thread Jon Fairbairn
Francesco Mazzoli writes: > At Fri, 03 May 2013 16:34:28 +0200, > Andreas Abel wrote: >> The answer to your question is given in Boehm's theorem, and the answer >> is "no", as you suspect. >> >> For the untyped lambda-calculus, alpha-equivalence of beta-eta normal >> forms is the same as obser

Re: [Haskell-cafe] Prolog-style patterns

2013-04-09 Thread Jon Fairbairn
Jan Stolarek writes: > Hi all, > > consider this simple reimplementation of 'elem' function: > > member :: Eq a => a -> [a] -> Bool > member _ [] = False > member y (x:xs) | x == y= True > | otherwise = member y xs > > If Haskell allowed to write pattern matching similar to Pr

Re: [Haskell-cafe] Ticking time bomb

2013-03-23 Thread Jon Fairbairn
Marc Weber writes: > The only safe way is acceptnig keys from people you know don't view pdf > using adobe reader, I don’t… > who don't browse the web (neither use flash) etc. I only browse the web (in general) from a diskless virtual machine. > And then still you also have to know that their

Re: [Haskell-cafe] Country names and language names

2013-03-08 Thread Jon Fairbairn
"Henk-Jan van Tuyl" writes: > On Wed, 06 Mar 2013 20:53:57 +0100, Obscaenvs wrote: >>> Do not forget that country names can change; e.g. the Netherlands >>> Antilles were split up in 2010. This might cause problems if you store >>> country codes in a database. If you simply remove obsolete count

Re: [Haskell-cafe] How to input Unicode string in Haskell program?

2013-02-22 Thread Jon Fairbairn
Alexander V Vershilov writes: > The problem is that Prelude.getLine uses current locale to load characters: > for example if you have utf8 locale, then everything works out of the box: > >> $ runhaskell 1.hs >> résumé 履歴書 резюме >> résumé 履歴書 резюме > > But if you change locale you'll have error:

Re: [Haskell-cafe] Why isn't "Program Derivation" a first class citizen?

2013-02-13 Thread Jon Fairbairn
Rustom Mody writes: > On Wed, Feb 13, 2013 at 4:17 AM, Nehal Patel wrote: >> >> Why isn't "Program Derivation" a first class citizen? >> --- > I am stating these things from somewhat foggy memory (dont have any > lambda-calculus texts handy) and so will welcome corrections from those who >

Re: [Haskell-cafe] lambda case

2012-11-30 Thread Jon Fairbairn
Andreas Abel writes: > I had been missing a pattern matching lambda in Haskell for > a long time (SML had "fn" since ages) and my typical use > will be > > monadic_expr >>= \case > branches We’ve been through that. I want something similar, but would have preferred something more algebrai

[Haskell-cafe] lambda case (was Re: A big hurray for lambda-case (and all the other good stuff))

2012-11-29 Thread Jon Fairbairn
Ben Franksen writes: > just wanted to drop by to say how much I like the new lambda case extension. > I use it all the time and I just *love* how it relieves me from conjuring up > dummy variables, which makes teh code not only esier to write but also to > read. > […] should *definitely* go i

Re: [Haskell-cafe] Sparse records/ADTs

2012-10-27 Thread Jon Fairbairn
Yuri de Wit writes: > Would this be relevant? > > https://github.com/jonsterling/Data.Records That looks promising, thanks. It does use rather a lot of extensions, so it’ll take me a while to understand it. -- Jón Fairbairn jon.fairba...@cl.cam.ac.uk

Re: [Haskell-cafe] Sparse records/ADTs

2012-10-26 Thread Jon Fairbairn
Twan van Laarhoven writes: > On 24/10/12 12:08, Jon Fairbairn wrote: >> >> Is there a convenient way of handling a data structure with lots >> of fields of different types that may or may not be filled in? >> > > Not sure about convenience, but here is a

[Haskell-cafe] Sparse records/ADTs

2012-10-24 Thread Jon Fairbairn
Is there a convenient way of handling a data structure with lots of fields of different types that may or may not be filled in? Something equivalent to data D = D {a::Maybe A, b::Maybe B, c::Maybe C, …} but with better space efficiency and a more convenient empty object. An easy alternative is

Re: [Haskell-cafe] Monads

2012-10-01 Thread Jon Fairbairn
"Albert Y. C. Lai" writes: > On 12-09-30 06:33 PM, Jake McArthur wrote: >> When discussing monads, at least, a side effect is an effect that is >> triggered by merely evaluating an expression. A monad is an interface >> that decouples effects from evaluation. > > I don't understand that definitio

Re: [Haskell-cafe] How to take a minimum sub list that only contain certain number of elements of certain type?

2012-09-25 Thread Jon Fairbairn
Magicloud Magiclouds writes: > Hi, > For example, I have an array [0..]. Now I want to take a sub list > that starts from index 0, and only contain 4 odds, and is minimum > result. The answer should be [0, 1, 2, 3, 4, 5, 6, 7]. > How to do that? Combining lazy computing, I cannot figure out a

Re: [Haskell-cafe] Knight Capital debacle and software correctness

2012-08-05 Thread Jon Fairbairn
Jay Sulzberger writes: > On Sat, 4 Aug 2012, Clark Gaebel wrote: > >> As far as I know, you can't check "equivalence" of _|_. Since Haskell uses >> _|_ to represent a nonterminating computation, this would be >> synonymouswith solving the halting >> problem. > > Ah, thanks. I will attempt to th

Re: [Haskell-cafe] Failing to find a function

2012-02-19 Thread Jon Fairbairn
Erik Hesselink writes: > On Sun, Feb 19, 2012 at 12:50, Jon Fairbairn > wrote: >> This is probably a failure of my search fu or some other mental >> lacuna, but is there already a definition of this function >> somewhere: >> \a b -> runKleisli $ (Kleisli a) &

[Haskell-cafe] Failing to find a function

2012-02-19 Thread Jon Fairbairn
This is probably a failure of my search fu or some other mental lacuna, but is there already a definition of this function somewhere: \a b -> runKleisli $ (Kleisli a) <+> Kleisli b ? Hoogling for its type MonadPlus m => (a -> m b) -> (a -> m b) -> a -> m b doesn’t net me anything useful. -

Re: [Haskell-cafe] Rewrite this imperative in FP way

2012-02-05 Thread Jon Fairbairn
Haisheng Wu writes: > a = [1,1,1,1] > b = [0,1,2,3] > d = [0,0,0,0] > > for i in b: > for j in c: > if (i+j)<3: > d[i+j] += a[i] > Do you have any cool solution in FP way? I find the above sufficiently alien that I can’t work out what it’s meant to do (what is it actually for?). c is

Re: [Haskell-cafe] strict, lazy, non-strict, eager

2012-01-18 Thread Jon Fairbairn
t; and termination. I would hope there would be, as that (or at least productivity) is the point of saying that Haskell has non-strict semantics. > On Mon, Jan 9, 2012 at 3:01 AM, > Jon Fairbairn wrote: > >> Perhaps what I should have said to be almost as succinct but >> thi

Re: [Haskell-cafe] strict, lazy, non-strict, eager

2012-01-09 Thread Jon Fairbairn
wren ng thornton writes: > On 12/28/11 10:23 AM, Jon Fairbairn wrote: >> Thiago Negri writes: >> >>> Lazy evaluation is one implementation of non-strict semantics, where >>> the arguments are evaluated only when they are needed. >> >> I would say th

Re: [Haskell-cafe] How to split this string.

2012-01-06 Thread Jon Fairbairn
Steve Horne writes: > On 05/01/2012 11:09, Brandon Allbery wrote: >> On Thu, Jan 5, 2012 at 05:57, Steve Horne >> > > wrote: >> >> -- groupCut - Similar to groupBy, but where groupBy assumes an >> equivalence relation, >> -- groupCut takes a fun

Re: [Haskell-cafe] How to split this string.

2012-01-05 Thread Jon Fairbairn
Steve Horne writes: > On 02/01/2012 11:12, Jon Fairbairn wrote: >> max writes: >> >>> I want to write a function whose behavior is as follows: >>> >>> foo "string1\nstring2\r\nstring3\nstring4" = ["string1", >>> "string

Re: [Haskell-cafe] How to split this string.

2012-01-02 Thread Jon Fairbairn
max writes: > I want to write a function whose behavior is as follows: > > foo "string1\nstring2\r\nstring3\nstring4" = ["string1", > "string2\r\nstring3", "string4"] > > Note the sequence "\r\n", which is ignored. How can I do this? cabal install split then do something like import Data.Li

Re: [Haskell-cafe] strict, lazy, non-strict, eager

2011-12-28 Thread Jon Fairbairn
Thiago Negri writes: > 2011/12/28 Jon Fairbairn : >> * non-strict semantics require that no argument is evaluated >>  unless needed. > > That's not the case on optimistic evaluation. Oops, yes. I should have said something like “non-strict semantics require that eval

Re: [Haskell-cafe] strict, lazy, non-strict, eager

2011-12-28 Thread Jon Fairbairn
Thiago Negri writes: > Lazy evaluation is one implementation of non-strict semantics, where > the arguments are evaluated only when they are needed. I would say this: * non-strict semantics require that no argument is evaluated unless needed. * lazy evaluation is an implementation of non-str

Re: [Haskell-cafe] Overloaded Strings as default

2011-11-29 Thread Jon Fairbairn
Ivan Lazar Miljenovic writes: > On 29 November 2011 07:28, Daniel Díaz Casanueva > wrote: >> Hi Cafe, >> >> I only feel curious about what would be the consequences of becoming the >> Overloaded Strings feature (currently, an extension) to be default in >> Haskell. This is not a proposal. I jus

Re: [Haskell-cafe] XML modification

2011-11-25 Thread Jon Fairbairn
Andrew Coppin writes: > On 23/11/2011 12:58 PM, Andrew Coppin wrote: >> On 23/11/2011 10:14 AM, Jon Fairbairn wrote: >>> HaXml >> >> Mmm. That looks very promising... >> >>> which gives some idea of the flavour. >> >> OK. So it looks like

Re: [Haskell-cafe] XML modification

2011-11-23 Thread Jon Fairbairn
Andrew Coppin writes: > I've got a folder with about 80 XML files in it. I want to > take each file and make specific modifications to it. > (Mostly just finding specific attributes and changing their > values to make then all consistent.) > > Now I guess it wouldn't take me /that/ long to code >

Re: [Haskell-cafe] Data.IArray rant

2011-09-06 Thread Jon Fairbairn
Roman Leshchinskiy writes: > On 03/09/2011, at 03:04, Ivan Lazar Miljenovic wrote: > >> On 3 September 2011 11:38, Evan Laforge wrote: >>> The result is that my first contact with haskell >>> arrays left me with the impression that they were complicated, hard to >>> use, and designed for someon

Re: [Haskell-cafe] Solving the configuration problem with parametrized modules

2011-09-06 Thread Jon Fairbairn
Joachim Breitner writes: > Hi Cafe, > > this is an idea that has been floating in my head for a while, and I’m > wondering about its feasibility and, if feasible, complexity (in the > range from „trivial“ over “blog post” over “paper” to “thesis”). > > Application authors in Haskell often face th

[Haskell-cafe] xmonad on xkcd

2011-08-07 Thread Jon Fairbairn
http://xkcd.com/934/ (and look at the “hover text”) — so who’s going to implement it? -- Jón Fairbairn jon.fairba...@cl.cam.ac.uk ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/l

Re: [Haskell-cafe] The Typeable class is changing

2011-07-12 Thread Jon Fairbairn
Carl Howells writes: > This will affect snap-core and heist, of the things I've provided > Typeable instances for. > > In snap-core, deriving makes it use the internal module name, rather > than the canonical location of the type. This causes issues with the > Hint library, so it's worked around

Re: [Haskell-cafe] Comment Syntax

2011-06-05 Thread Jon Fairbairn
"Albert Y. C. Lai" writes: > On 11-06-04 02:20 AM, Roman Cheplyaka wrote: >> It is, for my taste, a good comment marker, because of its resemblance >> to a dash. It makes the code look like real text: >> >>let y = x + 1 -- increment x > > COBOL is real text, if that is what you want. MOVE PR

Re: [Haskell-cafe] Comment Syntax

2011-06-04 Thread Jon Fairbairn
Roman Cheplyaka writes: > * Andrew Coppin [2011-06-03 18:12:04+0100] >> On 03/06/2011 05:02 PM, Albert Y. C. Lai wrote: >> >I propose that only {- -} is comment; that is, -- is an operator token >> >and not a marker of comments. >> >> I'm curious to know why anybody thought that "--" was a good

[Haskell-cafe] Re: a simple question about types

2010-11-18 Thread Jon Fairbairn
Daniel Fischer writes: > On Wednesday 17 November 2010 19:09:16, Jerzy M wrote: >> Hallo, >> let me take this simple function: (2*). >> If I check its type >> >> :t (2*) >> >> I'll obtain >> (2*) :: (Num a) => a -> a >> >> But now it suffices to write >> g = (2*) >> and check >> >> :t g >> >> to

[Haskell-cafe] Catching up on Time and Directory

2010-11-16 Thread Jon Fairbairn
I'm probably terribly out of date with this, so I wonder if anyone can save me the bother of working out what the /preferred/ libraries are for (a) determining the last-modified-time of a file or directory and (b) manipulating the resulting time datum. I can find System.Directory.getModificationT

[Haskell-cafe] Re: Mysterious fact

2010-11-03 Thread Jon Fairbairn
Lennart Augustsson writes: > Jon, you beat me to it. I was going to mention Ponder. Strange chance; yesterday was the first time I read haskell café for something like half a year. > But Ponder did have a builtin type, it had the function type built in. :) Well, to use the nomenclature of Pon

[Haskell-cafe] Re: Mysterious fact

2010-11-02 Thread Jon Fairbairn
Andrew Coppin writes: > The other day, I accidentally came up with this: > > |{-# LANGUAGE RankNTypes #-} > > type Either x y= forall r. (x -> r) -> (y -> r) -> r > > left :: x -> Either x y > left x f g= f x > > right :: y -> Either x y > right y f g= g y > > | > > This is one exam

[Haskell-cafe] Re: Function to find a substring

2010-06-08 Thread Jon Fairbairn
R J writes: > What's an elegant definition of a Haskell function that takes > two strings and returns "Nothing" in case the first string > isn't a substring of the first, or "Just i", where i is the > index number of the position within the first string where the > second string begins? f n h =

[Haskell-cafe] Re: Proof question -- (==) over Bool

2010-05-24 Thread Jon Fairbairn
Alexander Solla writes: > On May 23, 2010, at 1:35 AM, Jon Fairbairn wrote: > >> It seems to me relevant here, because one of the uses to which >> one might put the symmetry rule is to replace an expression “e1 >> == e2” with “e2 == e1”, which can turn a programme t

[Haskell-cafe] Re: Proof question -- (==) over Bool

2010-05-23 Thread Jon Fairbairn
Alexander Solla writes: > On May 22, 2010, at 1:32 AM, Jon Fairbairn wrote: > >> Since Bool is a type, and all Haskell types include ⊥, you need >> to add conditions in your proofs to exclude it. > > Not really. Bottom isn't a value, so much as an expression > f

[Haskell-cafe] Re: Proof question -- (==) over Bool

2010-05-22 Thread Jon Fairbairn
R J writes: > I'm trying to prove that (==) is reflexive, symmetric, and > transitive over the Bools, given this definition: > (==):: Bool -> Bool -> Bool > x == y = (x && y) || (not x && not y) Since Bool is a type, and all Haskell types include ⊥, you need to add conditions in your proofs to

[Haskell-cafe] Re: Announcement: Data.ISO3166_CountryCodes version 0.1

2010-04-25 Thread Jon Fairbairn
John Millikin writes: > Thanks for the library! I'm sure it will be very useful for people > dealing with internationalized applications / libraries. I have a few > suggestions, which might make your library easier to use and maintain. > > First, it's very common to include generated files in the

[Haskell-cafe] Announcement: Data.ISO3166_CountryCodes version 0.1

2010-04-24 Thread Jon Fairbairn
Just uploaded to hackage. Package providing datatype generated from the ISO3166 country code list. This was originally part of my Typeful HTMLs stuff, but I thought it deserved a wider audience. I think anything that uses country codes should use this datatype! As this is my first attempt at us

[Haskell-cafe] Re: The instability of Haskell libraries

2010-04-24 Thread Jon Fairbairn
John Goerzen writes: > It is somewhat of a surprise to me that I'm making this > post, given that there was a day when I thought Haskell was > moving too slow ;-) > > My problem here is that it has become rather difficult to > write software in Haskell that will still work with newer > compiler a

[Haskell-cafe] Re: persist and retrieve of IO type?

2010-04-10 Thread Jon Fairbairn
Ivan Lazar Miljenovic writes: > Daryoush Mehrtash writes: > >> Is there a way to persist a [IO ()] to say a file then retrieve it later and >> execute it using a sequence function? > > I'm not sure I understand what you're wanting... you can pass around > values of type "IO ()" around, but they

[Haskell-cafe] Re: Integers v ints

2010-04-02 Thread Jon Fairbairn
Jens Blanck writes: > On 1 April 2010 10:53, Ivan Lazar Miljenovic wrote: >> Jens Blanck writes: >> > I was wondering if someone could give me some references to >> > when and why the choice was made to default integral >> > numerical literals to Integer rather than to Int in >> > Haskell. Seem

[Haskell-cafe] Re: Are there any female Haskellers?

2010-03-28 Thread Jon Fairbairn
Leon Smith writes: > On Sat, Mar 27, 2010 at 1:56 PM, Jason Dagit wrote: >> For some reason it started out as a male dominated field. >> Let's assume for cultural reasons.  Once it became a male >>dominated field, us males  unknowingly made the work and >>learning environments somewhat hostile o

[Haskell-cafe] Re: Allowing hyphens in identifiers

2009-12-16 Thread Jon Fairbairn
Daniel Fischer writes: > Am Dienstag 15 Dezember 2009 03:04:43 schrieb Richard O'Keefe: >> On Dec 14, 2009, at 5:11 PM, Daniel Fischer wrote: >> > 1. I wasn't playing in the under_score vs. camelCase game, just >> > proposing a possible >> > reason why the camelCase may have been chosen for Haske

[Haskell-cafe] Re: Allowing hyphens in identifiers

2009-12-09 Thread Jon Fairbairn
Deniz Dogan writes: > 2009/12/8 Jon Fairbairn : >> Deniz Dogan writes: >> >>> [...] allow hyphens in identifiers, much like in Lisp >>> languages? E.g. hello-world would be a valid function name. >> >> I (among others) suggested it right at the

[Haskell-cafe] Re: Allowing hyphens in identifiers

2009-12-08 Thread Jon Fairbairn
Deniz Dogan writes: > Has there been any serious suggestion or attempt to change the syntax > of Haskell to allow hyphens in identifiers, much like in Lisp > languages? E.g. hello-world would be a valid function name. I (among others) suggested it right at the beginning when we were first defini

[Haskell-cafe] Re: Fwd: Is () a 0-length tuple?

2009-11-08 Thread Jon Fairbairn
"Pasqualino \"Titto\" Assini" writes: > The syntax is similar, but what else is? What would you expect from an empty tuple? (a,b,c) has a constructor function p3 a b c = (a,b,c) and three destructor functions s3_1 (a,b,c) = a, s3_2 (a,b,c) = b and s3_3 (a,b,c)=c (a,b) has a constructor functio

[Haskell-cafe] Re: Curried function terminology

2009-10-06 Thread Jon Fairbairn
David Virebayre writes: > On Mon, Oct 5, 2009 at 11:52 AM, Jon Fairbairn > wrote: > >> [1] A pet peeve of mine is "x supports y" being used backwards (as in >> "our application supports windows Vista", which would only make sense if >> it were

[Haskell-cafe] Re: Curried function terminology

2009-10-05 Thread Jon Fairbairn
michael rice writes: > This is from Learn You A Haskell: > > == > > "Curried functions > > Every function in Haskell officially only takes one > parameter. So how is it possible that we defined and used > several functions that take more than one parameter so far? > Well, it's a clever tr

[Haskell-cafe] Re: Cabal packages -> cabbages

2009-09-21 Thread Jon Fairbairn
Conor McBride writes: > On 20 Sep 2009, at 23:11, Jason Dusek wrote: > >> Some day, we're going to need a short, catchy name for Cabal >> packages. Let's call them cabbages. > > Not that this is a good reason to change your mind, but some > sufficiently ancient Brits may remember a televisual

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

2009-09-18 Thread Jon Fairbairn
Ketil Malde writes: > Gregory Propf writes: > >> 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 (-) > > Or just use 'negate' and 'subtract'? Well, now that ghc a

[Haskell-cafe] Re: Mapping over multiple values of a list at once?

2009-08-28 Thread Jon Fairbairn
Raynor Vliegendhart writes: > Just wondering, what should be the expected output be of something > like mavg 4 [1..3]? [3%2] or []? [0%1, 1%4, 3%4, 3%2, 3%2, 5%4, 3%4, 0%1], of course ;-P -- Jón Fairbairn jon.fairba...@cl.cam.ac.uk ___

[Haskell-cafe] Re: ANN: Typeful/Text/HTMLs (for AngloHaskell/for scrap?)

2009-08-19 Thread Jon Fairbairn
Colin Paul Adams writes: >>>>>> "Jon" == Jon Fairbairn writes: > Jon> darcs get --partial > Jon> http://homepage.ntlworld.com/jon.fairbairn/Typeful/Text/HTMLs > > Did you make any progress on this at Anglo-Haskell? Not really, owing to M

[Haskell-cafe] Re: ANN: Typeful/Text/HTMLs (for AngloHaskell/for scrap?)

2009-08-05 Thread Jon Fairbairn
I wrote: > You can get the whole thing with > > darcs get --partial > http://homepage.ntlworld.com/jon.fairbairn/Typeful/Text/nHTMLs but that was a temporary url that I copied and pasted. The correct one: darcs get --partial http://homepage.ntlworld.com/jon.fairbairn/Typeful/Text/HTMLs And I

[Haskell-cafe] ANN: Typeful/Text/HTMLs (for AngloHaskell/for scrap?)

2009-08-05 Thread Jon Fairbairn
A while ago I wrote this rather pedantic html library (it guarantees standards compliance via types, even down to the nesting restrictions). I announced it on the libraries list, but chronic fatigue gets in the way of following things up, so I haven't taken it any further until recently. And recen

[Haskell-cafe] Re: Adding a field to a data record

2009-07-29 Thread Jon Fairbairn
Henry Laxen writes: > It seems to me this should be easy, but I can't quite figure out > how to do it without a lot of typing. Here is the question: > > Suppose you have a data type like: > Data Foo = Foo { a :: Int, b :: Int, >... many other fields ... > y :: Int } deriving (Eq, Read, Sh

[Haskell-cafe] Re: Need feedback on my Haskell code

2009-07-29 Thread Jon Fairbairn
CK Kashyap writes: > line' (x1, y1) (x2, y2) deltax deltay ystep isSteep error > | x1 == x2 = if isSteep then [(y1, x1)] else [(x1, y1)] > | isSteep = > (y1, x1) : > line' (newX, newY) (x2, y2) deltax deltay ystep isSteep newError > | otherwise = > (x1, y1) : > line' (ne

[Haskell-cafe] Re: Implicit concatenation in list comprehensions

2009-07-22 Thread Jon Fairbairn
Bulat Ziganshin writes: > Hello Neil, > > Tuesday, July 21, 2009, 1:26:55 PM, you wrote: > >>>  ++ [ "-i"      | not (null (ghcOptSearchPath opts)) ] >>>  ++ [ "-i", dir | dir <- ghcOptSearchPath opts ] > >> Following the discussions, I now support this extension too - I keep >> seeing more and m

[Haskell-cafe] Re: was: Debugging methods for haskell structured data types the right way in haskell

2009-07-20 Thread Jon Fairbairn
Fernan Bolando writes: > On Sun, Jul 19, 2009 at 7:40 AM, wren ng thornton wrote: >> Fernan Bolando wrote: >>> >>> The intention is z0 is a system parameter and database, it contains a >>> set of info needed to define a particular simulation >> >> A single-constructor ADT, especially with the lab

[Haskell-cafe] Re: Debugging methods for haskell

2009-07-18 Thread Jon Fairbairn
Henning Thielemann writes: > On Thu, 16 Jul 2009, Fernan Bolando wrote: > >> Hi all >> >> I recently used 2 hours of work looking for a bug that was causing >> >> Program error: Prelude.!!: index too large > > A good way to avoid such problems is to avoid partial > functions at all. (!!) is also

[Haskell-cafe] Re: Debugging methods for haskell

2009-07-16 Thread Jon Fairbairn
Fernan Bolando writes: > On Thu, Jul 16, 2009 at 4:10 PM, Jon > Fairbairn wrote: > >> I wonder if your code has to use !! at all? I took a look at a random >> module from the above link, and (without making much attempt at >> understanding it), I'd guess that us

[Haskell-cafe] Re: Debugging methods for haskell

2009-07-16 Thread Jon Fairbairn
Fernan Bolando writes: > Hi all > > I recently used 2 hours of work looking for a bug that was causing > > Program error: Prelude.!!: index too large > > This is not very informative. It did not give me a hint which function > was causing this. In C adding a few printf would have helped me, but >

[Haskell-cafe] Re: Haskell Zippers on Wikibooks: teasing! :)

2009-07-15 Thread Jon Fairbairn
Matthias Görgens writes: >> doesn't make much sense to me yet, although I suspect I can read the mu as a >> lambda on types? > > Not really. The mu has more to do with recursion. I'd say it's entirely to do with recursion. It's like the Y combinator (or fix) for types, though it is combined wit

[Haskell-cafe] Re: ANN: AC-Vector, AC-Colour and AC-EasyRaster-GTK

2009-07-11 Thread Jon Fairbairn
Wolfgang Jeltsch writes: > Am Freitag, 10. Juli 2009 05:26 schrieb rocon...@theorem.ca: >> I find it amazing that you independently chose to spell colour with a `u'. >> It makes me feel better about my choice. > > I have to admit that it makes me unhappy. :-( > > Why do we use English for identi

[Haskell-cafe] Re: golf, predicate check function for MonadPlus

2009-07-07 Thread Jon Fairbairn
Dan Doel writes: > On Thursday 02 July 2009 6:36:09 am Jon Fairbairn wrote: >> check :: (MonadPlus m) => (a -> Bool) -> a -> m a >> check p a >> | p a = return a >> | otherwise = mzero > > I've often noticed the need for a similar functio

[Haskell-cafe] golf, predicate check function for MonadPlus (was Re: How to read safely?)

2009-07-02 Thread Jon Fairbairn
Dan Doel writes: > There was talk of adding a readMaybe a while ago, but apparently it > never happened. > > As it is, you can use reads, "read s" becomes: > > case reads s of > [(a, rest)] | all isSpace rest -> > _ -> > > which ensures that you have

[Haskell-cafe] Re: (fwd) Haskell logo fail

2009-06-18 Thread Jon Fairbairn
Jason Dusek writes: > Why don't we have a picture of a cool dinosaur instead? Something cool because the last heat of life went out of it 65 million years ago? -- Jón Fairbairn jon.fairba...@cl.cam.ac.uk ___ Haskell

[Haskell-cafe] Re: Haskell philosophy question

2009-05-17 Thread Jon Fairbairn
"Vasili I. Galchin" writes: > Hello, > > I am confused between Haskell as delineated in the Haskell Report VS > ghc "pragmas" which extend Haskell beyond the Haskell Report. Pragmas are part of the report, and while I agree that using them for extensions is stretching the meaning a bit, it'

[Haskell-cafe] Re: fromInteger for Lists

2009-05-02 Thread Jon Fairbairn
Henning Thielemann writes: > Paul Keir schrieb: >> There's nothing better than making a data type an instance of Num. In >> particular, fromInteger is a joy. But how about lists? > > http://www.haskell.org/haskellwiki/Num_instance_for_functions > http://www.haskell.org/haskellwiki/Type_classes_ar

[Haskell-cafe] Re: chr/ord?

2009-04-29 Thread Jon Fairbairn
Tim Wawrzynczak writes: > On Tue, Apr 28, 2009 at 8:08 PM, michael rice <[1]nowg...@yahoo.com> > wrote: > > Hi, > > My Prelude docs must be out of date because chr and ord don't seem to be > there. How do I access these functions? > Michael, those functions are not in the Prelude, they're i

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

2009-04-23 Thread Jon Fairbairn
"Sittampalam, Ganesh" writes: > Jon Fairbairn wrote: >> But we can remove them in future language versions. The point I was >> trying to make at the beginning of this subthread was that >> implementations should follow the definition, because having a core >&

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

2009-04-23 Thread Jon Fairbairn
Colin Paul Adams writes: >> "Lennart" == Lennart Augustsson writes: > > Lennart> Of course, n+k will be missed by Haskell obfuscators. I > Lennart> mean, what will we do without (+) + 1 + 1 = (+) ? > > I think what would be missed would you be having the opportunity to > explain to

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

2009-04-23 Thread Jon Fairbairn
"John A. De Goes" writes: > That's absurd. You have no way to access private source > code, so any decision on what features to exclude from > future versions of Haskell must necessarily look at > publicly accessible source code. This is all entirely beside the point. The question is not wheth

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

2009-04-22 Thread Jon Fairbairn
Miguel Mitrofanov writes: > Well, the problem is that every implementor does choose a > subset of standart to implement. That's what I'm complaining about. > It's much worse in JavaScript - essential features working > differently in Internet Explorer, Firefox, Opera, and > Safari, and sometime

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

2009-04-20 Thread Jon Fairbairn
Achim Schneider writes: > Jon Fairbairn wrote: > >> a...@cs.uu.nl writes: >> >> >Utrecht Haskell Compiler -- first release, version 1.0.0 >> > >> > >> > >> >

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

2009-04-19 Thread Jon Fairbairn
a...@cs.uu.nl writes: > Utrecht Haskell Compiler -- first release, version 1.0.0 > > > > The UHC team is happy to announce the first public release of the > Utrecht Haskell Compiler (UHC). UHC supports almost all Haskell9

[Haskell-cafe] Re: Learning Haskell

2009-03-24 Thread Jon Fairbairn
"Tom.Amundsen" writes: > How long did it take you to become proficient in Haskell? Something more than twenty years. > By that, I mean - how long until you were just as > comfortable with Haskell as you were with your strongest > language at that time? Oh, Haskell was my strongest language dur

[Haskell-cafe] Re: Haskell Logo write-in candidate

2009-03-21 Thread Jon Fairbairn
Warren Harris writes: > Hi Jon, > > I agree with much of your rant, and would agree that the > logo is probably the least interesting about haskell, but I > think that it's worth spending a little time to spiffy up > haskell's image from a marketing perspective. I don't disagree with that. I'

[Haskell-cafe] Re: Query on list comprehension

2009-03-20 Thread Jon Fairbairn
"Richard O'Keefe" writes: > The problem we were asked about was specifically > a > aa > aaa > The code (iterate ('a':) "\n") does not give the right answer. > It's not just that it produces an infinite list instead of three > strings, it doesn't even start with the right string. It s

[Haskell-cafe] Re: Haskell Logo write-in candidate

2009-03-20 Thread Jon Fairbairn
Warren Harris writes: > After spending a bit of time trying to decide how to vote, I > ended up deciding that my favorite would be a hybrid of > several of the designs (#9 & #49 FalconNL, and #50 George > Pollard). It's probably too late to include this in the > voting, but here it is nonethel

[Haskell-cafe] Re: Query on list comprehension

2009-03-19 Thread Jon Fairbairn
Henning Thielemann writes: > On Tue, 17 Mar 2009, Melanie_Green wrote: > >> What are the limitations of list comprehension. I want to use >> listcomprehension to output the pattern below. So a mixture of a's and >> newline characters. The part im stuck at is creating arguments in the >> listcompr

[Haskell-cafe] Re: Query on list comprehension

2009-03-18 Thread Jon Fairbairn
Melanie_Green writes: > What are the limitations of list comprehension. I want to use > listcomprehension to output the pattern below. So a mixture of a's and > newline characters. The part im stuck at is creating arguments in the > listcomprehension to stop at some point then execute next loop.

[Haskell-cafe] Re: Sugestion for a Haskell mascot

2009-03-12 Thread Jon Fairbairn
Joe Fredette writes: > Hehe, I love it. Sloth is a synonym for Lazyness in English > too, and they're so freaking cute... :) I wouldn't say it was an exact synonym. Though the dictionary definitions are similar, sloth has a more negative connotation than laziness; the fourth deadly sin is called

[Haskell-cafe] Re: How to work with date?

2009-03-02 Thread Jon Fairbairn
Bulat Ziganshin writes: > Hello Jon, > > Monday, March 2, 2009, 2:22:55 PM, you wrote: > >> take 10 $ map (addDays (-1)) $ repeat $ utctDay $ zonedTimeToUTC now > > take 10 $ iterate (addDays (-1)) $ utctDay $ zonedTimeToUTC now take anything I post before 14:00 with a pinch of salt. Or somethin

[Haskell-cafe] Re: How to work with date?

2009-03-02 Thread Jon Fairbairn
Magicloud Magiclouds writes: > Hi, >   I am working on some calendar GUI thing. And I cannot find a library > to operate the "date". > Like, when `now <- getZonedTime`, how could I get all the dates of > the week. Or when I got `today`, how to get the date of 10 days ago? This sort of thing (g

[Haskell-cafe] Re: Low-level high-level languages?

2009-02-16 Thread Jon Fairbairn
Maurí­cio writes: > Hi, > > I've checked this 'BitC' language (www.bitc-lang.org). It > uses some ideas we see in Haskell, although with different > realization, and target mainly reliable low level code, > like micro-kernels (although I think it could be used > anywhere C is also used, including

[Haskell-cafe] Re: permuting a list

2009-02-16 Thread Jon Fairbairn
Paul Johnson writes: > See http://okmij.org/ftp/Haskell/perfect-shuffle.txt I should have read that first time round! -- Jón Fairbairn jon.fairba...@cl.cam.ac.uk http://www.chaos.org.uk/~jf/Stuff-I-dont-want.html (updated 2009-01-31) __

[Haskell-cafe] Re: permuting a list

2009-02-15 Thread Jon Fairbairn
Heinrich Apfelmus writes: > The answer is a resounding "yes" and the main idea is that shuffling a > list is *essentially the same* as sorting a list; the minor difference > being that the former chooses a permutation at random while the latter > chooses a very particular permutation, namely the

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

2009-01-20 Thread Jon Fairbairn
Mauricio writes: > I'm trying, without success, to understand the difference > between existencial quantification and polymorphic > datatypes. Polymorphic types are universally quantified; so id:: forall t. t -> t means that id works for every type t. If haskell had a symbol for existential q

[Haskell-cafe] Re: Different return type?

2009-01-19 Thread Jon Fairbairn
"John Ky" writes: > Hi, > > Possibly a silly question but is it possible to have a function that has a > different return type based on it's first argument? Are you sure that's what you really want? > For instance > > data Person = Person { name :: String, ... } > data Business = Business { bus

[Haskell-cafe] Re: Logos of Other Languages

2008-12-19 Thread Jon Fairbairn
Ashley Yakeley writes: > All of these get one thing right that the current and most > of the proposed Haskell logos do not: they don't make any > reference to the syntax of the language itself. Doing so > seems to miss the point of a logo: it's supposed to appeal > visually, rather than semantica

[Haskell-cafe] Re: TimeDiff to Int?

2008-11-14 Thread Jon Fairbairn
"Lyle Kopnicky" <[EMAIL PROTECTED]> writes: > Thanks, but that doesn't seem to work. I got an answer of -3. I tried it > again a minute later and it was still -3. I tried again a minute later and > it was -1. It's just after 9am here, so I have no idea what to make of > those numbers. That's most

[Haskell-cafe] Re: TimeDiff to Int?

2008-11-13 Thread Jon Fairbairn
"Lyle Kopnicky" <[EMAIL PROTECTED]> writes: > I had some code using the oldtime package, and want to convert it to use > the time package. > One of the things I need to do is calculate the number of seconds since > midnight. The easy part is getting a TimeDiff result: You mean DiffTime? > utc <-

[Haskell-cafe] Re: [] vs [()]

2008-10-10 Thread Jon Fairbairn
"Daryoush Mehrtash" <[EMAIL PROTECTED]> writes: > What is the difference between empty list [] and list with one unit > element [()]? Prelude> :m + Data.List Prelude Data.List> []\\[()] [] or, for completeness, the difference between a list with one unit element and the empty list:

[Haskell-cafe] Re: Announcing OneTuple-0.1.0

2008-10-02 Thread Jon Fairbairn
Benjamin L.Russell <[EMAIL PROTECTED]> writes: >>Note: the singleton tuple does not support tuple syntax. > > What is the syntax for the singleton tuple? [...] > the singleton syntax will be different from the non-singleton syntax, > which is also syntactically inelegant. > > What is your solutio

  1   2   3   >