[Haskell-cafe] (no subject)
http://maipenarai.com/lindex02.html ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] (no subject)
I'm sorry, somehow my e-mail account got kidnapped. The link is a virus and should NOT be opened. I apologise for any inconvenience. Fernando Henrique Sanches 2011/6/13 Fernando Henrique Sanches fernandohsanc...@gmail.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [Vendettaproject]
I'm sorry, somehow my e-mail account got kidnapped. The link is a virus and should NOT be opened. I apologise for any inconvenience. Peço desculpas, de alguma forma minha conta de e-mail foi invadida. O link é um vírus e NÃO deve ser aberto. Peço desculpas por qualquer transtorno. Fernando Henrique Sanches Em 13 de junho de 2011 04:32, Fernando Henrique Sanches fernandohsanc...@gmail.com escreveu: -- Você está recebendo esta mensagem porque se inscreveu no grupo Vendetta Project dos Grupos do Google. Para postar neste grupo, envie um e-mail para fire-kitsune-anime-et-al-c...@googlegroups.com. Para cancelar a inscrição nesse grupo, envie um e-mail para fire-kitsune-anime-et-al-club+unsubscr...@googlegroups.com. Para obter mais opções, visite esse grupo em http://groups.google.com/group/fire-kitsune-anime-et-al-club?hl=pt-BR. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Parsec - separating Parsing from Lexing
Hello again. First, I'd like to thank you both for your help. You gave me nice tips and nice material. However, I think there is something I'm missing here. I've coded most of the parser, and I have a feeling I'm doing some great mistake. Not only my code won't compile, I don't know how to deal with multiple possible return values and worse yet - I don't know how I'll proceed from this to Semantic Analysis and, later, code generation. Honestly, I'm thinking I'll have to scrap out all of this code and use the (ugh) Java template code the teacher gave us. My code is divided in three files: Parser.hs (the real parsing, problematic): http://hpaste.org/fastcgi/hpaste.fcgi/view?id=13399#a13399 ParserTokens.hs (where I believe the problem arouse): http://hpaste.org/fastcgi/hpaste.fcgi/view?id=13400#a13400 Lexer.hs (the lexer, the only part I believe is mostly right): http://hpaste.org/fastcgi/hpaste.fcgi/view?id=13401#a13401 That's a lot of code and I feel I'm far from reaching the solution to my problem. This code is getting ugly, and I'm somewhat desperate. Any help will be greatly appreciated. Fernando Henrique Sanches On Tue, Nov 10, 2009 at 6:21 PM, Jason Dusek jason.du...@gmail.com wrote: You have to bootstrap your parser with something that takes an `MJVal` and updates the parser state. Here is a simple example: http://github.com/jsnx/system-uuid/blob/master/Options.hs This is a parser for command line options. It parses a list of `String`s, not `Char`s (because `argv` is `char**` and not `char*`, right?) so we introduce `stringPrim` and then build up the primitives from that. -- Jason Dusek ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Parsec - separating Parsing from Lexing
Hi. I believe I'm using parsec 3.0.1, although I already fixed the imports (even thou they were working). Thanks for the references, specially the parsec User Guide - it saved my life, in 30 minutes I actually *understood* my mistake and fixed it. Now my code and it compiles and makes sense, even though it's a bit useless, since it has no return values [yet]. I'll take a look at UUAG and Tiger. However, since this is a simple college assignment, I want my compiler to be as simple as possible but in a way I understand what I'm doing, so I'll probably be doing it by hand. Fernando Henrique Sanches On Mon, Nov 30, 2009 at 2:58 PM, Stephen Tetley stephen.tet...@gmail.comwrote: Hi Fernando Which version of Parsec are you using, the one that ships with GHC or Parsec 3? I would imagine whichever you one you are using you have the imports wrong for these modules: import Text.Parsec.Pos import Text.Parsec.Prim should be ... import Text.ParserCombinators.Parsec.Pos import Text.ParserCombinators.Parsec.Prim Also it seems like an applicative instance for Parsec's GenParser monad is missing. This isn't defined for parsec-2.1.0.1, people seem to define it themselves: -- The Applicative instance for every Monad looks like this. instance Applicative (GenParser s a) where pure = return (*) = ap ... you will need `ap` from Control.Monad in scope. Also there is a pdf document for Parsec (should be available from Daan Leijen's home page) that covers separate scanners, it has quite a lot more documentation than Parsec's Haddock docs. For semantic analysis I'd highly recommend UUAG, it is well documented and used for a large compiler (EHC). There is also a version of Andrew Appel's Tiger language written with it that is much smaller and more comprehensible, the version on Hackage doesn't seem to contain the attribute grammar source but it is available here: http://www.cs.uu.nl/wiki/bin/view/HUT/TigerCompiler http://www.cs.uu.nl/wiki/bin/view/HUT/AttributeGrammarSystem Best wishes Stephen ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Parsec - separating Parsing from Lexing
Hello. I'm currently implementing a MicroJava compiler for a college assignment (the implemented language was defined, the implementation language was of free choice). I've sucessfully implemented the lexer using Parsec. It has the type String - Parser [MJVal], where MJVal are all the possible tokens. However, I don't know how to implement the parser, or at least how to do it keeping it distinguished from the lexer. For example, the MicroJava grammar specifies: Program = program ident {ConstDecl | VarDecl | ClassDecl} { {MethodDecl} }. The natural solution (for me) would be: program = do string program programName - identifier ... However, I can't do this because the file is already tokenized, what I have is something like: [Program_, identifier_ testProgram, lBrace_, ...] for the example program: program testProgram { ... How should I implement the parser separated from the lexer? That is, how should I parse Tokens instead of Strings in the Haskell way? Fernando Henrique Sanches ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Fuzzy Logic / Linguistic Variables
I didn't read the book, but your code seems very elegant, more than I even thought possible. I've never programmed with fuzzy logic before, but I can understand your code - it reads naturally. Fernando Henrique Sanches On Wed, Oct 14, 2009 at 9:59 AM, Neal Alexander relapse@gmx.com wrote: So i was reading Programming Game AI by Example by Mat Buckland ( http://www.ai-junkie.com/books/toc_pgaibe.html) and decided to rewrite his chapter on Fuzzy logic in haskell (from C++). My initial impression: its one of those scenarios where OOP grossly over complicates things Heres an example taken from the book: An agent needs to decide what weapon to use based on his distance from the target and the amount of ammo each has. The result is in the desirability domain (0-100). http://code.haskell.org/~hexpuem/fuzzyLogic/AI/Logic/Fuzzy/Example.hshttp://code.haskell.org/%7Ehexpuem/fuzzyLogic/AI/Logic/Fuzzy/Example.hs An excerpt: weapons = [ Weapon RocketLauncher 9 rocketLauncher, Weapon ShotGun 13 shotgun, Weapon AssaultRifle 120 assaultRifle, Weapon SniperRifle 7 sniperRifle, Weapon Knife 1 knife ] chooseWeapon dist = maximum ratings where ratings = [ (f dist ammo, n) | Weapon n ammo f - weapons ] shotgun :: Double - Double - Double shotgun dist ammo = unfuzz desireDom $ rules (fuzz distDom dist) (fuzz ammoDom ammo) where rules :: Fuzzy Distances - Fuzzy Ammo - FL Desirability rules distance ammo = do distance `is` SniperSuited = Pointless distance `is` Far = Undesirable distance `is` Medium = Undesirable distance `is` Melee= Undesirable (distance `fairly` Near) (ammo `fairly` High) = VeryDesirable (distance `fairly` Near) (ammo `fairly` Good) = Desirable (distance `fairly` Near) (ammo `is` Low) = Undesirable Full code at http://code.haskell.org/~hexpuem/fuzzyLogic/http://code.haskell.org/%7Ehexpuem/fuzzyLogic/ . Suggestions welcome - maybe it'd be useful to upload to hackage at some point. It only supports triangle, shoulder, and singleton memberships at the moment. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: cabal: : openFile: does not exist (No such file or directory)
Sorry for ressurecting the thread, my I'm having the same problem here. Deleting the .cabal/config file shows only temporary results, and -v3 isn't helping: ~/sources/haskell-platform-2009.2.0.2 % cabal update Config file /home/fernando/.cabal/config not found. Writing default configuration to /home/fernando/.cabal/config Downloading the latest package list from hackage.haskell.org ~/sources/haskell-platform-2009.2.0.2 % cabal update cabal: :: openFile: does not exist (No such file or directory) ~/sources/haskell-platform-2009.2.0.2 % cabal update -v3 cabal: ?: openFile: does not exist (No such file or directory) I'm on Ubuntu 9.04 x64. ghc 6.10.4 This is the output of the mentioned describe-parsec command, but I don't know what to do with it: ~/sources/haskell-platform-2009.2.0.2 % ghc-pkg describe parsec-2.1.0.1 name: parsec version: 2.1.0.1 license: BSD3 copyright: maintainer: Daan Leijen d...@cs.uu.nl stability: homepage: http://www.cs.uu.nl/~daan/parsec.html package-url: description: Parsec is designed from scratch as an industrial-strength parser library. It is simple, safe, well documented (on the package homepage), has extensive libraries and good error messages, and is also fast. category: Parsing author: Daan Leijen d...@cs.uu.nl exposed: True exposed-modules: Text.ParserCombinators.Parsec.Language Text.ParserCombinators.Parsec.Token Text.ParserCombinators.Parsec.Error Text.ParserCombinators.Parsec.Char Text.ParserCombinators.Parsec.Combinator Text.ParserCombinators.Parsec.Expr Text.ParserCombinators.Parsec.Perm Text.ParserCombinators.Parsec.Pos Text.ParserCombinators.Parsec.Prim Text.ParserCombinators.Parsec hidden-modules: import-dirs: /usr/local/lib/parsec-2.1.0.1/ghc-6.10.4 library-dirs: /usr/local/lib/parsec-2.1.0.1/ghc-6.10.4 hs-libraries: HSparsec-2.1.0.1 extra-libraries: extra-ghci-libraries: include-dirs: includes: depends: base-4.1.0.0 hugs-options: cc-options: ld-options: framework-dirs: frameworks: haddock-interfaces: /usr/local/share/doc/parsec-2.1.0.1/html/parsec.haddock haddock-html: /usr/local/share/doc/parsec-2.1.0.1/html Fernando Henrique Sanches On Thu, Jul 30, 2009 at 7:52 AM, Mike Pentney mike.pent...@physics.orgwrote: I had a similar problem (on Ubuntu Incontinent Ibex). I'd previously installed ghc 6.8.x, and (among other things) cabal. When I decided to upgrade to the Haskell platform, I deleted ghc but not my original cabal installation. When I got the error, I deleted my (old) copy of ~/.cabal/config and it seemed to fix the problem. I'd assumed something in the config file was pointing to a file or directory that had been removed when I uninstalled ghc 6.8.x... HTH Mike. Job Vranish wrote: lol, yep you're right. I'd assumed the haskell platform shipped with the latest parsec, when in fact it does not :) my bad... However, I fixed the cabal issue by installing ghc 6.10.3 and rebuilding the haskell platform. Apparently there is either a compiler issue or incompatibility with 6.10.4 that causes the cabal: : openFile: does not exist (No such file or directory) error. - Job On Tue, Jul 28, 2009 at 10:44 AM, Thomas Hartman tphya...@gmail.commailto: tphya...@gmail.com wrote: did you verify parsec-2.1.0.1 exports Text.Parsec.Language ? This might be a parsec 2 versus parsec 3 issue ghc-pkg describe parsec-2.1.0.1 should tell you the answer to that. 2009/7/27 Job Vranish jvran...@gmail.com mailto:jvran...@gmail.com : I tried updating to ghc-6.10.4 and have exactly the same error. Also ghc doesn't seem to be able to find any of the haskell platform packages, even though it ghc-pkg finds them just fine. For example (trimmed for brevity): ghc-pkg list /usr/local/lib/ghc-6.10.4/./package.conf: Cabal-1.6.0.3, ... parsec-2.1.0.1, pretty-1.0.1.0, process-1.0.1.1, random-1.0.0.1, ... ghci -v readModel.hs GHCi, version 6.10.4: http://www.haskell.org/ghc/ :? for help Glasgow Haskell Compiler, Version 6.10.4, for Haskell 98, stage 2 booted by GHC version 6.8.2 Using package config file: /usr/local/lib/ghc-6.10.4/./package.conf ... readModel.hs:9:7: Could not find module `Text.Parsec.Language': locations searched: Text/Parsec/Language.hs Text/Parsec/Language.lhs Failed, modules loaded: none. ... ghc-pkg finds parsec, but ghci can't find it. And if I do a cabal -v3 update I get a: cabal: 3: openFile: does not exist (No such file or directory) Anybody figured it out? - Job Vranish On Fri, Jul 17, 2009 at 11:17 AM, Thomas Hartman tphya...@gmail.com mailto:tphya
Re: [Haskell-cafe] Haskell programmers in São Carlo s - SP - Brazil?
São Caetano, SP, Brazil - right next to São Paulo. UFABC Student. Fernando Henrique Sanches 2009/5/19 Maurício briqueabra...@yahoo.com Anybody else around here? Best, Maurício ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell Logo Voting has started!
Voting among 100+ options took a while (15-20 minutes?), but I had no problems. The system may be suboptimal, but it works nicely. It probably won't make people vote in wrong options (at least not too often, mistakes always happen), so it is doing a fine job. Thanks for organizing the voting for us. Fernando Henrique Sanches 2009/3/17 Eelco Lempsink ee...@lempsink.nl Hi there! I updated a couple of logo versions and ungrouped and regrouped the (former) number 31. Other than that, there was nothing standing in the way of the voting to begin imho, so I started up the competition. By now, I suppose everybody should have received their ballot. If you think you should have received it but didn't, please report it, I can resend the invitation. Also, for people not directly subscribed to the haskell-cafe mailing list, you can still send ballot requests until the end of the competition (March 24, 12:00 UTC). Make sure the message contains 'haskell logo voting ballot request' (e.g. in the subject). Depending on the winner of this voting round we can decide whether we need to continue with variations. Jared Updike already offered to donate a bit of time to help create several variations. But for now, good luck with sorting those options! :) -- Regards, Eelco Lempsink ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe