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 cod

[Haskell-cafe] ANNOUNCE: docidx-1.0.0

2011-07-15 Thread Andy Gimblett
531/focus=53572 ; then I wrote a static 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 -

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

2010-02-25 Thread Andy Gimblett
eChar :: String -> GenParser Char st String maybeChar as = option "" (choice (map char as) >>= \a -> return [a]) You can also break it immediately before do, which I think is sometimes more clear. If not an extra space is added following "do" 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 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
out? I'm hoping I'm not going to have 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.o

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

2010-02-23 Thread Andy Gimblett
$ concat [n, w, ".", f, e] where liftCtoS a = option "" (char a >> return [a]) Thanks for all the help, again. -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] Re: Proper round-trip HughesPJ/Parsec for Doubles?

2010-02-23 Thread Andy Gimblett
n <- option "" (char '-' >> return "-") -- Optional negation in exponent m <- many1 digit return $ n ++ m case e of Nothing -> return $ read $ w ++ ".&

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

2010-02-23 Thread Andy Gimblett
hing obvious I'm missing. 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

[Haskell-cafe] Broken registration link on hackage trac

2010-01-18 Thread Andy Gimblett
and thus can fix 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

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,

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.

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

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

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 w

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 whic

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 Ha

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 a

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

[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

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 wron

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 this - or

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

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 htt

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 n

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

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

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 sets;

[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

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

2007-08-17 Thread Andy Gimblett
rd, the rest is in English). Chapter 2 answers 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-Caf

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

2007-08-15 Thread Andy Gimblett
m that) are a > consequence of the way they transform under (smooth) maps. But perhaps this > is > better discussed on a differential geometry mailing list? I assumed he was just trying not to sing the "Spider Pig" song. ( http://uk.youtube.c

Re: [Haskell-cafe] Explaining monads

2007-08-15 Thread Andy Gimblett
> saying is: get used to it, it's not so bad. 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 Depa

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

2007-08-02 Thread Andy Gimblett
be fine/usable. If, with real data, it turns out to be too slow then yes, I'll ditch this naive method and look at graph 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

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 com

[Haskell-cafe] Cartesian product of a Set

2007-08-01 Thread Andy Gimblett
red if there were any hidden gotchas. I'm 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 Univer

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 Gi

[Haskell-cafe] Best way to build strings?

2005-07-20 Thread Andy Gimblett
"convert to string", btw). Is there a facility like this in Haskell? Or something else I should be using, other than lots of ++ ? Thanks, -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://www.haskell.org/mailman/listinfo/haskell-cafe

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

2005-07-15 Thread Andy Gimblett
ur immediate problem, add "-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 fo

[Haskell-cafe] Problem linking against Data.Graph

2005-07-15 Thread Andy Gimblett
is, or tell me what stupid thing I'm doing wrong, I'd really appreciate it. Many thanks, -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://www.haskell.org/mailman/listinfo/haskell-cafe