Re: [Haskell-cafe] No upgrade of GHC version in Ubuntu repository
Hi, On Mon, Oct 14, 2013 at 01:28:17PM +0200, Vlatko Basic wrote: I have 7.6.3 already, but I was wondering why the repository packages are not maintained. 12.04 is an LTS for 5 years, so I suppose many would stick to it for a longer time. I added PPAs for GHC 7.6.3 recently. Feel free to use: sudo apt-get --purge remove ghc sudo apt-get --purge remove cabal-install sudo apt-add-repository ppa:typeful/ghc-7.6.3 sudo apt-add-repository ppa:typeful/cabal-install sudo apt-get update sudo apt-get install ghc cabal-install This assumes that you only want to install GHC and cabal-install with apt and everything else from Hackage. Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANN: hspec-test-framework - Run test-framework tests with Hspec
Hi, I just released hspec-test-framework[1] and hspec-test-framework-th[2] to Hackage. They can be used to run test-framework tests with Hspec unmodified. This can also be used to work around test-framework's incompatibility with QuickCheck-2.6 and base-4.7.0 ;) Have a look at the README for usage instructions: https://github.com/sol/hspec-test-framework#readme Cheers, Simon [1] http://hackage.haskell.org/package/hspec-test-framework [2] http://hackage.haskell.org/package/hspec-test-framework-th ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: hspec-test-framework - Run test-framework tests with Hspec
Hi, Due to the recent announcement of Roman's tasty library, are there plans to basically release something similar to hspec-test-framework and hspec-test-framework-th but targeting tasty instead? I care about Hspec[1] and want to provide an upgrade path for test-framework users, but I'm looking forward to friendly competition ;) Cheers, Simon [1] http://hspec.github.io/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANN: hspec-smallcheck - SmallCheck support for the Hspec testing framework
Hi, I'm glad to announce SmallCheck support [1] for the Hspec testing framework. A tiny example on how to use it is here: https://github.com/hspec/hspec-smallcheck/blob/master/example/Spec.hs More documentation for Hspec is here: http://hspec.github.io/ Cheers, Simon [1] http://hackage.haskell.org/package/hspec-smallcheck ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haddock GSOC project progress
Hi Roman, However, the decision to use Attoparsec (instead of Parsec, say) strikes me as a bit odd, as it wasn't intended for parsing source code. In particular, I'm concerned with error messages this parser would produce. In addition to what Mateusz already said, I want to briefly summarize my justification for using Attoparsec: * Attoparsec's backtracking behavior is much easier to work with than Parsec's * There is no such thing as a parse error in Markdown, and I think we should try to make this true for Haddock markup, too Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Template Haskell and Haddock
On Wed, Jul 31, 2013 at 08:29:18PM +0300, kudah wrote: On Wed, 31 Jul 2013 15:18:32 +0200 Jose A. Lopes jabolo...@google.com wrote: Is there a way to access docstrings through Template Haskell ? For example, access the docstring of a function declaration ? No, but I believe you can access comments and annotations using a ghc plugin. See https://github.com/thoughtpolice/strict-ghc-plugin for example. By default, Haddock comments are not part of GHC's AST. You need to explicitly enable it (see e.g. [1]). For code that extracts all Haddock comments by using the GHC API, you can look at [2]. Cheers, Simon [1] https://github.com/sol/doctest-haskell/blob/master/src/GhcUtil.hs#L66 [2] https://github.com/sol/doctest-haskell/blob/master/src/Extract.hs ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [ANNOUNCE] rainbow - print colored text on UNIX-like systems
Hi, For whatever reason, your Haddock documentation is not visible on Hackage. Haddock documentation is created by a batch job and will show up eventually ;). Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] I wish cabal-dev to travel back in time
Personally I think we need something akin to Ruby's `Gemfile.lock` mechanism (ideally directly integrated into Cabal). Cheers, Simon On Sat, May 11, 2013 at 11:10:45AM +0200, Alberto G. Corona wrote: Hi Café: I created just now an issue in cabal-dev: https://github.com/creswick/cabal-dev/issues/101 When compiling old developments, I wish cabal-dev to install and build dependencies that were available at a that time I don't know if there are alternatives to solving this issue. I think that this is very useful and necessary, specially now when library updates are increasingly frequent. Maybe this problem is already solved and I just don´t know (as is often the case, for example when, in a sudden aha moment, I reinvented cabal-install months after the release). That is the reason why I tell you about it here in order to discuss it. motivation: I´m installing now an old soft development. Since many of my dependencies were labeled with -any or with , neither I neither cabal know which library versions are the right ones. By taking into account a date parameter, cabal-dev can figure out which libraries were the latest and the right ones at that time. -- Alberto. ___ 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] GSoC proposal: Haskell AST-based refactoring and API upgrading tool
Hi Niklas, I haven't read the whole proposal as I'm short of time. But Alan Zimmerman is doing a lot of work on integrating HaRe with the GHC API [1]. He is alanz on freenode and a regular in #hspec. I haven't looked at the code, but maybe it's of interest to you. Cheers, Simon [1] https://github.com/alanz/HaRe/tree/ghc-api On Mon, Apr 29, 2013 at 02:00:23PM +0800, Niklas Hambüchen wrote: I would like to propose the development of source code refactoring tool that operates on Haskell source code ASTs and lets you formulate rewrite rules written in Haskell. Objective - The goal is to make refactorings easier and allow global code changes that might be incredibly tedious to do in a non-automated way. By making these transformations convenient, we can make it easier to maintain clean code, add new features or clean up leftovers faster, and reduce the fear and effort to upgrade to newer versions of packages and APIs. Transformations --- First, here are a few operations you would use this tool for. Some of them are common operations you would also do in other programming languages, some are more specific to Haskell. * Changing all occurrences of import Prelude hiding (catch) to import qualified Control.Exception as E * Replacing all uses of a function with that function being imported qualified or the other way around * Adding a field to data constructor a record, setting user-supplied defaults for construction and destruction: -- Suppose you want to change one of these data User = User { name :: String, age :: Int } data User = User String Int -- into one of these data User = User { name :: String, age :: Int, active :: Bool } data User = User String Int Bool -- the refactoring tool could perform, in all relevant locations: show (User name age) = ... show (User name age _) = ... -- and also this transformation: ... u { name = deleted } ... ... u { name = deleted, active = False } ... -- or equivalently with records. -- Special cases could be taken care of as specified, such as -- whenever an object of [this User type] has --of its records passed into some function 'email', do this --now only if the user is active, so modify all relevant code --email (name u) --to --if (active u) then email (name u) else return () -- Other examples include adding a position counter to attoparsec. * Adding a type parameter to a type -- This happens a lot on monad transformer stacks, e.g. newtype MyMonad a b c = MyMonad (ReaderT a (WriterT b ... -- and as you would probably agree on, this is not the most -- comfortable change to make; in big project this can mean -- hour-long grinding. -- It has also recently happened in the basic underlying types -- of packages like conduit and pipes. * Adding a new transformer around a monad * Addressing problems like mentioned in http://blog.ezyang.com/2012/01/modelling-io/: There is one last problem with this approach: once the primitives have been selected, huge swaths of the standard library have to be redefined by “copy pasting” their definitions ... * Extracting a value into a let or where clause * Renaming a variable, and all its occurrences that are semantically same variable (based on its scope) * Changing the way things are done, such as: * Replacing uses of fmap with $, also taking care of the corresponding import, and such cases were partial application is involved * Replacing uses of when (isJust) to forM_ * Making imports clearer by adding all functions used to the file to the import list of the module that gets them in scope * Finding all places where an exported function does not have all its arguments haddock-documented. * Performing whole-project refactorings instead of operating on single files only, allowing operations like Find me all functions of this type, e.g. Maybe a - (a - m a) - m a in the project and extract them into this new module, with the name 'onJust'. Some of the problems above can be tried to address using regex-based search and replace, but this already fails in the simplest case of import Prelude hiding (catch) in case there is more than that imported from Prelude or newlines involved in the import list. Transformation on the AST are much more powerful, and can guarantee that the result is, at least syntactically, valid. No text base tool can do that. Other uses -- In addition to being able to perform transformations as mentioned above, the refactoring tool as a library can be leveraged to: * Support or be the base of code formatting tools such as haskell-stylish, linters, style/convention checkers, static analyzers, test coverage tools etc. * Implement automatic API upgrades.
Re: [Haskell-cafe] RFC: rewrite-with-location proposal
On Mon, Feb 25, 2013 at 09:57:04AM +0100, Joachim Breitner wrote: Hi, Am Montag, den 25.02.2013, 08:06 +0200 schrieb Michael Snoyman: Quite a while back, Simon Hengel and I put together a proposal[1] for a new feature in GHC. The basic idea is pretty simple: provide a new pragma that could be used like so: error :: String - a errorLoc :: IO Location - String - a {-# REWRITE_WITH_LOCATION error errorLoc #-} in light of attempts to split base into a pure part (without IO) and another part, I wonder if the IO wrapping is really necessary. Can you elaborate the reason why a simple Location - is not enough? The IO helps with reasoning. Without it you could write code that does something different depending on the call site. Here is an example: someBogusThingy :: Int someBogusThingy = .. someBogusThingyLoc :: Location - Int someBogusThingyLoc loc | (even . getLine) loc = 23 | otherwise= someBogusThingyLoc {-# REWRITE_WITH_LOCATION someBogusThingy someBogusThingyLoc #-} Now someBogusThingy behaves different depending on whether the call site is on an even or uneven line number. Admittedly, the example is contrived, but I hope it illustrates the issue. I do not insist on keeping it. If we, as a community, decide, that we do not need the IO here. Then I'm fine with dropping it. Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] RFC: rewrite-with-location proposal
On Mon, Feb 25, 2013 at 10:40:29AM +0100, Twan van Laarhoven wrote: I think there is no need to have a separate REWRITE_WITH_LOCATION rule. What if the compiler instead rewrites 'currentLocation' to the current location? Then you'd just define the rule: {-# REWRITE errorLoc error = errorLoc currentLocation #-} REWRITE rules are only enabled with -O. Source locations are also useful during development (when you care more about compilation time than efficient code and hence use -O0). So I'm not sure whether it's a good idea to lump those two things together. Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] cabal install choosing an older version
Hi Ozgur, I'm missing some context here, but I'll release an updated version of hspec ASAP ;) Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] HTF Quickcheck
On Tue, Dec 18, 2012 at 05:25:41PM +, gra...@fatlazycat.com wrote: Are there any libraries that define various common generators ? What would be the cleanest way to define two positive integers below 1000 that are different ? Seems relatively easy with conditionals. You can still use (==) to ensure that two numbers are different. I would use something like this: newtype Small = Small Int deriving Show instance Arbitrary Small where arbitrary = Small . (`mod` 1000) $ arbitrary prop_foo (Small x) (Small y) = x /= y == ... Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] HTF Quickcheck
On Mon, Dec 17, 2012 at 03:50:32PM +, gra...@fatlazycat.com wrote: Getting test failures, I believe, due to using conditional properties within quickckeck etc [TEST] RecFunSpec:map (test/RecFunSpec.hs:48) Gave up! Passed only 20 tests. *** Failed! (2ms) Is there a way for HTF/Quickcheck to specify these are not failed i.e. only fail if there is an actual error ? I have no idea about HTF, but QuickCheck thinks those are failures, too. If I run into something like this, it indicates a bug in my arbitrary instance. Here I would just adapt it so that it generates valid test data (possibly with the help of a newtype wrap). Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] HTF Quickcheck
On Mon, Dec 17, 2012 at 06:04:15PM +0200, Roman Cheplyaka wrote: Unfortunately, I don't know the answer to your question. However, if you don't find a solution, I suggest using SmallCheck instead of QuickCheck — it works better when you have many unsuitable cases. https://github.com/feuerbach/smallcheck/wiki/Comparison-with-QuickCheck As far as I know, SmallCheck is not supported by HTF, but it is supported by test-framework. test-framework also sometimes thinks a Gave up! is not a fail, which I think is a bug. But I gave up on trying to get that fixed [1], e.g. this (admittedly contrived) property is still a pass with test-framework: defaultMain [testProperty foo $ \x - x == 23 == True] Cheers, Simon [1] https://github.com/batterseapower/test-framework/issues/16 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] RFC: Changes to Travis CI's Haskell support
On Mon, Dec 03, 2012 at 08:13:42AM -0800, Johan Tibell wrote: On Mon, Dec 3, 2012 at 1:04 AM, Simon Hengel s...@typeful.net wrote: I think the right thing to do is: install: - cabal install --only-dependencies --enable-tests script: - cabal configure --enable-tests cabal build cabal test Please let me know if you think there are better ways to do it, or if you see any issues. This is the right thing to do. I just created the PRs: https://github.com/travis-ci/travis-build/pull/51 https://github.com/travis-ci/travis-ci.github.com/pull/172 Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] RFC: Changes to Travis CI's Haskell support
Hi, currently the default to test Haskell projects on Travis CI [1] is: install: - cabal install --enable-tests script: - cabal test The issue with this is that it runs the test-suite twice, which is a waste of resources and delays build reports. This was an oversight on my part, when I adapted Travis's Haskell support for cabal-install-0.14.0. I think the right thing to do is: install: - cabal install --only-dependencies --enable-tests script: - cabal configure --enable-tests cabal build cabal test Please let me know if you think there are better ways to do it, or if you see any issues. Cheers, Simon [1] https://travis-ci.org/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANN: base-compat
Hi, I just released the first version of a package that provide new additions to base for older versions of base [2]. So far the following is covered: readMaybe readEither lookupEnv getExecutablePath Source is on GitHub [2]; patches welcome ;) Cheers, Simon [1] http://hackage.haskell.org/package/base-compat [2] https://github.com/sol/base-compat ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: base-compat
On Fri, Nov 30, 2012 at 02:32:12PM +0100, dag.odenh...@gmail.com wrote: Adding could be useful. Yes, patch is welcome ;) Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] JavaScript (SpiderMonkey, V8, etc) embedded in GHC?
Nice! Thanks! I'll have a go with it today or tomorrow. There is not much yet. Have a look at the specs [1] to see what currently works. Cheers, Simon [1] https://github.com/sol/v8/tree/master/test/Foreign/JavaScript ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Quickcheck
On Mon, Nov 12, 2012 at 07:21:06PM +, gra...@fatlazycat.com wrote: Hi, Trying to find some good docs on QuickCheck, if anyone has one ? Been scanning what I can find, but a question. What would be the best way to generate two different/distinct integers ? I would use Quickcheck's implication operator here: quickCheck $ \x y - x /= (y :: Int) == ... Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] JavaScript (SpiderMonkey, V8, etc) embedded in GHC?
Out of curiosity: wouldn't it make more sense to focus on the other direction (calling Haskell from V8)? Roughly like: I guess it really depends what you are after. If you want to cabalize existing JS libs, then I think bindings to V8 make perfect sense ;) Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] JavaScript (SpiderMonkey, V8, etc) embedded in GHC?
Hi, I've looked around with no success… this surprises me actually. Has anyone embedded SpiderMonkey, V8, or any other relatively decent JavaScript interpreters in GHC (using the FFI)? I just started something [1]. Cheers, Simon [1] https://github.com/sol/v8 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Announce: Haskell Platform 2012.4.0.0
The Changelog says: ghc 7.0.4 - 7.4.2 I think this should be: ghc 7.4.1 - 7.4.2 Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: test-framework-golden-1.1
On Sun, Oct 07, 2012 at 09:09:07PM +0300, Roman Cheplyaka wrote: * Simon Hengel s...@typeful.net [2012-10-07 15:45:21+0200] On Fri, Oct 05, 2012 at 05:17:18PM +0300, Roman Cheplyaka wrote: I can do that indeed, and I guess I could reimplement everything I have at the moment on top of HUnit. However, an important part of functionality isn't there at the moment — golden file management. You should be able to say, for this test, take its current output and write it to the corresponding golden file. In order to do that, you need to have access to the list of golden tests in the suite. This is where implementation details of different test frameworks start to matter. Probably one can make an abstraction over test frameworks that would give the list of all golden tests. (Although when you start abstracting over test frameworks, which are abstractions themselves, it becomes somewhat funny.) Ok, makes sense. I'm looking forward to give it a try, and see how it compares to using operating system primitives (say `cp') for golden file management. 1. You often want to update not just one test, but all, or some of the tests (when you've made a change and verified that the changes in output are expected). Doing it in command line is certainly possible, but not trivial nor convenient. 2. For some tests (like goldenVsString) the output is not captured in a file, so using cp directly is not possible. Yes and yes. I have no fixed expectations nor any idea how an ideal interface would look like, but I guess there is room for improvement. So I'm really looking forward to try it ;) Speaking of such functionality, correct me if I'm wrong, but neither HUnit nor hspec won't be able to support it anyway, because they represent tests as opaque IO actions. It would be easy to extend Hspec to support this in the same way you extend test-framework to support this. It requires existentials; the only substantial difference that I can see is that test-framework already uses existentials, while Hspec does not. Well, if you are willing to make this change, then I'll try to do my part of the job and expose a useful abstraction. If it gives us something that is useful from a users perspective, I'm happy to make that change. I would hope that something like [1] works, e.g.: instance Example GoldenTest where evaluateExample c = evaluateExample c . goldenTestToHUnitAssetion exampleMetadata = Just . Metadata That way the Typeable instance is optional. Personally, I still think that it may be a good idea to first explore the design space with test-framework before trying to abstract over it. Cheers, Simon [1] https://github.com/sol/hspec/commit/6927f642aea44803b57c2b77548931f6865b0c38 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: test-framework-golden-1.1
On Fri, Oct 05, 2012 at 05:17:18PM +0300, Roman Cheplyaka wrote: I can do that indeed, and I guess I could reimplement everything I have at the moment on top of HUnit. However, an important part of functionality isn't there at the moment — golden file management. You should be able to say, for this test, take its current output and write it to the corresponding golden file. In order to do that, you need to have access to the list of golden tests in the suite. This is where implementation details of different test frameworks start to matter. Probably one can make an abstraction over test frameworks that would give the list of all golden tests. (Although when you start abstracting over test frameworks, which are abstractions themselves, it becomes somewhat funny.) Ok, makes sense. I'm looking forward to give it a try, and see how it compares to using operating system primitives (say `cp') for golden file management. Speaking of such functionality, correct me if I'm wrong, but neither HUnit nor hspec won't be able to support it anyway, because they represent tests as opaque IO actions. It would be easy to extend Hspec to support this in the same way you extend test-framework to support this. It requires existentials; the only substantial difference that I can see is that test-framework already uses existentials, while Hspec does not. Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: test-framework-golden-1.1
Hi, I am glad to announce the first public release of test-framework-golden — a golden testing library. Nice! The library is integrated with test-framework, so you can use golden tests in addition to SmallCheck/QuickCheck/HUnit tests. I would suggest to rename the modules to Test.Framework.Golden and Test.Framework.Golden.Advanced to more clearly represent that fact. Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: test-framework-golden-1.1
My justification (which you may or may not buy) is that, unlike, say, Test.Framework.Providers.HUnit, this is not an adaptation of an existing testing library to test-framework, but is a new library that just happens to use test-framework. So it's more like Test.HUnit, although it already subsumes what would become Test.Framework.Providers.Golden. Unless HUnit, it's unlikely that this will be integrated into other testing frameworks. So I think it is less general. Anyway, it's up to you. Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: test-framework-golden-1.1
1. It's hard to guess at the moment how a good interface to the pure golden part should look like. Maybe just produce HUnit assertions, e.g.: goldenVsFile :: FilePath - FilePath - IO () - Assertion That way it works with plain HUnit main = runTestTT $ TestLabel someAction produce desired output $ goldenVsFile ref.txt out.txt someAction test-framework main = defaultMain [ testGroup someAction [ testCase produces some desired output $ goldenVsFile ref.txt out.txt someAction ] ] Hspec main = hspec $ do describe someAction $ do it produces some desired output $ do goldenVsFile ref.txt out.txt someAction and probably every other current or future Haskell test framework. Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Organizaing tests in Haskell
Hi, Is there any better solution to organize tests in Haskell? (Disclaimer: I'm the maintainer of Hspec ;) If you use Hspec[1] for testing, you do not have to assemble your individual tests manually into a test suit; hspec-discover[2] takes care of that. There is no comprehensive user's guide for Hspec yet, but a basic introduction is at [3]. If you have any questions, feel free to join in at #hspec on freenode. Should I just give up on module encapsulation, or should I only test functions exposed by the module and don't worry about internal functions? You can do it with CPP. Say, if you have a module Foo, with functions foo, bar and baz, where baz is not part of the public interface, then the export list becomes: {-# LANGUAGE CPP #-} module Foo where ( foo , bar #ifdef TEST , baz #endif ) You then run tests with -DTEST. To make development easier you can add a .ghci file to your project, with: echo ':set -DTEST -isrc -itest' .ghci And of course you need to add cpp-options: -DTEST to your Cabal test-suite section. Cheers, Simon [1] http://hackage.haskell.org/package/hspec [2] https://github.com/hspec/hspec/tree/master/hspec-discover#automatically-discover-and-run-hspec-tests [3] http://hspec.github.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Organizaing tests in Haskell
Of course others are still able to import your Internal modules That is not necessarily true. For libraries, you can list internal modules as other-modules (in contrast to exposed-modules) in you Cabal file. That way they are not part of the public interface of your library. However, that approach does not work if you want to do encapsulation within a single project. I think in that case you most likely end up with CPP (it's ugly, but it works). Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Organizaing tests in Haskell
On Sun, Sep 23, 2012 at 06:11:59PM +0200, Heinrich Apfelmus wrote: Simon Hengel wrote: Of course others are still able to import your Internal modules That is not necessarily true. For libraries, you can list internal modules as other-modules (in contrast to exposed-modules) in you Cabal file. That way they are not part of the public interface of your library. How do I access internal modules with cabal test , though? Last time I tried, I could not find a way to expose in the test section of the cabal file. It works, if you add the source directory to hs-source-dirs of the test suite (in contrast to depending on the library!), e.g.: hs-source-dirs: test, src or hs-source-dirs: test, . This still has the disadvantage, that the sources are compiled twice. But I'm not aware of a better way to do it. If you mostly use GHCi for development, it's not a big issue. Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Organizaing tests in Haskell
On Sun, Sep 23, 2012 at 04:10:56PM +0200, Jan Stolarek wrote: I don't mind sacrificing encapsulation within the package itself. If it works for project as big as Yesod it should work for me. Yesod uses the CPP solution, too (e.g. [1]). Cheers, Simon [1] https://github.com/yesodweb/shakespeare/blob/master/shakespeare/Text/Shakespeare.hs ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUCE: Haddock 2.10.0 and 2.11.0
On Sat, Sep 08, 2012 at 09:19:08AM +1000, Ivan Lazar Miljenovic wrote: More seriously, it seems there's an error building even 2.12.0 with GHC 7.6; is that correct? A functional version of Haddock 2.12.0 comes with GHC 7.6.1. This build error only affects you, if you want to use the Haddock API. But yes, if you want to use the Haddock API, you are currently stuck. Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Monospace code in Haddock
On Wed, Sep 05, 2012 at 08:40:37PM +0100, Niklas Hambüchen wrote: Is it possible to use inlined monospaced font in Haddock that does *not* replace and to links and does *not* link to Haskell functions (like @ and ' and and ` do)? Have you tried to escape stuff within @. e.g.: @\foo\@ I think this should work. Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Monospace code in Haddock
On Wed, Sep 05, 2012 at 08:53:26PM +0100, Niklas Hambüchen wrote: OK, but how to prevent it from linking to foo if I have a function foo in my module? Hmm, I'm not sure if I understand the problem. Can you give a minimal example? Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Monospace code in Haddock
On Wed, Sep 05, 2012 at 09:11:47PM +0100, Niklas Hambüchen wrote: When you write: -- | This function returns the string @hello@ and you have a function called hello in scope, haddock will hyperlink the the above hello to that function, which is confusing if your monospace string has actually nothing to do with that function. In other words: Haddock always links to your functions in inline monospaced text, and you can't turn that off. -- | Gives you @\span\hello\/span\@ will therefore link to functions 'span' and 'hello' if they exist. As far as I know Haddock markup is interpreted withing @-blocks. So if you write @`foo`@ it will get linked, but if you just write @foo@ it should not be linked. If you write @\`foo`@ it should again not be linked. It may be awkward at times, but I think you should be able to achieve what you want, no? Please give a self-contained minimal example that illustrates your issue, if this still does not help. Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Fwd: 'let' keyword optional in do notation?
On Wed, Aug 08, 2012 at 12:22:39PM -0400, David Feuer wrote: Changing scoping rules based on whether things are right next to each other? No thanks. Would expanding each let-less binding to a separate let feel more sound to you? Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cabal install fails due to recent HUnit
On Fri, Jul 20, 2012 at 10:02:18AM +0100, Ross Paterson wrote: On Fri, Jul 20, 2012 at 09:34:16AM +0100, Simon Hengel wrote: Hi Ross, can you fix this on Hackage? My suggested solution is to again just remove the test-suite sections from the cabal file, if that is fine with Richard. I'll modify the packages in-place if there's a consensus on what to do. I think Richard gave his consent. Is there still anything we need to sort out? BTW: Here is a reddit story on the issue: http://www.reddit.com/r/haskell/comments/x16h7/hackage_b0rked_for_cabal_0102/ Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cabal install fails due to recent HUnit
On Mon, Jul 23, 2012 at 12:51:32PM -0500, Stephen Paul Weber wrote: Currently you would have to do the upgrade manually, as `cabal-install cabal-install` won't work (or alternatively edit your local ~/.cabl/packages/hackage.haskell.org/00-index.tar). Pending a fix on hackage (hopefully) I've been using `cabal copy cabal register` to grab specific packages today. How would I go about fixing my 00-index.tar? I tride de-tarring, deleting the recent versions of HUnit, and re-tarring, and when I copy that file in cabal starts telling me no packages exist...? E.g. with vim, you can edit files in the tar file (in-place). That is what I did, and it worked fine. Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Need help with learning Parsec
I have an outstanding question - What's the second parameter of the parse function really for? It's used to refer to the source file on parse errors. Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cabal install fails due to recent HUnit
Hi Ross, can you fix this on Hackage? My suggested solution is to again just remove the test-suite sections from the cabal file, if that is fine with Richard. The current situation is unfortunate, as it breaks almost all installs from Hackage with cabal-install 0.10.2 / Cabal 1.10.1.0, e.g. you can not even upgrade cabal-install anymore: $ cabal --version cabal-install version 0.10.2 using version 1.10.1.0 of the Cabal library $ cabal install cabal-install Resolving dependencies... cabal: Couldn't read cabal file HUnit/1.2.5.0/HUnit.cabal Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cabal install fails due to recent HUnit
Upgrading to Cabal-1.10.2.0 (or cabal-install-0.14.0 with Cabal-1.14.0) should fix the problem. Currently you would have to do the upgrade manually, as `cabal-install cabal-install` won't work (or alternatively edit your local ~/.cabl/packages/hackage.haskell.org/00-index.tar). See my other mail to this thread. Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cabal install fails due to recent HUnit
On Wed, Jul 18, 2012 at 05:51:51PM -0600, Richard G. wrote: What's the best way to fix this? I can see two options: - Move the test stanzas to a different Cabal file, allowing users to perform the tests with a little fiddling. - Remove the conditional statements from the test stanzas, which may break compatibility with some compilers and interpreters. Is there another option? I think it is preferable to have a test section in the main cabal file. Just an idea: What about having just a single test suite that *depends on the library*? I think that way the test suit would not require any conditionals, but you could not test with different optimization levels anymore. We could then add a Makefile/script that configures, builds and tests with the different optimization levels. This approach also has the advantage, that we are testing exactly the same thing (the library!) that the user is going to use. Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Need help with learning Parsec
On Thu, Jul 19, 2012 at 06:45:05PM +0530, Sai Hemanth K wrote: gettext = (many1 $ noneOf ) = (return . Body) You can simplify this to: import Control.Applicative hiding ((|)) gettext = Body $ many1 (noneOf ) And some of your other parsers can be simplified as well: innerXML = xml | gettext openTag :: Parser String openTag = char '' * many (noneOf ) * char '' endTag :: String - Parser String endTag str = string / * string str * char '' ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Need help with learning Parsec
gettext = Body $ many1 (noneOf ) Note that this is the same as: gettext = Body `fmap` many1 (noneOf ) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Need help with learning Parsec
On Thu, Jul 19, 2012 at 03:34:47PM +0200, Simon Hengel wrote: openTag :: Parser String openTag = char '' * many (noneOf ) * char '' endTag :: String - Parser String endTag str = string / * string str * char '' Well yes, modified to what Christian Maeder just suggested. Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cabal install fails due to recent HUnit
CCing: Ross Paterson and Richard G. On Wed, Jul 18, 2012 at 05:54:44PM +0200, Martijn Schrage wrote: On 18-07-12 17:37, Erik Hesselink wrote: Hi Martijn, Yes, upgrading will obviously fix things (we do use 0.14 on our development machines) Well, to me it wasn't entirely obvious that upgrading to Cabal-1.10.2.0 fixes the problem for cabal-install-0.12, and I still think this is a good solution for most people that use version 2012.2.0.0 of the platform. I'd suggest you ask Duncan to patch the hackage repository, and maybe contact the maintainer of HUnit to prevent future problems. This also breaks all travis-ci builds. I think it is critical to refrain from using conditionals in test-suite stanzas for some time + fix the broken release on Hackage. Is there a way to make this issue more well-know. Would a warning on the upload page help? @Richard FYI: Just uploading a new package won't solve this issue. Cheers, Simon -- Martijn , but we have not set up any infrastructure for building a custom cabal on production servers. We just use the one from the Ubuntu repositories, which uses Cabal 1.10.1.0 on oneiric. So until we upgrade to precise I guess we have a problem. Erik On Wed, Jul 18, 2012 at 5:24 PM, Martijn Schrage mart...@oblomov.com wrote: Hi Erik, A similar thing happened to me with the GraphViz package. As Duncan explained to me, the problem is that Cabal-1.10.0.0 (and I believe also 1.10.1.0) incorrectly reports an error when conditionals are used in test suites. Upgrading to Cabal-1.10.2.0 (or cabal-install-0.14.0 with Cabal-1.14.0) should fix the problem. Unfortunately, this means your build will not work on a fresh Haskell Platform v2012.2.0.0, until HUnit is patched in the hackage index. Cheers, Martijn Schrage -- Oblomov Systems (http://www.oblomov.com) On 18-07-12 16:26, Erik Hesselink wrote: Hi all, All cabal installs using cabal-install-0.10.2 are currently failing for us. This is due to the cabal file for HUnit-1.2.5.0, which was recently uploaded to hackage. The ouput I'm getting from cabal is just: Reading available packages... Resolving dependencies... cabal: Couldn't read cabal file HUnit/1.2.5.0/HUnit.cabal If I unpack HUnit-1.2.5.0 and call 'cabal configure', I get: cabal: HUnit.cabal:57: The 'type' field is required for test suites. The available test types are: exitcode-stdio-1.0 The relevant lines from the cabal file are: Test-Suite hunit-tests-optimize-0 Type: exitcode-stdio-1.0 These look fine to me. Does anyone have any idea how to go about fixing this (on hackage at least)? Could this package temporarily be removed, to avoid breaking everyone's cabal? Erik ___ 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
[Haskell-cafe] ANNOUNCE: hspec-1.3.0
Hi, hspec-1.3.0 is out [1]. This release comes with two major new features: - BDD-style combinators to make assertions [2] - Automatic test discovery [3] Test.Hspec now exports parts of the monadic API and the new BDD-style combinators. You can use Test.Hspec.Core as a drop-in replacement for legacy code. The full release notes are here at [4]. A basic introduction to Hspec is at [5]. Feedback is very welcome! Cheers, Simon [1] http://hackage.haskell.org/package/hspec [2] https://github.com/sol/hspec-expectations#readme [3] https://github.com/hspec/hspec/tree/master/hspec-discover#readme [4] https://github.com/hspec/hspec/blob/master/CHANGES.markdown [5] http://hspec.github.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] HUnit/cabal integration
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 Personally I'd use some test framework that is build on top of HUnit and QuickCheck. My weapon of choice is Hspec [1], but there are other options. 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? You only have to add dependencies on what you actually use, so if you depend on your library and only use stuff from your library, you do not need to depend on parsec. On a broader scope, you have two options, either (a) Depend on your library in your Cabal test section. or (b) Include the source files of your library in your Cabal test section. Whether you want (a) or (b) depends on the circumstances. Here is a (possibly not complete) list of differences: - (a) Is suitable when you only want to test the public interface of your library, but it does not allow you to test stuff that is not exposed. In contrast, (b) allows you to test stuff that is not exposed. - (a) usually gives you a short test section in your Cabal file (and is more DRY). (b) requires you to repeat all dependencies, options, etc. of your library section in your test section. - Compilation is slower with (b), because the source files of your library are compiled twice. - (b) even works in the rare case, when your test framework depends on your library (e.g. if you use HUnit to test a dependency of HUnit). I'm assuming here, that your library sources and test sources live in different directory hierarchies, and I'm not sure what the exact behavior is, if they don't! Let's look at an example. If your library sources are in '.' and your test sources are in 'test' option (a) looks like so: test-suite foo-tests type: exitcode-stdio-1.0 main-is: foo-tests.hs hs-source-dirs: test build-depends: base = 4.3.1.0 5 , foo-- depend on your library , HUnit = 1.2.4.2 And option (b) looks like so: test-suite foo-tests type: exitcode-stdio-1.0 main-is: foo-tests.hs hs-source-dirs: . -- include the sources of your library , test build-depends: base = 4.3.1.0 5 , parsec = 3.1.2-- inculde the depencencies of your library , HUnit = 1.2.4.2 Hope that helps. Feel free to ask, if anything is unclear. Cheers, Simon [1] http://hspec.github.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ghci session slows down over time.
Hi Jonathan, I'm seeing crazy amounts of slowdown in a ghci session after just a few executions of :r (reload). Using :set +r (revert top-level bindings) doesn't seem to help. What version of ghc are you using? Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] link to section heading in Haddock
After glancing through the haddock documentation and some googling, I can't tell if there's a supported way to link to a section heading in haddock documentation. Is there? There are several things that could be of interest. - There is support for named anchors [1]. I guess this is your best bet for now. You could e.g. use Foo#g:1 To link to the first section of module Foo. Disadvantages: (a) the id is not stable, it changes when you add new sections before that section (b) you can't decide on the link text, it is always the module name If it is ok for you to just link to some portion of text instead of the section heading, you can insert a named anchor (e.g. #foobar#) and use that (e.g. Foo#foobar). This solves (a), but not (b). - There is support for named links [2]. This is already implemented, not sure when it will hit the road. - There is a ticket for exactly what you are asking for [3]. But no work has been done on that yet. Cheers, Simon [1] http://www.haskell.org/haddock/doc/html/ch03s08.html#id566440 [2] http://trac.haskell.org/haddock/ticket/190 [3] http://trac.haskell.org/haddock/ticket/193 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Confused by ghci output
ghci 3^40 `mod` 3 :: Int 2 Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANN: hspec-1.1.0
Hi, I'm glad to announce a new release of hspec[1]. Detailed release notes are at [2]. Introductory documentation is at [3]. Cheers, Simon [1] http://hackage.haskell.org/package/hspec-1.1.0 [2] https://github.com/hspec/hspec/blob/master/CHANGES.markdown [3] http://hspec.github.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell Hackathon in Munich
Hi Heinrich, the Munich Haskell Meeting is glad to announce a local one day Hackathon in Munich. It will take place the 12th of May 2012 from 10am to 6pm. Please checkout the details at: I'll join. BTW: Any reason why we would not want to put this on the wiki? And can we create an IRC channel on freenode for that (#munihac, or anything)? Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Automatic discovery of tests
Hi Graham, Or is there a better way just to invoke specific functions prefixed with case_ prop_ etc in the entire src/test directory of the cabal build ? I think this would be possible if we had GHC ticket #1475 implemented. I just added a comment [1]. Cheers, Simon [1] http://hackage.haskell.org/trac/ghc/ticket/1475#comment:12 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANN: Latest package versions on Hackage as JSON/JSONP
Hi, I provide a relation between /package name/ and /latest version/ on Hackage as both JSON and JSONP. http://www.typeful.net/~tbot/hackage/ This are static files, and they are regenerated whenever new packages are uploaded (with a delay of about one minute). Two simple usage examples are given in the README[1]. Feel free to access this information for whatever purpose! Cheers, Simon [1] https://github.com/sol/hackage-jsonp#readme ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANN: doctest-0.6.0 (support for ghc-7.4, please test)
Hi, I just uploaded a new version of Doctest that adds support for ghc-7.4. http://hackage.haskell.org/package/doctest Doctest now comes with it's own parser and does not depend on Haddock anymore. This is a quite involved change, and it may still have issues. So pleases test, and do not be shy in reporting any bugs (either as a reply to this post or on [1]). Cheers, Simon [1] https://github.com/sol/doctest-haskell/issues ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] good lightweight web-framework like sinatra?
If you want a simple framework, you can just use WAI directly. If you want to give that a try, make sure to have a look at the README. https://github.com/yesodweb/wai/blob/master/wai/README.md Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: Haskell Platform Versions Comparison Chart
Hi Joachim, Regarding information about Debian sid, I'd like to understand the exact use case. Can you elaborate on that? one use case is developers who use distro packages and want to tell others against what version of the platform they develop their code against. I'll not add that myself, but I'm happy to add a link to a friendly fork. Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: Haskell Platform Versions Comparison Chart
Do you see a way that you could incorporate distribution information? I thought it would be nice to have a second table that correlates Platform versions with distro releases, because I think this is relevant to package authors. Regarding information about Debian sid, I'd like to understand the exact use case. Can you elaborate on that? Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: Haskell Platform Versions Comparison Chart
This includes both, packages that come with ghc and platform packages. Source is on GitHub[1]. Nice. Any chance you could get the packages sorted alphabetically so that it's easier to look things up directly? Sure, now they are sorted alphabetically (case-insensitive). Before it was more like two alphabetically sorted lists (case-sensitive), GHC boot libs first, and platform libs second (determined by the latest release, exactly what `ghc-pkg list` gives you). Ideally boot libs and platform libs would go into two separate tables, but packages may move between those (e.g. syb did). Cheers, Simon PS: If directly means manually, than I'd strongly advise against doing that ;) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANN: Haskell Platform Versions Comparison Chart
Hi, I compiled a chart that gives a side-by-side comparison of package versions in various Haskell Platform releases. http://sol.github.com/haskell-platform-versions-comparison-chart/ This includes both, packages that come with ghc and platform packages. Source is on GitHub[1]. Cheers, Simon [1] https://github.com/sol/haskell-platform-versions-comparison-chart ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: Haskell Platform Versions Comparison Chart
That's great! I think, it would be useful to include the version of the shipped gcc (where applicable). I think this only applies to windows**; and I'd tend to put it into a separate table. But yes, open a ticket or send me a pull request (preferred!). Cheers, Simon ** Not really suer about Mac OS X, but I think it requires Xcode, can someone confirm this. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: Haskell Platform Versions Comparison Chart
** Not really suer about Mac OS X, but I think it requires Xcode, can someone confirm this. Yes, the platform on Mac OS X requires Xcode, which includes gcc. Thanks. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Type classes for converting to Text and String
Hi! When writing library code that should work with both String and Text I find my self repeatedly introducing classes like: class ToString a where toString :: a - String class ToText a where toText :: a - Text (I use this with newtype wrapped value types backed by Text or ByteString.) So I wonder whether it would be a good idea to have a package that provides those classes. Or maybe just ToText, and provide default implementations of toString and toText, like: class ToText a where toText :: a - Text toText = Text.pack . toString toString :: a - String toString = Text.unpack . toText How do you guys deal with that? Any thoughts? Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Type classes for converting to Text and String
On Thu, Mar 08, 2012 at 11:00:34AM +0100, Christopher Done wrote: On 8 March 2012 10:53, Simon Hengel s...@typeful.net wrote: When writing library code that should work with both String and Text I find my self repeatedly introducing classes like: class ToString a where toString :: a - String class ToText a where toText :: a - Text Text is already an instance of IsString which provides IsString. What exactly do you mean? I've defined ToString in my own projects though, it would be nice for it to be defined somewhere (Data.String maybe?). We could write a proposal to add ToString to base (maybe a good idea, not sure). ToString has a striking similarity with Show, but it's still different: * toString converts some a to a String * show gives a string _representation_ of some a (e.g. converting a String to a String is just id and hence different from show; this is akin to Python's __str__/__repr__) But this does still not help with toText. Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Type classes for converting to Text and String
On Thu, Mar 08, 2012 at 12:18:56PM +0200, Roman Cheplyaka wrote: If it's fine to depend on FunDeps, you can use ListLike. http://hackage.haskell.org/package/ListLike How would that help with toText? Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Type classes for converting to Text and String
On Thu, Mar 08, 2012 at 12:37:31PM +0100, Yves Parès wrote: If you just need to go back and forth from String to Text, why do you need to be generic? pack and unpack from Data.Text do the job. Always going through String or Text may (depending on what your underlying representation is) be less efficient than converting directly to String/Text. Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Type classes for converting to Text and String
On Thu, Mar 08, 2012 at 12:54:13PM +0200, Roman Cheplyaka wrote: * Simon Hengel s...@typeful.net [2012-03-08 11:48:41+0100] On Thu, Mar 08, 2012 at 12:18:56PM +0200, Roman Cheplyaka wrote: If it's fine to depend on FunDeps, you can use ListLike. http://hackage.haskell.org/package/ListLike How would that help with toText? toText = fromListLike (ListLike instance for Text is provided by the listlike-instances package.) Ah, the listlike-instances package is the missing piece. Not sure if this is going somewhere. But I'm still trying to get a clear picture of the performance implications. Say I have a newtype-wrapped ByteString that I would decode to String/Text using UTF-8: newtype Value = Value ByteString Would it be possible to go from Value to Text by essentially ending up with Data.Text.Encoding.decodeUtf8 at runtime (e.g. by using rewrite rules)? Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Good Java book? (not off-topic)
Is there any book on Java that approaches the language in a way that doesn't make programmers impervious to FP and Haskell? Two standard books are Effective Java (EJ) and Java Concurrency in Practice (JCIP). They aren't introductory; but I think they are a good idea if you want to use Java on a professional basis. And at least JCIP advocates immutability. Cheers, Simon [1] http://jcip.net/ [1] http://java.sun.com/docs/books/effective/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] where to put general-purpose utility functions
headMaybe :: [a] - Maybe a Is this the same as Data.Maybe.maybeToList? readMaybe :: Read a = String - Maybe a This has been added to base recently [1]. Cheers, Simon [1] https://github.com/ghc/packages-base/commit/0e1a02b96cfd03b8488e3ff4ce232466d6d5ca77 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] In-memory Handle for testing
For testing I want to stub handles, performing all reads and writes in memory (and in process, so no mmap). From looking at the documentation of mkFileHandle[1], I think this should be possible. But it requires some work. Is there already something out there? Cheers, Simon [1] http://hackage.haskell.org/packages/archive/base/4.4.1.0/doc/html/GHC-IO-Handle.html#v:mkFileHandle ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] In-memory Handle for testing
There might still be some things in GHC.IO.Handle that assume FD handles - I haven't tried it in a while. For now I'm only using putStr and putStrLn on the handle, and that seems to work. Thanks! ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to catch all exceptions that could be caught?
Use SomeException for the type, as it is the base of the exception hierarchy. But it is usually recommended that you *don't* do this, as it even captures Ctrl-c invocations: I think there are situation when it is justified to catch almost all exceptions. And people do that a lot, which often leads to ctrl-c not properly working (e.g. we had this in HUnit before 1.2.4.2). The way I deal with this is: someAction `catches` [ -- Re-throw AsyncException, otherwise execution will not terminate -- on SIGINT (ctrl-c). All AsyncExceptions are re-thrown (not -- just UserInterrupt) because all of them indicate severe -- conditions and should not occur during normal operation. Handler (\e - throw (e :: AsyncException)), Handler (\e - yourHandler $ e :: SomeException) ] Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to split this string.
Doesn't the function lines handle different line-endings? (In the Prelude and in Data.List) It does not ignore \r\n. Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] List x ByteString x Lazy Bytestring
Hi, - If bytestring is not suitable for text manipulation, is there something faster than lists? Have a look at the text package[1]. Cheers, Simon [1] http://hackage.haskell.org/package/text ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to get a file path to the program invoked?
How to get this path in Haskell? Maybe FindBin or executable-path work. Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to get a file path to the program invoked?
How to get this path in Haskell? If I understand you correctly, you want takeDirectory `fmap` getProgName I think getProgName does not give you the full path, but only the program name. Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to get a file path to the program invoked?
On Thu, Dec 01, 2011 at 03:53:37PM -0200, Felipe Almeida Lessa wrote: On Thu, Dec 1, 2011 at 3:41 PM, Simon Hengel simon.hen...@wiktory.org wrote: How to get this path in Haskell? If I understand you correctly, you want takeDirectory `fmap` getProgName I think getProgName does not give you the full path, but only the program name. Neither does $0, does it? It depends on how the program is called. $0 depend everything you need to find your program (say, the relative or absolute path used), but getProgName does not. Here is an example: ./foo/foo Here $0 will be ./foo/foo, but getProgName will be foo. Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to get a file path to the program invoked?
On Thu, Dec 01, 2011 at 07:02:09PM +0100, Simon Hengel wrote: On Thu, Dec 01, 2011 at 03:53:37PM -0200, Felipe Almeida Lessa wrote: On Thu, Dec 1, 2011 at 3:41 PM, Simon Hengel simon.hen...@wiktory.org wrote: How to get this path in Haskell? If I understand you correctly, you want takeDirectory `fmap` getProgName I think getProgName does not give you the full path, but only the program name. Neither does $0, does it? It depends on how the program is called. $0 depend everything you need to find your program (say, the relative or absolute path used), but getProgName does not. Here is an example: ./foo/foo Here $0 will be ./foo/foo, but getProgName will be foo. s/depend/contains ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] doctest: Interpreter exited with an error: ExitFailure 127
Hi Chris, i have upgraded to doctest version 0.4.1. Now when i try to run the example from the webpage, i get: doctest: Interpreter exited with an error: ExitFailure 127 What's wrong here and how can i fix it? Can you still reproduce this on your system? If yes, I'd like to see if we can do something about it (if only improving the error message). Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Retaining functions in memory
I was looking for a way to retain the values of a specific function in memory. Is there some way to do this. Maybe this helps: http://www.haskell.org/haskellwiki/Memoization I haven't read through it, though.. Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Github support for cabal files
Hi Joris, not exactly what you are think about, but still maybe somewhat related. I thought it would be nice to have support for literate Haskell in README files (say README.lhs) on GitHub. I've done something similar for WAI[1], using sed to transform it to markdown, native support support for README.lhs would still be nice. That said, I think if you'd integrate cabal support into GitHub's README facility, README.* should still have precedence. Cheers, Simon [1] https://github.com/yesodweb/wai/tree/master/wai ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANNOUNCE: doctest-0.4.0
I just uploaded a new version of doctest[1] to Hackage. WHAT IS doctest? doctest is a port of Python's doctest[2] to Haskell. It can be used to verify, that examples in Haddock comments[3] do still work. This also provides you with a simple mechanism to write unit test, without the burden of maintaining a dedicated test suite. A basic example of usage is at [4]. WHAT'S NEW IN THIS VERSION? === doctest's functionality is now exposed as a library, this allows for integration with existing test frameworks. Sakari Jokinen is working on integration with test-framework[5]. Thanks to Sakari Jokinen for both, his contributions to the doctest API and his work on test-framework-doctest! Cheers, Simon [1] http://hackage.haskell.org/package/doctest [2] http://docs.python.org/library/doctest.html [3] http://www.haskell.org/haddock/doc/html/ch03s08.html#id566093 [4] https://github.com/sol/doctest-haskell#readme [5] https://github.com/sakari/test-framework-doctest ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: doctest-0.3.0
Hi Herbert, I was wondering whether doctest could somehow be integrated with Haskell's test-framework[1] and/or HTF package[2], as an additional test-provider, as I tend to write trivial test-cases as haddock comments but more extensive ones as dedicated unit-tests. This would be possible with Python's `nose` testing-framework[3] Do You have any suggestions/ideas how that could be accomplished? We have a ticket for that, I hope this will get into the next release. Cheers, Simon [1] https://github.com/sol/doctest-haskell/issues/1 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANNOUNCE: doctest-0.3.0
I just uploaded a new version of doctest[1] to Hackage. WHAT IS doctest? doctest is a port of Python's doctest[2] to Haskell. It can be used to verify, that examples in Haddock comments[3] do still work. This also provides you with a simple mechanism to write unit test, without the burden of maintaining a dedicated test suite. A basic example of usage is at [4]. WHAT'S NEW IN THIS VERSION? === It is now possible to intersperse comments between a longer, continuing example. All examples within the same comment now share a namespace. The following now works : -- | Calculate Fibonacci number of given 'Num'. -- -- First let's set `n` to ten: -- -- let n = 10 -- -- And now calculate the 10th Fibonacci number: -- -- fib n -- 55 fib :: Integer - Integer fib 0 = 0 fib 1 = 1 fib n = fib (n - 1) + fib (n - 2) Thanks to Sakari Jokinen for this contribution! In addition I changed the name from DocTest to doctest. I think using all lower-case package names is a good thing. And as we will use doctest as a library in the near future, this was the last chance for this change. Cheers, Simon [1] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/doctest [2] http://docs.python.org/library/doctest.html [3] http://www.haskell.org/haddock/doc/html/ch03s08.html#id566093 [4] http://haskell.org/haskellwiki/DocTest ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: DocTest-0.2.0
I like the idea of a getDocTests function. In theory, it could take a cabal file as an argument, and use the Cabal library to get a list of all modules to be checked. It would also be convenient if it automatically passed in GHC options correlating to each LANGUAGE pragma found on a module. If you open up a ticket, I'll give it a try when I have a less tight schedule. Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANNOUNCE: DocTest-0.2.0
I just uploaded a new version of DocTest[1] to Hackage. WHAT IS DocTest? DocTest is a port of Python's doctest[2] to Haskell. It can be used to verify, that examples in Haddock comments[3] do still work. This also provides you with a simple mechanism to write unit test, without the burden of maintaining a dedicated test suite. A basic example of usage is at [4]. WHAT'S NEW IN THIS VERSION? === Support for blank lines in the result of an expression (analogous to the BLANKLINE-feature of Python's doctest). Here is an example of usage: -- | -- Some example: -- -- putStrLn foo\n\nbar -- foo -- BLANKLINE -- bar Currently this is implemented in DocTest, but we will move it to Haddock with the next release. Cheers, Simon [1] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/DocTest [2] http://docs.python.org/library/doctest.html [3] http://www.haskell.org/haddock/doc/html/ch03s08.html#id566093 [4] http://haskell.org/haskellwiki/DocTest ___ 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: DocTest-0.2.0
Hello Michael, I would like to integrate DocTest into my normal test suite procedures. Do you have a recommended approach for this? I think I have projects using all of test-framework[1], HTF[2] and hspect[3], so I'm not picky here. Currently you are pretty much on your own here. A shell script that runs both, doctest and unit test, is what I currently use. In principle it should be possible to provide an API function that maps a list of flags and source files to tests, like: getDocTests :: [Flag] - [FilePath] - IO [Test] But with this you still have to figure out the flags and source files. A different approach would be to provide Cabal with a `doctest' target (similar to the `haddock' target), that runs the DocTests. Cabal already knows the necessary information to do so. Sadly, I have no time to work on any of these for at least a month. Nevertheless, I'd be interested what you think about it. Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: HackageOneFive: Reverse dependency lookup for all packages on Hackage
I wrote a tiny Snap app that provides reverse dependency lookup for all packages on Hackage. Are you familiar with Roel van Djik's revdep Hackage? http://bifunctor.homelinux.net/~roel/hackage/packages/hackage.html Not yet, seems to be exactly what I've been locking for. Thanks for the pointer. Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANN: HackageOneFive: Reverse dependency lookup for all packages on Hackage
Hello, I wrote a tiny Snap app that provides reverse dependency lookup for all packages on Hackage. A git repository is at: https://github.com/sol/HackageOneFive Setup instructions are provide in the README[1] file. It uses a PostgreSQL database for storage but it should be trivial to port this to e.g. SQLite. As always feedback and patches are gladly welcome! btw: Is there still progress on Hackage 2.0? Cheers, Simon [1] https://github.com/sol/HackageOneFive#readme ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Parsec in Haskell platform
It would be convenient to have a page which would list all the HP packages with their versions. The release page [2] only has a list of packages whose versions has changed since the last release, as I understood. It would be nice to have a page that lists everything included in every HP release, together with their version numbers. (So that, e.g., I can see at a glance what version of GHC, Haddock or cabal-install is in HP-2009.1.0.0.) All this information must exist somewhere, it's just not easily viewable on the web. Yes, I needed the same information recently. I ended up reading the Cabal file at [1]. A convenient way to see what packages are included in what version of the platform would still be very useful, though. Cheers, Simon [1] http://code.haskell.org/haskell-platform/haskell-platform.cabal ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANNOUNCE: DocTest-0.1.0
I'm very excited to announce a new version of DocTest[1]. DocTest now uses Haddock for parsing of comments. Examples are now marked-up with Haddocks newly introduced support for examples of interaction[2][3]. A very basic example of usage is at [4]. DocTest is still experimental. Suggestions and patches are gladly welcome! Cheers, Simon [1] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/DocTest [2] http://www.haskell.org/haddock/CHANGES.txt [3] http://www.haskell.org/haddock/doc/html/ch03s08.html#id566093 [4] http://haskell.org/haskellwiki/DocTest ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] GSoC Project: A Haddock + Pandoc documentation tool
I just finished writing my GSoC proposal and I want to have some feedback from the community. I'll try to be brief (this is not the proposal). So where is the proposal? Is there a ticket on GSoC trac? Cheers, Simon ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Splitting list with predicate
Most excellent! Thanks. I frequently use Hoogle[1] when I need a function, that I think must exist, but do not know how it is named. Try: (a - Bool) - [a] - ([a], [a]) With the recipe from [2] you may even invoke hoogle from within ghci: ghci :hoogle (a - Bool) - [a] - ([a], [a]) Hope that helps. Cheers, Simon [1] http://haskell.org/hoogle/ [2] http://www.haskell.org/haskellwiki/Ghci#Hoogle ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Splitting list with predicate
Wouldn't one need to know the order of the arguments? (a - Bool) - [a] - ([a], [a]) Not really, if you try [a] - (a - Bool) - ([a], [a]) it will yield the exact same list of results. Cheers. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe