Re: [Haskell-cafe] question automatic indentation (and so on)
On Mon, Jul 01, 2013 at 09:48:42AM +0200, Joachim Breitner wrote: SNIP I found https://github.com/jaspervdj/stylish-haskell/ (found via http://stackoverflow.com/q/6870148/946226) which formats just some very few aspects of Haskell. Does anyone have a more complete solution? Or is interested in creating one? I'd love a fully-automatic indentation tool; it's one of the things about the Lisp world that I miss. But is this actually a solvable problem? I think that, to be fully correct, an indentation algorithm for Haskell would have to know not only the syntactic structure of the program but also the programmer's intent, in some cases. Heh -- forgive the pun. Nested CASE expressions are actually one of the trickiest bits. If the programmer doesn't put parens around the inner expression (and doesn't use braces and semis), then only indentation serves to indicate when the inner case ends and the next branch of the outer case begins: case x of A - ... B - case y of Just z - ... Nothing - ... C - ... Similarly (tying this back to my original question), in a do block, applications that span multiple lines are tricky: do f x y z a b c How does the indentation tool know if (a b c) is supposed to be the next item in the do block, or merely a continuation of the previous application of f? Richard ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] question about indentation conventions
On Mon, Jul 01, 2013 at 05:18:39PM +1200, Richard A. O'Keefe wrote: It looked pretty explicit to me: The golden rule of indentation ... you will do fairly well if you just remember a single rule: Code which is part of some expression should be indented further in than the beginning of that expression (even if the expression is not the leftmost element of the line). This means for example that f (g x y z) is OK but f (g x y z) is not. Sure. So my first question boils down to which of the two alternatives below does the community prefer? (To be clear about the intended semantics: this is the application of the function f to the arguments x, y, and z.) f x y z or f x y z Both are correct, in most contexts. And then there's the second question: if the second alternative is preferable, is there a way to get haskell-mode to do it automatically? As it is, it refuses to indent y any farther to the right than in the first alternative. I can space it in by hand, and then haskell-mode puts z under y, but that's annoying, and it gets in the way of reindenting large regions of code automatically. Richard ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] question about indentation conventions
On Sun, Jun 30, 2013 at 07:53:08PM -0400, Richard Cobbe wrote: Two questions: And what I've concluded by reading this thread: 1) Are there wide-spread conventions in the Haskell community for how to indent an application expression that's split across multiple lines? Well, there's general consensus in favor of indenting the continuing lines, but not a lot of consensus on how much, etc. Not surprising, and that's OK. Infix operators are more complicated. 2) If there is such a convention, how do I make Emacs's haskell-mode do it? Doesn't seem to be possible, unless you're in a do block. To be clear: I wasn't asking how to make Emacs do all of my indentation automatically, as it can in Lisp and C modes. I realize that isn't possible. But since haskell-mode doesn't have very good support for the style I personally prefer (which is, in fact, consistent with Richard O'Keefe's favorite rule), I wondered if that might indicate that the community prefers a different style. Apparently not. Thanks to all who responded; it's been an interesting (if occasionally overly excited) discussion. Richard ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] question about indentation conventions
I hope I'm not starting a holy war with this, but I'm curious about an aspect of coding style that's been bugging me for a while, and I'm not finding much discussion of this question on the web or in the mailing list archives. Two questions: 1) Are there wide-spread conventions in the Haskell community for how to indent an application expression that's split across multiple lines? For how to indent an expression that uses infix operators? Or does everyone pretty much do their own thing? 2) If there is such a convention, how do I make Emacs's haskell-mode do it? By default, in most cases Emacs's haskell-mode with turn-on-haskell-indentation does function firstArgument (second argument) thirdArgument Personally, I'd prefer some indentation on the 2nd and 3rd lines to indicate that they're continuing an expression begun on a previous line. I can use parens around the entire application to force haskell-mode to indent subsequent lines (and of course this is necessary in some contexts, like a 'do' expression), but haskell-mode only indents that by a single space: do (function firstArgument (second argument) thirdArgument) nextAction I'd find a larger indent---even just 2 spaces---to be more readable. My inclination to indent the second and following lines of a multi-line application expression is informed by my long experience in Scheme, Racket, and Lisp, whose S-expressions lend themselves to fairly straightforward (and automatable!) indentation conventions. If the Haskell community does things differently, though, I'm happy to adapt. This is the sort of thing that one picks up from the community, as in other languages. I don't, however, have a whole lot of contact with that community outside this list -- thus the post, despite the dangers inherent in discussing subjective stuff like this that people often feel strongly about. Thanks, Richard ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] question about indentation conventions
On Sun, Jun 30, 2013 at 05:41:46PM -0700, Darren Grant wrote: Hi Richard, This page helped me when starting out: http://en.wikibooks.org/wiki/Haskell/Indentation On 2013-06-30 4:55 PM, Richard Cobbe co...@ccs.neu.edu wrote: snip 1) Are there wide-spread conventions in the Haskell community for how to indent an application expression that's split across multiple lines? For how to indent an expression that uses infix operators? Or does everyone pretty much do their own thing? snip Thanks for the pointer, Darren, and I did come across that page earlier. I should have been clearer in my original question: I'm curious about what to do when a multi-argument function application gets split across lines. That wiki page dicsusses how the layout rule interacts with various special forms (let, where, if, do, case), but it doesn't seem to address function applications, beyond implying that it's ok to indent the continuing lines of a function application. Richard ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Where did the Cabal manual go?
I'm not able to access the cabal manual today: links to my local copy and links to the copy at haskell.org result in a 404. I'm running the Haskell Platform, 2012.4.0.0, 64-bit, OS X 10.8.2. On my first attempt this morning, I loaded file:///Library/Haskell/doc/start.html in my browser and clicked on the Cabal link. The browser can't find file:///Library/Haskell/doc/ghc-doc/Cabal/index.html, and indeed the directory /Library/Haskell/doc/ghc-doc/Cabal doesn't exist. Ok, I think, so my local copy's gotten corrupted. One sudo /Library/Haskell/bin/uninstall-hs --remove thru 7.4.2 and reinstall later, I try again; no change. I also can't find any docs by doing find /Library/Haskell -iname \*cabal\* find /Library/Frameworks/GHC.framework -iname \*cabal\* either. I also get a 404 when I click on the Cabal link from http://lambda.haskell.org/platform/doc/current/start.html. I can probably recover a copy from system backups, but what's going on? Richard ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Where did the Cabal manual go?
On Sun, Jan 27, 2013 at 03:47:38PM -0200, Felipe Almeida Lessa wrote: Do you mean the Cabal User Guide? http://www.haskell.org/cabal/users-guide/ Yes, that's it, and I'm in the process of downloading a copy now (so I can work without a WiFi connection). I'm still curious about why there's a broken link on http://lambda.haskell.org/platform/doc/current/start.html, and what on earth I did to delete the copy of the user's guide that used to be on my hard drive as part of the Haskell Platform installation (or, worse, what was silently done on my behalf). It's possible I missed a notification that this was happening, but I certainly don't remember seeing anything to that effect. Richard ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Where did the Cabal manual go?
On Sun, Jan 27, 2013 at 01:48:06PM -0500, Richard Cobbe wrote: On Sun, Jan 27, 2013 at 03:47:38PM -0200, Felipe Almeida Lessa wrote: Do you mean the Cabal User Guide? http://www.haskell.org/cabal/users-guide/ Yes, that's it, and I'm in the process of downloading a copy now (so I can work without a WiFi connection). By the way, if the Cabal users guide is no longer to be packaged with the Haskell Platform, can I suggest adding a link to http://www.haskell.org/cabal that would allow folks to download a tgz with the HTML docs, much as is provided for Happy and Alex? As it is, one has to download 4 html files and a css file and hope that's everything. Richard ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] cabal isn't updating local doc index after local package upgrade
Haskell Platform 2012 v2.0.0, MacOS 64-bit. (MacOS 10.8.2.) I just used cabal to upgrade the installation of a local package I'm writing, and I'm still seeing the old version of the documentation in ~/Library/Haskell/doc/index.html. How can I fix this? In more detail: this machine had greek-1.0.1 installed, but I was working on another package that needed greek-1.1.0. So I went into the directory where I keep the source for the greek package, made sure it was up-to-date, and ran cabal clean cabal configure cabal build cabal install as my normal user, not as root. As far as I can tell, the rebuild was successful; cabal's output finished with Installing library in /Users/cobbe/Library/Haskell/ghc-7.4.1/lib/greek-1.1.0/lib Registering greek-1.1.0... Updating documentation index /Users/cobbe/Library/Haskell/doc/index.html However, when I open ~/Library/Haskell/doc/index.html in my browser, I still see the documentation for greek-1.0. The docs for the new version are present, in ~/Library/Haskell/ghc-7.4.1/lib/greek-1.1.0/doc, but they don't appear in the main index. Am I missing a step in the process, or is this a bug in cabal? Is there a workaround? I do have a couple of older versions of the greek package insatlled, because there doesn't seem to be an easy way to remove obsolete packages. Could they be causing problems? If so, what's the best way to delete them? (I don't particularly mind having the older versions hanging around, as long as they're actually harmless.) Thanks much, Richard ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] cabal isn't updating local doc index after local package upgrade
On Sat, Nov 24, 2012 at 08:37:31PM +0200, Roman Cheplyaka wrote: This is filed as https://github.com/haskell/cabal/issues/1051 Ah! Thanks for the pointer; I didn't know about that bug database. I'll watch that issue for further developments. * Richard Cobbe co...@ccs.neu.edu [2012-11-24 12:43:55-0500] Haskell Platform 2012 v2.0.0, MacOS 64-bit. (MacOS 10.8.2.) I just used cabal to upgrade the installation of a local package I'm writing, and I'm still seeing the old version of the documentation in ~/Library/Haskell/doc/index.html. How can I fix this? Richard ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] GHC rendering of non-ASCII characters configurable?
On Mon, Jul 30, 2012 at 11:45:38PM +1000, Ivan Lazar Miljenovic wrote: On 30 July 2012 04:04, Richard Cobbe co...@ccs.neu.edu wrote: I'm working on an application that involves processing a lot of Unicode data, and I'm finding the built-in Show implementation for Char to be really inconvenient. Specifically, it renders all characters at U+0080 and above with decimal escapes: Prelude '\x80' '\128' This is annoying because all of the Unicode charts give the code points in hex, and indeed the charts are split into different PDFs at numbers that are nice and round in hex but not in decimal. So in order to figure out which character I'm looking at, I have to convert back to hex and then look it up in the charts. Can I ask what you're doing here? Are you printing individual characters or entire chunks of text? Mostly, I'm working with expressions of type String, rather than Text; the Char above was merely an example to demonstrate the problem. The two I/O cases that most concern me are evaluating a String expression at the GHCi REPL, and working with HUnit test cases built around String expressions. I suppose I could wrap putStrLn around all string exprs at the repl, but a) that's a pain; b) it's important for this app that I be able to distinguish between precomposed characters and combining characters; and c) some of the characters I'm dealing with are very similar in my terminal fonts, such as U+1F00 and U+1F01. It's much nicer to be able to just see the code points. The other problem is with HUnit tests. When a test fails (under runTestTT, anyway) you get a diagnostic printed to stdout. I'm not sure exactly what logic HUnit uses to produce these error messages, but it's almost certainly calling 'show' on the underlying strings. So there's no place, as far as I know, where I can insert a call to putStrLn. Richard ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] GHC rendering of non-ASCII characters configurable?
On Tue, Jul 31, 2012 at 09:17:34PM +1000, Ivan Lazar Miljenovic wrote: On 31 July 2012 21:01, Richard Cobbe co...@ccs.neu.edu wrote: On Mon, Jul 30, 2012 at 11:45:38PM +1000, Ivan Lazar Miljenovic wrote: Can I ask what you're doing here? Are you printing individual characters or entire chunks of text? Mostly, I'm working with expressions of type String, rather than Text; Any particular reason why? Using Text will probably solve your problem and give you a performance improvement at the same time. Well, I initially went with String because I didn't want to clutter up my code with all of the calls to 'pack', especially around string literals. I'm open to being convinced that it's worth it to switch, though. In any case, while Text is undoubtedly faster than String, it unfortunately doesn't solve my problem with output rendering: [vimes:~]$ ghci GHCi, version 7.4.1: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Prelude :m +Data.Text Prelude Data.Text pack \x1f00 Loading package array-0.4.0.0 ... linking ... done. Loading package bytestring-0.9.2.1 ... linking ... done. Loading package deepseq-1.3.0.0 ... linking ... done. Loading package text-0.11.2.0 ... linking ... done. \7936 Prelude Data.Text pack \x1f01 \7937 Richard ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] GHC rendering of non-ASCII characters configurable?
I'm working on an application that involves processing a lot of Unicode data, and I'm finding the built-in Show implementation for Char to be really inconvenient. Specifically, it renders all characters at U+0080 and above with decimal escapes: Prelude '\x80' '\128' This is annoying because all of the Unicode charts give the code points in hex, and indeed the charts are split into different PDFs at numbers that are nice and round in hex but not in decimal. So in order to figure out which character I'm looking at, I have to convert back to hex and then look it up in the charts. Is there any way to ask GHC to render super-ASCII characters with their hexadecimal escapes, instead? I'm perfectly happy to write my own custom Show instance, but I don't know how to hook that into ghci's REPL (or, for that matter, the routines that HUnit uses to generate the messages on failed tests, etc.). I'm using GHC 7.4.1 on MacOS 10.7.4. Thanks, Richard ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] HUnit/cabal integration
I'm working on a little library package (purely for my own consumption) that's built with Cabal, and I have a couple of questions about the pragmatics of using HUnit for it. First, I'd like to be able to run my tests via cabal test from the shell prompt. I've seen http://hackage.haskell.org/trac/hackage/wiki/UpgradingTests and followed that, and it basically works. I'm curious if I'm doing it in the best (or at least most idiomatic) way. I've included my cabal file and test driver below, for specifics. Two questions: First: the web page I cite above describes the interface that the test binary must support to work with cabal, specifically w.r.t. the binary's exit code. Your test suites likely already fit this model. However, if you are using an old version of QuickCheck or HUnit, your executable may not be returning the correct error code. This seems to me to suggest that recent versions of HUnit automatically take care of generating the exit code, but I've found that I have to examine HUnit's results and synthesize the exit code manually, as in the driver program below. (I'm running HUnit 1.2.4.2, but the interface for 1.2.4.3 doesn't appear to differ on this point.) Am I misinterpreting the wiki page, or am I missing something in HUnit's API that generates the exit code automatically? Second: Am I specifying the Build-Depends correctly for the Test-Suite? Specifically: do I need to state a dependency on the library defined in the same package, or does it pick that up automatically? Further, foo-tests doesn't use parsec directly. Is the transitive dependency automatically provided for me, or do I need to list it explicitly as below? Thanks much, Richard My cabal file: Name: foo Version:0.0 Cabal-Version: = 1.2 Author: Richard Cobbe Synopsis: Sample cabal package for HUnit integration Build-Type: Simple Library Exposed-Modules: Foo, Foo.Parser, Foo.Show Build-Depends: base = 4.3.1.0 5, parsec = 3.1.2 Test-Suite foo-tests main-is: foo-tests.hs type: exitcode-stdio-1.0 Build-Depends: base = 4.3.1.0 5, parsec = 3.1.2, HUnit = 1.2.4.2 and foo-tests.hs: module Main where import Test.HUnit import qualified Foo.Parser import System.Exit main :: IO () main = do c - runTestTT (Foo ~: Foo.Parser.tests) if (errors c == 0 failures c == 0) then exitWith ExitSuccess else exitWith (ExitFailure (-1)) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] HUnit/cabal integration
On Thu, Jul 05, 2012 at 04:17:33PM +0200, Simon Hengel wrote: First: the web page I cite above describes the interface that the test binary must support to work with cabal, specifically w.r.t. the binary's exit code. Your test suites likely already fit this model. However, if you are using an old version of QuickCheck or HUnit, your executable may not be returning the correct error code. This seems to me to suggest that recent versions of HUnit automatically take care of generating the exit code, but I've found that I have to examine HUnit's results and synthesize the exit code manually, as in the driver program below. (I'm running HUnit 1.2.4.2, but the interface for 1.2.4.3 doesn't appear to differ on this point.) Am I misinterpreting the wiki page, or am I missing something in HUnit's API that generates the exit code automatically? AFAIK, you have to do it explicitly. But you can shorten it to something like this: when (errors c /= 0 || failures c /= 0) exitFailure Ah, good suggestion. Thanks! Second: Am I specifying the Build-Depends correctly for the Test-Suite? Specifically: do I need to state a dependency on the library defined in the same package, or does it pick that up automatically? Further, foo-tests doesn't use parsec directly. Is the transitive dependency automatically provided for me, or do I need to list it explicitly as below? snip Let's look at an example. Many thanks for your advice -- and I particularly appreciate the examples! I haven't had a chance to try them out yet, but I hope to be able to soon. Thanks a bunch for your help, Richard ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ghc 7.0.3 view patterns and exhaustiveness
I'm starting to play around with GHC's support for view patterns, and I'm running into what appears to be an annoying limitation of the implementation. GHC 7.0.3 (32-bit), MacOS 10.6.8. First module; defines an abstract type provides a (trivial) view for it. module Term(Term, TermView(..), view) where data Term = TVar String | TApp Term Term | TLam String Term data TermView = Var String | App Term Term | Lam String Term view :: Term - TermView view (TVar x) = Var x view (TApp rator rand) = App rator rand view (TLam x body) = Lam x body Second module tries to use the view in a trivial function: {-# LANGUAGE ViewPatterns #-} module Client where import Term numVarRefs :: Term - Integer numVarRefs (view - Var _) = 1 numVarRefs (view - App rator rand) = numVarRefs rator + numVarRefs rand numVarRefs (view - Lam _ body) = numVarRefs body -- numVarRefs (view - _) = error bogus f :: TermView - Integer f (Var _) = 1 f (App rator rand) = f (view rator) + f (view rand) f (Lam _ body) = f (view body) GHCI complains when trying to load this second module: Client.hs:8:1: Warning: Pattern match(es) are non-exhaustive In an equation for `numVarRefs': Patterns not matched: _ (I have :set -fwarn-incomplete-patterns in my .ghci.) I wrote 'f' to make sure that my patterns for TermView are indeed exhaustive, and GHC doesn't complain about it all. If I uncomment the last definition for numVarRefs, the warning goes away. I did some searching around on the web, in the mailing list archives, and in the GHC bug database, and I see that early on, views had trouble giving useful diagnostics for overlapping or non-exhaustive patterns, but most of those problems seem to have been fixed. I also couldn't find a bug report for precisely this situation -- #4439 is the closest, but I'm not using existential types here at all. Should I file a bug, or am I overlooking something simple? Or is this a known limitation of the current implementation? Thanks, Richard ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Library support for sorting with Text.Data.ICU.Collate.MCollator?
I'm trying to sort a list of Text values using a collator obtained from the Text.Data.ICU.Collate module in the text-icu package on Hackage. Unfortunately, I can't use the normal Data.List.sortBy function with one of these collators, because the collators return (IO Ordering), not Ordering. It's easy to write sortWithCollator :: [Text] - IO [Text], but I'd rather not have to. I haven't been able to find library support for this anywhere -- am I overlooking it, or do I need to write the sort function myself? Thanks, Richard ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Library support for sorting with Text.Data.ICU.Collate.MCollator?
On Mon, Sep 19, 2011 at 04:29:03PM +0300, Michael Snoyman wrote: On Mon, Sep 19, 2011 at 4:26 PM, Richard Cobbe co...@ccs.neu.edu wrote: I'm trying to sort a list of Text values using a collator obtained from the Text.Data.ICU.Collate module in the text-icu package on Hackage. Unfortunately, I can't use the normal Data.List.sortBy function with one of these collators, because the collators return (IO Ordering), not Ordering. It's easy to write sortWithCollator :: [Text] - IO [Text], but I'd rather not have to. I haven't been able to find library support for this anywhere -- am I overlooking it, or do I need to write the sort function myself? Hi Richard, You want to use freeze[1] to get an immutable collator, and then use the pure collate[2] function. Ah -- perfect. Can't think how I missed freeze. Thanks! Richard ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to use cabal's data-files feature and run in-place?
On Thu, Apr 21, 2011 at 11:27:10PM -0500, Antoine Latter wrote: 2. Here's what I do for the paths situation: In the package description, create a CPP option so you know you're compiling via Cabal: Cpp-options: -DCABAL Then create a module to wrap around the autogenerated paths module, making sure to put the CPP Language pragma at the top: {-# LANGUAGE CPP #-} You can then use #ifdef CABAL to decide to re-export the Cabal autogenerated paths functionality, or to use the ones you've written yourself (based on the current directory or whatever you need). I hope that this helps! I don't have any examples on hand at the moment. Thanks -- works like a charm! I'm particularly pleased to see that ghci supports cpp. Richard ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to use cabal's data-files feature and run in-place?
On Thu, Apr 21, 2011 at 11:27:10PM -0500, Antoine Latter wrote: 1. A side note - using the 'cabal' command line tool is easier for many tasks than 'runhaskell Setup'. In particular, it does a user install by default. Interesting -- didn't know that was possible. I didn't see that in the Cabal manual; section 4 gives instructions entirely in terms of 'runhaskell Setup'. Am I overlooking something? 2. Here's what I do for the paths situation: In the package description, create a CPP option so you know you're compiling via Cabal: Cpp-options: -DCABAL Then create a module to wrap around the autogenerated paths module, making sure to put the CPP Language pragma at the top: {-# LANGUAGE CPP #-} You can then use #ifdef CABAL to decide to re-export the Cabal autogenerated paths functionality, or to use the ones you've written yourself (based on the current directory or whatever you need). I hope that this helps! I don't have any examples on hand at the moment. That sounds like it should work, thanks. I'd been thinking about using CPP tricks, but I didn't know how to use CPP for a module in a way that would work with the rest of the toolchain -- in particular, with both ghc and ghci. I'll give it a shot. Thanks! Richard ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to use cabal's data-files feature and run in-place?
On Fri, Apr 22, 2011 at 09:23:32AM +0200, Max Rabkin wrote: On Fri, Apr 22, 2011 at 03:46, Richard Cobbe co...@ccs.neu.edu wrote: Unfortunately, that's not happening. Cabal is clearly generating the module; I can see it in dist/build/autogen. But my copy is overriding the autogenerated one, even for cabal builds -- at least, that's what I'm seeing when I run the binary out of dist/build/package/executable. I'm no Cabal expert, but the first thing I'd try is to leave your copy out of the list of included files in the Cabal file. I'm not listing the included files, actually -- all I have is a main-is: setting, and ghc is pulling the rest in through automatic dependency detection. Actually, that suggests another strategy: if there's a way in the cabal file to configure ghc's search path, then I could make sure that the cabal-generated file is seen before mine. It's a little fragile, though, as it depends on the precise place that cabal puts the generated file. I'll look into that. Richard ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] How to use cabal's data-files feature and run in-place?
I'm running Haskell Platform 2011.2.0.1 on a MacOS 10.6.7 machine (the machine is 64-bit, but I'm running the 32-bit platform). I'm writing an application for personal use, and I'd like to use Cabal to package it up and handle installation. This way, when I'm working on the program, I won't break the reasonably stable installed version and can continue to use it. (I'm not committed to cabal by any means; suggestions for other ways to accomplish the same thing are more than welcome!) I've got some data files I'd like to package with the application, and Cabal's data-files field is the obvious way to do that. The immediate problem, then, is how to access the files -- I can use the generated Paths_pkg module for the installed copy of the app, but then I can't run the thing in-place in ghci in the development directory. I did some googling and came across a blog post (http://neilmitchell.blogspot.com/2008/02/adding-data-files-using-cabal.html) which suggested that I provide my own Paths_pkg.hs file that points to the files' location in the development copy. When I build with Cabal, the generated form of this module would override my hand-written one, and it should therefore work in the installed case as well. Unfortunately, that's not happening. Cabal is clearly generating the module; I can see it in dist/build/autogen. But my copy is overriding the autogenerated one, even for cabal builds -- at least, that's what I'm seeing when I run the binary out of dist/build/package/executable. Is there a way to be able to use data files in both contexts? FWIW, I'm running cabal as runhaskell Setup.hs configure --user runhaskell Setup.hs build Thanks much, Richard ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] can't download haskell-mode for emacs: directory is empty
I'm trying to see if I'm running the latest version of haskell-mode.el. Unfortunately, the download link at the top of http://www.haskell.org/haskellwiki/Haskell_mode_for_Emacs points to a directory with nothing in it. Is there somewhere else I should be looking? I tried sending email to the maintainer a couple of weeks ago, but I haven't heard a response. What's the status on this package? Thanks, Richard ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] can't download haskell-mode for emacs: directory is empty
On Sun, Mar 06, 2011 at 09:51:39PM +0200, Yitzchak Gale wrote: Richard Cobbe wrote: I'm trying to see if I'm running the latest version of haskell-mode.el. Unfortunately, the download link at the top of http://www.haskell.org/haskellwiki/Haskell_mode_for_Emacs points to a directory with nothing in it. Is there somewhere else I should be looking? It is still disabled after the hack attack on community.haskell.org. However, the darcs repository for the project has been re-enabled. It is at: http://code.haskell.org/haskellmode-emacs/ Ah -- I was unaware of the attack. Thanks for the info, and for the pointer to the repository! Richard ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe