[Haskell-cafe] there's a monster in my Haskell!

2006-10-31 Thread Andrew Pimlott
To boost the popularity of Scheme, Felleisen has argued for renaming lambda to something cool, such as Funster.[1] Likewise, Haskell intimidates newcomers with the arcane term monad. Peyton Jones's hopeful campaign to replace it with warm fuzzy thing[2] has so far produced few results. Inspired

Re: [Haskell-cafe] Computing lazy and strict list operations at the same time

2006-09-26 Thread Andrew Pimlott
This is a follow-up to a thread from June-July[1]. The question was how to write the function initlast :: [a] - ([a], a) initlast xs = (init xs, last xs) so that it can be consumed in fixed space: main = print $ case initlast [0..10] of (init, last) -

[Haskell-cafe] job writing security software in Haskell

2006-09-25 Thread Andrew Pimlott
Planning Systems, Inc. has a job opportunity for Haskell programmers. My synopsis is below, and the official description is at http://www.plansys.com/careers/job_details.cfm?JobID=28 Write Haskell code for a US government contractor. Projects include a high-assurance authorization system build

[Haskell-cafe] debugging space leaks in references

2006-08-22 Thread Andrew Pimlott
GHC's great space profiling tools don't appear to be much help when your leaked memory is stored in references (IORefs, StablePtrs, etc). I had a real-life case where the allocation profile showed me where the leaked data came from, and I could guess that it was being held by some reference, but

Re: [Haskell-cafe] HTTPS in Haskell

2006-08-18 Thread Andrew Pimlott
On Fri, Aug 18, 2006 at 11:05:21AM +0100, Pasqualino 'Titto' Assini wrote: Is there any implementation of HTTPS/SSL in Haskell? Have you seen hsgnutls? It uses the GnuTLS C library. http://www.cs.helsinki.fi/u/ekarttun/hsgnutls/ (Hmm, perhaps it would be easier to find if the word Haskell

Re: [Haskell] Monadic parser combinators with logging

2006-08-03 Thread Andrew Pimlott
On Thu, Aug 03, 2006 at 08:40:26AM +0200, Harald ROTTER wrote: Thanks for the hint, I will try to implement the suggested monadic structure. I realized perhaps I should have made the hint slightly more explicit by changing the name: newtype ParserT m a = ParserT { runParserT :: (PState - m

Re: [Haskell] Monadic parser combinators with logging

2006-08-02 Thread Andrew Pimlott
On Wed, Aug 02, 2006 at 10:52:14AM +0200, Harald ROTTER wrote: newtype Parser a = Parser { runParser :: (PState - [(a, PState)])} as the parsing monad with the Parser state PState that contains the remaining input after matching and possibly some additional user defined state elements. I

Re: [Haskell-cafe] Re: [Parsec] Backtracking with try does not work for me?

2006-08-02 Thread Andrew Pimlott
On Tue, Aug 01, 2006 at 10:08:16PM +0200, Stephane Bortzmeyer wrote: notFollowedBy seems to work for me and is quite simple, even for my brain. Thanks. Actually, it doesn't work, and is quite subtle, at least for my brain. There was a discussion in this thread:

Re: [Haskell-cafe] RE: ANN: System.FilePath 0.9

2006-07-28 Thread Andrew Pimlott
On Thu, Jul 27, 2006 at 09:59:37PM +0200, Udo Stenzel wrote: Andrew Pimlott wrote: After all, the trailing slash has no real meaning for any intermediate processing you might do. Here I beg to differ. I'd expect: * setFileName foo bar == bar * setFileName foo/ bar == foo/bar

Re: [Haskell-cafe] RE: ANN: System.FilePath 0.9

2006-07-27 Thread Andrew Pimlott
On Wed, Jul 26, 2006 at 04:02:31PM -0700, Andrew Pimlott wrote: I admit I don't know enough to say how the lpt1 issue should be handled. Is there any Win32 call I can make that will help me avoid accidentally opening these magic files? Say, if I call open with O_CREAT | O_EXCL

Re: [Haskell-cafe] RE: ANN: System.FilePath 0.9

2006-07-27 Thread Andrew Pimlott
On Wed, Jul 26, 2006 at 05:06:41PM -0400, David Roundy wrote: cp(1), for example, treats paths with trailing separators differently from paths without. This doesn't apply uniformly to all programs--except that we can say that any path with a trailing '/' is intended to be a directory, and

Re: [Haskell-cafe] RE: ANN: System.FilePath 0.9

2006-07-26 Thread Andrew Pimlott
On Wed, Jul 26, 2006 at 03:36:13AM +0100, Neil Mitchell wrote: Its a rats nest to do it properly, but some very basic idea of does this path have things which there is no way could possibly be in a file - for example c:\|file is a useful thing to have. This seems to encourage the classic

Re: [Haskell-cafe] RE: ANN: System.FilePath 0.9

2006-07-26 Thread Andrew Pimlott
On Wed, Jul 26, 2006 at 03:29:01PM +0200, Udo Stenzel wrote: Andrew Pimlott wrote: Also, it looks from this that you treat paths differently depending on whether they end in a separator. Yet this makes no difference to the system. That seems wrong to me. Not to the system, but some

Re: [Haskell-cafe] RE: ANN: System.FilePath 0.9

2006-07-26 Thread Andrew Pimlott
On Wed, Jul 26, 2006 at 04:34:50PM +0100, Duncan Coutts wrote: On Wed, 2006-07-26 at 15:29 +0200, Udo Stenzel wrote: Exactly. I believe, a FilePath should be an algebraic datatype. Most operations on that don't have to be specified, because they are simple and have an obvious effect. Add

Re: [Haskell-cafe] RE: ANN: System.FilePath 0.9

2006-07-26 Thread Andrew Pimlott
On Wed, Jul 26, 2006 at 08:19:47PM +0100, Neil Mitchell wrote: Ok, this is a good use case. What should wget do if isValid fails? makeValid is system dependant, and unspecified in its behaviour, although obviously some kind of closeness to the original would be ideal. So what if isValid

Re: [Haskell-cafe] RE: ANN: System.FilePath 0.9

2006-07-26 Thread Andrew Pimlott
On Wed, Jul 26, 2006 at 10:32:02PM +0100, Neil Mitchell wrote: Sorry, I meant to say what I think wget should do. IMO, it should have a conservative set of allowed characters, encode the filename into that Not enough, because of the LPT1 issue - unless you add L as a disallowed letter :)

Re: [Haskell-cafe] RE: ANN: System.FilePath 0.9

2006-07-25 Thread Andrew Pimlott
[Sorry for the late reply.] On Wed, Jul 19, 2006 at 03:16:48AM +0100, Neil Mitchell wrote: I want to make sure a filename is valid. For example, prn and con This is another rat's nest, so I suggest that it be dealt with separately from the basic filepath module. The notion of valid is

Re: [Haskell-cafe] RE: ANN: System.FilePath 0.9

2006-07-18 Thread Andrew Pimlott
On Sun, Jul 16, 2006 at 08:43:31PM -0500, Brian Smith wrote: I kind of expect that a Haskell library for file paths will use the type system to ensure some useful properties about the paths. It's a nice idea, but I claim that it's a rat's nest. Path semantics, when you look hard at them, are

Re: [Haskell-cafe] Computing lazy and strict list operations at the same time

2006-07-14 Thread Andrew Pimlott
On Mon, Jun 19, 2006 at 05:50:13PM +0100, Duncan Coutts wrote: On Mon, 2006-06-19 at 17:03 +0100, Jon Fairbairn wrote: il [] = error foo il [x] = ([], x) il (x:xs) = cof x (il xs) where cof x ~(a,b) = (x:a, b) -- ! From a quick test, it looks like

Re: [Haskell-cafe] error vs. MonadError vs. fail

2006-03-28 Thread Andrew Pimlott
On Wed, Mar 29, 2006 at 08:57:00AM +1200, Daniel McAllansmith wrote: On Tuesday 28 March 2006 07:29, Andrew Pimlott wrote: MonadError is not up to this task as far as I can tell. Why not? All that needs to be done is write the missing instances, eg instance MonadError () Maybe

Re: [Haskell-cafe] error vs. MonadError vs. fail

2006-03-27 Thread Andrew Pimlott
On Mon, Mar 27, 2006 at 02:53:58PM +1200, Daniel McAllansmith wrote: Is there a consensus on how anticipatable failure situations should be handled? There was a thread, haskell programming guidelines, from 2006-02-25 where John Meacham and Cale Gibbard had a bit of back-and-forth about

Re: [Haskell] generic catch in a MonadIO

2006-02-08 Thread Andrew Pimlott
On Wed, Feb 08, 2006 at 12:59:48AM -0500, David Menendez wrote: Since the monad transformers in MTL all promote MonadError, you can also use throwError and catchError with instances of MonadIO. Currently, the error type associated with IO is IOError, not Exception, but it should be possible to

[Haskell] Re: System.FilePath survey

2006-02-06 Thread Andrew Pimlott
On Mon, Feb 06, 2006 at 03:36:17PM +, Simon Marlow wrote: The reason we can't just go right ahead and do The Right Thing (i.e. introduce a new ADT for FilePaths) is because it touches so much other stuff, including stuff that also needs revising, so it doesn't feel right to just fix the

Re: Parallel list comprehensions

2006-02-04 Thread Andrew Pimlott
On Sat, Feb 04, 2006 at 06:31:56PM +, Jon Fairbairn wrote: There ought to be a list_product somewhere (I mean [1..] `list_product` [4..] == [(1,4),(2,4),(1,5),(3,4),(2,5),(1,6),...]). Is there? This is called fair conjunction in Backtracking, Interleaving, and Terminating Monad

Re: Test performance impact (was: The dreaded M-R)

2006-02-02 Thread Andrew Pimlott
On Thu, Feb 02, 2006 at 12:34:30PM -, Simon Marlow wrote: Still, you could argue that it doesn't actually tell you the cause of the problem: namely that ij are being evaluated twice as often as you might expect by looking at the code. Would not the entries count in the profile tip you off

[Haskell-cafe] SCC accounting

2006-02-01 Thread Andrew Pimlott
We've been trying to track down a memory leak, and by adding SCC annotations, pinned it down to a very brief expression. Unfortunately, the expression is just a variable! We even looked at the generated core: (case ([Soutei.Term Logic.BodyVar] - (...) - Logic.Frame

Re: [Haskell-cafe] SCC accounting

2006-02-01 Thread Andrew Pimlott
On Wed, Feb 01, 2006 at 12:28:59AM -0800, Andrew Pimlott wrote: The Haskell code looks like predQuery pred = case lookup pred ctxIdx of Just f - {-# SCC pq.foo' #-} f Note that f is a function, which we expect to be expensive when it is called. However, that should be charged

Re: [Haskell-cafe] Correct usage of MonadError, ErrorT?

2006-01-31 Thread Andrew Pimlott
On Tue, Jan 31, 2006 at 05:07:00PM +1300, Daniel McAllansmith wrote: On Tuesday 31 January 2006 16:32, Andrew Pimlott wrote: What type would your mapError have? The first idea that comes to mind is mapError :: (MonadError e1 m1, MonadError e2 m2) = (e1 - e2

Re: [Haskell-cafe] Correct usage of MonadError, ErrorT?

2006-01-30 Thread Andrew Pimlott
On Tue, Jan 31, 2006 at 03:00:41PM +1300, Daniel wrote: I've got some functions in MonadError with different Error types. I would like to map errors of one Error type onto the other Error type. It seems that the only facility for doing this is mapErrorT, but that seems to force me to work

Re: [Haskell-cafe] Re: [Haskell] Simple IO Regions

2006-01-18 Thread Andrew Pimlott
On Tue, Jan 17, 2006 at 06:13:14PM +, Keean Schupke wrote: Just made a few modifications and thought it might be useful to people. I have rewritten the functions as liftR and bracketR over a MonadIO monad interface (allowing monad-transformers to be used). This is now usable as

Re: [Haskell-cafe] Using MonadError within other Monads

2005-12-19 Thread Andrew Pimlott
On Mon, Dec 19, 2005 at 10:21:36PM +1300, Karl Grapone wrote: I still find monadic signatures a little confusing, I believe ghci was, at some point, deriving types for f or g that had MonadError in place of Either String, so I'll have to think carefully about why it is so different from the

Re: [Haskell-cafe] Using MonadError within other Monads

2005-12-18 Thread Andrew Pimlott
[It is best to post questions only to haskell-cafe.] On Mon, Dec 19, 2005 at 03:53:53PM +1300, Karl Grapone wrote: I'm having trouble making use of MonadError within another Monad, in this case IO. I've blundered around for a while, trying various combinations of things, but I don't think

Re: [Haskell-cafe] Optimizing a high-traffic network architecture

2005-12-15 Thread Andrew Pimlott
On Fri, Dec 16, 2005 at 07:03:46AM +0100, Tomasz Zielonka wrote: On 12/16/05, Einar Karttunen ekarttun@cs.helsinki.fi wrote: To matters nontrivial all the *nix variants use a different more efficient replacement for poll. So we should find a library that offers a unified interface for all

Re: [Haskell-cafe] Detecting Cycles in Datastructures

2005-11-27 Thread Andrew Pimlott
On Fri, Nov 18, 2005 at 11:37:40AM -0500, Paul Hudak wrote: This is a very late response to an old thread... ditto :-) unwind :: Expr - Expr unwind (Add e1 e2) = Add (unwind e1) (unwind e2) unwind (Rec fe)= x where x = unwind (fe x) unwind e = e Since this discussion

Re: [Haskell-cafe] Detecting Cycles in Datastructures

2005-11-26 Thread Andrew Pimlott
On Sat, Nov 19, 2005 at 02:27:06AM +0100, Benjamin Franksen wrote: [You should read some of his papers, for instance the most unreliable techique in the world to compute pi. I was ROTFL when I saw the title and reading it was an eye-opener and fun too.] In addition to being clever and

Re: [Haskell-cafe] questions on lazy pattern, StateT monad

2005-11-23 Thread Andrew Pimlott
On Wed, Nov 23, 2005 at 02:03:22AM -0700, Fan Wu wrote: instance MonadPlus m = MonadPlus (StateT s m) where mzero = lift mzero mplus m1 m2 = do s - peek let m1' = runState s m1 m2' = runState s m2

Re: [Haskell-cafe] Monad Transformer question

2005-11-22 Thread Andrew Pimlott
On Tue, Nov 22, 2005 at 05:26:00PM -0700, Fan Wu wrote: type NDS a = StateT ProblemState [] a getVar :: Var - NDS (Maybe Value) getVar v = do vs - gets vars return $ lookup v vs What puzzles me is that, I think the Monad of the do block shall be the NDS (Maybe

Re: Records (was Re: [Haskell] Improvements to GHC)

2005-11-21 Thread Andrew Pimlott
On Sun, Nov 20, 2005 at 08:54:35AM -0500, David Roundy wrote: As an aside, what's responsible for the insanity of pattern matching record fields being backwards? I'd bar = b to bind b to bar, not the other way around... why should record pattern matching use '=' in a manner opposite from the

Re: [Haskell-cafe] How to use notFollowedBy function in Parsec

2005-11-21 Thread Andrew Pimlott
On Sun, Nov 20, 2005 at 09:27:53PM -0500, Sara Kenedy wrote: Thanks for your solution. However, when I try this, str1 :: Parser String str1 = do str - many anyToken notFollowedBy' semi return str notFollowedBy' :: Show a = GenParser tok st a

Re: [Haskell-cafe] How to use notFollowedBy function in Parsec

2005-11-19 Thread Andrew Pimlott
On Sat, Nov 19, 2005 at 06:43:48PM -0500, Sara Kenedy wrote: str1 :: Parser String str1 = do {str - many anyToken; notFollowedBy semi; return str} However, when I compile, there is an error. ERROR Test.hs:17 - Type error in application *** Expression : notFollowedBy semi *** Term

Re: [Haskell-cafe] ReaderT and concurrency

2005-11-16 Thread Andrew Pimlott
On Wed, Nov 16, 2005 at 11:51:19AM -0500, Kurt Hutchinson wrote: I have to perform another runReaderT when forking? Or is there a way to get the ReaderT environment automatically carried over to the newly created Set B thread? This is an unavoidable pain as far as I know. It would be nice if

Re: [Haskell-cafe] ReaderT and concurrency

2005-11-16 Thread Andrew Pimlott
On Wed, Nov 16, 2005 at 07:20:48PM +0100, Tomasz Zielonka wrote: On Wed, Nov 16, 2005 at 09:45:17AM -0800, Andrew Pimlott wrote: On Wed, Nov 16, 2005 at 11:51:19AM -0500, Kurt Hutchinson wrote: I have to perform another runReaderT when forking? Or is there a way to get the ReaderT

Re: [Haskell-cafe] handling rank 2 types

2005-11-04 Thread Andrew Pimlott
On Thu, Nov 03, 2005 at 08:35:26PM -0800, Andrew Pimlott wrote: I want a function newtype Empty = Empty (forall a. [a]) listToEmpty :: [v] - IO Empty listToEmpty l = liftM Empty (mapM no l) where no :: a - IO a' no x = fail element found ... I could probably define a generic

[Haskell-cafe] handling rank 2 types

2005-11-03 Thread Andrew Pimlott
I am trying to use a rank 2 type to enforce a condition on a data structure. For the purpose of this message, I am trying to ensure that a list is empty (ignoring the possibility of bottom elements): {-# OPTIONS -fglasgow-exts #-} import Control.Monad newtype Empty = Empty (forall a. [a]) I

Re: [Haskell-cafe] Help using QuickCheck

2005-10-21 Thread Andrew Pimlott
On Fri, Oct 21, 2005 at 07:58:10PM +0200, Benjamin Franksen wrote: I am asking help with using QuickCheck. I tried everything I could think of, but invariably as soon as I start invoking the quickCheck function on my property it fails with interactive:1:0: No instances for (Arbitrary

Re: [Haskell-cafe] Help using QuickCheck

2005-10-21 Thread Andrew Pimlott
On Fri, Oct 21, 2005 at 09:09:41PM +0200, Benjamin Franksen wrote: Many thanks! I wish I had remembered that I had this kind of problem before: ghc reports two errors, of which the /second/ one is the 'real' problem and the first one is just a by-product. The case in your original message is

[Haskell-cafe] case of (was: [Haskell] Mixing monadic and non-monadic functions)

2005-09-19 Thread Andrew Pimlott
On Sat, Sep 17, 2005 at 06:56:36PM +0100, Ben Rudiak-Gould wrote: * The new syntax is really nice as a replacement for the annoyingly common x - foo ; case x of... idiom that I've always disliked. I might wish for case of to mean \x - case x of: foo = case of ... Useful outside of

Re: [Haskell-cafe] Network parsing and parsec

2005-09-15 Thread Andrew Pimlott
On Thu, Sep 15, 2005 at 11:09:25AM -0500, John Goerzen wrote: The recent thread on binary parsing got me to thinking about more general network protocol parsing with parsec. A lot of network protocols these days are text-oriented, so seem a good fit for parsec. However, the difficulty I

Re: [Haskell-cafe] Network parsing and parsec

2005-09-15 Thread Andrew Pimlott
On Thu, Sep 15, 2005 at 06:11:58PM -0700, Andrew Pimlott wrote: I don't see why this would be more error-prone than any other approach. Hmm... I take that back. I don't know anything about the IMAP protocol, but after imagining for a few moments what it might be like, I can see how it could

Re: [Haskell-cafe] Control.Monad.Cont fun

2005-07-25 Thread Andrew Pimlott
On Thu, Jul 07, 2005 at 07:08:23PM +0200, Tomasz Zielonka wrote: Hello! Some time ago I wanted to return the escape continuation out of the callCC block, like this: getCC = callCC (\c - return c) But of course this wouldn't compile. I thought that it would be useful to be able to

Re: [Haskell-cafe] Newbie Question about Error Handling

2005-07-24 Thread Andrew Pimlott
On Sun, Jul 24, 2005 at 08:00:58PM +, Gerd M wrote: Hello! I'm confused by the error handling in Haskell. I've written a program that uses a combined monad of type: type MyMonad a = ErrorT MyErrorType (StateT MyStateType IO) a (MyErrorType is an instance of Error) Therefore, to handle

[Haskell-cafe] Re: Module.T naming style

2005-07-15 Thread Andrew Pimlott
On Fri, Jul 15, 2005 at 10:48:04AM +0200, Henning Thielemann wrote: On Thu, 14 Jul 2005, Andrew Pimlott wrote: 2) enshrining one-type-per-module in the naming convention is not IMO justified, and may prove limiting; Other languages like Modula-3 and Oberon do it with great success

[Haskell-cafe] Module.T naming style (was: matrix computations based on the GSL)

2005-07-14 Thread Andrew Pimlott
On Wed, Jul 13, 2005 at 06:13:48PM +0200, Alberto Ruiz wrote: I have changed the function names as suggested. This new style is clearly better, allowing Vector.add, Matrix.add, Vector.Complex.add, Matrix.Complex.add, etc. ... Now we can have Vector.T a and Matrix.T a for any storable a

Re: [Haskell] line-based interactive program

2005-07-08 Thread Andrew Pimlott
On Fri, Jul 08, 2005 at 02:51:11PM +0100, Colin Runciman wrote: My interaction depends on the (subtle order of) evaluation of a pure and total function? Pure, yes; total, no. Many important things depend on order of evaluation in lazy programs: for example, whether they compute a

Re: [Haskell-cafe] Conversion between MonadPlus instances

2005-07-01 Thread Andrew Pimlott
On Fri, Jul 01, 2005 at 12:33:13PM +0200, Gracjan Polak wrote: Example: I have some function, that can return multiple results. Currently I need only the first one, but in the spirit of NotJustMaybe, I try to be as general as possible. If I code it like this: reduction :: (MonadPlus m)

Re: [Haskell-cafe] foldl and space problems

2005-06-13 Thread Andrew Pimlott
On Mon, Jun 13, 2005 at 03:29:21PM +0200, Gracjan Polak wrote: Bernard Pope wrote: Perhaps you could post the definition of the state type? Or even better, a small example of code that runs badly. I still don't know where old code had problems, but after rewriting everything it seems to

[Haskell-cafe] Control.Monad.Error

2005-06-12 Thread Andrew Pimlott
I just discovered Control.Monad.Error, and all sorts of questions and ideas came to mind. I would be happy for any comments or pointers. - Monad and MonadError are uncannily similar, especially if you ignore that ugly duckling fail: class (Monad m) = MonadError e m | m - e where

Re: [Haskell-cafe] Re: Haskell vs OCaml

2005-05-03 Thread Andrew Pimlott
On Wed, May 04, 2005 at 12:40:13PM +1000, Erik de Castro Lopo wrote: That leaves one aspect of Haskell vs Ocaml I don't yet understand. What are the advantages of lazy evaluation? The advantage of lazy evaluation is that evaluation order becomes one less thing you have to think about. The

Re: [Haskell] Re: ANNOUNCE: The jhc Haskell compiler.

2005-04-28 Thread Andrew Pimlott
On Wed, Apr 27, 2005 at 03:56:38PM -0700, John Meacham wrote: for now, these are equivalent. ghc --make Main.hs -o foo jhc Main.hs -o foo jhc is effectivly always in --make mode. I suggest you make it possible not to operate in --make mode. A build system usually wants to know which

Re: [Haskell-cafe] Parsec question: how to access parser state

2005-03-20 Thread Andrew Pimlott
On Sun, Mar 20, 2005 at 03:32:38PM -0500, Dimitry Golubovsky wrote: type TParser a = GenParser Token (FiniteMap String Declaration) a The FiniteMap (which is the user state) is expected to be updated during parsing whus building some internal lookup table. and in one of the parsing

[Haskell-cafe] Re: [Haskell] State, StateT and lifting

2005-03-19 Thread Andrew Pimlott
On Sat, Mar 19, 2005 at 03:25:32AM -0800, Juan Carlos Arevalo Baeza wrote: Andrew Pimlott wrote: You might solve this by changing the type of matchRuleST: matchRuleST :: MonadState RuleSet m = String - m (maybe Rule) I don't know... The original using IO somehow offended me because

Re: [Haskell-cafe] Re: [Haskell] State, StateT and lifting

2005-03-19 Thread Andrew Pimlott
On Sat, Mar 19, 2005 at 01:42:11PM -0800, Juan Carlos Arevalo Baeza wrote: Andrew Pimlott wrote: On Sat, Mar 19, 2005 at 03:25:32AM -0800, Juan Carlos Arevalo Baeza wrote: Andrew Pimlott wrote: You might solve this by changing the type of matchRuleST: matchRuleST :: MonadState

Re: [Haskell] State, StateT and lifting

2005-03-18 Thread Andrew Pimlott
[I think it is preferred to post this on haskell-cafe.] On Fri, Mar 18, 2005 at 02:00:37PM -0800, Juan Carlos Arevalo Baeza wrote: matchRuleST :: String - State RuleSet (Maybe Rule) makeST :: String - StateT RuleSet IO () matchRuleST doesn't really need IO for anything (it just works on

Re: [Haskell-cafe] Literate Haskell

2005-02-18 Thread Andrew Pimlott
On Fri, Feb 18, 2005 at 09:21:00PM +0100, Dmitri Pissarenko wrote: I'm curious what experienced Haskellers think about using literate Haskell in daily work. This isn't a deep answer, but I find both of Haskell's literate syntaxes more trouble than they're worth. The leading syntax makes a

[Haskell-cafe] tree with labeled edges as a monad

2005-01-19 Thread Andrew Pimlott
This is a have you seen this monad? post. I was trying to construct a search tree, and decided I wanted to do it in a monad (so I could apply StateT and keep state as I explored the space). I discovered that a tree with labeled leaves is a monad, but I wanted to label internal nodes, and such a

Re: [Haskell-cafe] The difference between ($) and application

2004-12-14 Thread Andrew Pimlott
On Tue, Dec 14, 2004 at 01:49:57PM -0500, Derek Elkins wrote: On Mon, Dec 13, 2004 at 07:49:00PM -0800, oleg at pobox.com wrote: The operator ($) is often considered an application operator of a lower precedence. Modulo precedence, there seem to be no difference between ($) and `the

Re: [Haskell-cafe] The difference between ($) and application

2004-12-13 Thread Andrew Pimlott
On Tue, Dec 14, 2004 at 11:23:24AM +0100, Henning Thielemann wrote: On Tue, 14 Dec 2004, Andrew Pimlott wrote: (Of course, it's still useful, by itself or in a slice, as a higher-order operator.) You can also use 'id' in this cases, right? I'm thinking of things like zipWith

Re: [Haskell-cafe] The difference between ($) and application

2004-12-13 Thread Andrew Pimlott
On Mon, Dec 13, 2004 at 07:49:00PM -0800, [EMAIL PROTECTED] wrote: The operator ($) is often considered an application operator of a lower precedence. Modulo precedence, there seem to be no difference between ($) and `the white space', and so one can quickly get used to treat these operators

Re: [Haskell-cafe] Re: exitFailure under forkProcess

2004-10-27 Thread Andrew Pimlott
On Wed, Oct 27, 2004 at 11:30:12AM +0100, Simon Marlow wrote: The System.Posix library is severely lacking in documentation. Ideally for each function it would list the POSIX equivalent, and a table with the mapping in the other direction would be useful too. One idea on this topic: Many

Re: [Haskell-cafe] Re: exitFailure under forkProcess

2004-10-26 Thread Andrew Pimlott
On Wed, Oct 27, 2004 at 12:56:12AM +, John Goerzen wrote: If you follow this a little bit, you'll find that forkProcess is *NOT* throwing the exception that is being reported here. The message is being printed by the RTS of the child process. No exception is thrown in the parent.

Re: [Haskell-cafe] existential type problem

2004-10-21 Thread Andrew Pimlott
On Sat, Oct 16, 2004 at 05:54:46AM +, [EMAIL PROTECTED] wrote: data Bar a m = forall t. (MonadTrans t, Monad (t m)) = Bar (t m a - m a) (t m Int) data Foo = Foo (forall a m. Monad m = Bar a m) Is it true that I cannot have a function foo run op = Foo (Bar run op)

Re: [Haskell-cafe] existential type problem

2004-10-16 Thread Andrew Pimlott
On Fri, Oct 15, 2004 at 07:54:46PM -0700, [EMAIL PROTECTED] wrote: Andrew Pimlott wrote: I want values in my existential type to denote, for some monad, a monadic operation and a way to run the monad. Except, I want it mix the operation with operations in another monad, so it use a monad

[Haskell-cafe] existential type problem

2004-10-15 Thread Andrew Pimlott
I'm having trouble using an existential type, becasue of what seem to be limitations in how I can express the type. I want values in my existential type to denote, for some monad, a monadic operation and a way to run the monad. Except, I want it mix the operation with operations in another

Re: [Haskell-cafe] existential type problem

2004-10-15 Thread Andrew Pimlott
On Sat, Oct 16, 2004 at 10:19:14AM +0900, Koji Nakahara wrote: On Fri, 15 Oct 2004 19:55:02 -0400 Andrew Pimlott [EMAIL PROTECTED] wrote: data Foo = forall t. (MonadTrans t) = Foo ((Monad m, Monad (t m)) = t m a - m a)-- run ((Monad m

Re: [Haskell-cafe] mutually recursive modules

2004-09-27 Thread Andrew Pimlott
On Mon, Sep 27, 2004 at 10:46:25AM -0700, Fergus Henderson wrote: (2) Although most of the mutual recursion occurred only in the intermediate stages of the refactoring, some of the mutual recursion remained at the end of the refactoring, forcing two modules with only the

[Haskell-cafe] lhaskell.vim syntax highlighting script

2004-07-29 Thread Andrew Pimlott
haskell-cafe, you are listed as the maintainer of the vim haskell syntax highlighting script. :-) lhaskell.vim uses the tex.vim syntax script, which does set iskeyword-=_. This makes editing haskell rather uncomfortable (eg, the '*' command doesn't work right). I don't know what breaks if you

Re: [Haskell] Parsec question: attempted 'notMatching' combinator

2004-02-18 Thread Andrew Pimlott
On Wed, Feb 18, 2004 at 02:45:15PM +0100, Daan Leijen wrote: On Wed, 18 Feb 2004 01:11:31 -0500, Andrew Pimlott [EMAIL PROTECTED] wrote: After some pondering and fiddling, a version I like: notFollowedBy' :: Show a = GenParser tok st a - GenParser tok st () notFollowedBy' p

Re: [Haskell] Parsec question: attempted 'notMatching' combinator

2004-02-18 Thread Andrew Pimlott
On Wed, Feb 18, 2004 at 02:45:15PM +0100, Daan Leijen wrote: On Wed, 18 Feb 2004 01:11:31 -0500, Andrew Pimlott [EMAIL PROTECTED] wrote: After some pondering and fiddling, a version I like: notFollowedBy' :: Show a = GenParser tok st a - GenParser tok st () notFollowedBy' p

Re: [Haskell-cafe] Re: [Haskell] Parsec question: attempted 'notMatching' combinator

2004-02-18 Thread Andrew Pimlott
On Wed, Feb 18, 2004 at 10:48:39AM +, Graham Klyne wrote: [To Haskell-cafe...] At 16:57 17/02/04 -0500, Andrew Pimlott wrote: On Tue, Feb 17, 2004 at 07:48:52PM +, Graham Klyne wrote: [[ notMatching :: Show a = GenParser tok st a - GenParser tok st () notMatching p = do

Re: [Haskell] Parsec question: attempted 'notMatching' combinator

2004-02-17 Thread Andrew Pimlott
On Tue, Feb 17, 2004 at 04:57:34PM -0500, Andrew Pimlott wrote: What about a more prosaic implementation: notFollowedBy' :: Show a = GenParser tok st a - GenParser tok st () notFollowedBy' p= do res - do a - try p; return $ Just

Re: [Haskell] ANNOUNCE: HsUnix 1.0.1 - Haskell for Unix Shell Scripting

2004-02-09 Thread Andrew Pimlott
On Mon, Feb 09, 2004 at 12:49:28PM +0100, Tomasz Zielonka wrote: On Sun, Feb 08, 2004 at 09:36:16PM +0100, Volker Wysk wrote: Error Handling Error handling is one thing which is done much more thoroughly in HsUnix than in shells. Failed programs won't be silently ignored.

Re: [Haskell] ANNOUNCE: HsUnix 1.0.1 - Haskell for Unix Shell Scripting

2004-02-09 Thread Andrew Pimlott
On Mon, Feb 09, 2004 at 07:16:09PM +0100, Volker Wysk wrote: main = mainwrapper $ call (execp cat [nosuchfile] -|- execp echo [hello]) This happens to work right. The error is reported via a dynamic exception: ~/src/hsunix/build $ ./test2 cat: nosuchfilehello : No such file

Re: Programming style (or: too clever by half?)

2003-11-12 Thread Andrew Pimlott
On Wed, Nov 12, 2003 at 02:54:32PM +, Graham Klyne wrote: I just spotted a possible idiom for something that seems to pop up from time to time: foldr const But I can't help feeling that this code is perversely obscure. Clever. I usually end up with something like listToMaybe

Re: ghci failed to load static archive

2003-09-02 Thread Andrew Pimlott
On Mon, Sep 01, 2003 at 12:12:23PM +0100, Simon Marlow wrote: It looks like you should force a load of the haskell98 package before loading Fudgets.o. Try adding a -package haskell98 on the command line. After getting past some more problems with fudgets finding its symbols, I am down to

ghci failed to load static archive

2003-08-29 Thread Andrew Pimlott
I'm sure this is pilot error, but I'm reporting it like the message says. I was trying to figure out how to get the fudgets library loaded into ghci. (I still haven't succeeded, in case you have any tips. Fudgets programs work fine when compiled with ghcxmake.) % ghci -fglasgow-exts