[Haskell-cafe] Creating Repa arrays from unboxed vectors
Dear list, I'm trying to create unboxed REPA array from unboxed Vector, but I keep getting this type error: ghci :m + Data.Array.Repa ghci :m + Data.Array.Repa.Repr.Unboxed ghci :m + Data.Vector.Unboxed ghci fromUnboxed Z (Data.Vector.Unboxed.singleton 1) interactive:5:16: Couldn't match expected type `vector-0.9.1:Data.Vector.Unboxed.Base.Vector e0' with actual type `Data.Vector.Unboxed.Vector a0' In the return type of a call of `Data.Vector.Unboxed.singleton' In the second argument of `fromUnboxed', namely `(Data.Vector.Unboxed.singleton 1)' In the expression: fromUnboxed Z (Data.Vector.Unboxed.singleton 1) I am confused, because REPA documentation lists Vector from Data.Vector.Unboxed package as its second parameter. Why am I getting this error? I have Repa 3.2 an vector 0.9.1. Janek ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Creating Repa arrays from unboxed vectors
On 4 October 2012 20:50, Janek S. fremenz...@poczta.onet.pl wrote: Dear list, I'm trying to create unboxed REPA array from unboxed Vector, but I keep getting this type error: ghci :m + Data.Array.Repa ghci :m + Data.Array.Repa.Repr.Unboxed ghci :m + Data.Vector.Unboxed ghci fromUnboxed Z (Data.Vector.Unboxed.singleton 1) interactive:5:16: Couldn't match expected type `vector-0.9.1:Data.Vector.Unboxed.Base.Vector e0' with actual type `Data.Vector.Unboxed.Vector a0' In the return type of a call of `Data.Vector.Unboxed.singleton' In the second argument of `fromUnboxed', namely `(Data.Vector.Unboxed.singleton 1)' In the expression: fromUnboxed Z (Data.Vector.Unboxed.singleton 1) This makes it look like you've got two versions of vector installed, with Repa built against the version that _isn't_ 0.9.1. I am confused, because REPA documentation lists Vector from Data.Vector.Unboxed package as its second parameter. Why am I getting this error? I have Repa 3.2 an vector 0.9.1. Janek ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Ivan Lazar Miljenovic ivan.miljeno...@gmail.com http://IvanMiljenovic.wordpress.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Creating Repa arrays from unboxed vectors
Thanks! This makes it look like you've got two versions of vector installed, This is true, I have vector-0.9.1 and vector-0.10, but with Repa built against the version that _isn't_ 0.9.1. this, I think, is not exactly correct: [root@GLaDOS : /dane/download] ghc-pkg field repa depends depends: QuickCheck-2.4.2-41cb2884cc20cd78948de62849bd9667 base-4.5.0.0-6db966b4cf8c1a91188e66d354ba065e bytestring-0.9.2.1-18f26186028d7c0e92e78edc9071d376 ghc-prim-0.2.0.0-c2ff696e5b8ec4d4b2bc2e42085fe471 template-haskell-2.7.0.0-133c0fdb189e05de22bd926d39f99fe3 vector-0.9.1-04dd5c58c224b03a4dc90091cf93a01d So Repa is build againts 0.9.1. Everything works when I do ghc-pkg hide vector-0.10.0. Is there a way to tell GHCi which version of library it should load? I tried -XPackageImports but it doesn't allow to specify version of a package, only its name (or I don't know how to specify version). Jan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Creating Repa arrays from unboxed vectors
On Thu, Oct 4, 2012 at 1:58 PM, Janek S. fremenz...@poczta.onet.pl wrote: Thanks! This makes it look like you've got two versions of vector installed, This is true, I have vector-0.9.1 and vector-0.10, but with Repa built against the version that _isn't_ 0.9.1. No, no, Repa is build against 0.9.1 since vector-0.9.1 appears in the _expected_ type, that is the type expected by the environment of the expression, here that's fromUnboxed which comes from the Repa library, so if it's waiting for a Vector from vector-0.9.1 it means Repa is built against this version (which is not the latest on your computer thus the problem). -- Jedaï ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Creating Repa arrays from unboxed vectors
so if it's waiting for a Vector from vector-0.9.1 it means Repa is built against this version (which is not the latest on your computer thus the problem). Yes, as I said the latest one is 0.10. Is there any way to sensibly manage this kind of dependencies (sensibly = without hidding packages manually). Jan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Which advanced Haskell topics interest you
Most existing Haskell books and similar teaching material is aimed at programmers who are new to Haskell. This survey is to assess the community interest in teaching material covering advanced topics beyond the commonly taught introductory material. https://docs.google.com/spreadsheet/viewform?formkey=dE1QZFNRLTFMdkllYWIyR2FkYnRzZHc6MQ Manuel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Which advanced Haskell topics interest you
Something to consider is that it's not so much whether the material is basic, advanced, or intermediate; it's that the way it's being presented is boring and ineffective. Take the Head First Java book, which was deliberately engineered to overcome precisely this hitherto neglected aspect of technical teaching. There's a lot we can learn from how that book was put together because it's done wonders for onboarding java developers. A summary of what makes the book different: http://books.google.com/books?id=lXEBwv0LYogCpg=PR22source=gbs_selected_pagescad=3 -- Kim-Ee On Thu, Oct 4, 2012 at 9:43 PM, Manuel M T Chakravarty c...@cse.unsw.edu.au wrote: Most existing Haskell books and similar teaching material is aimed at programmers who are new to Haskell. This survey is to assess the community interest in teaching material covering advanced topics beyond the commonly taught introductory material. https://docs.google.com/spreadsheet/viewform?formkey=dE1QZFNRLTFMdkllYWIyR2FkYnRzZHc6MQ Manuel ___ 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] Which advanced Haskell topics interest you
On 4 October 2012 18:04, Kim-Ee Yeoh k...@atamo.com wrote: Something to consider is that it's not so much whether the material is basic, advanced, or intermediate; it's that the way it's being presented is boring and ineffective. I'd suggest there is enough range in the Haskell books now available, that for most tastes, there's a beginners to intermediate book already a given learner wouldn't consider boring. Of course different learners will like different ones... As for an advanced book, maybe limiting the subject to one domain (concurrency / DSLs for graphics / pick a favourite ...) might make a better book than one targeting a mix of advanced topics. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Which advanced Haskell topics interest you
2012/10/4 Stephen Tetley stephen.tet...@gmail.com: On 4 October 2012 18:04, Kim-Ee Yeoh k...@atamo.com wrote: Something to consider is that it's not so much whether the material is basic, advanced, or intermediate; it's that the way it's being presented is boring and ineffective. I'd suggest there is enough range in the Haskell books now available, that for most tastes, there's a beginners to intermediate book already a given learner wouldn't consider boring. Of course different learners will like different ones... As for an advanced book, maybe limiting the subject to one domain (concurrency / DSLs for graphics / pick a favourite ...) might make a better book than one targeting a mix of advanced topics. PBRT (http://pbrt.org/) in Haskell would be awesome :) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] HaskellDB Convertible Exception: incompatible types
Hi, going deeper i found the following: http://hackage.haskell.org/packages/archive/haskelldb-hdbc/2.1.0/doc/html/src/Database-HaskellDB-HDBC.html#line-126 HaskellDB is converting from SqlTimestampT (no timezone defined) to CalendarTimeT (timezone required). This conversion tries then to be done using LocalTime ( http://hackage.haskell.org/packages/archive/HDBC/2.2.6.1/doc/html/src/Database-HDBC-SqlValue.html#line-735 ) which fails. I believe real problem is CalendarTimeT. SqlTimestampT clearly doesn't define a timezone. There's a need to create a new type to handle these types. Timestamps but no timezone (Localtime). I attach a patch for this. I tested this in a project. Not quite sure how to add the tests. What should i do to add this patch to haskell? A version dependency of this two should be added, Andras 2012/9/29 Andras Gyomrey lgand...@gmail.com Hi, I get *** Exception: Convertible: error converting source data SqlLocalTime 2012-04-27 10:22:15 of type SqlValue to type Data.Time.LocalTime.LocalTime.ZonedTime: incompatible types when i try to show a record with a field of type CalendarTime (automatically generated by Database.HaskellDB.DBDirect, Mysql database type is timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP I already looked forhttp:// haskell.1045720.n5.nabble.com/programmatic-DB-interface-td3120759.html. But the problem there is about a regexp (not a type). And the incompatible type problem was caused because of a concatenation. Here, as you can see, i have no idea what's going on. Can someone please help me? Andras haskelldb-2.1.1.patch Description: Binary data haskelldb-hdbc-2.1.0.patch Description: Binary data ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Which advanced Haskell topics interest you
On Thu, Oct 4, 2012 at 1:21 PM, Stephen Tetley stephen.tet...@gmail.com wrote: On 4 October 2012 18:04, Kim-Ee Yeoh k...@atamo.com wrote: Something to consider is that it's not so much whether the material is basic, advanced, or intermediate; it's that the way it's being presented is boring and ineffective. I'd suggest there is enough range in the Haskell books now available, that for most tastes, there's a beginners to intermediate book already a given learner wouldn't consider boring. Of course different learners will like different ones... As for an advanced book, maybe limiting the subject to one domain (concurrency / DSLs for graphics / pick a favourite ...) might make a better book than one targeting a mix of advanced topics. Another problem is that the topics in these domains don't simply deal with Haskell, they deal with real computer science that is not to be understated. Concurrency for Haskell involves tackling the real implementation issues inherent in making things work, but also a good taste of semantics, and actual concurrency. If you're approaching this from an outsider's perspective (never taken a class in concurrency, never heard of process algebra, etc..) the topic will be more difficult than if you're in the know and want a survey of topics as they are implemented in Haskell. As far as functional data structures go, we already have an excellent book, though it of course could use updating, along with real world Haskell like treatment, but the core thinking is there. kris ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANNOUNCE: test-framework-golden-1.1
I am glad to announce the first public release of test-framework-golden — a golden testing library. Hackage: http://hackage.haskell.org/package/test-framework-golden GitHub: https://github.com/feuerbach/test-framework-golden Golden tests are similar to unit tests (as implemented in HUnit), but the idea is to store the expected result in files (called «golden» files). I was introduced to the idea of golden testing by Bohdan Vlasyuk at ZuriHac in 2010. Since then I've discovered that this is a nice approach and it is already used in variety of projects (e.g. ghc, haddock). Surprisingly, not much is written about golden testing, and I've been unable to find any golden testing libraries for Haskell or any other programming language. Every project has its own ad-hoc implementation in Haskell/Python/Shell/etc. The closest match on the market is Simon Michael's shelltestrunner. But to use it you have to expose the tested functionality via command line, which may be inconvenient. So this is my attempt at a general golden testing library. It consists of two modules. Test.Golden has a simple interface that helps you get started very quickly. Test.Golden.Advanced provides a very generic testing function that you can use to implement the testing system you dream about. The library is integrated with test-framework, so you can use golden tests in addition to SmallCheck/QuickCheck/HUnit tests. In future there's a plan to support some golden test management capabilities. Roman ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] What is a functional approach to linear algebra routines? I see REPA warns that one must use fusion or risk slow routines.
Apparently using STUarrays in an imperative fashion is fraught with peril (and the performance of molasses). Casey -- -- Regards, KC ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] total Data.Map.! function
Henning Thielemann wrote: I wondered whether there is a brilliant typing technique that makes Data.Map.! a total function. That is, is it possible to give (!) a type, such that m!k expects a proof that the key k is actually present in the dictionary m? How can I provide the proof that k is in m? Same question for 'lab' (import Data.Graph.Inductive(lab)). That is, can there be a totalLab, with (totalLab gr = fromJust . lab gr) that expects a proof that the node Id is actually contained in a graph? I think it's possible. However, if you are able to track keys in a meaningful way, you are also able to reify the contents of the map in the type! At this point, it's no longer clear whether you really want that. Here's the reason. Consider the expression map' = insert key value map The idea is that the type of map' should now indicate that the key is in the map. Since map does not necessarily contain the key , you have to add to the type information. But at this point, why not add the *value* to the type as well? Instead of adding just the key to the type information, you can add a tuple (key,value) to the type by virtue of some mild form of parametricity. But at this point, you've put the whole map into the type. Best regards, Heinrich Apfelmus -- http://apfelmus.nfshost.com ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Creating Repa arrays from unboxed vectors
Hello! Perhaps package imports would do the trick? http://haskell.org/ghc/docs/latest/html/users_guide/syntax-extns.html#package-imports Not exactly something you'd want to release in a module in a hackage package, though. -Michael On Oct 4, 2012 7:07 AM, Janek S. fremenz...@poczta.onet.pl wrote: so if it's waiting for a Vector from vector-0.9.1 it means Repa is built against this version (which is not the latest on your computer thus the problem). Yes, as I said the latest one is 0.10. Is there any way to sensibly manage this kind of dependencies (sensibly = without hidding packages manually). Jan ___ 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] ANN: cabal-install-1.16.0 (and Cabal-1.16.0.1)
Does this new release included the sandbox functions discussed in this blog post: http://blog.johantibell.com/2012/08/you-can-soon-play-in-cabal-sandbox.html ? Tim ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: cabal-install-1.16.0 (and Cabal-1.16.0.1)
On Thu, Oct 4, 2012 at 7:11 PM, Tim Docker t...@dockerz.net wrote: Does this new release included the sandbox functions discussed in this blog post: http://blog.johantibell.com/2012/08/you-can-soon-play-in-cabal-sandbox.html ? It doesn't. The sandbox feature requires a little UI work still. I expect to have it out by the end of the year. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Which advanced Haskell topics interest you
Kristopher Micinski krismicin...@gmail.com: On Thu, Oct 4, 2012 at 1:21 PM, Stephen Tetley stephen.tet...@gmail.com wrote: As for an advanced book, maybe limiting the subject to one domain (concurrency / DSLs for graphics / pick a favourite ...) might make a better book than one targeting a mix of advanced topics. Another problem is that the topics in these domains don't simply deal with Haskell, they deal with real computer science that is not to be understated. Concurrency for Haskell involves tackling the real implementation issues inherent in making things work, but also a good taste of semantics, and actual concurrency. Those are very good points. Thanks, Manuel ___ 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
That's cool, thank you. A. Sent from my iPad On 04/ott/2012, at 23:55, Roman Cheplyaka r...@ro-che.info wrote: I am glad to announce the first public release of test-framework-golden — a golden testing library. Hackage: http://hackage.haskell.org/package/test-framework-golden GitHub: https://github.com/feuerbach/test-framework-golden Golden tests are similar to unit tests (as implemented in HUnit), but the idea is to store the expected result in files (called «golden» files). I was introduced to the idea of golden testing by Bohdan Vlasyuk at ZuriHac in 2010. Since then I've discovered that this is a nice approach and it is already used in variety of projects (e.g. ghc, haddock). Surprisingly, not much is written about golden testing, and I've been unable to find any golden testing libraries for Haskell or any other programming language. Every project has its own ad-hoc implementation in Haskell/Python/Shell/etc. The closest match on the market is Simon Michael's shelltestrunner. But to use it you have to expose the tested functionality via command line, which may be inconvenient. So this is my attempt at a general golden testing library. It consists of two modules. Test.Golden has a simple interface that helps you get started very quickly. Test.Golden.Advanced provides a very generic testing function that you can use to implement the testing system you dream about. The library is integrated with test-framework, so you can use golden tests in addition to SmallCheck/QuickCheck/HUnit tests. In future there's a plan to support some golden test management capabilities. Roman ___ 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: test-framework-golden-1.1
I'm a big fan of TDD and tend to approach all languages by learning how to TDD in them. As such, you mention that this is similar, could you please send some links about this? Cheers! On Thu, Oct 4, 2012 at 11:55 PM, Roman Cheplyaka r...@ro-che.info wrote: I am glad to announce the first public release of test-framework-golden — a golden testing library. Hackage: http://hackage.haskell.org/package/test-framework-golden GitHub: https://github.com/feuerbach/test-framework-golden Golden tests are similar to unit tests (as implemented in HUnit), but the idea is to store the expected result in files (called «golden» files). I was introduced to the idea of golden testing by Bohdan Vlasyuk at ZuriHac in 2010. Since then I've discovered that this is a nice approach and it is already used in variety of projects (e.g. ghc, haddock). Surprisingly, not much is written about golden testing, and I've been unable to find any golden testing libraries for Haskell or any other programming language. Every project has its own ad-hoc implementation in Haskell/Python/Shell/etc. The closest match on the market is Simon Michael's shelltestrunner. But to use it you have to expose the tested functionality via command line, which may be inconvenient. So this is my attempt at a general golden testing library. It consists of two modules. Test.Golden has a simple interface that helps you get started very quickly. Test.Golden.Advanced provides a very generic testing function that you can use to implement the testing system you dream about. The library is integrated with test-framework, so you can use golden tests in addition to SmallCheck/QuickCheck/HUnit tests. In future there's a plan to support some golden test management capabilities. Roman ___ 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