Re: [Haskell-cafe] CPS Streams
jeff p mutjida at gmail.com writes: I've always thought that the essence of iteratees is just CPS for sure, at some level of abstraction this ought to be true, since CPS simulates call-by-value in a call-by-name language, cf. Gordon Plotkin: Call-by-Name, Call-by Value and the Lambda Calculus TCS , Vol. 1, pp. 125-159, http://homepages.inf.ed.ac.uk/gdp/publications/ and the purpose of iteratee is to provide strict [...] I/O http://hackage.haskell.org/package/iteratee-0.8.9.4 J.W. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: luachunk-0.1
On Mon, Oct 8, 2012 at 6:48 AM, Kristopher Micinski krismicin...@gmail.com wrote: Oh, this is nice, we have our undergrads implement a compiler to Lua bytecode as part of their term projects, and currently use a homebrew OCaml package. This seems to be pretty complete, however, and it would be interesting for me to reimplement some stuff with this.. Please do! It would be great to have some real world testing. Unfortunately the Lua bytecode isn't really documented or intended to be generated, meaning that you essentially have to reverse engineer it. (Maybe not unfortunately; it's not meant to be used like that, but unfortunately for people looking to find projects to assign people...) I used the excellent A No-Frills Introduction to Lua 5.1 VM Instructions (http://scholar.google.com/scholar?cluster=14039839166840129336). Highly recommended to get a quick overview of the entire bytecode format. -- Anupam ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Image processing using Repa
I'm playing a bit with Repa library and its DevIL bindings. I tried to modify one of the examples from tutorial on HaskellWiki. I want to load an image, rotate it and save it to disk. I managed to write something like this: import Foreign.Ptr import System.Environment import Data.Array.Repa as R hiding ((++)) import qualified Data.Array.Repa.Repr.ForeignPtr as RFP import Data.Array.Repa.IO.DevIL main = do [f] - getArgs (RGB v) - runIL $ readImage f RFP.computeIntoP (RFP.toForeignPtr v) (rot180 v) runIL $ writeImage (flip-++f) (RGB v) return () rot180 g = backpermute e flop g where e@(Z :. x :. y :. _) = extent g flop (Z :. i :. j :. k) = (Z :. x - i - 1 :. y - j - 1 :. k) This is obviously wrong, because the foreign pointer used as a data source is at the same time used as destination, so the data gets overwritten before it is used. Does this mean that I have to allocate foreign memory buffers on my own? If so, than it feels kind of painfull to go through the hassle of allocating foreign pointers, converting between many different representations and so on. Am I doing something wrong and if not is there a more painless way of working with images and repa in Haskell? Jan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Image processing using Repa
You do not have to use computeIntoP. You can just use computeP followed by toForeignPtr (i don't remember the exact name for that and am on my phone so it would be awkward to look up). So Repa can create the buffer for you. Coincidentally, I didn't realize computeIntoP even existed, and I want it for what I'm doing! On Oct 10, 2012 7:55 AM, Janek S. fremenz...@poczta.onet.pl wrote: I'm playing a bit with Repa library and its DevIL bindings. I tried to modify one of the examples from tutorial on HaskellWiki. I want to load an image, rotate it and save it to disk. I managed to write something like this: import Foreign.Ptr import System.Environment import Data.Array.Repa as R hiding ((++)) import qualified Data.Array.Repa.Repr.ForeignPtr as RFP import Data.Array.Repa.IO.DevIL main = do [f] - getArgs (RGB v) - runIL $ readImage f RFP.computeIntoP (RFP.toForeignPtr v) (rot180 v) runIL $ writeImage (flip-++f) (RGB v) return () rot180 g = backpermute e flop g where e@(Z :. x :. y :. _) = extent g flop (Z :. i :. j :. k) = (Z :. x - i - 1 :. y - j - 1 :. k) This is obviously wrong, because the foreign pointer used as a data source is at the same time used as destination, so the data gets overwritten before it is used. Does this mean that I have to allocate foreign memory buffers on my own? If so, than it feels kind of painfull to go through the hassle of allocating foreign pointers, converting between many different representations and so on. Am I doing something wrong and if not is there a more painless way of working with images and repa in Haskell? 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] Image processing using Repa
You do not have to use computeIntoP. You can just use computeP followed by toForeignPtr (i don't remember the exact name for that and am on my phone so it would be awkward to look up). So Repa can create the buffer for you. Coincidentally, I didn't realize computeIntoP even existed, and I want it for what I'm doing! I managed to fix my code - thanks! The main function now reads: main = do [f] - getArgs (RGB v) - runIL $ readImage f rotated - (computeP $ rot180 v) :: IO (Array RFP.F DIM3 Word8) runIL $ writeImage (flip-++f) (RGB rotated) Jan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANN: Groundhog 0.2 - now with database index support
I am excited to announce a new release of Groundhog 0.2 - a library for high-level database access. * http://hackage.haskell.org/package/groundhog * http://hackage.haskell.org/package/groundhog-th * http://hackage.haskell.org/package/groundhog-postgresql * http://hackage.haskell.org/package/groundhog-sqlite * http://github.com/lykahb/groundhog Since the last release I got a lot of positive feedback which showed that many people are interested in the project. I want to thank them for their encouragement and constructive suggestions that helped me to adjust the development priorities. To help keeping track of the Groundhog project development, the most important changes of a release are now logged to the HISTORY files in repository. Along with many small improvements and refactorings, this major release has two novel features: * Support for database unique indexes. Now the unique keys can be created with either constraints or indexes. In the API the difference affects only the code generation settings which have a new field * Customizing column type name for schema migration. This contributes to compatibility with already existing databases and allows utilization of the database-specific features like limiting string size or number precision. See example at https://github.com/lykahb/groundhog/blob/master/examples/dbSpecificTypes.hs Package groundhog-th has improved error reporting. Now it precisely reports the line and position where parsing of the YAML-based settings failed. This required a patch in the yaml dependency, so other yaml package users have this fix as well. The full description of the YAML settings format is available at http://hackage.haskell.org/packages/archive/groundhog-th/0.2.0/doc/html/Database-Groundhog-TH.html I appreciate your feedback. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] CPS Streams
Here is an haste of the original message since it seems like the formatting was lost. http://hpaste.org/76082 sorry about that, Jeff ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: luachunk-0.1
On Wed, Oct 10, 2012 at 6:48 AM, Anupam Jain ajn...@gmail.com wrote: I used the excellent A No-Frills Introduction to Lua 5.1 VM Instructions (http://scholar.google.com/scholar?cluster=14039839166840129336). Highly recommended to get a quick overview of the entire bytecode format. FYI this is we hand out to our students as well,!, kris ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Is there a tool to see reduction steps?
I have been given a piece of code that uses Tie-ing the Knot concept to label a tree of nodes in breath first manner. It seems to work fine, but I am having trouble expanding the code on my own to see the evaluation process. I like to know if there is a tools to use to see the reduction steps. data Tree = Leaf | Node Tree Int Tree deriving Show label (Node ln _ rn) ((h:r):rest) = (Node lr h rr, r:r2) where (lr, r1) = label ln rest (rr, r2) = label rn r1 label _ _ = (Leaf, []) lt t = let (r, unused) = label t ([1..]:unused) in r -- Daryoush Weblog: http://onfp.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is there a tool to see reduction steps?
Hi Daryoush, You could add another case to label, importing Debug.Trace: data Tree = Leaf | Node Tree Int Tree deriving Show *label t | trace (show $ label ++ show t) False = undefined* label (Node ln _ rn) ((h:r):rest) = (Node lr h rr, r:r2) where (lr, r1) = label ln rest (rr, r2) = label rn r1 label _ _ = (Leaf, []) lt t = let (r, unused) = label t ([1..]:unused) in r This will output one line per each call to label. Except for one thing: your show function will never actually terminate, if the tree is cyclic. You can fix this by defining your own show function. HTH, Ozgur ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Haskell Weekly News: Issue 247
Welcome to issue 247 of the HWN, an issue covering crowd-sourced bits of information about Haskell from around the web. This issue covers the week of September 30 to October 6, 2012. Quotes of the Week * monochrom: 98% of people lack the property that they're members of the other 2% * ManuelChakravarty: We used to say, Learn Haskell, it makes you a better Java programmer. Now we say, Learn Agda, it makes you a better Haskell programmer. * Cale: data Nature a = Rock a | Stream (Nature a) | Bush (Nature a) (Nature a) * rwbarton: type inference is supposed to be the compiler's job, not the reader's job * ShelSilverstein: Lazy Lazy Lazy Lazy Lazy Lazy Jane. She wants a drink of water so she waits and waits and waits and waits and waits for it to rain. * Cale: We're up to 950 users which apparently means that any beginner question is now answered by 4 people. * YayMe: When I first started playing with haskell I could barely sleep for 2 days because of how confused it made me * EvanLaforge: Then we can tell them about how we had to walk in the snow both ways uphill fighting space leaks with bare hands while they just have to read about it. * nand: every time I try arguing semantics, I come to the conclusion that every word is the exact same thing and refers to anything * bfig: i have been reborn as a haskell programer after finding Debug.Trace Top Reddit Stories * Factorization diagrams Domain: mathlesstraveled.com, Score: 82, Comments: 11 On Reddit: [1] http://goo.gl/Jrk0M Original: [2] http://goo.gl/kXkiV * The New Cloud Haskell Domain: well-typed.com, Score: 73, Comments: 21 On Reddit: [3] http://goo.gl/hcRJJ Original: [4] http://goo.gl/0oWfj * GHC HEAD now features Agda-like Holes Domain: hpaste.org, Score: 66, Comments: 43 On Reddit: [5] http://goo.gl/J8bIu Original: [6] http://goo.gl/297jv * FizzBuzz Revisited using Monoids Domain: dave.fayr.am, Score: 55, Comments: 68 On Reddit: [7] http://goo.gl/nqIsE Original: [8] http://goo.gl/995Zq * Which advanced Haskell topics interest you? (Survey) Domain: docs.google.com, Score: 39, Comments: 12 On Reddit: [9] http://goo.gl/Djy63 Original: [10] http://goo.gl/K5pRm * A fast new SipHash implementation Domain: serpentine.com, Score: 34, Comments: 8 On Reddit: [11] http://goo.gl/ZGSxD Original: [12] http://goo.gl/GiD3F * Communication Patterns in Cloud Haskell (Part 1): master-slave, work-stealing and work-pushing Domain: well-typed.com, Score: 33, Comments: 10 On Reddit: [13] http://goo.gl/IRr8s Original: [14] http://goo.gl/6vUyY * Category and lenses Domain: web.jaguarpaw.co.uk, Score: 28, Comments: 2 On Reddit: [15] http://goo.gl/r6Ajl Original: [16] http://goo.gl/VwtQP * Yesod Tutorial 1 at FP Complete Domain: fpcomplete.com, Score: 28, Comments: 15 On Reddit: [17] http://goo.gl/wnUkh Original: [18] http://goo.gl/kvCMu * The usual type signatures for foldl and foldr are confusing Domain: self.haskell, Score: 27, Comments: 63 On Reddit: [19] http://goo.gl/XGHq8 Original: [20] http://goo.gl/XGHq8 * Haskell Symposium 2012 (with youtube links) Domain: haskell.org, Score: 27, Comments: 1 On Reddit: [21] http://goo.gl/7Dz89 Original: [22] http://goo.gl/I1XXa * Solving a Partial Differential Equation Comonadically Domain: idontgetoutmuch.wordpress.com, Score: 27, Comments: 2 On Reddit: [23] http://goo.gl/Qxwjq Original: [24] http://goo.gl/lBm12 * Need a math related Haskell project suggestion Domain: self.haskell, Score: 22, Comments: 20 On Reddit: [25] http://goo.gl/o3lYl Original: [26] http://goo.gl/o3lYl * Algebraically Interpreting Polymorphism Domain: stackoverflow.com, Score: 21, Comments: 12 On Reddit: [27] http://goo.gl/3SCA9 Original: [28] http://goo.gl/wC6rm Top StackOverflow Questions * Why is seq bad? votes: 18, answers: 1 Read on SO: [29] http://goo.gl/IwVYS * Can I speed up this Haskell algorithm? votes: 18, answers: 3 Read on SO: [30] http://goo.gl/PSVUB * Is there a library that uses ConstraintKinds to generalize all the base type classes to allow constraints? votes: 15, answers: 1 Read on SO: [31] http://goo.gl/MfTMC * What are skolems? votes: 15, answers: 2 Read on SO: [32] http://goo.gl/qEnEI * What does it usually mean when a Haskell record accessor leads with an underscore? votes: 14, answers: 3 Read on SO: [33] http://goo.gl/3YD1n * How does this piece of obfuscated Haskell code work? votes: 12, answers: 1 Read on SO: [34] http://goo.gl/rLtFG * How to implement a game loop in reactive-banana? votes: 12, answers: 1 Read on SO: [35] http://goo.gl/nx3zR * How do Haskell currying and