[Haskell-cafe] Case-insensitive lexing with Alex

2008-01-28 Thread Joel Reymont
Any suggestions on how to implement case-insensitive lexing with Alex? Thanks, Joel -- http://wagerlabs.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: Case-insensitive lexing with Alex

2008-01-28 Thread Joel Reymont
On Jan 28, 2008, at 2:44 PM, Geoffrey Mainland wrote: map toLower onto your input before you pass it to your lexer? Or do you only want keywords to be case-insensitive? Just keywords. You can have Array or array or aRrAy. -- http://wagerlabs.com

[Haskell-cafe] C# parser written in Haskell

2008-01-27 Thread Joel Reymont
Does anyone have a C# parser written in Haskell? Thanks, Joel -- http://wagerlabs.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Yampa / AFRPVectorSpace.hs

2007-12-17 Thread Joel Reymont
On Dec 17, 2007, at 4:30 PM, Peter Verswyvelen wrote: Maybe you could place Yampa in a Darcs depot? darcs get http://wagerlabs.com/yampa I think we should move it to Google Code, though. -- http://wagerlabs.com ___ Haskell-Cafe mailing list

[Haskell-cafe] Expert systems

2007-12-04 Thread Joel Reymont
Is there an expert system implemented in Haskell, or a library perhaps? A CLIPS/RETE implementation? The main stumbling point, from my perspective, is how to implement a knowledge base and check whether patterns with a certain shape have been asserted. It's much easier to do this in a

[Haskell-cafe] Missing _environ

2007-11-09 Thread Joel Reymont
Dan, On Nov 9, 2007, at 12:58 AM, Dan Piponi wrote: Well that was the crucial fact I needed. 6.8.1 is now built. ghci doesn't work, it complains about an unknown symbol '_environ' in HSbase-3.0.0.0.o The installation process strips the binaries which strips away _environ. You need to

[Haskell-cafe] Re: Composing trading strategies (was: Should I step into a minefield? / Writing a trading studio in Haskell)

2007-11-08 Thread Joel Reymont
Greg, Can you post a couple of examples of what the trading strategies look like? Thanks, Joel On Nov 8, 2007, at 7:32 PM, Greg Fitzgerald wrote: The idea is that the user composes an 'openPosition' and 'closePosition' trading strategies from a combinator library and gives them

[Haskell-cafe] HOC is dead! Long live HOC!

2007-11-07 Thread Joel Reymont
BridgeSupport [1] is new functionality in Leopard that makes the current Haskell Objective-C bindings (HOC) obsolete (almost). --- The metadata is intended to be a resource for use beyond bridging. Most frameworks on the system provide two chunks of XML BridgeSupport metadata; succinct and

[Haskell-cafe] Memory-mapped arrays?

2007-11-07 Thread Joel Reymont
Is there such a thing as memory-mapped arrays in GHC? I'm looking for something that would let me memory-map a file of floats and access it as an array. Thanks, Joel -- http://wagerlabs.com ___ Haskell-Cafe mailing list

[Haskell-cafe] Should I step into a minefield? / Writing a trading studio in Haskell

2007-11-07 Thread Joel Reymont
I need to pick among the usual list of suspects for a commercial product that I'm writing. The suspects are OCaml, Haskell and Lisp and the product is a trading studio. My idea is to write something like TradeStation [1] or NinjaTrader, only for the Mac. It would be quite nifty to use

[Haskell-cafe] Re: HOC is dead! Long live HOC!

2007-11-07 Thread Joel Reymont
On Nov 7, 2007, at 9:57 PM, Wolfgang Thaller wrote: One big piece of information we need that is currently missing from the BridgeSupport files is which declaration comes form which header file. HOC's module structure currently follows Apple's .h files, and we need the module system for

[Haskell-cafe] CPP, Leopard and Haskell Objective-C bindings

2007-11-06 Thread Joel Reymont
It seems that the current approach taken by HOC is to strip preprocessing directives. This may not have been a problem before Leopard but Cocoa header files are now full of macros in most unusual places, e.g. @interface NSObject (NSDeprecatedMethods) + (void)poseAsClass:(Class)aClass

[Haskell-cafe] Re: CPP, Leopard and Haskell Objective-C bindings

2007-11-06 Thread Joel Reymont
On Nov 6, 2007, at 6:57 PM, Wolfgang Thaller wrote: That is not exactly what we want, I think. Currently, HOC parses things file-by-file, so we do NOT want to follow #include directives. We might just process the line pragmas from CPP to keep track of where things came from, OTOH. You

[Haskell-cafe] Leopard: ghc 6.8.1 and the case of the missing _environ

