Re: [Haskell-cafe] question about indentation conventions
On Mon, Jul 01, 2013 at 05:18:39PM +1200, Richard A. O'Keefe wrote: > On 1/07/2013, at 1:04 PM, Richard Cobbe wrote: > > 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. > > 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. It seems to me that this means f x1 x2 x3 x4 is not. The OP was initially asking about this situation. Tom ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] question automatic indentation (and so on)
Hi, on a related note: At HaL8 I was wondering how well Haskell would be suited for a workflow similar to what the go programmers do: Do not worry about code layout, but let the computer handle it! For more rationale and examples see http://golang.org/doc/effective_go.html#formatting While everyone has his own style and preferences, as soon as multiple programmers work on the same code, a consistently enforced formatting would probably help here a lot. Also, I would be happy to give up some bikeshedding^Wformatting freedom for not having to worry about this aspect. 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? Greetings, Joachim -- Joachim Breitner e-Mail: m...@joachim-breitner.de Homepage: http://www.joachim-breitner.de ICQ#: 74513189 Jabber-ID: nome...@joachim-breitner.de signature.asc Description: This is a digitally signed message part ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Installing Z3 on OS X 10.8.4 ( Off topic )
Hello all, Not directly related to Haskell but I am trying to install Z3 to use SBV package[1]. I followed the instructions[2] to install it. *Mukeshs-MacBook-Pro:SMT mukeshtiwari$ git clone https://git01.codeplex.com/z3 -b unstable Cloning into 'z3'... remote: Counting objects: 16070, done. remote: Compressing objects: 100% (3928/3928), done. remote: Total 16070 (delta 12057), reused 16070 (delta 12057) Receiving objects: 100% (16070/16070), 7.62 MiB | 287 KiB/s, done. Resolving deltas: 100% (12057/12057), done.* After installing Z3 *Running python example.py in z3/examples/python gives this result. * *Mukeshs-MacBook-Pro:python mukeshtiwari$ python example.py sat [y = 4, x = 2]* but when I am running sbv package, I am getting this error. *Mukeshs-MacBook-Pro:site-packages mukeshtiwari$ ghci -XScopedTypeVariables GHCi, version 7.6.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.SBV.Bridge.Z3 Prelude Data.SBV.Bridge.Z3> prove $ \(x::SWord8) -> x `shiftL` 2 .== 4*x Loading package pretty-1.1.1.0 ... linking ... done. Loading package array-0.4.0.1 ... linking ... done. Loading package deepseq-1.3.0.1 ... linking ... done. Loading package filepath-1.3.0.1 ... linking ... done. Loading package old-locale-1.0.0.5 ... linking ... done. Loading package time-1.4.0.1 ... linking ... done. Loading package bytestring-0.10.0.0 ... linking ... done. Loading package unix-2.6.0.0 ... linking ... done. Loading package directory-1.2.0.0 ... linking ... done. Loading package process-1.1.0.2 ... linking ... done. Loading package old-time-1.1.0.1 ... linking ... done. Loading package containers-0.5.0.0 ... linking ... done. Loading package random-1.0.1.1 ... linking ... done. Loading package template-haskell ... linking ... done. Loading package QuickCheck-2.5.1.1 ... linking ... done. Loading package transformers-0.3.0.0 ... linking ... done. Loading package mtl-2.1.2 ... linking ... done. Loading package syb-0.3.7 ... linking ... done. Loading package sbv-2.10 ... linking ... done. *** An error occurred. *** Unable to locate executable for z3 *** Executable specified: "z3" Prelude Data.SBV.Bridge.Z3> * I have posted every details on installation on pastebin[3]. The documentation file says that[4] it will install *2) Building Z3 using make/g++ and Python Execute: autconf ./configure python scripts/mk_make.py cd build make sudo make install It will install z3 executable at /usr/bin, libraries at /usr/lib, and include files at /usr/include.* Mukeshs-MacBook-Pro:z3 mukeshtiwari$ echo $PATH /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/mukeshtiwari/Programming/GHC/ghc-7.6.1/bin:/Users/mukeshtiwari/.cabal/bin:/Users/mukeshtiwari/Erlang/bin:/Users/mukeshtiwari/Programming/Scala/scala-2.10.0/bin:/usr/local/smlnj-110.75/bin:/Users/mukeshtiwari/.rvm/bin Could some one please tell me how to solve this problem. Regards, Mukesh Tiwari [1] http://hackage.haskell.org/package/sbv [2] http://z3.codeplex.com/wikipage?title=Building%20the%20unstable%20%28working-in-progress%29%20branch&referringTitle=Documentation [3] http://pastebin.com/K5rq3jCF [4] http://z3.codeplex.com/SourceControl/latest#README ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Installing Z3 on OS X 10.8.4 ( Off topic )
I also tried installing Yices[1] but still getting same error. I followed the instructions but still the same error. Seems like I am missing some crucial details about path but not able to resolve it. Mukeshs-MacBook-Pro:SMT mukeshtiwari$ cd yices-2.1.0/ Mukeshs-MacBook-Pro:yices-2.1.0 mukeshtiwari$ ls LICENSENOTICESREADMEbindocetc examplesincludelib Mukeshs-MacBook-Pro:yices-2.1.0 mukeshtiwari$ ls LICENSENOTICESREADMEbindocetc examplesincludelib Mukeshs-MacBook-Pro:yices-2.1.0 mukeshtiwari$ cat README Yices SMT Solver, Copyright SRI International, 2012 === This file is part of the Yices 2.0 binary distribution for MacOS X. Yices is distributed free-of-charge for personal use under the terms of the Yices license (see LICENSE). Content --- This distribution includes three solvers bin/yices (for the Yices 2 language) bin/yices-smt (for SMT-LIB 1.2) bin/yices-sat (sat solver, DIMACS format) and the Yices libraries and header files lib/libyices.2.0.0.dylib include/yices.h include/yices_types.h include/yices_limits.h include/yices_exit_codes.h Examples and documentation are in the examples and doc directories. The binaries and library were linked statically against GMP version 5.0.4, copyright Free Software Foundation (see NOTICES). Recommended Library Installation on MacOS X --- The library's install name is '/usr/local/lib/libyices.2.dylib' so the following procedure should be used to install it. 1) copy libyices.2.0.0.dylib in /usr/local/lib (this requires administrative privileges): sudo cp libyices.2.0.0.dylib /usr/local/lib sudo chmod 755 /usr/local/lib/libyices.2.0.0.dylib 2) add two symbolic links: sudo ln -sf libyices.2.0.0.dylib /usr/local/lib/libyices.dylib sudo ln -sf libyices.2.0.0.dylib /usr/local/lib/libyices.2.dylib For more information, please visit http://yices.csl.sri.com. Mukeshs-MacBook-Pro:yices-2.1.0 mukeshtiwari$ cd lib/ Mukeshs-MacBook-Pro:lib mukeshtiwari$ ls libyices.2.1.0.dylib Mukeshs-MacBook-Pro:lib mukeshtiwari$ sudo cp libyices.2.1.0.dylib /usr/local/lib Password: Mukeshs-MacBook-Pro:lib mukeshtiwari$ sudo chmod 755 /usr/local/lib/libyices.2.1.0.dylib Mukeshs-MacBook-Pro:lib mukeshtiwari$ sudo ln -sf libyices.2.1.0.dylib /usr/local/lib/libyices.dylib Mukeshs-MacBook-Pro:lib mukeshtiwari$ sudo ln -sf libyices.2.1.0.dylib /usr/local/lib/libyices.2.dylib Mukeshs-MacBook-Pro:~ mukeshtiwari$ ghci -XScopedTypeVariables GHCi, version 7.6.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.SBV.Bridge.Yices Prelude Data.SBV.Bridge.Yices> prove $ \(x::SWord8) -> x `shiftL` 2 .== 4*x Loading package pretty-1.1.1.0 ... linking ... done. Loading package array-0.4.0.1 ... linking ... done. Loading package deepseq-1.3.0.1 ... linking ... done. Loading package filepath-1.3.0.1 ... linking ... done. Loading package old-locale-1.0.0.5 ... linking ... done. Loading package time-1.4.0.1 ... linking ... done. Loading package bytestring-0.10.0.0 ... linking ... done. Loading package unix-2.6.0.0 ... linking ... done. Loading package directory-1.2.0.0 ... linking ... done. Loading package process-1.1.0.2 ... linking ... done. Loading package old-time-1.1.0.1 ... linking ... done. Loading package containers-0.5.0.0 ... linking ... done. Loading package random-1.0.1.1 ... linking ... done. Loading package template-haskell ... linking ... done. Loading package QuickCheck-2.5.1.1 ... linking ... done. Loading package transformers-0.3.0.0 ... linking ... done. Loading package mtl-2.1.2 ... linking ... done. Loading package syb-0.3.7 ... linking ... done. Loading package sbv-2.10 ... linking ... done. *** An error occurred. *** Unable to locate executable for Yices *** Executable specified: "yices-smt" Regards, Mukesh Tiwari [1] http://yices.csl.sri.com/download-yices2.shtml On Mon, Jul 1, 2013 at 2:57 PM, mukesh tiwari wrote: > Hello all, > Not directly related to Haskell but I am trying to install Z3 to use SBV > package[1]. I followed the instructions[2] to install it. > > *Mukeshs-MacBook-Pro:SMT mukeshtiwari$ git clone > https://git01.codeplex.com/z3 -b unstable > Cloning into 'z3'... > remote: Counting objects: 16070, done. > remote: Compressing objects: 100% (3928/3928), done. > remote: Total 16070 (delta 12057), reused 16070 (delta 12057) > Receiving objects: 100% (16070/16070), 7.62 MiB | 287 KiB/s, done. > Resolving deltas: 100% (12057/12057), done.* > > After installing Z3 > *Running python example.py in z3/examples/python gives this result. > * > *Mukeshs-MacBook-Pro:python mukeshtiwari$ python example.py > sat > [y = 4, x = 2]* > > but when I am running sbv pac
Re: [Haskell-cafe] Installing Z3 on OS X 10.8.4 ( Off topic )
Finally I got the Yices working by adding yices-2.1.0/bin to my path. Still looking to resolve Z3. Regards, Mukesh Tiwari On Mon, Jul 1, 2013 at 3:42 PM, mukesh tiwari wrote: > I also tried installing Yices[1] but still getting same error. I followed > the instructions but still the same error. Seems like I am missing some > crucial details about path but not able to resolve it. > > Mukeshs-MacBook-Pro:SMT mukeshtiwari$ cd yices-2.1.0/ > Mukeshs-MacBook-Pro:yices-2.1.0 mukeshtiwari$ ls > LICENSENOTICESREADMEbindocetc > examplesincludelib > Mukeshs-MacBook-Pro:yices-2.1.0 mukeshtiwari$ ls > LICENSENOTICESREADMEbindocetc > examplesincludelib > Mukeshs-MacBook-Pro:yices-2.1.0 mukeshtiwari$ cat README > Yices SMT Solver, Copyright SRI International, 2012 > === > > This file is part of the Yices 2.0 binary distribution for MacOS X. > Yices is distributed free-of-charge for personal use under the terms > of the Yices license (see LICENSE). > > > Content > --- > > This distribution includes three solvers > > bin/yices (for the Yices 2 language) > bin/yices-smt (for SMT-LIB 1.2) > bin/yices-sat (sat solver, DIMACS format) > > and the Yices libraries and header files > > lib/libyices.2.0.0.dylib > include/yices.h > include/yices_types.h > include/yices_limits.h > include/yices_exit_codes.h > > > Examples and documentation are in the examples and doc directories. > > > The binaries and library were linked statically against GMP version 5.0.4, > copyright Free Software Foundation (see NOTICES). > > > > Recommended Library Installation on MacOS X > --- > > The library's install name is '/usr/local/lib/libyices.2.dylib' so > the following procedure should be used to install it. > > 1) copy libyices.2.0.0.dylib in /usr/local/lib (this requires >administrative privileges): > > sudo cp libyices.2.0.0.dylib /usr/local/lib > sudo chmod 755 /usr/local/lib/libyices.2.0.0.dylib > > > 2) add two symbolic links: > > sudo ln -sf libyices.2.0.0.dylib /usr/local/lib/libyices.dylib > sudo ln -sf libyices.2.0.0.dylib /usr/local/lib/libyices.2.dylib > > > > > For more information, please visit http://yices.csl.sri.com. > Mukeshs-MacBook-Pro:yices-2.1.0 mukeshtiwari$ cd lib/ > Mukeshs-MacBook-Pro:lib mukeshtiwari$ ls > libyices.2.1.0.dylib > Mukeshs-MacBook-Pro:lib mukeshtiwari$ sudo cp libyices.2.1.0.dylib > /usr/local/lib > Password: > Mukeshs-MacBook-Pro:lib mukeshtiwari$ sudo chmod 755 > /usr/local/lib/libyices.2.1.0.dylib > Mukeshs-MacBook-Pro:lib mukeshtiwari$ sudo ln -sf libyices.2.1.0.dylib > /usr/local/lib/libyices.dylib > Mukeshs-MacBook-Pro:lib mukeshtiwari$ sudo ln -sf libyices.2.1.0.dylib > /usr/local/lib/libyices.2.dylib > > Mukeshs-MacBook-Pro:~ mukeshtiwari$ ghci -XScopedTypeVariables > > GHCi, version 7.6.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.SBV.Bridge.Yices > Prelude Data.SBV.Bridge.Yices> prove $ \(x::SWord8) -> x `shiftL` 2 .== 4*x > > Loading package pretty-1.1.1.0 ... linking ... done. > Loading package array-0.4.0.1 ... linking ... done. > Loading package deepseq-1.3.0.1 ... linking ... done. > Loading package filepath-1.3.0.1 ... linking ... done. > Loading package old-locale-1.0.0.5 ... linking ... done. > Loading package time-1.4.0.1 ... linking ... done. > Loading package bytestring-0.10.0.0 ... linking ... done. > Loading package unix-2.6.0.0 ... linking ... done. > Loading package directory-1.2.0.0 ... linking ... done. > Loading package process-1.1.0.2 ... linking ... done. > Loading package old-time-1.1.0.1 ... linking ... done. > Loading package containers-0.5.0.0 ... linking ... done. > Loading package random-1.0.1.1 ... linking ... done. > Loading package template-haskell ... linking ... done. > Loading package QuickCheck-2.5.1.1 ... linking ... done. > Loading package transformers-0.3.0.0 ... linking ... done. > Loading package mtl-2.1.2 ... linking ... done. > Loading package syb-0.3.7 ... linking ... done. > Loading package sbv-2.10 ... linking ... done. > *** An error occurred. > *** Unable to locate executable for Yices > *** Executable specified: "yices-smt" > > > Regards, > Mukesh Tiwari > > [1] http://yices.csl.sri.com/download-yices2.shtml > > > On Mon, Jul 1, 2013 at 2:57 PM, mukesh tiwari < > mukeshtiwari.ii...@gmail.com> wrote: > >> Hello all, >> Not directly related to Haskell but I am trying to install Z3 to use SBV >> package[1]. I followed the instructions[2] to install it. >> >> *Mukeshs-MacBook-Pro:SMT mukeshtiwari$ git clone >> https://git01.codeplex.com/z3 -b unstable >> Cloning into 'z3'... >> remote: Counting objects: 16070, done. >> remote: Compress
Re: [Haskell-cafe] question about indentation conventions
> Code which is part of some expression should be indented > further in than the beginning of that expression [...] Yes. Then the next question is "how much further in". My answer is: it does not matter, but make it consistent (like 4 spaces), with the implication that indentation should *not* depend on length of identifiers in the previous line(s) Example (bad): foo x = do bar baz Example (good): foo x = do bar baz Reason: when refactoring later changes the name "foo", or the number or names of its arguments, you'll have to re-indent code (in the "bad" version): (a) this needs tool support and (b) it creates noise in the diffs. - J.W. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] question automatic indentation (and so on)
On Mon, Jul 01, 2013 at 09:48:42AM +0200, Joachim Breitner wrote: > 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] Installing Z3 on OS X 10.8.4 ( Off topic )
> Unable to locate executable for z3 well, do you really have z3 in the $PATH? what does 'which z3' answer? I used this for installation of z3: python scripts/mk_make.py --prefix=/usr/local and note that the install script says: Z3 shared libraries were installed at /usr/local/lib, make sure this directory is in your LD_LIBRARY_PATH environment variable. - J.W. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] question automatic indentation (and so on)
Hi, Am Montag, den 01.07.2013, 07:59 -0400 schrieb Richard Cobbe: > 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? I would still expect the developer to write correctly intended Haskell, so the the tool would have to employ a Haskell parser to get an AST (with extra information on where comments were – probably the trickiest part) and then pretty-prints it. If it were not for comments, using haskell-src-exts would already provide a first approximation to the problem, as shown in this script: https://github.com/djv/small/blob/master/tidy.hs Greetings, Joachim -- Joachim “nomeata” Breitner m...@joachim-breitner.de • http://www.joachim-breitner.de/ Jabber: nome...@joachim-breitner.de • GPG-Key: 0x4743206C Debian Developer: nome...@debian.org signature.asc Description: This is a digitally signed message part ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] question about indentation conventions
I always preferred (I think going back to my lisp days) foo x y z indenting subsequent arguments to the same level as the first, but I have not convinced haskell-mode to do that for me. (The general rule here being that similar things should be at the same indent, which will always result in subexpressions being further indented, but is somewhat more specific.) The case I never quite know what to do with is a series of expressions connected with operators, e.g. foo <|> bar <|> baz Leaving operators at the beginning of lines (rather than trailing the previous line) seems preferable, but does one (where the layout rules apply) align the operator or the function? (the alternative being, if your mail client does not make a mess of it with a variable-width font) foo <|> bar <|> baz ~IRS From: haskell-cafe-boun...@haskell.org [haskell-cafe-boun...@haskell.org] on behalf of Richard Cobbe [co...@ccs.neu.edu] Sent: Monday, July 01, 2013 8:00 AM To: haskell-cafe@haskell.org Subject: 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 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Installing Z3 on OS X 10.8.4 ( Off topic )
On Mon, Jul 1, 2013 at 8:34 AM, Johannes Waldmann < waldm...@imn.htwk-leipzig.de> wrote: > and note that the install script says: > > Z3 shared libraries were installed at /usr/local/lib, make sure this > directory is in your LD_LIBRARY_PATH environment variable. > Only applicable on Linux (and setting the OS X equivalent of LD_LIBRARY_PATH is an absolutely wonderful way to break your system). OS X compiles full paths to shared objects into binaries, and provides a tool to change them if the need arises (install_name_tool). -- brandon s allbery kf8nh sine nomine associates allber...@gmail.com ballb...@sinenomine.net unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net ___ 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 1, 2013 at 3:43 AM, Tom Ellis < tom-lists-haskell-cafe-2...@jaguarpaw.co.uk> wrote: > > is OK but > > f (g x > > y z) > > is not. > > It seems to me that this means > > f x1 x2 > x3 x4 > > is not. The OP was initially asking about this situation. > If you wrote that in a do, the compiler would insert a (>>) between the two lines. -- brandon s allbery kf8nh sine nomine associates allber...@gmail.com ballb...@sinenomine.net unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] question about indentation conventions
My current approach is not to have one rule for every case but rather to indent however seems best for the particular code. For example, for Parsec's <|>, I try to make the code look like a BNF grammar rather than adhering to normal indentation conventions. Perhaps as a carry-over from my C-style programming days, I usually have the operators at the end of the line, but I put <|> at the beginning, several steps *left* of where it would normally be, to get everything aligned nicely. Similarly, I try to align things to show the structure of the code. For example, if I have two similar function calls on top of each other, I try to highlight the parallelism: foo (Just $ a + b) Nothing foo Nothing (Just $ a + b) The main idea is that I try to format my code not based on what the *code* is but based on what it *means*. I don't know if this is entirely reasonable, but I like it. I've thought about writing an automatic indenting tool for Haskell (or, more accurately, a pretty-printer) for another project I have, and this is the main thing that threw me off. While automatic indentation might make sense for less expressive languages (Google Go being an extreme example), I think it would be too constraining for Haskell. After all, in reasonable code, chances are that similar constructs end up meaning wildly different things (especially with the advent of pervasive embedded DSLs), so the code itself is a poor indicator of its own structure. So this is really something of an aside, but I do not think that a gofmt-style tool would be quite as useful for Haskell, and it certainly does not replace good taste. ** On Mon, Jul 1, 2013 at 9:34 AM, Sturdy, Ian wrote: > I always preferred (I think going back to my lisp days) > > foo x y > z > > indenting subsequent arguments to the same level as the first, but I have > not convinced haskell-mode to do that for me. (The general rule here being > that similar things should be at the same indent, which will always result > in subexpressions being further indented, but is somewhat more specific.) > > The case I never quite know what to do with is a series of expressions > connected with operators, e.g. > > foo > <|> bar > <|> baz > > Leaving operators at the beginning of lines (rather than trailing the > previous line) seems preferable, but does one (where the layout rules > apply) align the operator or the function? (the alternative being, if your > mail client does not make a mess of it with a variable-width font) > > foo > <|> bar > <|> baz > > ~IRS > > From: haskell-cafe-boun...@haskell.org [haskell-cafe-boun...@haskell.org] > on behalf of Richard Cobbe [co...@ccs.neu.edu] > Sent: Monday, July 01, 2013 8:00 AM > To: haskell-cafe@haskell.org > Subject: 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 > > > > ___ > 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] question about indentation conventions
On Mon, Jul 1, 2013 at 9:56 AM, Tikhon Jelvis wrote: > I've thought about writing an automatic indenting tool for Haskell (or, > more accurately, a pretty-printer) for another project I have, and this is > the main thing that threw me off. While automatic indentation might make > sense for less expressive languages (Google Go being an extreme example), I > think it would be too constraining for Haskell. After all, in reasonable > code, chances are that similar constructs end up meaning wildly different > things (especially with the advent of pervasive embedded DSLs), so the code > itself is a poor indicator of its own structure. > One might look at the history of the indentation modules for Emacs haskell-mode. Short version: they gave up, tab iterates through the possibilities because it's quite impossible to know which one is correct without a *semantic*, not just syntactic, understanding of the code. (Which, when you think about it, is pretty much par for the Haskell language definition. See also the literally impossible brace insertion rule of Haskell98.) -- brandon s allbery kf8nh sine nomine associates allber...@gmail.com ballb...@sinenomine.net unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] question about indentation conventions
That's certainly true. As I mentioned, I was actually considering a *pretty-printer* rather than an automatic indentation tool per se. The end results are similar, but the pretty-printer is really only the latter part of the problem: it's predicated on already having a valid AST. My particular use case involved diffing and merging ASTs directly; this means that I would have to somehow output the result in a human-readable format. Moreover, the actual AST I was outputting could have been the combination of two others, without any prior concrete syntax! I still haven't worked out a good way to do this for Haskell (or, to be fair, any other language). But yeah, Haskell is pretty intractable as far as language grammars go. I think this is a great compromise--I value language expressiveness over tooling--but it certainly is a compromise. On Mon, Jul 1, 2013 at 10:10 AM, Brandon Allbery wrote: > On Mon, Jul 1, 2013 at 9:56 AM, Tikhon Jelvis wrote: > >> I've thought about writing an automatic indenting tool for Haskell (or, >> more accurately, a pretty-printer) for another project I have, and this is >> the main thing that threw me off. While automatic indentation might make >> sense for less expressive languages (Google Go being an extreme example), I >> think it would be too constraining for Haskell. After all, in reasonable >> code, chances are that similar constructs end up meaning wildly different >> things (especially with the advent of pervasive embedded DSLs), so the code >> itself is a poor indicator of its own structure. >> > > One might look at the history of the indentation modules for Emacs > haskell-mode. Short version: they gave up, tab iterates through the > possibilities because it's quite impossible to know which one is correct > without a *semantic*, not just syntactic, understanding of the code. > (Which, when you think about it, is pretty much par for the Haskell > language definition. See also the literally impossible brace insertion rule > of Haskell98.) > > -- > brandon s allbery kf8nh sine nomine > associates > allber...@gmail.com > ballb...@sinenomine.net > unix, openafs, kerberos, infrastructure, xmonad > http://sinenomine.net > ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Installing Z3 on OS X 10.8.4 ( Off topic )
SBV should be able to pick up Z3 from your path; make sure the "z3" executable is in it and you can invoke it from your shell. Alternatively, you can use the SBV_Z3 environment variable to point to the executable itself, if adding it to your path is not desirable for whatever reason. Let me know if you still have issues. -Levent. On Mon, Jul 1, 2013 at 5:34 AM, Johannes Waldmann < waldm...@imn.htwk-leipzig.de> wrote: > > Unable to locate executable for z3 > > well, do you really have z3 in the $PATH? > what does 'which z3' answer? > > I used this for installation of z3: > python scripts/mk_make.py --prefix=/usr/local > > and note that the install script says: > > Z3 shared libraries were installed at /usr/local/lib, make sure this > directory is in your LD_LIBRARY_PATH environment variable. > > - J.W. > > > > ___ > 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
[Haskell-cafe] "Casting" newtype to base type?
Hello Cafe! I had a (simplified) record data P = P { a :: String, b :: String, c :: IO String } deriving (Show, Eq) but to get automatic deriving of 'Show' and 'Eq' for 'data P' I have created 'newtype IOS' and its 'Show' and 'Eq' instances newtype IOS = IO String instance Show (IOS) where show _ = "(IO String) function" instance Eq (IOS) where _ == _ = True (the easiest 'instance Show (IO String) where ...' produces "orphan instance") and changed 'data P' to data P = P { a :: String, b :: String, c :: IOS } deriving (Show, Eq) but now when I try to set 'c' field in fun :: FilePath -> P -> IO P fun path p = do b <- doesFileExist path ... return $ p {c = readFile path} I get error Couldn't match expected type `IOS' with actual type `IO String' which is correct. So, the question is: Is it possible to somehow "cast" 'IO String' to 'IOS', or in some other way set 'c' field to an 'IO String' function so that it can be later used such as 'content <- c p'. Thanks ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] "Casting" newtype to base type?
Am 7/1/2013 5:07 PM, schrieb Vlatko Basic: to get automatic deriving of 'Show' and 'Eq' for 'data P' I have created 'newtype IOS' and its 'Show' and 'Eq' instances newtype IOS = IO String What you really want is newtype IOS = IOS (IO String) I.e. a IOS value "wraps" an IO String. data P = P { a :: String, b :: String, c :: IOS } deriving (Show, Eq) but now when I try to set 'c' field in fun :: FilePath -> P -> IO P fun path p = do b <- doesFileExist path ... return $ p {c = readFile path} I get error Couldn't match expected type `IOS' with actual type `IO String' which is correct. So, the question is: Is it possible to somehow "cast" 'IO String' to 'IOS' With the change to your 'newtype', you could use return $ p {c = IOS (readFile path)} instead. -- Frerich Raabe - ra...@froglogic.com www.froglogic.com - Multi-Platform GUI Testing ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] "Casting" newtype to base type?
On Mon, Jul 01, 2013 at 05:07:00PM +0200, Vlatko Basic wrote: > Hello Cafe! > > I had a (simplified) record > > data P = P { > a :: String, > b :: String, > c :: IO String > } deriving (Show, Eq) > > but to get automatic deriving of 'Show' and 'Eq' for 'data P' I have > created 'newtype IOS' and its 'Show' and 'Eq' instances > > newtype IOS = IO String > instance Show (IOS) where show _ = "(IO String) function" > instance Eq (IOS) where _ == _ = True An Eq instance for something containing IO is bound to lead to puzzlement somewhere down the line. I think you're better off defining something like data P_lesser = P_lesser { a_lesser :: String, b_lesser :: String } deriving (Show, Eq) to_lesser p = P_lesser (a p) (b p) and just factoring everything through "to_lesser" when you want to compare or show. Tom ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Spam on list??
Yeah I'm getting stuff from j...@eukor.com every time I post. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] "Casting" newtype to base type?
On 1 Jul 2013, at 16:07, Vlatko Basic wrote: > I had a (simplified) record > > data P = P { >a :: String, >b :: String, >c :: IO String >} deriving (Show, Eq) > > but to get automatic deriving of 'Show' and 'Eq' for 'data P' I have created > 'newtype IOS' and its 'Show' and 'Eq' instances > > newtype IOS = IO String Not quite! That is a newtype'd String, not a newtype's (IO String). Try this: newtype IOS = IOS (IO String) > but now when I try to set 'c' field in > >return $ p {c = readFile path} > > I get error > Couldn't match expected type `IOS' with actual type `IO String' Use the newtype constructor to convert an IO String -> IOS. return $ p {c = IOS $ readFile path} Regards, Malcolm ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Spam on list??
Title: 인증페이지시안1 Anybody else getting this spam emails from j...@eukor.com every time a message is sent to Cafe? Original Message Subject: Re: [Haskell-cafe] "Casting" newtype to base type? From: j...@eukor.com To: me Date: 01.07.2013 17:07 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Spam on list??
On Mon, Jul 1, 2013 at 11:19 AM, Vlatko Basic wrote: > Anybody else getting this spam emails from j...@eukor.com every time a > message is sent to Cafe? > Yes, and I'm hoping a list admin steps in soon. The irony is, it's their *anti*spam filter. They decided to use one of those obnoxious whitelisting systems that requires all senders to register with it before it will pass on their mail... but didn't exclude mailing lists from this. Mailing lists, of course, can't authenticate, so they're sending all these image-heavy "please whitelist yourself" messages in Korean to the list submission address *and* not seeing any actual list traffic. This is one of the reasons I sometimes wish that use of an active spam whitelist like this were grounds for disabling the user's email account. They can't even tell what kind of mess they're making. -- brandon s allbery kf8nh sine nomine associates allber...@gmail.com ballb...@sinenomine.net unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Subclass or no subclass?
On 30/06/13, Dan Burton wrote:I am not trying to say "every building is a shelter", rather "anything that is a building must provide sheltering services". Well if it walks like a shelter and quacks like a shelter... /shrugOne of the nice things about OO is the intuitive nature of the is-a relation between class and instance (forgetting hierarchies for the moment). I suggest that an intuitive interpretation of the Haskell class–instance relation might be *acts-as*. For example, a car or a bus could afford transport once they have a move operation. This is an intuitive view for design; it does not reflect the language level function of handling ad-hoc polymorphism. Also it reifies the type class, which AFAIK does not exist at run time. Tá an teachtaireacht seo scanta ó thaobh ábhar agus víreas ag Seirbhís Scanta Ríomhphost de chuid Seirbhísí Faisnéise, ITBÁC agus meastar í a bheith slán. http://www.dit.ie This message has been scanned for content and viruses by the DIT Information Services E-Mail Scanning Service, and is believed to be clean. http://www.dit.ie ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Subclass or no subclass?
Here's another thought (not my own): Abstractions can be classified based on where responsibility lies. Popular languages implementing interface composition expect the caller to know almost nothing about the concrete details while the callee has to handle all concrete permutations. Conversely, the sort of abstraction we see in typeclasses, much like those in c++ template programming, require the client to dictate concrete details that satisfy the callee requirements. Cheers, Darren On 2013-07-01 9:08 AM, "Patrick Browne" wrote: > On 30/06/13, *Dan Burton * wrote: > > I am not trying to say "every building is a shelter", rather "anything >> that is a building must provide sheltering services". > > > Well if it walks like a shelter and quacks like a shelter... /shrug > > One of the nice things about OO is the intuitive nature of the is-a > relation between class and instance (forgetting hierarchies for the > moment). I suggest that an intuitive interpretation of the Haskell > class–instance relation might be *acts-as*. For example, a car or a bus > could afford transport once they have a move operation. This is an > intuitive view for design; it does not reflect the language level function > of handling ad-hoc polymorphism. Also it reifies the type class, which > AFAIK does not exist at run time. > > > > Tá an teachtaireacht seo scanta ó thaobh ábhar agus víreas ag Seirbhís > Scanta Ríomhphost de chuid Seirbhísí Faisnéise, ITBÁC agus meastar í a > bheith slán. http://www.dit.ie > This message has been scanned for content and viruses by the DIT > Information Services E-Mail Scanning Service, and is believed to be clean. > http://www.dit.ie > ___ > 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] "Casting" newtype to base type?
Hi Wallace, yes, indeed. Now I see I mixed newtype with type in declaration, and forgot the first one is a constructor. Original Message Subject: Re: [Haskell-cafe] "Casting" newtype to base type? From: Malcolm Wallace To: vlatko.ba...@gmail.com Cc: Haskell-Cafe Date: 01.07.2013 17:24 On 1 Jul 2013, at 16:07, Vlatko Basic wrote: I had a (simplified) record data P = P { a :: String, b :: String, c :: IO String } deriving (Show, Eq) but to get automatic deriving of 'Show' and 'Eq' for 'data P' I have created 'newtype IOS' and its 'Show' and 'Eq' instances newtype IOS = IO String Not quite! That is a newtype'd String, not a newtype's (IO String). Try this: newtype IOS = IOS (IO String) but now when I try to set 'c' field in return $ p {c = readFile path} I get error Couldn't match expected type `IOS' with actual type `IO String' Use the newtype constructor to convert an IO String -> IOS. return $ p {c = IOS $ readFile path} Regards, Malcolm ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] "Casting" newtype to base type?
I'm experimenting. The IO field is just a helper field, so it shouldn't have any consequences. Original Message Subject: Re: [Haskell-cafe] "Casting" newtype to base type? From: Tom Ellis To: haskell-cafe@haskell.org Date: 01.07.2013 17:24 On Mon, Jul 01, 2013 at 05:07:00PM +0200, Vlatko Basic wrote: Hello Cafe! I had a (simplified) record data P = P { a :: String, b :: String, c :: IO String } deriving (Show, Eq) but to get automatic deriving of 'Show' and 'Eq' for 'data P' I have created 'newtype IOS' and its 'Show' and 'Eq' instances newtype IOS = IO String instance Show (IOS) where show _ = "(IO String) function" instance Eq (IOS) where _ == _ = True An Eq instance for something containing IO is bound to lead to puzzlement somewhere down the line. I think you're better off defining something like data P_lesser = P_lesser { a_lesser :: String, b_lesser :: String } deriving (Show, Eq) to_lesser p = P_lesser (a p) (b p) and just factoring everything through "to_lesser" when you want to compare or show. Tom ___ 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] ANNOUNCE: module-management-0.9.3 - clean import lists, split and merge modules
On Sat, Jun 29, 2013 at 12:09 PM, David Fox wrote: > I've just uploaded version 0.10, which corrects some formatting bugs > and incorporates most of the changes suggested in this thread. Please > give it a try! Version 0.10.1 is now available - it should build with GHC 7.4.1, fixes more formatting bugs, includes the unit test input data and debian/changelog. The next release will address people's concerns about the signature of the splitModule function. It will take a function defining how to map symbols to module names, so people can define their own splits. It will also return a set of values describing what it did. Should I keep posting updates in this thread? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: module-management-0.9.3 - clean import lists, split and merge modules
On 07/01/2013 08:38 PM, David Fox wrote: > Should I keep posting updates in this thread? Yes please, I'm interested in following this development! That, or get yourself a blog and let us all know where to point our RSS readers. - Ollie signature.asc Description: OpenPGP digital signature ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] cabal-dev: installing/running with profiling enabled
Hi all, I want to profile a Haskell program. I have tons of libraries installed without profiling enabled, and some of them are installed with my Linux distribution's package mangaer. So I tried installing the program in a fresh cabal-dev environment with profiling enabled, so that all dependencies would be also installed with profiling enabled. But for some reason even after installing with `cabal-dev install --enable-executable-profiling -prof` I still can't run this program with `caba-dev/bin/program +RTS -p`, it fails with 'program: the flag -p requires the program to be built with -prof'. Can anyone help me on installing/running in cabal-dev with profiling enabled? --- Ömer Sinan Ağacan http://osa1.net ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] some questions about Template Haskell
John Lato wrote: > The problem isn't the output of nameBase, it's the input parameter 'n'. > In your example, you've created a function that takes input (a Name) and > generates code based upon that input. In order to lift a value (n) from > an ordinary context into a quote, it needs a Lift instance. Thanks John. Ok I can understand that a Lift instance is needed, but to use the lift function below, we also need a Lift instance for the return of (nameBase n), because lift is a function that operates on instances of the Lift typeclass: > :i lift class Lift t where lift :: t -> Q Exp And it is indeed the case: > :i Lift [...] instance Lift a => Lift [a] instance Lift Char And as I have shown on a small example, lift and [||] return about the same result: > runQ $ lift "u" ListE [LitE (CharL 'u') > runQ $ [| "u" |] LitE (StringL "u") So what is the difference between lift and [||]? Although I feel stupid, I cannot lie and claim I have understood. > Perhaps it helps if you think about what a quote does: it allows you to > write essentially a string of Haskell code that is converted into an AST. > For this to work, the quote parser needs to know how to generate the AST > for an identifier. Like much of Haskell, it's type-driven. For > identifiers in scope from imports, TH simply generates a variable with the > correct name. But for data, the parser needs a way to generate an AST > representation, which is what Lift is for. Ok, I think I understand that (we need some method to transform a value at data level in a token of an AST), but it seems to me it does not answer my question above. But I am probably wrong. Thanks TP ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] cabal-dev: installing/running with profiling enabled
Hi Ömer, I've replied in-line below. On Mon, Jul 1, 2013 at 2:34 PM, Ömer Sinan Ağacan wrote: > So I tried installing the program in a fresh cabal-dev environment > with profiling enabled, so that all dependencies would be also > installed with profiling enabled. But for some reason even after > installing with `cabal-dev install --enable-executable-profiling > -prof` I still can't run this program with `caba-dev/bin/program +RTS > -p`, it fails with 'program: the flag -p requires the program to be > built with -prof'. > Because you're installing libraries (into the cabal-dev sandbox) you'll also need to add the --enable-library-profiling flag, in addition to the --enable-executable-profiling flag. Cabal-dev could infer the former from the later, but we haven't done that (this doesn't seem to come up very often). I don'th think the -prof flag is necessary; but if it is, then it may also be misinterpreted by cabal-dev; generally, you need to pass flags that only use a single leading "-" to cabal-dev with the --flags=... option. (eg: 'cabal-dev install --enable-library-profiling --enable-executable-profiling --flags=-prof' This command worked for me: $ cabal-dev install --enable-library-profiling --enable-executable-profiling Note that you must remove the existing cabal-dev sandbox directory before running that command (or the installed dependencies that were built without library profiling can cause the build to fail. --Rogan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] question about indentation conventions
On 2/07/2013, at 12:00 AM, Richard Cobbe wrote: > 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 This (a) clearly violates the Golden Rule of Indentation and (b) Goes out of its way to confuse human readers. I do not know any indenting program that would tolerate such a layout for C or Lisp. > or > >f x > y > z > > Both are correct, in most contexts. What part of "y and z are PARTS of f x y z and so SHOULD BE INDENTED relative to the whole expression" is hard to understand? If by "correct" you mean "will not confuse a Haskell parser", you're right. If you mean "will not dangerously mislead human readers", only the second form is acceptable. I do not trust any program to do my indentation. And let's face it, if your Haskell functions are big enough that manual indentation is a big issue, they are too big. ___ 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
Re: [Haskell-cafe] some questions about Template Haskell
On Mon, Jul 1, 2013 at 5:42 PM, TP wrote: > So what is the difference between lift and [||]? > Although I feel stupid, I cannot lie and claim I have understood. Hi TP, Sometimes [| |] does need to call lift. If for some reason the original lift wasn't exported, you could define: myLift x = [| x |] But if you have enough $( ) splices to balance out the [| |], there is no lift involved: myId1 x = $( [| x |] ) myId2 x = [| $(x) |] I think your first example is supposed to do: *Pr> let x = 5 in $(pr 'x) x = 5 That's possible if you had defined pr as: pr n = [| putStrLn $ $(lift (nameBase n)) ++ " = " ++ show $(varE n) |] If there were no [| |] quotes, but still the ' syntax for getting a Name, it would still be possible to define pr: pr2 n = varE 'putStrLn `appE` (infixE (Just (lift (nameBase n))) (varE '(++)) (Just (infixE (Just (lift " = ")) (varE '(++)) (Just (appE (varE 'show) (varE n)) -- Adam ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] question about indentation conventions
I prefer the other style--as do others, evidently (see the example in my first reply.) I agree that this was a good discussion, but let's not conclude so easily that the entire community is in favor of one thing or the other. On Mon, Jul 1, 2013 at 8:24 PM, Richard Cobbe wrote: > 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 mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] cabal-dev: installing/running with profiling enabled
Hi Rogan, Thanks for your reply. > I don'th think the -prof flag is necessary; but if it is, then it may also > be misinterpreted by cabal-dev; generally, you need to pass flags that only > use a single leading "-" to cabal-dev with the --flags=... option. (eg: > 'cabal-dev install --enable-library-profiling --enable-executable-profiling > --flags=-prof' > > > This command worked for me: > > $ cabal-dev install --enable-library-profiling --enable-executable-profiling OK, so I removed `cabal-dev` directory, and installed again with this command. But it still failed with same error message("the flag -p requires the program to be built with -prof"). Then I also tried removing cabal-dev again and installing again but this time with extra `--flags=-prof` parameter. Failed with same error. Just to be sure I created a new cabal project with only one file: 'Hello.hs' with contents 'main = putStrLn "hello"' and tried to install it with cabal-dev. And `./cabal-dev-/bin/Hello +RTS -p` failed with same error again. Maybe something wrong with my system? My first thought was maybe cabal-dev is using some pre-installed library, and it's not recompiling the whole world for each sandbox. But I don't know how to check this. Any ideas on that? Thanks, --- Ömer Sinan Ağacan http://osa1.net ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Installing Z3 on OS X 10.8.4 ( Off topic )
Thank you for your response. Now it's working. -Mukesh Tiwari On Mon, Jul 1, 2013 at 8:32 PM, Levent Erkok wrote: > SBV should be able to pick up Z3 from your path; make sure the "z3" > executable is in it and you can invoke it from your shell. Alternatively, > you can use the SBV_Z3 environment variable to point to the executable > itself, if adding it to your path is not desirable for whatever reason. > > Let me know if you still have issues. > > -Levent. > > > On Mon, Jul 1, 2013 at 5:34 AM, Johannes Waldmann < > waldm...@imn.htwk-leipzig.de> wrote: > >> > Unable to locate executable for z3 >> >> well, do you really have z3 in the $PATH? >> what does 'which z3' answer? >> >> I used this for installation of z3: >> python scripts/mk_make.py --prefix=/usr/local >> >> and note that the install script says: >> >> Z3 shared libraries were installed at /usr/local/lib, make sure this >> directory is in your LD_LIBRARY_PATH environment variable. >> >> - J.W. >> >> >> >> ___ >> 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 > > ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe