Re: [Haskell-cafe] Explaining monads

2007-08-15 Thread Andy Gimblett
. At AngloHaskell, one of Phillipa's slides referred to Haskell as a programming language theory gateway drug - and was clearly of the opinion that this was A Good Thing. -- Andy Gimblett Computer Science Department University of Wales Swansea http://www.cs.swan.ac.uk/~csandy

[Haskell-cafe] Re: Re[2]: Why monad tutorials don't work

2007-08-15 Thread Andy Gimblett
geometry mailing list? I assumed he was just trying not to sing the Spider Pig song. ( http://uk.youtube.com/watch?v=5XQ_GWKvDE0 ) ;-) -- Andy Gimblett Computer Science Department University of Wales Swansea http://www.cs.swan.ac.uk/~csandy/ ___ Haskell

Re: [Haskell-cafe] So far, so good! Until... (Haskell 98 Report questions)

2007-08-17 Thread Andy Gimblett
the questions asked above, with copious examples and exercises. Hope this helps, -Andy -- Andy Gimblett Computer Science Department University of Wales Swansea http://www.cs.swan.ac.uk/~csandy/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http

[Haskell-cafe] ANN: fp-southwales, the South Wales Functional Programming User Group

2009-10-14 Thread Andy Gimblett
Dear friends, It is my pleasure to announce the formation of fp-southwales, a user group for anybody interested in functional programming in the area of south Wales, UK. We're based out of Swansea University's Computer Science department, where there are a few of us using Haskell for our

[Haskell-cafe] Observer pattern in Haskell?

2009-11-09 Thread Andy Gimblett
Hi all, I've been doing some GUI programming recently, using wx. To help manage dependencies between state and UI elements, I looked for a Haskell version of the Observer design pattern, and I found an implementation written by Bastiaan Heeren of ou.nl [1]. It pretty much did what I

Re: [Haskell-cafe] Observer pattern in Haskell?

2009-11-09 Thread Andy Gimblett
Hi Neil, On 9 Nov 2009, at 14:50, Neil Brown wrote: 1. Does anyone have any comments, on either version? There is no way to remove an observer, which is something I'd expect to have available. I realise this would require assigning a key to each observer (and thus perhaps storing them in

Re: [Haskell-cafe] Observer pattern in Haskell?

2009-11-09 Thread Andy Gimblett
On 9 Nov 2009, at 15:21, Eduard Sergeev wrote: Andy Gimblett-2 wrote: To help manage dependencies between state and UI elements, I looked for a Haskell version of the Observer design pattern Isn't Reactive Programming approach more suitable than Observer if we talk about Haskell

Re: [Haskell-cafe] Observer pattern in Haskell?

2009-11-09 Thread Andy Gimblett
On 9 Nov 2009, at 16:47, Eduard Sergeev wrote: Andy Gimblett-2 wrote: Possibly. Care to expand? If you have a more elegant solution, which fits in well with ordinary wxHaskell, I'd be interested. I believe there are a few experimental frameworks built on top of wxHaskell which use

Re: [Haskell-cafe] Observer pattern in Haskell?

2009-11-09 Thread Andy Gimblett
On 9 Nov 2009, at 17:41, Neil Brown wrote: Just to clarify -- I meant access to another MVar. Basically, if I do this: do v - newMVar addObserver sub (putMVar v) If when the observers are run, the MVar v (that I've allocated) is non-empty, my code will block until it is empty, which

[Haskell-cafe] ANNOUNCE: simple-observer-0.0.1, a simple implementation of the observer design pattern

2009-11-11 Thread Andy Gimblett
Hi all, Further to earlier discussion on this topic, I've just released a first version of this package to hackage: http://hackage.haskell.org/package/simple-observer It is a fairly simple implementation of subject/observer which I've recently used to good effect in an GUI written using

[Haskell-cafe] A small (?) problem with type families

2009-11-13 Thread Andy Gimblett
Hi all, This email is literate Haskell. I'm trying to use type families to express some dependencies between type classes, and I'm running into trouble, I think because I'm producing chains of dependencies which the checker can't resolve... Here's a minimised version of the state I've got

Re: [Haskell-cafe] A small (?) problem with type families

2009-11-13 Thread Andy Gimblett
Ack. I've just realised that P/Q is not a functional dependency. I need to use a multi-parameter type class there. So my question is probably completely pointless - sorry! Thanks anyway, -Andy On 13 Nov 2009, at 20:26, Andy Gimblett wrote: Hi all, This email is literate Haskell. I'm

Re: [Haskell-cafe] A small (?) problem with type families

2009-11-13 Thread Andy Gimblett
, at 20:48, Andy Gimblett wrote: Ack. I've just realised that P/Q is not a functional dependency. I need to use a multi-parameter type class there. So my question is probably completely pointless - sorry! Thanks anyway, -Andy On 13 Nov 2009, at 20:26, Andy Gimblett wrote: Hi all

[Haskell-cafe] Broken registration link on hackage trac

2010-01-18 Thread Andy Gimblett
it. :-) Cheers, -Andy -- Andy Gimblett http://gimbo.org.uk/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Proper round-trip HughesPJ/Parsec for Doubles?

2010-02-23 Thread Andy Gimblett
. As hpaste.org seems to be down, I'll attach a code example here instead. Thanks! -Andy -- Andy Gimblett http://gimbo.org.uk/ TestParse.hs Description: Binary data ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo

[Haskell-cafe] Re: Proper round-trip HughesPJ/Parsec for Doubles?

2010-02-23 Thread Andy Gimblett
m - many1 digit return $ n ++ m case e of Nothing - return $ read $ w ++ . ++ f Just e' - return $ read $ w ++ . ++ f ++ e ++ e' -- Andy Gimblett http://gimbo.org.uk

Re: [Haskell-cafe] Re: Proper round-trip HughesPJ/Parsec for Doubles?

2010-02-23 Thread Andy Gimblett
-- Andy Gimblett http://gimbo.org.uk/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Building/installing OS X application bundles for GUIs - cabal-macosx

2010-02-24 Thread Andy Gimblett
to completely override the install machinery - that would feel somewhat self-defeating. Many thanks, -Andy -- Andy Gimblett http://gimbo.org.uk/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell

[Haskell-cafe] Re: Proper round-trip HughesPJ/Parsec for Doubles?

2010-02-25 Thread Andy Gimblett
this leads to an odd indentation of at least one line. I'm curious: which line in the above is indented oddly? Oh, wait: you don't mean odd as in strange, do you? You mean odd as in not even? So, e.g. the spaces line starts at column 5? What's wrong with that? Cheers! -Andy -- Andy

Re: [Haskell-cafe] Problem linking against Data.Graph

2005-07-15 Thread Andy Gimblett
-package fgl to your compilation line. *slaps forehead* Of course! I remember reading this now, but I had forgotten about it. And I've already come across this requirement in the past with Parsec, so I really should have thought of it... Many thanks for your help! -Andy -- Andy Gimblett

Re: [Haskell-cafe] Re: ghc for sunos

2005-09-09 Thread Andy Gimblett
On Fri, Sep 09, 2005 at 01:54:20PM +0200, Stephane Bortzmeyer wrote: I'm surrounded by Sun boxes here. One solution is to install Debian/GNU Linux on these, ghc runs fine on it :-) Or NetBSD - very good on older hardware, in particular. -Andy -- Andy Gimblett Computer Science

[Haskell-cafe] Typeclass default implementation in subclasses

2009-07-20 Thread Andy Gimblett
Hi all, This email is literate Haskell. I have a question about default implementations of typeclasses. {-# LANGUAGE TypeSynonymInstances #-} module Thing where import Text.PrettyPrint.HughesPJ Let say I want to pretty-print some values, enclosed in double quotes. The natural thing to do

Re: [Haskell-cafe] Re: Simple quirk in behavior of `mod`

2009-07-23 Thread Andy Gimblett
On 23 Jul 2009, at 11:59, Matthias Görgens wrote: Round-to-even means x.5 gets rounded to x if x is even and x+1 if x is odd. This is sometimes known as banker's rounding. OK. That's slightly unusual indeed. It's meant to minimise total rounding error when rounding over large data

[Haskell-cafe] Ambiguous type variable with subclass instance (also: is there a better way to do this?)

2009-09-17 Thread Andy Gimblett
Hi all. This email is in literate Haskell; you should be able to load it into ghci and verify what I'm saying (nb: it won't compile without alteration: see below). I'm trying to do something which may anyway be stupid / not the best approach to what I'm trying to achieve; however, it's not

Re: [Haskell-cafe] Ambiguous type variable with subclass instance (also: is there a better way to do this?)

2009-09-17 Thread Andy Gimblett
On 17 Sep 2009, at 15:21, José Pedro Magalhães wrote: E.g. here's a type Bar with three constructors: data Bar = X | Y | Z deriving (Show) instance Enumerated Bar where constructors = [X, Y, Z] (This is certainly ugly. Any suggestions?) |constructors| is expressible in

Re: [Haskell-cafe] Ambiguous type variable with subclass instance (also: is there a better way to do this?)

2009-09-17 Thread Andy Gimblett
On 17 Sep 2009, at 16:50, Daniel Fischer wrote: Yes, the second appearance of 'constructors' is at an unspecified type. instance (Enumerated a) = Target a where convert n | n 0 = Nothing | otherwise = case drop n constructors of (x:_) - Just x

Re: [Haskell-cafe] Ambiguous type variable with subclass instance (also: is there a better way to do this?)

2009-09-19 Thread Andy Gimblett
On 17 Sep 2009, at 18:01, Ryan Ingram wrote: Here's a way that works more closely to your original version: instance Enumerated a = Target a where convert n | n = 0 n numConstrs = Just (constrs !! n) | otherwise = Nothing where constrs = constructors

Re: [Haskell-cafe] Re: [Hs-Generics] how to automatically create and install documentations of a package?

2009-09-23 Thread Andy Gimblett
On 21 Sep 2009, at 09:14, Martijn van Steenbergen wrote: Michael Shulman wrote: Is there a way to make it automatically update a single contents page with links to the documentation of all installed packages? See: http://thread.gmane.org/gmane.comp.lang.haskell.cafe/53531/ focus=53560

[Haskell-cafe] Haddock and literate Haskell: annotations must be marked as source?

2009-09-24 Thread Andy Gimblett
Hi all, I've developed a bit of a taste for literate Haskell lately, being a verbose sort of guy. Unfortunately, it doesn't seem to interact with Haddock in the way I'd like/expect. I just wanted to check that my understanding of the situation is correct before I (regretfully) give up

Re: [Haskell-cafe] Haddock and literate Haskell: annotations must be marked as source?

2009-09-24 Thread Andy Gimblett
On 24 Sep 2009, at 18:28, Duncan Coutts wrote: On Thu, 2009-09-24 at 17:49 +0100, Andy Gimblett wrote: So: am I right that this is the intended/expected behaviour? If not, how does one get round it? If so, could someone perhaps comment on the prospects/complexity of implementing

Re: [Haskell-cafe] Haddock and literate Haskell: annotations must be marked as source?

2009-09-24 Thread Andy Gimblett
On 24 Sep 2009, at 20:10, Duncan Coutts wrote: On Thu, 2009-09-24 at 19:48 +0100, Andy Gimblett wrote: That's great news for me, except: that's what I tried first, and I've just tried it again and it still doesn't seem to work for me. Perhaps I am doing something wrong...? You're quite

[Haskell-cafe] Cartesian product of a Set

2007-08-01 Thread Andy Gimblett
particularly concerned by toList (O(n)) fromList (O(n log n)) - but for other reasons I'd really like to be using Set rather than List for this (I think). Many thanks for any thoughts, -Andy -- Andy Gimblett Computer Science Department University of Wales Swansea http://www.cs.swan.ac.uk/~csandy

Re: [Haskell-cafe] Cartesian product of a Set

2007-08-01 Thread Andy Gimblett
On Wed, Aug 01, 2007 at 01:42:52PM -0700, Dan Weston wrote: Andy Gimblett wrote: cartesian :: Ord a = S.Set a - S.Set (a,a) cartesian x = S.fromList [(i,j) | i - xs, j - xs] where xs = S.toList x Your list comprehension always generates a sorted list, so changing S.fromList to its

Re: [Haskell-cafe] Cartesian product of a Set

2007-08-02 Thread Andy Gimblett
algorithms, which is of course the Smart thing to do. However, it's beautiful (to me) code right now, which strongly reflects the definition of the problem, so I'd be happy not to. :-) Cheers, -Andy -- Andy Gimblett Computer Science Department University of Wales Swansea http://www.cs.swan.ac.uk

[Haskell-cafe] ANNOUNCE: docidx-1.0.0

2011-07-15 Thread Andy Gimblett
version in Python later that year: http://gimbo.org.uk/blog/2009/09/23/ ; then Andy Price ported that to Haskell: https://github.com/andyprice/docidx.hs ; finally, I rewrote that to build the index via Cabal rather than walking the filesystem directly - and here we are. -- Andy Gimblett hask

Re: [Haskell-cafe] ANNOUNCE: docidx-1.0.0

2011-07-18 Thread Andy Gimblett
With apologies, I now announce docidx-1.0.1 which fixes a problem kindly pointed out by Jack Henahan. If you tried to install docidx using cabal install over the weekend and failed, please try again now. The docidx-1.0.0.tar.gz uploaded to hackage on Friday was missing most of its source code