Re: [Haskell-cafe] Github support for cabal files
On 24.07.2011 13:11, Joris Putcuyps wrote: On Sat, 23 Jul 2011 19:25:53 -0700 Greg Weberg...@gregweber.info wrote: [1] http://hackage.haskell.org/package/hamlet The cabal file should be compact, and quite often the description field is very lengthy. I would like it alot if I could reference a README.??? (pandoc compatible extension) from cabal. Then it would be compatible with github and give me more information in my haddock html pages which were generated by `cabal haddock`. To this end I sometimes wrote a dummy module containing more documentation. In the Cabal description file I refer to this module with a quotation like Module. This way, I can even organize the documentation in chapters. I added DEPRECATED pragmas to these modules, in order to prevent people from importing them. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] For class Monoid; better names than mempty mappend might have been: mid (mident) mbinop
On 24.07.2011 22:20, Antoine Latter wrote: On Sat, Jul 23, 2011 at 1:41 PM, KCkc1...@gmail.com wrote: It would be easier for beginners to grok. I think that assumes that all beginners have a strong foundation in algebra. Although it does have the advantage that the names are as abstract as the class. As pointed out earlier in this list, the name of the class and the methods are inconsistent. Monoid refers to a general algebraic structure, whereas mempty and mappend refer to certain instances like lists. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] How to use cabal macros in .hsc files
Hello, Currently it's not possible to use cabal macros like MIN_VERSION_base(x,y,z) in .hsc files: http://hackage.haskell.org/trac/hackage/ticket/870 Is there a workaround to get the same effect? Regards, Bas ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [Haskell-beginners] Conciseness question
Sorry, I haven't read all the replies so I don't know if you have completely described the problem you're trying to solve; however, it might be better for people in future to say they want O(1) for insertions, O(lg n) for searching, etc. If they don't want to completely describe what their problem is. -- -- Regards, KC ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] For class Monoid; better names than mempty mappend might have been: mid (mident) mbinop
As pointed out earlier in this list, the name of the class and the methods are inconsistent. Monoid refers to a general algebraic structure, whereas mempty and mappend refer to certain instances like lists. Thank you for articulating what I was trying to get at. -- -- Regards, KC ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is there a program to check if a matrix is totally unimodular?
I haven't come across unimodular matrices before, but according to the definition on wikipedia it seems fairly straightforward to implement a naive algorithm to decide it. Also, have you considered trying IRC for these sorts of short questions? The #haskell IRC channel on freenode is helpful and seems better suited to asking questions like this, if you just want quick answers. There's a shorter lag than a mailing list, and the IRC medium seems closer to the kinds of things I've seen you ask. From observing the mailing list for quite a while, it seems that if you want a decent conversation on here, you should ask more fleshed-out questions with an explanation of some background to the problem, and more details on what you want and why. -Dan On Wed, Aug 3, 2011 at 5:45 PM, KC kc1...@gmail.com wrote: -- -- Regards, KC ___ 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] Analyzing slow performance of a Haskell program
Where is the `unsafeAt` function? I can't seem to find it ( http://haskell.org/hoogle/?hoogle=unsafeat). For reference I have asked the same question on StackOverflow. One person suggested that the reason might be that Int64 on Windows is broken ( http://stackoverflow.com/questions/6970904/analyzing-slow-performance-of-a-haskell-program/6976448#6976448 ). I tried the same test on Arch Linux x64 (GHC 7.0.3) but it still can't complete in 3 minutes, where as a new C++ version I wrote completes in 45 seconds (because I didn't want to use Mono for benchmarks. For reference here is the C++ implementation http://ideone.com/vZGhh (Again, ironically shorter than Haskell and actually looks quite clean)) The profile under x64 Linux is similar to the one posted before -- most allocations and time spent in wordLength'. It seems mysterious that such an innocent program is so obscure to write correctly in Haskell :P Chris On Mon, Aug 8, 2011 at 1:40 AM, Eugene Kirpichov ekirpic...@gmail.comwrote: What about using unsafe array indexing operations? (i.e. array `unsafeAt` index) 2011/8/7 Chris Yuen kizzx2+hask...@gmail.com: Here is an updated version using Data.Array.Unboxed http://ideone.com/YXuVL And the profile http://hpaste.org/49940 Still taking 5+ minutes... Chris On Sun, Aug 7, 2011 at 5:20 PM, Daniel Fischer daniel.is.fisc...@googlemail.com wrote: On Sunday 07 August 2011, 10:52:20, Max Bolingbroke wrote: In short I don't see how to get further without changing the algorithm or doing some hacks like manual unrolling. Maybe someone else has some ideas? Well, the C# implementation uses arrays for lookup while the Haskell version uses list lookups in (tens !! fromIntegral t) ++ wordify x and case'd functions lenTens 0 = 0 lenTens 1 = 3 lenTens 2 = 6 lenTens 3 = 6 lenTens 4 = 5 lenTens 5 = 5 lenTens 6 = 5 lenTens 7 = 7 lenTens 8 = 6 lenTens 9 = 6 wordify is only called once at the end, so that should not have a measurable impact, but the lenXXXs might. I'm not sure what CaseLen.$wlenTens :: GHC.Prim.Int# - GHC.Prim.Int# [GblId, Arity=1, Str=DmdType L, Unf=Unf{Src=vanilla, TopLvl=True, Arity=1, Value=True, ConLike=True, Cheap=True, Expandable=True, Guidance=IF_ARGS [12] 11 0}] CaseLen.$wlenTens = \ (ww_shY :: GHC.Prim.Int#) - case ww_shY of _ { __DEFAULT - CaseLen.lenTens1 `cast` (CoUnsafe GHC.Types.Int GHC.Prim.Int# :: GHC.Types.Int ~ GHC.Prim.Int#); 0 - 0; 1 - 3; 2 - 6; 3 - 6; 4 - 5; 5 - 5; 6 - 5; 7 - 7; 8 - 6; 9 - 6 } means at a lower level, but it's certainly worth trying out whether an unboxed array lookup is faster. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Eugene Kirpichov Principal Engineer, Mirantis Inc. http://www.mirantis.com/ Editor, http://fprog.ru/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Analyzing slow performance of a Haskell program
On Monday 08 August 2011, 18:24:45, Chris Yuen wrote: Where is the `unsafeAt` function? Data.Array.Base I can't seem to find it ( http://haskell.org/hoogle/?hoogle=unsafeat). Data.Array.Base is not haddocked (there's a reason for that), so hoogle doesn't know about its functions. For reference I have asked the same question on StackOverflow. One person suggested that the reason might be that Int64 on Windows is broken ( http://stackoverflow.com/questions/6970904/analyzing-slow-performance-o f-a-haskell-program/6976448#6976448 ). As far as I know, there's no 64-bit GHC for windows, so that might well have performance impact even on 64-bit windows. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] extending and reusing cmdargs option specs ?
Hi Neil, I just spent a day converting hledger from getopt to cmdargs. cmdargs feels more high level and featureful and nicer. And yet... I haven't reduced the line count that much - nothing like your HLint 3:1 ratio. And, I may have made things worse for myself in the reuse/avoiding boilerplate department: I'm not sure how to reuse a cmdargs options data structure, extending it with a few more options. Using getopt I was able to do this without repeating myself (as long as I defined the full set of Opt constructors in one place.) I've looked at the more advanced cmdargs api, but don't see a way yet - would you have any ideas ? I want this because I have multiple executables (hledger, hledger-vty, hledger-web etc.) which should share most (but not all) options. Also, I'd like to move a generic subset of report options, without the ui- specific ones, into hledger-lib for use by all apps. Also, the hledger executable has multiple commands, so I'd like to define a mode for each, but not have to redeclare all the same options for each mode - I didn't see how to do that. As always, thanks a lot for cmdargs! -Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] For class Monoid; better names than mempty mappend might have been: mid (mident) mbinop
On Mon, Aug 8, 2011 at 1:56 AM, Henning Thielemann schlepp...@henning-thielemann.de wrote: On 24.07.2011 22:20, Antoine Latter wrote: On Sat, Jul 23, 2011 at 1:41 PM, KCkc1...@gmail.com wrote: It would be easier for beginners to grok. I think that assumes that all beginners have a strong foundation in algebra. Although it does have the advantage that the names are as abstract as the class. As pointed out earlier in this list, the name of the class and the methods are inconsistent. Monoid refers to a general algebraic structure, whereas mempty and mappend refer to certain instances like lists. I don't know what the intention for the names was, but I read them as syntactic empty and append, as in the monoid constructs of algebra. In other words, we construct words by appending (or concatenating) elements of a monoid. And we have an empty word. This usage is common enough in mathematics. After all, if we use the Monoid class interface for a type, we are explicitly using the monoid operations, and not the type's underlying interpretation for appending words in the type. Why should the generic monoid operator names reflect the underlying usage? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Help understanding Haskell runtime costs
Hello all, I'm relatively new to Haskell and trying to solve some online judge's problems in it. One of the problems is to say if a given sentence is a tautogram or not. A tautogram is just a sentence with all the words starting with the same letter. My first try (solution is ok) was to do it as haskeller as possible, trying to overcome my imperative mind. But it did bad at performance (0.30 secs of runtime, 4.6 mb of memory): -- code start import Data.Char (toLower) main = getContents = mapM_ (putStrLn . toStr . isTautogram . words) . takeWhile (/= *) . lines toStr :: Bool - [Char] toStr True = Y toStr False = N isTautogram :: [[Char]] - Bool isTautogram (x:[]) = True isTautogram (x:xs) = all ((== firstChar) . toLower . head) xs where firstChar = toLower . head $ x -- code end I tried to profile the code, but didn't find anything useful. My bet is that all this words . lines is consuming more memory than necessary, maybe saving space for the lines already processed. Then I tried a some-what tail-call function, consuming one line at each iteration: -- code start import Data.Char (toLower) main :: IO () main = getLine = mainLoop mainLoop :: [Char] - IO () mainLoop s | (head s) == '*' = return () | otherwise = (putStrLn . toStr . isTautogram . words $ s) main toStr :: Bool - [Char] toStr True = Y toStr False = N isTautogram :: [[Char]] - Bool isTautogram (x:[]) = True isTautogram (x:xs) = all ((== firstChar) . toLower . head) xs where firstChar = toLower . head $ x -- code end Note that the only thing that changed between the two tries was the main-loop. The second version runs faster (got 0.11 secs) and with less memory (3.6 mb) Can someone explain to me what is really going on? Maybe pointing out how I can achieve these optimizations using profiling information... Thanks, Thiago. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Analyzing slow performance of a Haskell program
On Mon, Aug 8, 2011 at 9:24 AM, Chris Yuen kizzx2+hask...@gmail.com wrote: For reference I have asked the same question on StackOverflow. One person suggested that the reason might be that Int64 on Windows is broken ( http://stackoverflow.com/questions/6970904/analyzing-slow-performance-of-a-haskell-program/6976448#6976448 ). No, they're barking up the wrong tree. I've put an idiomatic Haskell translation of your C++ algorithm at https://gist.github.com/1133048#file_wordy.hs (I've also included a copy of your original C++, with a bug fixed, in the same gist.) As you can see, the two are almost identical. Not surprisingly, each one spends the bulk of its time computing word lengths. GHC simply doesn't do a great job of compiling fairly tight code like this. gcc generates about 100 lines of assembly that's mostly easy to follow (except for some bit-twiddling tricks to avoid div instructions). Although the Core it generates looks fine, GHC spends quite a bit of time in its generated assembly on what looks to me like STG housekeeping (it spends only 0.3% of its time in the garbage collector, because it doesn't allocate memory). The overall result is that the Haskell code runs about 5x more slowly than the C++ code. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Couldn't match expected type `Integer' against inferred type `Int'
Why am I getting this error: Couldn't match expected type `Integer' against inferred type `Int' In the expression: foldl step 0 xs In the definition of `asInt_foldAux': asInt_foldAux xs = foldl step 0 xs where step acc '.' = error cannot handle decimal numbers step acc x = acc * 10 + digitToInt x for this code? import Data.Char (digitToInt) asInt_fold :: String - Integer asInt_fold ('-':xs) = -(asInt_foldAux xs) asInt_fold xs = asInt_foldAux xs asInt_foldAux :: String - Integer asInt_foldAux xs = foldl step 0 xs where step acc '.' = error cannot handle decimal numbers step acc x = acc * 10 + digitToInt x Note that I'm using Int, rather than Integer, to avoid silent overflow errors. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Couldn't match expected type `Integer' against inferred type `Int'
On 9 August 2011 10:49, Paul Reiners paul.rein...@gmail.com wrote: Why am I getting this error: Couldn't match expected type `Integer' against inferred type `Int' In the expression: foldl step 0 xs In the definition of `asInt_foldAux': asInt_foldAux xs = foldl step 0 xs where step acc '.' = error cannot handle decimal numbers step acc x = acc * 10 + digitToInt x for this code? import Data.Char (digitToInt) asInt_fold :: String - Integer asInt_fold ('-':xs) = -(asInt_foldAux xs) asInt_fold xs = asInt_foldAux xs asInt_foldAux :: String - Integer asInt_foldAux xs = foldl step 0 xs where step acc '.' = error cannot handle decimal numbers step acc x = acc * 10 + digitToInt x digitToInt returns an Int; as such the result of asInt_foldAux is an Int, but you've specified in its type signature that it should be returning an Integer. Note that I'm using Int, rather than Integer, to avoid silent overflow errors. Should that be the other way round? -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Couldn't match expected type `Integer' against inferred type `Int'
On Aug 8, 2011, at 7:59 PM, Ivan Lazar Miljenovic wrote: On 9 August 2011 10:49, Paul Reiners paul.rein...@gmail.com wrote: Why am I getting this error: Couldn't match expected type `Integer' against inferred type `Int' In the expression: foldl step 0 xs In the definition of `asInt_foldAux': asInt_foldAux xs = foldl step 0 xs where step acc '.' = error cannot handle decimal numbers step acc x = acc * 10 + digitToInt x for this code? import Data.Char (digitToInt) asInt_fold :: String - Integer asInt_fold ('-':xs) = -(asInt_foldAux xs) asInt_fold xs = asInt_foldAux xs asInt_foldAux :: String - Integer asInt_foldAux xs = foldl step 0 xs where step acc '.' = error cannot handle decimal numbers step acc x = acc * 10 + digitToInt x digitToInt returns an Int; as such the result of asInt_foldAux is an Int, but you've specified in its type signature that it should be returning an Integer. So is there something like digitToInteger? Or can I somehow cast the Int to an Integer? Note that I'm using Int, rather than Integer, to avoid silent overflow errors. Should that be the other way round? Yes, it should be the other way round. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Analyzing slow performance of a Haskell program
On 9 August 2011 10:06, Bryan O'Sullivan b...@serpentine.com wrote: On Mon, Aug 8, 2011 at 9:24 AM, Chris Yuen kizzx2+hask...@gmail.comwrote: For reference I have asked the same question on StackOverflow. One person suggested that the reason might be that Int64 on Windows is broken ( http://stackoverflow.com/questions/6970904/analyzing-slow-performance-of-a-haskell-program/6976448#6976448 ). No, they're barking up the wrong tree. I've put an idiomatic Haskell translation of your C++ algorithm at https://gist.github.com/1133048#file_wordy.hs (I've also included a copy of your original C++, with a bug fixed, in the same gist.) As you can see, the two are almost identical. Not surprisingly, each one spends the bulk of its time computing word lengths. GHC simply doesn't do a great job of compiling fairly tight code like this. gcc generates about 100 lines of assembly that's mostly easy to follow (except for some bit-twiddling tricks to avoid div instructions). Although the Core it generates looks fine, GHC spends quite a bit of time in its generated assembly on what looks to me like STG housekeeping (it spends only 0.3% of its time in the garbage collector, because it doesn't allocate memory). The overall result is that the Haskell code runs about 5x more slowly than the C++ code. GHC generating bad assembly suggests trying the llvm codegen (see http://donsbot.wordpress.com/2010/02/21/smoking-fast-haskell-code-using-ghcs-new-llvm-codegen/). Compiling Bryan's code with $ ghc -O2 -fllvm Wordy.hs it now runs only 2x slower than the C++ code. Reiner ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Couldn't match expected type `Integer' against inferred type `Int'
On 9 August 2011 11:06, Paul Reiners paul.rein...@gmail.com wrote: On Aug 8, 2011, at 7:59 PM, Ivan Lazar Miljenovic wrote: On 9 August 2011 10:49, Paul Reiners paul.rein...@gmail.com wrote: step acc x = acc * 10 + digitToInt x digitToInt returns an Int; as such the result of asInt_foldAux is an Int, but you've specified in its type signature that it should be returning an Integer. So is there something like digitToInteger? Or can I somehow cast the Int to an Integer? step acc x = acc * 10 + fromIntegral (digitToInt x) -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Declarative configuration languages?
On Sun, Aug 7, 2011 at 6:58 PM, Richard O'Keefe o...@cs.otago.ac.nz wrote: A colleague just asked me I'm trying to kick off some work into middleware for configuration of large-scale, distributed systems. Have you come across any elegant, declarative configuration languages used for this sort of job? I've found a couple of papers, but I've never _used_ any of the systems. Any recommendations? I haven't used any configuration languages to develop my own configuration system. But I have used a combination of Haskell and JSON to handle configuration in many applications. (And I'm currently working on one for HandbrakeCLI, the video encoding tool) The general idea is straight forward. Create configuration data types to represent the variable run-time data. Read from JSON/YAML/etc and deserialize to the internal Haskell representation. Let the configuration runners interpret the configuration in terms of IO actions calling to external tools. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Problems building lambdabot on osx
I've tried off and on the last couple of days to build Lambdabot on Mac OS X (before and after the upgrade from 10.6 to 10.7) and I keep running into linker errors with the 64-bit Haskell Platform (ghc 7.0.3). First, there's the issue with linking against libiconv, which is solved this way: cabal install --extra-lib-dirs=/usr/lib That leaves a whole mess of link errors against libHSreadline: Linking dist/build/lambdabot/lambdabot ... ld: warning: could not create compact unwind for _ffi_call_unix64: does not use RBP or RSP based frame Undefined symbols for architecture x86_64: _rl_insert_completions, referenced from: _readlinezm1zi0zi1zi0_SystemziConsoleziReadline_zdwa5_info in libHSreadline-1.0.1.0.a(Readline.o) _rl_possible_completions, referenced from: _readlinezm1zi0zi1zi0_SystemziConsoleziReadline_zdwa7_info in libHSreadlin (full error report at http://hpaste.org/50036 ) I did manage to install readline through macports: $ port installed readline The following ports are currently installed: readline @6.2.000_0 (active) $ file /opt/local/lib/libreadline.dylib /opt/local/lib/libreadline.dylib: Mach-O 64-bit dynamically linked shared library x86_64 and I did manage to get readline installed properly by specifying the include/lib dirs from macports: cabal install readline --configure-option=--with-readline-libraries=/opt/local/lib --configure-option=--with-readline-includes=/opt/local/include and readline does work in ghci: $ ghci GHCi, version 7.0.3: http://www.haskell.org/ghc/ :? for help Prelude :m + System.Console.Readline Prelude System.Console.Readline readline testing testing exit exit Just exit Prelude System.Console.Readline The only issue, which has me stumped, is that lambdabot can't seem to find the readline dependency. Adding the --with-readline options when trying to build lambdabot has no effect. Neither does adding --extra-lib-dirs=/opt/local/lib to cabal install. Anyone have a clue where to start to work around this? Would switching to ghc HEAD help here? Thanks, -- Adam ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Haskell syntax highlighting in a public blog
Hi, Is there a public blog that that allow syntax highlighting of Haskell code? Oscar Picasso ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell syntax highlighting in a public blog
9/08/2011 11:54 AM, Oscar Picasso kirjutas: Hi, Is there a public blog that that allow syntax highlighting of Haskell code? Are you talking about a plugin for a blog engine? CodeColourer on WordPress will do it. Arlen ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] extending and reusing cmdargs option specs ?
On 8/8/11 1:59 PM, Simon Michael wrote: And, I may have made things worse for myself in the reuse/avoiding boilerplate department: I'm not sure how to reuse a cmdargs options data structure, extending it with a few more options. This is a big problem I'm dealing with too lately. In particular, what I would like is if cmdargs could do flattening of structures, either automatically or with a new annotation combinator. With this it would be easy to have a basic FooBar program: data FooBar = FooBar { foo :: Foo , bar :: Bar } deriving (Data, Typeable,...) getFooBarMode :: IO (Mode (CmdArgs FooBar)) getFooBarMode = ... and then extend it to a FooBarBaz program: data FooBarBaz = FooBarBaz { fooBar :: FooBar , baz :: Baz } deriving (Data, Typeable,...) getFooBarBazMode :: IO (Mode (CmdArgs FooBarBaz)) getFooBarBazMode = ... The big trick is that I should be able to call getFooBarMode from getFooBarBazMode equivalently to if I had defined, data FooBarBaz = FooBarBaz { foo :: Foo , bar :: Bar , baz :: Baz } deriving (Data, Typeable,...) and copied over getFooBarMode inline into getFooBarBazMode. The problem is that the bulk of the code is in the Mode-generating functions, and it's also the sort of code that's hardest to keep in sync documentation-wise. I don't mind the extra indirection in the Mode structures since I don't actually use them in the program itself; I have an internal configuration type that I compile the FooBarBaz down to, so that I can perform additional semantic consistency checks before execution, as well as precomputing what the commandline arguments dereference into (e.g., functions). As always, thanks a lot for cmdargs! -Simon Indeed. Aside from this feature request I've been quite pleased :) -- Live well, ~wren ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell syntax highlighting in a public blog
On 9 August 2011 12:04, Arlen Cuss cel...@sairyx.org wrote: 9/08/2011 11:54 AM, Oscar Picasso kirjutas: Hi, Is there a public blog that that allow syntax highlighting of Haskell code? Are you talking about a plugin for a blog engine? CodeColourer on WordPress will do it. I think he meant more along the lines of wordpress.com, which as far as I know _doesn't_ support highlighting Haskell. -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Problems building lambdabot on osx
On Mon, Aug 8, 2011 at 8:38 PM, Adam Turoff adam.tur...@gmail.com wrote: I've tried off and on the last couple of days to build Lambdabot on Mac OS X (before and after the upgrade from 10.6 to 10.7) and I keep running into linker errors with the 64-bit Haskell Platform (ghc 7.0.3). First, there's the issue with linking against libiconv, which is solved this way: cabal install --extra-lib-dirs=/usr/lib That leaves a whole mess of link errors against libHSreadline: Linking dist/build/lambdabot/lambdabot ... ld: warning: could not create compact unwind for _ffi_call_unix64: does not use RBP or RSP based frame Undefined symbols for architecture x86_64: _rl_insert_completions, referenced from: _readlinezm1zi0zi1zi0_SystemziConsoleziReadline_zdwa5_info in libHSreadline-1.0.1.0.a(Readline.o) _rl_possible_completions, referenced from: _readlinezm1zi0zi1zi0_SystemziConsoleziReadline_zdwa7_info in libHSreadlin (full error report at http://hpaste.org/50036 ) I did manage to install readline through macports: $ port installed readline The following ports are currently installed: readline @6.2.000_0 (active) $ file /opt/local/lib/libreadline.dylib /opt/local/lib/libreadline.dylib: Mach-O 64-bit dynamically linked shared library x86_64 and I did manage to get readline installed properly by specifying the include/lib dirs from macports: cabal install readline --configure-option=--with-readline-libraries=/opt/local/lib --configure-option=--with-readline-includes=/opt/local/include and readline does work in ghci: $ ghci GHCi, version 7.0.3: http://www.haskell.org/ghc/ :? for help Prelude :m + System.Console.Readline Prelude System.Console.Readline readline testing testing exit exit Just exit Prelude System.Console.Readline The only issue, which has me stumped, is that lambdabot can't seem to find the readline dependency. Adding the --with-readline options when trying to build lambdabot has no effect. Neither does adding --extra-lib-dirs=/opt/local/lib to cabal install. Anyone have a clue where to start to work around this? Would switching to ghc HEAD help here? My usually technique for solving readline-related issues is to rip-out readline from whatever I want to build, substituting in Haskeline if I want nice editing. It isn't very scientific, but I find it to be a more interesting problem to solve. I've given this a try in the Lambdabot source, but I'm getting unrelated errors building it so I'm not sure it works. Ripping out readline should be a brief bit of hacking in Plugin/OfflineRC.hs, from what I can tell. Antoine ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell syntax highlighting in a public blog
On Aug 8, 2011, at 10:26 PM, Ivan Lazar Miljenovic wrote: On 9 August 2011 12:04, Arlen Cuss cel...@sairyx.org wrote: 9/08/2011 11:54 AM, Oscar Picasso kirjutas: Hi, Is there a public blog that that allow syntax highlighting of Haskell code? Are you talking about a plugin for a blog engine? CodeColourer on WordPress will do it. I think he meant more along the lines of wordpress.com, which as far as I know _doesn't_ support highlighting Haskell. I haven't done this personally, but here is a javascript based solution that should work with any blog that allows you to include custom stylesheets / javascript: http://nix-tips.blogspot.com/2010/09/javascript-highlighter-for-haskell-code.html___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe