Re: [Haskell] Monadic parser combinators with logging

2006-08-02 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 ->

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 element

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

[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

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 th

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 comput

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 whi

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

Re: [Haskell] Do the libraries define S' ?

2004-07-07 Thread Andrew Pimlott
On Wed, Jul 07, 2004 at 01:18:54PM +0100, Graham Klyne wrote: > There's a pattern of higher-order function usage I find myself repeatedly > wanting to use, exemplified by the following: > > [[ > -- combineTest :: (Bool->Bool->Bool) -> (a->Bool) -> (a->Bool) -> (a->Bool) > combineTest :: (b->c->d)

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

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

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

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

2004-02-17 Thread Andrew Pimlott
On Tue, Feb 17, 2004 at 07:48:52PM +, Graham Klyne wrote: > Thanks! That got me going, though not with quite what you suggested. > > I ended up with this: > [[ > notMatching :: Show a => GenParser tok st a -> GenParser tok st () > notMatching p = do { a <- try p ; unexpected (show a) } <|> re

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

2004-02-17 Thread Andrew Pimlott
On Tue, Feb 17, 2004 at 06:42:39PM +, Graham Klyne wrote: > I've attempted to define a Parsec combinator thus: > > [[ > notMatching :: Show a => GenParser tok st a -> GenParser tok st () > notMatching p = try ( do { a <- p ; unexpected (show a) } <|> return () ) > ]] If p fails but consumes s

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 >

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