2007-11-06 Thread Joel Reymont
Symptoms: You build 6.8.1 from source on Leopard (x86 in my case) and then junior:ghc-6.8.1 joelr$ ghci GHCi, version 6.8.1: http://www.haskell.org/ghc/ :? for help ghc-6.8.1: /usr/local/lib/ghc-6.8.1/lib/base-3.0.0.0/HSbase-3.0.0.0.o: unknown symbol `_environ' Loading package base ...

[Haskell-cafe] Embedding the GHC API

2007-10-31 Thread Joel Reymont
Has anyone tried to embed GHC as a library recently? What is the size of the resulting binary? I'm assuming a bare minimum of needed libraries. Thanks, Joel -- http://wagerlabs.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

[Haskell-cafe] Quasiquotations part of GHC?

2007-10-29 Thread Joel Reymont
Folks, Did quasiquotations ever make it into the GHC tree? They were implemented as a patch to 6.7. Thanks, Joel -- http://wagerlabs.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Erlang VM in Haskell

2007-08-16 Thread Joel Reymont
On Aug 16, 2007, at 1:36 PM, Neil Bartlett wrote: However, wouldn't it be rather difficult, given that there doesn't seem to be a publicly available specification for the Erlang VM or the BEAM file format Very difficult, correct. I use Erlang daily, in fact Erlang is what brings bread to

[Haskell-cafe] Erlang VM in Haskell

2007-08-15 Thread Joel Reymont
Folks, I would like to write an Erlang VM in Haskell. I first thought of OCaml but Haskell has SMP and lazy evaluation may come in handy. Plus, I'll need help in this project like in no other and support from the Haskell community has always been outstanding. I'm doing this to learn more

Re: [Haskell-cafe] Picking an architecture for a Haskell web app

2007-05-10 Thread Joel Reymont
On May 10, 2007, at 10:01 AM, Bayley, Alistair wrote: Depends. Did you leave out WASH intentionally? http://www.informatik.uni-freiburg.de/~thiemann/WASH/ Nope, I forgot about it but looked at the Hemp app this morning. Thanks, Joel -- http://wagerlabs.com/

Re: [Haskell-cafe] Debugging

2007-05-10 Thread Joel Reymont
On May 10, 2007, at 10:19 AM, Jules Bean wrote: The 'next step' is to move from testing by hand in ghci to writing quickcheck properties / smallcheck / unit tests for the functions. I still don't understand the difference between QC and SC. Would someone kindly explain and provide an

[Haskell-cafe] Telling Cabal not to install the executable

2007-05-10 Thread Joel Reymont
I tell Cabal to build library and a test harness. How can I tell Cabal that I only want the library installed? Thanks, Joel -- http://wagerlabs.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

[Haskell-cafe] Picking an architecture for a Haskell web app

2007-05-09 Thread Joel Reymont
Folks, I have finished an alpha version of my EasyLanguage [1] to C# compiler and need to deploy it on Amazon EC2/S3. The compiler web interface is very simple: paste EL code, get back C# code or the same EL code with the error highlighted. I view the site as more than just a compiler,

Re: [Haskell-cafe] Indenting with PPrint

2007-05-08 Thread Joel Reymont
Brandon, On May 8, 2007, at 12:33 AM, Brandon Michael Moore wrote: braces x = group (PP. braces (nest 4 (linebreak x) linesbreak) I ended up with the following: nest = PP.nest 4 braces x = nest (lbrace $ x) $ rbrace If you happen to be formatting C I've also worked out how to get nice

[Haskell-cafe] Co-arbitrary

2007-05-08 Thread Joel Reymont
Would someone kindly explain why we need co-arbitrary in QuickCheck and how to define it? Detailed examples would be awesome! I would be willing to paste an in-depth explanation on my wall and keep it forever. Thanks in advance, Joel -- http://wagerlabs.com/

[Haskell-cafe] QuickCheck invariants for AST transformations

2007-05-08 Thread Joel Reymont
I'm looking for suggestions on how to create invariants for the following AST transformation code. Any suggestions are appreciated! I asked this question before and Lennart suggested abstract interpretation as a solution. This would require interpreters for both ASTs to determine that the

[Haskell-cafe] Indenting with PPrint

2007-05-07 Thread Joel Reymont
Folks, Are you using UU.PPrint [1]? Can you tell me how to print stuff like this? { blah blah } I tried the following which sort of works but doesn't return the closing brace to the indentation level of the first one. braces x = PP.braces $ linebreak indent 4 x

[Haskell-cafe] Re: [Haskell] Newbie: what are the advantages of Haskell?

2007-04-26 Thread Joel Reymont
The biggest advantage of Haskell to me is that it helps me write better programs in other languages. For one reason or another Haskell never turns out to be my final implementation language my my programs gain in the process. Joel -- http://wagerlabs.com/

[Haskell-cafe] Is Template Haskell a suitable macro language?

2007-04-24 Thread Joel Reymont
I'm finding myself dealing with several large abstract syntax trees that are very similar in nature. The constructor names would be the same or one type may be a small extension of another. This is something that I wouldn't worry about with Lisp, for example, as I would create a bunch of

[Haskell-cafe] Creating QuickCheck properties

2007-04-23 Thread Joel Reymont
Folks, I have code like this that I want to test with QuickCheck but I'm having trouble imagining how I would wrap it up in a property. Do I make sure that id, subs, back are always morphed properly or do I leave that to separate properties for their respective types? Do I then ensure

[Haskell-cafe] QuickCheck testing of AST transformers

2007-04-23 Thread Joel Reymont
My previous post did not receive any replies so I thought I might try generalizing the problem a bit... Suppose I'm parsing a language into a syntax tree and then transforming that tree into another AST representing a core language. The core language is a more general AST that should help

[Haskell-cafe] Re: QuickCheck subsumes unit testing

2007-04-21 Thread Joel Reymont
On Apr 21, 2007, at 2:54 AM, Donald Bruce Stewart wrote: Just to walk the walk, and not just talk the talk, here's a quick unit testing 'diff' driver I hacked up for QuickCheck. Yay! I'll be the first to switch over! Note that we actually probably want to use SmallCheck here, I don't

[Haskell-cafe] Writing guards shorthand

2007-04-19 Thread Joel Reymont
Support I want to infer the type given an Op that looks like this (incomplete): data Op = Minus | Plus | Mul | LT | GT Is there a shorthand way of bunching Minus, Plus and Mul in a function guard since they all result in TyNum whereas the rest in TyBool? I really

Re: [Haskell-cafe] Writing guards shorthand

2007-04-19 Thread Joel Reymont
This is what want. Notice the succinctness. Objective Caml version 3.10+dev24 (2007-02-16) # type foo = A | B | C | D | E | F ;; type foo = A | B | C | D | E | F # A;; - : foo = A # let infer = function | A | B | C - true; | D | E | F - false;; val infer : foo - bool = fun # infer

Re: [Haskell-cafe] Re: Writing guards shorthand

2007-04-19 Thread Joel Reymont
On Apr 19, 2007, at 4:10 PM, Jón Fairbairn wrote: Is there some reason why you don't want data Op = Aop Aop | Bop Bop data Aop = Minus | Plus | Mul data Bop = LT | GT It's a long story. The short version is that the above will complicate my AST a whole lot. I had it this way

[Haskell-cafe] Morphing ASTs and scrapping boilerplate code

2007-04-19 Thread Joel Reymont
Folks, I'm transforming ASTs as part of my compiler from one language into another. The source AST is a list of statements whereas the target AST is a class definition. type Object a = State Obj a data Obj = Object { objSym :: Integer -- starting # for gensym , objVars ::

[Haskell-cafe] Re: Morphing ASTs and scrapping boilerplate code

2007-04-19 Thread Joel Reymont
. Thanks, Joel On Apr 19, 2007, at 5:11 PM, Joel Reymont wrote: instance Morpher Type C.Type where ... morph (TyList ty) = liftM C.TyList (morph ty) morph (TyArray ty) = liftM C.TyArray (morph ty) morph (TySeries ty) = liftM C.TySeries (morph ty) morph (TyInput ty

[Haskell-cafe] SYB and opaque types

2007-04-18 Thread Joel Reymont
Suppose I need to manually derive Data and Typeable for SourcePos from Parsec to make sure my code compiles. I won't actually be running the code I manually derive since the constructor that includes SourcePos will be skipped. With Neil Mitchell's (and #haskell) help I'm doing this to

Re: [Haskell-cafe] Zero-arity tests in QuickCheck and displaying expected result

2007-04-17 Thread Joel Reymont
On Apr 17, 2007, at 9:31 AM, Ketil Malde wrote: Prelude Test.QuickCheck let prop0 = List.sort [3,2,1] == [1,2,3] in quickCheck prop0 OK, passed 100 tests. My point is to be able to see that result generated was X and that it did not match expected Y, where both X and Y are printed out.

[Haskell-cafe] Zero-arity tests in QuickCheck and displaying expected result

2007-04-16 Thread Joel Reymont
On Apr 16, 2007, at 9:29 PM, Donald Bruce Stewart wrote: It's interesting to note that QuickCheck generalises unit testing: zero-arity QC properties are exactly unit tests. I don't think this works very well. I rely quite heavily on being able to compare expected output with test results

[Haskell-cafe] Re: Zero-arity tests in QuickCheck and displaying expected result

2007-04-16 Thread Joel Reymont
Are there any examples of such custom drivers? On Apr 16, 2007, at 10:09 PM, Donald Bruce Stewart wrote: That's just the default driver. Plenty of custom drivers exist which compare the output. The QC driver is just a function you implement, after all. -- http://wagerlabs.com/

Re: [Haskell-cafe] Zero-arity tests in QuickCheck and displaying expected result

2007-04-16 Thread Joel Reymont
That's what HUnit does but it's enticing to be able to standardize on QuickCheck for all of your testing. On Apr 16, 2007, at 10:11 PM, Lennart Augustsson wrote: Why can't you just do 'f 1 2 3 == (4, 5, 6, 7)' to test f? -- http://wagerlabs.com/

Re: [Haskell-cafe] Parallel executing of actions

2007-04-15 Thread Joel Reymont
On Apr 15, 2007, at 8:23 PM, Spencer Janssen wrote: parSequence_ xs = do m - newEmptyMVar mapM_ (\x - forkIO x putMVar m ()) xs replicateM_ (length xs) (takeMVar m) mapM_ above spawns (length xs) threads blocking on a single lock, right? replicateM_ then makes sure that the

[Haskell-cafe] Type checking with Haskell

2007-04-12 Thread Joel Reymont
Folks, The ghc/compiler/typecheck directory holds a rather large body of code and quick browsing through did not produce any insight. How do you implement type checking in haskell? Assume I have an Expr type with a constructor per type and functions can take lists of expressions. Do I

Re: [Haskell-cafe] Type checking with Haskell

2007-04-12 Thread Joel Reymont
On Apr 12, 2007, at 1:07 PM, Stefan Holdermans wrote: You might want to check out Typing Haskell in Haskell [1] by Mark P. Jones. Must be _the_ paper as Don suggested it as well. I also looked at my copy of Andrew Appel's compilers in ML book and realized that I should be going about it

[Haskell-cafe] Typing non-Haskell in Haskell

2007-04-12 Thread Joel Reymont
I feel I should set aside a Friday of every week just to read the Haskell papers :-). After skimming through Typing Haskell in Haskell I have a couple of questions... Are type constructors (TyCon) applicable to Haskell only? Mine is a Pascal-like language. How would I type Pascal

Re: [Haskell-cafe] Type checking with Haskell

2007-04-12 Thread Joel Reymont
Thanks Stefan! On Apr 12, 2007, at 3:00 PM, Stefan O'Rear wrote: Your problem, as I understand it, is even simpler than most since there are no higher order functions and no arguments. I do have functions and arguments but I don't have HOF. (That said, it would probably be better to fuse

Re: [Haskell-cafe] Type checking with Haskell

2007-04-12 Thread Joel Reymont
On Apr 12, 2007, at 3:00 PM, Stefan O'Rear wrote: Also, GHC runs typechecking *before* desugaring, apparently thinking error messages are more important than programmer sanity :) What would be the benefit of running type checking after desugaring? -- http://wagerlabs.com/

Re: [Haskell-cafe] Left-factoring with Parsec

2007-04-12 Thread Joel Reymont
+ a + a^2 + a^3 + a^4 + ... OK, now put your grammar hat back on. What's 1 | a | aa | aaa | | ... it's just an arbitrary number of a:s, i.e., a* (or 'many a' in parsec). So finally expr = b a* -- Lennart On Apr 11, 2007, at 18:15 , Joel Reymont wrote: Suppose I have expr

[Haskell-cafe] Left-factoring with Parsec

2007-04-11 Thread Joel Reymont
Suppose I have expr = expr : expr : expr. Can the above be left-factored to fail on empty input so that my parser doesn't go into a loop? Thanks, Joel -- http://wagerlabs.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

[Haskell-cafe] Skipping keywords with Parsec

2007-04-11 Thread Joel Reymont
Is there a way to have any Parsec combinator skip a certain set of keywords? I tried lexeme = P.lexeme lexer . (skip ) but I don't think lexeme is called for every keyword. Thanks, Joel -- http://wagerlabs.com/ ___ Haskell-Cafe

[Haskell-cafe] Re: Skipping keywords with Parsec

2007-04-11 Thread Joel Reymont
Just in case I wasn't clear enough, I'm asking about skipping keywords represented by the skip combinator that can be located anywhere within the input. I do know about skipMany and skipMany1, in fact skip is defined in terms of these. On Apr 11, 2007, at 9:04 PM, Joel Reymont wrote

Re: [Haskell-cafe] Parsec: Help needed with simple parser

2007-04-10 Thread Joel Reymont
On Apr 10, 2007, at 3:42 AM, Albert Y. C. Lai wrote: Does option help? Like: It did, together with a couple of 'try's. Thanks, Joel -- http://wagerlabs.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

[Haskell-cafe] Type checking and locating token with Parsec

2007-04-10 Thread Joel Reymont
Folks, Imagine a language where Num + Num yields a Num and Str + Num yields a Str but Num + Str should not be allowed. I implemented parsing for such a language in OCaml with a yacc-based parser without an additional type-checking pass, entirely within the yacc grammar. I tried to take

[Haskell-cafe] Grabbing list of functions from current module

2007-04-09 Thread Joel Reymont
Folks, Does anyone have code that can grab a list of functions named with a certain prefix from the current (or given) module? I want to find functions named, say, ast_* and produce a list of tuples like (input1, ast_input1). Thanks, Joel -- http://wagerlabs.com/

Re: [Haskell-cafe] Grabbing list of functions from current module

2007-04-09 Thread Joel Reymont
Mea culpa! I meant Template Haskell code :-). Thanks John! On Apr 9, 2007, at 2:02 PM, John Meacham wrote: sed -ne 's/^ast_\([a-z0-9_A-Z]\+\).*$/(\1,ast_\1)/p' File.hs note the two occurances of 'ast_'. -- http://wagerlabs.com/ ___

[Haskell-cafe] Parsec: buildExpressionParser of a different type than parsed term

2007-04-09 Thread Joel Reymont
Folks, I'm trying to parse NumExpr NumExpr (example) which should return a logical expression while parsing numeric terms. I can't figure out how to make buildExpressionParser do this for me since it takes the type of the term parser given to it. If I supply a parser for numeric terms

Re: [Haskell-cafe] Parsec: buildExpressionParser of a different type than parsed term

2007-04-09 Thread Joel Reymont
Albert, On Apr 10, 2007, at 12:19 AM, Albert Y. C. Lai wrote: As you probably suspect, one single use of buildExpressionParser cannot accomplish it. It is equivalent to the problem of homogeneous lists. The issue is that I need buildExpressionParser to parse numerical expression but

[Haskell-cafe] Parsec: Help needed with simple parser

2007-04-09 Thread Joel Reymont
Folks, I wrote a parser for what should be a simple expression but it's not working. Any help is appreciated! My expression is x + 1 where x can be either Close, or Close[N] or Close[N] of DataM where N and M are positive integers. What happens in my case is that 1 + x parses fine but x

[Haskell-cafe] MPTC and type classes issue (polymorphic '+')

2007-04-07 Thread Joel Reymont
Folks, I'm trying to save time when typing in my ASTs so I thought I would create a Plus class like this (I do hide the one from Prelude) class PlusClass a b c | a b - c where (+) :: a - b - c {- instance (Integral a, Integral b) = PlusClass a b Expr where a + b = NumExpr (NumOp

Re: [Haskell-cafe] MPTC and type classes issue (polymorphic '+')

2007-04-07 Thread Joel Reymont
Pepe, On Apr 7, 2007, at 1:31 PM, Pepe Iborra wrote: input2 = [ InputDecs [ inp emaLength TyNumber ((20::Integer) + (40::Integer)) ] ] Thank you for your suggestion! I'm trying to make my AST definition as succinct as possible, though, so I would really love to have 20 + 40. The issue

Re: [Haskell-cafe] MPTC and type classes issue (polymorphic '+')

2007-04-07 Thread Joel Reymont
This is the related paste: http://hpaste.org/1291#a9 -- http://wagerlabs.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] MPTC and type classes issue (polymorphic '+')

2007-04-07 Thread Joel Reymont
Pepe, On Apr 7, 2007, at 2:01 PM, Pepe Iborra wrote: And without the Integral assumption, you cannot define your instance. So what I would do is to create a thin wrapper: i = id :: Integer - Integer and write: input2 = [ InputDecs [ inp emaLength TyNumber ((i 20) + (i 40)) ] ] That's

Re: [Haskell-cafe] MPTC and type classes issue (polymorphic '+')

2007-04-07 Thread Joel Reymont
On Apr 7, 2007, at 2:01 PM, Pepe Iborra wrote: So what I would do is to create a thin wrapper: i = id :: Integer - Integer and write: input2 = [ InputDecs [ inp emaLength TyNumber ((i 20) + (i 40)) ] ] I do it like this and it does save typing. It's not bad so I'll stick to it for

Re: [Haskell-cafe] MPTC and type classes issue (polymorphic '+')

2007-04-07 Thread Joel Reymont
On Apr 7, 2007, at 4:16 PM, Stefan O'Rear wrote: You can probably use -fallow-incoherent-instances for this. It has a scary name on purpose since it doesn't usually do what you think it should... My (very limited!) understanding of type checking algorithms says that in this case, the worst

[Haskell-cafe] How can I refactor this code?

2007-04-06 Thread Joel Reymont
http://hpaste.org/127 It looks quite ugly to me so any help is appreciated! Thanks in advance, Joel -- http://wagerlabs.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: How can I refactor this code?

2007-04-06 Thread Joel Reymont
That would be http://hpaste.org/1278, my apologies! -- http://wagerlabs.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Automatic derivation (TemplateHaskell?)

2007-04-05 Thread Joel Reymont
Stefan, Data.Derive is a most awesome piece of code! Is there soemething in DrIFT that you did not like that made you write it? Thanks a lot! On Apr 5, 2007, at 12:48 AM, Stefan O'Rear wrote: Data.Derive can do this. In an attempt to avoid munging the relevent files they are

Re: Re[2]: [Haskell-cafe] Automatic derivation (TemplateHaskell?)

2007-04-05 Thread Joel Reymont
Following tells me that Data.Derive.Peephole was built. ar t dist/build/libHSderive-0.1.a says Derive.o is there. ghc-pkg -l /opt/local/lib/ghc-6.6/package.conf: Cabal-1.1.6, FilePath-0.11, GLUT-2.0, HUnit-1.1, OpenGL-2.1, QuickCheck-1.0, base-2.0, cgi-2006.9.6, derive-0.1, fgl-5.2,

Re: [Haskell-cafe] Automatic derivation (TemplateHaskell?)

2007-04-05 Thread Joel Reymont
Stefan, What version of ghc are you using? Mine is 6.6. Data/Derive/Play.hs:9:7: Could not find module `Control.Monad.State': it is a member of package mtl-1.0, which is hidden I commented out that import line. Preprocessing library derive-0.1... Preprocessing executables for

Re: [Haskell-cafe] Automatic derivation (TemplateHaskell?)

2007-04-05 Thread Joel Reymont
On Apr 5, 2007, at 11:04 AM, Joel Reymont wrote: This is in Language.Haskell.TH.Syntax which is imported at the top of Data/Derive/TH.hs so I don't understand the cause of the error Apparently instance Functor Q was added to 6.6 very recently and it's not in MacPorts yet. I decided

Re: [Haskell-cafe] Automatic derivation (TemplateHaskell?)

2007-04-05 Thread Joel Reymont
That did it, thanks! On Apr 5, 2007, at 12:07 PM, Twan van Laarhoven wrote: instance Functor Q where fmap = liftM -- http://wagerlabs.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: Re[2]: [Haskell-cafe] Automatic derivation (TemplateHaskell?)

2007-04-05 Thread Joel Reymont
Installed derive, trying to load it with ghci -package derive Loading package base ... linking ... done. Loading package template-haskell ... linking ... done. Loading package FilePath-0.11 ... linking ... done. ghc-6.6: unknown symbol `_derivezm0zi1_DataziDeriveziPeephole_zdf7_closure' Loading

Re: [Haskell-cafe] Automatic derivation (TemplateHaskell?)

2007-04-05 Thread Joel Reymont
This is in Language.Haskell.TH.Syntax which is imported at the top of Data/Derive/TH.hs so I don't understand the cause of the error instance Functor Q where fmap f (Q x) = Q (fmap f x) Copying the above into TH.hs gives me Preprocessing library derive-0.1... Preprocessing executables for

Re: Re[2]: [Haskell-cafe] Automatic derivation (TemplateHaskell?)

2007-04-05 Thread Joel Reymont
Data.Derive.TH Data.Derive.Binary Data.Derive.BinaryDefer Data.Derive.Eq Data.Derive.Play On Apr 5, 2007, at 12:46 PM, Joel Reymont wrote: FunParser.hs:4:7: Could not find module `Data.Derive.Peephole': Use -v to see a list of the files searched for. -- http

Re: [Haskell-cafe] Automatic derivation (TemplateHaskell?)

2007-04-05 Thread Joel Reymont
With derive compiled and installed I thought I would change the code a bit and try it... ghci -fth -v0 -e '$( _derive_print_instance makeFunParser Foo )' baz.hs baz.hs:30:3: Not in scope: `a1' Any help is appreciated! Thanks, Joel --- FunParser.hs: module FunParser where

Re: [Haskell-cafe] Automatic derivation (TemplateHaskell?)

2007-04-05 Thread Joel Reymont
Here's the output from -ddump-splices (thanks Saizan for the tip). It's returning a1 instead of a0. ghci -fth -e '$( _derive_print_instance makeFunParser Foo )' baz.hs -ddump-splices baz.hs:1:0: baz.hs:1:0: Splicing declarations derive makeFunParser 'Foo ==

Re: [Haskell-cafe] Automatic derivation (TemplateHaskell?)

2007-04-05 Thread Joel Reymont
Shouldn't this work just as well? numExpr = choice [ try $ float = return . Num , integer = return . Int ] It works on Foo(10.345) but not on Bar(10, 103.34). On Apr 5, 2007, at 4:09 PM, Stefan O'Rear wrote: numExpr :: GenParser Char a NumExpr numExpr = do sg -

[Haskell-cafe] Which pretty printer?

2007-04-04 Thread Joel Reymont
Should I prefer Daan Leijen's pretty printer [1] to the Hughes-SPJ one that comes with GHC? Has anyone looked at both and is able to tell the difference? I need to pretty-print a Pascal-like language as well as C#. Thanks, Joel [1]

[Haskell-cafe] Re: Which pretty printer?

2007-04-04 Thread Joel Reymont
Also, are there examples of using either pretty printer? On Apr 4, 2007, at 9:57 AM, Joel Reymont wrote: Should I prefer Daan Leijen's pretty printer [1] to the Hughes-SPJ one that comes with GHC? Has anyone looked at both and is able to tell the difference? I need to pretty-print a Pascal

[Haskell-cafe] QuickCheck's co-arbitrary

2007-04-04 Thread Joel Reymont
Folks, I understand that arbitrary defines the possible values. How do I generally come up with co-arbitrary, though? Would someone kindly explain the choice of co-arbitrary in the following cases, specially the very last bit with variant 1 . coarbitrary a? instance Arbitrary Char where

[Haskell-cafe] QuickCheck: Arbitrary for a complex type

2007-04-04 Thread Joel Reymont
Suppose I have a type describing a statement and that I'm trying to make it an instance of arbitrary. The type looks like this: data Statement = InputDecs [InputDecl] | VarDecs [VarDecl] | ArrayDecs [ArrayDecl] | Compound [Statement] | Assign (VarIdent, Expr) |

[Haskell-cafe] Re: QuickCheck: Arbitrary for a complex type

2007-04-04 Thread Joel Reymont
I got this simple example working so I think I have my question answered. Now I just have to learn to write generators of my own to produce valid and invalid input for my parser. module Foo where import Control.Monad import System.Random import Test.QuickCheck data Foo = Foo Int

Re: [Haskell-cafe] Re: QuickCheck: Arbitrary for a complex type

2007-04-04 Thread Joel Reymont
One last bit then... My identifiers should start with letter | char '_' and the tail should be alphaNum | char '_'. I guess I can use choose and oneof to produce the right set of characters but how do I combine the two into a single identifier of a given length (up to 20 chars, say)?

[Haskell-cafe] Automatic derivation (TemplateHaskell?)

2007-04-04 Thread Joel Reymont
Folks, I have very uniform Parsec code like this and I'm wondering if I can derive it using TemplateHaskell or DrIFT or some other tool. Any ideas? Note that 1) The reserved word matches the constructor 2) No arguments equals no parens 3) More than one argument is separated with a comma

[Haskell-cafe] SmallCheck and parser testing

2007-04-03 Thread Joel Reymont
Folks, I'm trying to figure out how to test a Parsec-based parser with Smallcheck [1]. My test AST is below and the goal is to return StyleValue Int here if the parser is fed an integer, or return Solid when parsing Solid, etc. data Style = StyleValue Expr | Solid | Dashed

[Haskell-cafe] Keeping a symbol table with Parsec

2007-04-02 Thread Joel Reymont
Folks, Are there any examples of keeping a symbol table with Parsec? I'm translating a parser from OCaml and I do this OUTPUT COLON ID LP NUMERIC_SIMPLE RP { add $3 TypNumOut; SimpleOutputDec ($3, Number) } Meaning that if a keyword Output is followed by : and an identifier and then

Re: [Haskell-cafe] Keeping a symbol table with Parsec

2007-04-02 Thread Joel Reymont
On Apr 2, 2007, at 11:17 PM, Nicolas Frisby wrote: Section 2.12 of the Parsec manual[1] discusses user state. It sounds like that is what you are after. Yes, thanks. My question is mostly about how to return a different token when the lexer finds an identifier that's already in the

Re: [Haskell-cafe] questions about core

2007-02-12 Thread Joel Reymont
On Feb 12, 2007, at 5:45 AM, Matt Roberts wrote: - The hackathon videos, - A transformation-based optimiser for Haskell, - An External Representation for the GHC Core Language (DRAFT for GHC5.02), and - Secrets of the Glasgow Haskell Compiler inliner. Matt, can you please post

Re: [Haskell-cafe] questions about core

2007-02-12 Thread Joel Reymont
On Feb 12, 2007, at 7:06 AM, Stefan O'Rear wrote: We have Core because Simon lacks the patience to solve the halting problem and properly perform effects analysis on STG. We have STG because Simon lacks the patience to wait for the 6.6 Simplifier to finish naively graph-reducing every

Re: [Haskell-cafe] Lambada and connecting Haskell to a Weblogic server

2007-02-11 Thread Joel Reymont
Yep, don't have access to the Weblogic server. I'm re-evaluating my options, though, since I'm lazy by nature. On Feb 11, 2007, at 12:30 PM, Neil Bartlett wrote: Joel, Implementing Java RMI in Haskell sounds like a nightmare. Why not use HTTP? You could easily write a wrapper Servlet that

[Haskell-cafe] Embedding ghc

2007-02-10 Thread Joel Reymont
Has anyone tried embedding ghc into their app? How big are the resulting binaries? Thanks, Joel -- http://wagerlabs.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Haskell vs Ruby as a scripting language

2007-02-10 Thread Joel Reymont
Is anyone using Haskell as a scripting language in their app? I'm thinking of viable it would be to embed ghc in a Mac (Cocoa) app. TextMate [1] uses Ruby as the extension language and quite successfully at that. Everybody loves Ruby since it's simple. I need a trading systems language and

Re: [Haskell-cafe] Haskell vs Ruby as a scripting language

2007-02-10 Thread Joel Reymont
On Feb 10, 2007, at 2:25 PM, Brian Smith wrote: Is your application primarily written in Haskell? If not, you would have to create an interface between that language and Haskell in order for your Haskell programs to manipulate your domain objects and user interface. It would be

[Haskell-cafe] Lambada and connecting Haskell to a Weblogic server

2007-02-10 Thread Joel Reymont
Folks, Where can I find Lambada these days and would it be of any use to me in trying to connect to a Weblogic server? To make the long story short, my broker's Java software connects to a remote Weblogic server and I would like to do the same. I suppose this would require me to

[Haskell-cafe] Parsec and Java

2007-02-10 Thread Joel Reymont
Folks, Is there a Java parser implemented using Parsec? Thanks, Joel -- http://wagerlabs.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] How did you stumble on Haskell?

2007-02-03 Thread Joel Reymont
I'll go for the shortest story... I stumbled upon Simon's Composing Financial Contracts paper, Simon was gracious enough to spend a fair bit of time on the phone with me. The rest is history :-). Joel -- http://wagerlabs.com/ ___

[Haskell-cafe] A distributed and replicating native Haskell database

2007-02-02 Thread Joel Reymont
Folks, Allegro Common Lisp has AllegroCache [1], a database built on B-Trees that lets one store Lisp objects of any type. You can designate certain slots (object fields) as key and use them for lookup. ACL used to come bundled with the ObjectStore OODBMS for the same purpose but then

Re: [Haskell-cafe] A distributed and replicating native Haskell database

2007-02-02 Thread Joel Reymont
On Feb 2, 2007, at 3:06 PM, Paul Johnson wrote: As a rule, storing functions along with data is a can of worms. Either you actually store the code as a BLOB or you store a pointer to the function in memory. Either way you run into problems when you upgrade your software and expect the

Re: [Haskell-cafe] Connected!

2007-02-01 Thread Joel Reymont
What part of Russia do you live in? On Feb 1, 2007, at 1:23 PM, Bulat Ziganshin wrote: Hello haskell-cafe, i've just got ADSL connection here! it's slow (64k) and not cheap, but at least it is completely different from dial-up i've used before -- http://wagerlabs.com/

Re: [Haskell-cafe] proposal: HaBench, a Haskell Benchmark Suite

2007-01-28 Thread Joel Reymont
On Jan 28, 2007, at 8:51 AM, Andy Georges wrote: it is nice to know that e.g., Data.ByteString performs as good as C, but is would be even nicer to see that large, real-life apps can reach that same performance. What about using darcs as a benchmark? I heard people say it's slow. The

  1   2   3   4   5   >