From dstcruz at gmail.com Thu May 1 02:39:50 2014 From: dstcruz at gmail.com (Daniel Santa Cruz) Date: Wed, 30 Apr 2014 22:39:50 -0400 Subject: [Haskell-cafe] Haskell Weekly News: Issue 293 Message-ID: Welcome to issue 293 of the HWN, an issue covering crowd-sourced bits of information about Haskell from around the web. This issue covers from April 20 to 26, 2014 Quotes of the Week * monochrom: linux's ulimit for main memory will not help because linux kernel's allocator is a lazy yes-man (think irrefutable pattern) * edwardk: lens is the only library I've ever written that generates hate mail and invites to give talks in almost equal measure * shachaf: You don't need lens to produce or consume lenses. You just need it to complain about them. * glguy_: Reddit has shown you don't need to have used the lens package to complain about it, either Top Reddit Stories * What I Wish I Knew When Learning Haskell 2.0 Domain: dev.stephendiehl.com, Score: 191, Comments: 37 On Reddit: [1] http://goo.gl/PkvrnZ Original: [2] http://goo.gl/ljYe4w * Announcing cabal 1.20 Domain: blog.johantibell.com, Score: 141, Comments: 38 On Reddit: [3] http://goo.gl/H16RoZ Original: [4] http://goo.gl/2r3vBH * Lens is unidiomatic Haskell Domain: ro-che.info, Score: 124, Comments: 231 On Reddit: [5] http://goo.gl/Hm7Zbl Original: [6] http://goo.gl/HrI0L6 * wreq: a capable new HTTP client library Domain: serpentine.com, Score: 121, Comments: 128 On Reddit: [7] http://goo.gl/kUZp4s Original: [8] http://goo.gl/y8QFpR * Applicative became a superclass of Monad Domain: ghc.haskell.org, Score: 94, Comments: 46 On Reddit: [9] http://goo.gl/0OIiPz Original: [10] http://goo.gl/DKCUsD * Open Sourced! Cryptol: A Domain Specific Language for Specifying Cryptographic Algorithms Domain: cryptol.net, Score: 91, Comments: 7 On Reddit: [11] http://goo.gl/32oaZd Original: [12] http://goo.gl/30Y9g0 * Model-view-controller, Haskell-style Domain: haskellforall.com, Score: 81, Comments: 55 On Reddit: [13] http://goo.gl/yJH5Ck Original: [14] http://goo.gl/pjqFPN * Lenses don't compose backwards. Domain: self.haskell, Score: 73, Comments: 35 On Reddit: [15] http://goo.gl/p9e9v8 Original: [16] http://goo.gl/p9e9v8 * 14 Haskell Projects accepted for Google Summer of Code Domain: google-melange.com, Score: 59, Comments: 28 On Reddit: [17] http://goo.gl/bw3jrU Original: [18] http://goo.gl/O91dDJ * New issue of The Monad Reader (#23) Domain: themonadreader.wordpress.com, Score: 48, Comments: 11 On Reddit: [19] http://goo.gl/PgFaAg Original: [20] http://goo.gl/M62yM8 * Lens from the ground up Domain: mth.io, Score: 44, Comments: 25 On Reddit: [21] http://goo.gl/7hb2dZ Original: [22] http://goo.gl/W2C4x2 * Lenses You Can Make at Home Domain: duplode.github.io, Score: 40, Comments: 17 On Reddit: [23] http://goo.gl/5Fx3re Original: [24] http://goo.gl/qs2nbt Top StackOverflow Questions * How do experienced Haskell developers approach laziness at *design* time? votes: 26, answers: 1 Read on SO: [25] http://goo.gl/obf2MG * Lax monoidal functors with a different monoidal structure votes: 14, answers: 3 Read on SO: [26] http://goo.gl/gR954y * Maximizing Haskell loop performance with GHC votes: 13, answers: 2 Read on SO: [27] http://goo.gl/TNaeB7 * What does it mean that the semantics (of Haskell) are affected by the inferred types (of return type polymorphism)? votes: 12, answers: 2 Read on SO: [28] http://goo.gl/e702Su * Write a parallel array Haskell expression once, run on CPUs & GPUs with repa and accelerate votes: 10, answers: 2 Read on SO: [29] http://goo.gl/gvSnV8 * Best way to save 10 GB vector to disk in Haskell votes: 9, answers: 3 Read on SO: [30] http://goo.gl/6SjJeG * What is the purpose of the `Typeable (* -> Constraint) Monoid` instance? votes: 9, answers: 1 Read on SO: [31] http://goo.gl/QeLSHm Until next time, [32]+Daniel Santa Cruz References 1. http://dev.stephendiehl.com/hask 2. http://www.reddit.com/r/haskell/comments/23srcm/what_i_wish_i_knew_when_learning_haskell_20/ 3. http://blog.johantibell.com/2014/04/announcing-cabal-120.html 4. http://www.reddit.com/r/haskell/comments/23i6ih/announcing_cabal_120/ 5. http://ro-che.info/articles/2014-04-24-lens-unidiomatic.html 6. http://www.reddit.com/r/haskell/comments/23uzpg/lens_is_unidiomatic_haskell/ 7. http://www.serpentine.com/wreq/ 8. http://www.reddit.com/r/haskell/comments/23q8kc/wreq_a_capable_new_http_client_library/ 9. https://ghc.haskell.org/trac/ghc/browser/ghc/libraries/base/GHC/Base.lhs?rev=88c9403264950326e39a05f262bbbb069cf12977#L382 10. http://www.reddit.com/r/haskell/comments/23ob5a/applicative_became_a_superclass_of_monad/ 11. http://cryptol.net/index.html 12. http://www.reddit.com/r/haskell/comments/23w3su/open_sourced_cryptol_a_domain_specific_language/ 13. http://www.haskellforall.com/2014/04/model-view-controller-haskell-style.html 14. http://www.reddit.com/r/haskell/comments/2407hs/modelviewcontroller_haskellstyle/ 15. http://www.reddit.com/r/haskell/comments/23x3f3/lenses_dont_compose_backwards/ 16. http://www.reddit.com/r/haskell/comments/23x3f3/lenses_dont_compose_backwards/ 17. http://www.google-melange.com/gsoc/projects/list/google/gsoc2014 18. http://www.reddit.com/r/haskell/comments/23mfwj/14_haskell_projects_accepted_for_google_summer_of/ 19. http://themonadreader.wordpress.com/2014/04/23/issue-23/ 20. http://www.reddit.com/r/haskell/comments/23u25r/new_issue_of_the_monad_reader_23/ 21. http://mth.io/talks/lens-from-the-ground-up/ 22. http://www.reddit.com/r/haskell/comments/23z5xb/lens_from_the_ground_up/ 23. http://duplode.github.io/posts/lenses-you-can-make-at-home.html 24. http://www.reddit.com/r/haskell/comments/241aec/lenses_you_can_make_at_home/ 25. http://stackoverflow.com/questions/23280936/how-do-experienced-haskell-developers-approach-laziness-at-design-time 26. http://stackoverflow.com/questions/23316255/lax-monoidal-functors-with-a-different-monoidal-structure 27. http://stackoverflow.com/questions/23315001/maximizing-haskell-loop-performance-with-ghc 28. http://stackoverflow.com/questions/23282921/what-does-it-mean-that-the-semantics-of-haskell-are-affected-by-the-inferred-t 29. http://stackoverflow.com/questions/23202145/write-a-parallel-array-haskell-expression-once-run-on-cpus-gpus-with-repa-and 30. http://stackoverflow.com/questions/23247289/best-way-to-save-10-gb-vector-to-disk-in-haskell 31. http://stackoverflow.com/questions/23277838/what-is-the-purpose-of-the-typeable-constraint-monoid-instance 32. https://plus.google.com/105107667630152149014/about -------------- next part -------------- An HTML attachment was scrubbed... URL: From kazu at iij.ad.jp Thu May 1 02:58:09 2014 From: kazu at iij.ad.jp (Kazu Yamamoto (=?iso-2022-jp?B?GyRCOzNLXE9CSScbKEI=?=)) Date: Thu, 01 May 2014 11:58:09 +0900 (JST) Subject: [Haskell-cafe] ghc-mod version 4.1.0 Message-ID: <20140501.115809.1417729316609112864.kazu@iij.ad.jp> Hello guys, I have released ghc-mod version 4.1.0. In this version, ghc-modi provides "info" and "type" commands. This means that you can display types and information of expressions very quickly on Emacs. http://hackage.haskell.org/package/ghc-mod Thanks to GHC's -fdefer-type-errors, "type" and "info" can work even if the file contains type errors. Yay! Of course, you can make use of GHC's hole. For more information, please read the "Types" subsection of the following page: http://mew.org/~kazu/proj/ghc-mod/en/emacs.html Enjoy! --Kazu From ivan.miljenovic at gmail.com Thu May 1 12:46:47 2014 From: ivan.miljenovic at gmail.com (Ivan Lazar Miljenovic) Date: Thu, 1 May 2014 22:46:47 +1000 Subject: [Haskell-cafe] Dealing with GHC 7.8 Message-ID: I've been trying to update the various Haskell packages for Exherbo, but for some packages I keep getting errors like this (taken from vector-th-unbox, which is ultimately needed by criterion): runhaskell Setup copy --destdir=/var/tmp/paludis/build/dev-haskell-vector-th-unbox-0.2.0.2/image/ Installing library in /var/tmp/paludis/build/dev-haskell-vector-th-unbox-0.2.0.2/image/usr/lib64/x86_64-linux-ghc-7.8.2/vector-th-unbox-0.2.0.2 Setup: Error: Could not find module: Data.Vector.Unboxed.Deriving with any suffix: ["dyn_hi"] in the search path: ["dist/build"] When trying to find solutions for this, every result happens to be for Windows... which this isn't. Has some way of dealing with building packages using just runhaskell Setup changed? -- Ivan Lazar Miljenovic Ivan.Miljenovic at gmail.com http://IvanMiljenovic.wordpress.com From michael at snoyman.com Thu May 1 12:49:12 2014 From: michael at snoyman.com (Michael Snoyman) Date: Thu, 1 May 2014 15:49:12 +0300 Subject: [Haskell-cafe] Dealing with GHC 7.8 In-Reply-To: References: Message-ID: I think you need to upgrade to cabal-install 1.18 or later, and then recompile your entire package database. Johan wrote about this on Google+: https://plus.google.com/u/0/115504368969270249241/posts/19fyYuT5C1i On Thu, May 1, 2014 at 3:46 PM, Ivan Lazar Miljenovic < ivan.miljenovic at gmail.com> wrote: > I've been trying to update the various Haskell packages for Exherbo, > but for some packages I keep getting errors like this (taken from > vector-th-unbox, which is ultimately needed by criterion): > > runhaskell Setup copy > --destdir=/var/tmp/paludis/build/dev-haskell-vector-th-unbox-0.2.0.2/image/ > Installing library in > > /var/tmp/paludis/build/dev-haskell-vector-th-unbox-0.2.0.2/image/usr/lib64/x86_64-linux-ghc-7.8.2/vector-th-unbox-0.2.0.2 > Setup: Error: Could not find module: Data.Vector.Unboxed.Deriving with any > suffix: ["dyn_hi"] in the search path: ["dist/build"] > > When trying to find solutions for this, every result happens to be for > Windows... which this isn't. Has some way of dealing with building > packages using just runhaskell Setup changed? > > -- > Ivan Lazar Miljenovic > Ivan.Miljenovic at gmail.com > http://IvanMiljenovic.wordpress.com > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan.miljenovic at gmail.com Thu May 1 13:02:06 2014 From: ivan.miljenovic at gmail.com (Ivan Lazar Miljenovic) Date: Thu, 1 May 2014 23:02:06 +1000 Subject: [Haskell-cafe] Dealing with GHC 7.8 In-Reply-To: References: Message-ID: On 1 May 2014 22:49, Michael Snoyman wrote: > I think you need to upgrade to cabal-install 1.18 or later, and then > recompile your entire package database. Johan wrote about this on Google+: > > https://plus.google.com/u/0/115504368969270249241/posts/19fyYuT5C1i Except I'm not using cabal-install, I'm using my system's (source-based) package manager, which uses runhaskell Setup under the hood. And yes, it's Cabal-1.18. Since these are all packages being built on the system level, I'm pretty sure it's not using any old versions of libraries built by cabal-install-1.16. > > > On Thu, May 1, 2014 at 3:46 PM, Ivan Lazar Miljenovic > wrote: >> >> I've been trying to update the various Haskell packages for Exherbo, >> but for some packages I keep getting errors like this (taken from >> vector-th-unbox, which is ultimately needed by criterion): >> >> runhaskell Setup copy >> >> --destdir=/var/tmp/paludis/build/dev-haskell-vector-th-unbox-0.2.0.2/image/ >> Installing library in >> >> /var/tmp/paludis/build/dev-haskell-vector-th-unbox-0.2.0.2/image/usr/lib64/x86_64-linux-ghc-7.8.2/vector-th-unbox-0.2.0.2 >> Setup: Error: Could not find module: Data.Vector.Unboxed.Deriving with any >> suffix: ["dyn_hi"] in the search path: ["dist/build"] >> >> When trying to find solutions for this, every result happens to be for >> Windows... which this isn't. Has some way of dealing with building >> packages using just runhaskell Setup changed? >> >> -- >> Ivan Lazar Miljenovic >> Ivan.Miljenovic at gmail.com >> http://IvanMiljenovic.wordpress.com >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe > > -- Ivan Lazar Miljenovic Ivan.Miljenovic at gmail.com http://IvanMiljenovic.wordpress.com From ivan.miljenovic at gmail.com Thu May 1 13:10:12 2014 From: ivan.miljenovic at gmail.com (Ivan Lazar Miljenovic) Date: Thu, 1 May 2014 23:10:12 +1000 Subject: [Haskell-cafe] Dealing with GHC 7.8 In-Reply-To: References: Message-ID: On 1 May 2014 23:02, Ivan Lazar Miljenovic wrote: > On 1 May 2014 22:49, Michael Snoyman wrote: >> I think you need to upgrade to cabal-install 1.18 or later, and then >> recompile your entire package database. Johan wrote about this on Google+: >> >> https://plus.google.com/u/0/115504368969270249241/posts/19fyYuT5C1i > > Except I'm not using cabal-install, I'm using my system's > (source-based) package manager, which uses runhaskell Setup under the > hood. > > And yes, it's Cabal-1.18. > > Since these are all packages being built on the system level, I'm > pretty sure it's not using any old versions of libraries built by > cabal-install-1.16. But I tried rebuilding vector again and now it magically builds... so maybe I had somehow built vector with Cabal-1.16 :/ Sorry for the noise. > >> >> >> On Thu, May 1, 2014 at 3:46 PM, Ivan Lazar Miljenovic >> wrote: >>> >>> I've been trying to update the various Haskell packages for Exherbo, >>> but for some packages I keep getting errors like this (taken from >>> vector-th-unbox, which is ultimately needed by criterion): >>> >>> runhaskell Setup copy >>> >>> --destdir=/var/tmp/paludis/build/dev-haskell-vector-th-unbox-0.2.0.2/image/ >>> Installing library in >>> >>> /var/tmp/paludis/build/dev-haskell-vector-th-unbox-0.2.0.2/image/usr/lib64/x86_64-linux-ghc-7.8.2/vector-th-unbox-0.2.0.2 >>> Setup: Error: Could not find module: Data.Vector.Unboxed.Deriving with any >>> suffix: ["dyn_hi"] in the search path: ["dist/build"] >>> >>> When trying to find solutions for this, every result happens to be for >>> Windows... which this isn't. Has some way of dealing with building >>> packages using just runhaskell Setup changed? >>> >>> -- >>> Ivan Lazar Miljenovic >>> Ivan.Miljenovic at gmail.com >>> http://IvanMiljenovic.wordpress.com >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://www.haskell.org/mailman/listinfo/haskell-cafe >> >> > > > > -- > Ivan Lazar Miljenovic > Ivan.Miljenovic at gmail.com > http://IvanMiljenovic.wordpress.com -- Ivan Lazar Miljenovic Ivan.Miljenovic at gmail.com http://IvanMiljenovic.wordpress.com From fryguybob at gmail.com Thu May 1 13:33:09 2014 From: fryguybob at gmail.com (Ryan Yates) Date: Thu, 1 May 2014 09:33:09 -0400 Subject: [Haskell-cafe] Stupid newbie question of the day: why is newMVar in the IO monad In-Reply-To: References: Message-ID: There is extra work done to make this safe. See the following: https://github.com/ghc/ghc/blob/af6746fb6b5adb5ba5be6e0f647c4ebe767ce084/rts/sm/Storage.c#L305 https://ghc.haskell.org/trac/ghc/ticket/5558 Ryan On Thu, May 1, 2014 at 8:25 AM, Mikulas Patocka < mikulas at artax.karlin.mff.cuni.cz> wrote: > > Also note linked from the global variables page on the wiki is: > > http://www.haskell.org/haskellwiki/Top_level_mutable_state > > > > Important for the `unsafePerformIO` option is the NOINLINE pragma to > ensure > > that only one global variable exists. In the STM case it is also > important > > to use `newTVarIO` rather then `unsafePerformIO $ atomically newTVar` > which > > does not work. > > > > Ryan > > Hi > > I think it isn't correct even with NOINLINE. > > > Read the paper "Haskell on a Shared-Memory Multiprocessor" > http://research.microsoft.com/pubs/67424/2005-haskell.pdf > > Among other things, the paper presents these ideas: > > (section 3.1) When multiple threads start to evaluate the same thunk > concurrently, we could use interlocked compare-and-swap instruction to > make sure that only one thread starts to evaluate it. However, the > compare-and-swap instruction is slow and executing it at every thunk > evaluation decreases performance. So, the designers avoid the > compare-and-swap instruction (section 3.2) and consequently there is a > race condition - there is a small window where two or more threads may > evaluate the same thunk concurrently. > > Normally, this race condition doesn't matter, because Haskell is purely > functional language, so when multiple threads evaluate the same thunk they > end up with the same result - but in this particular example, where one is > using unsafePerformIO to construct a unique variable, it can hurt, because > you end up executing "unsafePerformIO $ newMVar 0" concurrently (section > 3.5 of the paper). > > > So - code like this isn't correct, the numbers returned by "uniq" may not > be unique if we hit the race condition when evaluating "global": > > global :: MVar Integer > global = unsafePerformIO $ newMVar 0 > {-# NOINLINE global #-} > uniq = modifyMVar global (\i -> return (i+1,i)) > > > Has anything changed since that time, so that this construct is safe? > > Mikulas > -------------- next part -------------- An HTML attachment was scrubbed... URL: From patrick.john.wheeler at gmail.com Thu May 1 14:00:57 2014 From: patrick.john.wheeler at gmail.com (Patrick Wheeler) Date: Thu, 1 May 2014 09:00:57 -0500 Subject: [Haskell-cafe] forLoop + strict State monad is much faster than foldl' In-Reply-To: <535FD4BA.2010807@nh2.me> References: <535FD3F7.2080402@nh2.me> <535FD4BA.2010807@nh2.me> Message-ID: Int has a tight loop for `EnumFromTo` http://git.haskell.org/packages/base.git/blob/HEAD:/GHC/Enum.lhs#l500 On the other hand look at `EnumFromTo` for word32 http://hackage.haskell.org/package/base-4.7.0.0/docs/src/GHC-Word.html#Word32 It calls `integralEnumFromTo` Which is 723integralEnumFromTo :: Integral a => a -> a -> [a] 724integralEnumFromTo n m = map fromInteger [toInteger n .. toInteger m] That is right you get converted to an Integer, then back again. http://git.haskell.org/packages/base.git/blob/52c0b09036c36f1ed928663abb2f295fd36a88bb:/GHC/Real.lhs#l723 This seems to be the problem with all loops that use `Word32` and `EnumFromTo`. It looks like you could add a better `EnumFromTo` for `Word32` and you would close the gap between the loops that are using `EnumFromTo` and those that are not. Patrick On Tue, Apr 29, 2014 at 11:35 AM, Niklas Hamb?chen wrote: > Interestingly, the discrimination against Word32 does not end here: > > When compiling with -fllvm > ( > http://htmlpreview.github.io/?https://github.com/nh2/loop/blob/master/results/bench-foldl-and-iorefs-are-slow-llvm.html > ), > we can see that the forLoop + strict State monad is completely compiled > away to a no-op for Int, but not for Word32. > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -- Patrick Wheeler Patrick.John.Wheeler at gmail.com Patrick.J.Wheeler at rice.edu Patrick.Wheeler at colorado.edu -------------- next part -------------- An HTML attachment was scrubbed... URL: From patrick.john.wheeler at gmail.com Thu May 1 14:17:38 2014 From: patrick.john.wheeler at gmail.com (Patrick Wheeler) Date: Thu, 1 May 2014 09:17:38 -0500 Subject: [Haskell-cafe] forLoop + strict State monad is much faster than foldl' In-Reply-To: <535FD3F7.2080402@nh2.me> References: <535FD3F7.2080402@nh2.me> Message-ID: @Niklas You can use the `foldM` form the FoldL package to achieve equal results as the fastest loops in your current benchmark. foldM will allow you to deal with your loops at a high level of abstraction though. See the following post, by Gabriel Gonzalez, for an example: http://www.haskellforall.com/2013/08/foldl-100-composable-streaming-and.html I have added the bench mark to my fork of your repo, and made a pull request: https://github.com/Davorak/loop It looks like the only reason that `foldM` does not preform well with `Word32` is because of the naive implementation of `enumFromTo` for Word32 as explained in my other email in more detail. Here is the Criterion report: http://htmlpreview.github.io/?https://github.com/Davorak/loop/blob/master/results/bench.html On Tue, Apr 29, 2014 at 11:31 AM, Niklas Hamb?chen wrote: > This is just a short notice that using > > foldl' (+) 0 [0..100000::Int] > > is over 10 times slower than using > > flip execState 0 $ > forLoop (0 :: Int) (< n) (+1) $ \i -> do > x <- get > put $! x + i > > with `loopFor` as on https://github.com/nh2/loop. > > Even using an IORef is twice as fast as the pure foldl' (but still 5 > times slower than strict State). > > The benchmark is at > > http://htmlpreview.github.io/?https://github.com/nh2/loop/blob/master/results/bench-foldl-and-iorefs-are-slow.html > . > > (All benchmarks are linked from https://github.com/nh2/loop.) > > You can see there that the problem is gone when using Vector.foldl', but > only for Int - for Word32 it persists. > > It seems that manual looping is beneficial even when dealing with prime > examples of pure code that GHC ought to optimize well. > > Niklas > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -- Patrick Wheeler Patrick.John.Wheeler at gmail.com Patrick.J.Wheeler at rice.edu Patrick.Wheeler at colorado.edu -------------- next part -------------- An HTML attachment was scrubbed... URL: From simon at joyful.com Thu May 1 16:16:33 2014 From: simon at joyful.com (Simon Michael) Date: Thu, 01 May 2014 09:16:33 -0700 Subject: [Haskell-cafe] ANN: hledger-0.23, hledger-web-0.23 Message-ID: <1398960993.4203.112599653.69F692DB@webmail.messagingengine.com> I'm pleased to announce hledger and hledger-web 0.23! This release includes command-line fixes and polish, a new accounts command, and a number of changes to the balance command relating to --depth, --flat, and multicolumn mode, which I find has made it much more useful. Release notes: http://hledger.org/release-notes#hledger-023-201451 . Contributors to this release: Peter Simons and Marko Koci?. hledger (http://hledger.org) is a command-line tool and haskell library for tracking financial transactions, which are stored in a human-readable plain text format. It can also read CSV or timelog files. It provides useful reports, and can also help you record new transactions interactively. Add-on commands include hledger-web (a web interface), hledger-irr (for calculating internal rate of return) and hledger-interest (for generating interest transactions). hledger is inspired by and largely compatible with Ledger. Installation: cabal update; cabal install hledger [hledger-web] (see http://hledger.org/installing for help) or sponsor a binary at http://hledger.org/download Best! -Simon From suhorng at gmail.com Thu May 1 17:16:53 2014 From: suhorng at gmail.com (suhorng Y) Date: Fri, 2 May 2014 01:16:53 +0800 Subject: [Haskell-cafe] Prevent replicateM_ from repeating expensive (pure) computations Message-ID: Hi all, I've been writing loops in a monad using `replicateM_`. However, recently I discovered that it caused my program become extremely slow. For example, > module Main where > > import Control.Monad (replicateM_) > > fib :: Int -> Int > fib 0 = 0 > fib 1 = 1 > fib n = fib (n-1) + fib (n-2) > > main = do > n <- readLn > let fn = fib n > replicateM_ 20 (print fn) The program ran fine if no optimization is turned on. However, when I used `-O` or `-O2` with GHC (7.4/7.6), the program became extremely slow, and if I replaced `replicateM_` by `mapM_`, the problem disappeared. I suspected that GHC inlined `fn`, causing `replicateM_` to recalculate the value in every loop. Though the problem could be solved by either using `mapM_`, lifting `print fn` to a global definition or manually demanding it be evaluated strictly, I would expected `fn` not to be computed multiple times. Any suggestions around this? Thanks! Sincerely, suhorng -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at nh2.me Thu May 1 17:40:47 2014 From: mail at nh2.me (=?UTF-8?B?TmlrbGFzIEhhbWLDvGNoZW4=?=) Date: Thu, 01 May 2014 18:40:47 +0100 Subject: [Haskell-cafe] forLoop + strict State monad is much faster than foldl' In-Reply-To: References: <535FD3F7.2080402@nh2.me> Message-ID: <5362871F.8050707@nh2.me> Nice find, I merged your benchmark addition. Would you mind making a GHC issue from your `enumFromTo` findings? On 01/05/14 15:17, Patrick Wheeler wrote: > @Niklas > > You can use the `foldM` form the FoldL package to achieve equal results > as the fastest loops in your current benchmark. foldM will allow you to > deal with your loops at a high level of abstraction though. See the > following post, by Gabriel Gonzalez, for an example: > http://www.haskellforall.com/2013/08/foldl-100-composable-streaming-and.html > > I have added the bench mark to my fork of your repo, and made a pull > request: > https://github.com/Davorak/loop > > It looks like the only reason that `foldM` does not preform well with > `Word32` is because of the naive implementation of `enumFromTo` for > Word32 as explained in my other email in more detail. > > Here is the Criterion report: > http://htmlpreview.github.io/?https://github.com/Davorak/loop/blob/master/results/bench.html From danny.gratzer at gmail.com Thu May 1 17:41:33 2014 From: danny.gratzer at gmail.com (Danny Gratzer) Date: Thu, 1 May 2014 12:41:33 -0500 Subject: [Haskell-cafe] Prevent replicateM_ from repeating expensive (pure) computations In-Reply-To: References: Message-ID: You seem to be right about the inlining. This seems to work import Control.Monad (replicateM_) fib :: Int -> Int fib 0 = 0 fib 1 = 1 fib n = fib (n-1) + fib (n-2) main = do n <- readLn fn <- return $! fib n -- force one and only one evaluation replicateM_ 20 (print fn) Otherwise you can make inline fn more difficult (impossible?) with seq main = do n <- readLn let fn = fib n fn `seq` replicateM_ 20 (print fn) Note that GHC seems to be too smart for itself and will inline something like flip const fn $ .... since it can see that const isn't strict in fn. Cheers, Danny Gratzer -------------- next part -------------- An HTML attachment was scrubbed... URL: From a at lelf.me Thu May 1 18:16:51 2014 From: a at lelf.me (Antonio Nikishaev) Date: Thu, 01 May 2014 22:16:51 +0400 Subject: [Haskell-cafe] Haskell Programming Font with Ligatures References: <1025dd06-1b73-435c-902b-302a654fd1c0@googlegroups.com> <8c27a5dd-f8a1-44bd-8882-d3f3092fb7d9@googlegroups.com> Message-ID: Garrett Mitchener writes: > I just tried this in gedit and it looks really nice! Thanks for > putting this together. > > Doesn't work in emacs though :-( It's not that hard to make it work http://www.reddit.com/r/haskell/comments/23g9dv/oc_haskell_programming_font_with_ligatures/cgx7gbi From qdunkan at gmail.com Thu May 1 19:33:26 2014 From: qdunkan at gmail.com (Evan Laforge) Date: Thu, 1 May 2014 12:33:26 -0700 Subject: [Haskell-cafe] Haskell Programming Font with Ligatures In-Reply-To: References: <1025dd06-1b73-435c-902b-302a654fd1c0@googlegroups.com> <8c27a5dd-f8a1-44bd-8882-d3f3092fb7d9@googlegroups.com> Message-ID: Just to verify, this only works in those few terminals that support ligatures in fixed-width fonts, right? I tried on OSX with iTerm2 and no ligatures are rendered, just separate characters. But it's on the "not supported" list so no surprise. Anyone happen know how to get OS X font rendering to do it? The iterm guys are very responsive to feature requests or patches. On Thu, May 1, 2014 at 11:16 AM, Antonio Nikishaev wrote: > Garrett Mitchener writes: > >> I just tried this in gedit and it looks really nice! Thanks for >> putting this together. >> >> Doesn't work in emacs though :-( > > It's not that hard to make it work > http://www.reddit.com/r/haskell/comments/23g9dv/oc_haskell_programming_font_with_ligatures/cgx7gbi > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From a at lelf.me Thu May 1 20:25:22 2014 From: a at lelf.me (Antonio Nikishaev) Date: Fri, 2 May 2014 00:25:22 +0400 Subject: [Haskell-cafe] Haskell Programming Font with Ligatures In-Reply-To: References: <1025dd06-1b73-435c-902b-302a654fd1c0@googlegroups.com> <8c27a5dd-f8a1-44bd-8882-d3f3092fb7d9@googlegroups.com> Message-ID: Ligatures are not used, it's (setq haskell-font-lock-symbols 'unicode) and tweaked font. The pic in reddit comment is of the stock ?cocoa? Emacs. On 1 May 2014, at 23:33, Evan Laforge wrote: > Just to verify, this only works in those few terminals that support > ligatures in fixed-width fonts, right? I tried on OSX with iTerm2 and > no ligatures are rendered, just separate characters. But it's on the > "not supported" list so no surprise. Anyone happen know how to get OS > X font rendering to do it? The iterm guys are very responsive to > feature requests or patches. > > On Thu, May 1, 2014 at 11:16 AM, Antonio Nikishaev wrote: >> Garrett Mitchener writes: >> >>> I just tried this in gedit and it looks really nice! Thanks for >>> putting this together. >>> >>> Doesn't work in emacs though :-( >> >> It's not that hard to make it work >> http://www.reddit.com/r/haskell/comments/23g9dv/oc_haskell_programming_font_with_ligatures/cgx7gbi >> From andrew.gibiansky at gmail.com Thu May 1 21:22:56 2014 From: andrew.gibiansky at gmail.com (Andrew Gibiansky) Date: Thu, 1 May 2014 14:22:56 -0700 Subject: [Haskell-cafe] Packaging Haskell Environment for Mac App Message-ID: Hey all, [This is an xpost from Reddit, where the postseems not to be showing up for some reason...] I'd like to package the Haskell Platform and GHC (for GHC API) together in one bundle in order to distribute it with a Mac app. (Specifically, I am working on a Mac app for IHaskell , so beginners can download that to immediately get started playing with Haskell). Does anyone have any experience with this? What's the easiest way to do this? My list of dependencies is fairly long: - Haskell Platform (well, all packages in it) - A few other packages installed via cabal - A native library (libzmq); cabal packages depend on it - Functioning Python > 2.6ish - GHC API My current best idea is to package this all in a Virtualbox VM. I need to run a server that my Mac app client can use, so mount shared folders in the VM so that the VM can read/write to disk and expose some ports from the VM. If this is the best solution, what Linux distro would you suggest to use in the VM? I'd want something very lightweight. I've also considered using Docker somehow, as IHaskell is already packaged with a Dockerfile. However, I'm not sure how I'd package docker so that its all doable via a single Mac app install. Ideas? Suggestions? Thanks! I know this isn't *directly* related to Haskell, but I'm hoping someone here has experience packaging Haskell applications. -- Andrew Gibiansky -------------- next part -------------- An HTML attachment was scrubbed... URL: From bos at serpentine.com Fri May 2 03:51:40 2014 From: bos at serpentine.com (Bryan O'Sullivan) Date: Thu, 1 May 2014 20:51:40 -0700 Subject: [Haskell-cafe] ghc-mod version 4.1.0 In-Reply-To: <20140501.115809.1417729316609112864.kazu@iij.ad.jp> References: <20140501.115809.1417729316609112864.kazu@iij.ad.jp> Message-ID: On Wed, Apr 30, 2014 at 7:58 PM, Kazu Yamamoto wrote: > I have released ghc-mod version 4.1.0. In this version, ghc-modi > provides "info" and "type" commands. This means that you can display > types and information of expressions very quickly on Emacs. > After years of despair over Emacs integration with ghc, I've been giving ghc-mod a try over the past day or two, and it seems to work quite well. Nice work! -------------- next part -------------- An HTML attachment was scrubbed... URL: From kazu at iij.ad.jp Fri May 2 12:17:00 2014 From: kazu at iij.ad.jp (Kazu Yamamoto (=?iso-2022-jp?B?GyRCOzNLXE9CSScbKEI=?=)) Date: Fri, 02 May 2014 21:17:00 +0900 (JST) Subject: [Haskell-cafe] ghc-mod version 4.1.0 In-Reply-To: References: <20140501.115809.1417729316609112864.kazu@iij.ad.jp> Message-ID: <20140502.211700.2031943760727962773.kazu@iij.ad.jp> Elliot, > One slight concern I've been running into recently is the memory usage of > ghc-modi. I've been on a rampage over the last few days trying to keep the > Chart library from OOMing on my laptop, and this generally involves killing > one or more ghc-modi instances with 1GB+ of resident memory. If anyone else > can confirm this is an issue (and it isn't already a known issue/necessary > evil), I'd be happy to file an issue on Github and do some preliminary work > as to why this is happening. Please record this space leak to a github issue. You are the second person who are taking about this. Though I have not experienced such a space leak, it must exit in some cases. Let's try to fix it. --Kazu From elliot.robinson at argiopetech.com Fri May 2 06:07:39 2014 From: elliot.robinson at argiopetech.com (Elliot Robinson) Date: Fri, 2 May 2014 02:07:39 -0400 Subject: [Haskell-cafe] ghc-mod version 4.1.0 In-Reply-To: References: <20140501.115809.1417729316609112864.kazu@iij.ad.jp> Message-ID: Very much agreed with Bryan O'Sullivan on the usefulness of ghc-mod. Thanks for what you're doing for the Emacs/Haskell community. One slight concern I've been running into recently is the memory usage of ghc-modi. I've been on a rampage over the last few days trying to keep the Chart library from OOMing on my laptop, and this generally involves killing one or more ghc-modi instances with 1GB+ of resident memory. If anyone else can confirm this is an issue (and it isn't already a known issue/necessary evil), I'd be happy to file an issue on Github and do some preliminary work as to why this is happening. --- Elliot Robinson Phone: (321) 252-9660 Site: www.argiopetech.com Email: elliot.robinson at argiopetech.com PGP Fingerprint: 0xD1E72E6A9D0610FFBBF838A6FFB5205A9FEDE59A -------------- next part -------------- An HTML attachment was scrubbed... URL: From wangbj at gmail.com Fri May 2 21:32:06 2014 From: wangbj at gmail.com (Baojun Wang) Date: Fri, 2 May 2014 14:32:06 -0700 Subject: [Haskell-cafe] Parsec lookAhead with choice (<|>) doesn't work as expected? Message-ID: Hi List, There is my first email on haskell-cafe, I must admit haskell is a amazing language even though I found it hard to program. I'm trying to use Parsec to parse a text file something like: format 1) HEADER BODY format 2) BODY BODY = many DATA_FIELDS I must distinguish the format is either 1) or 2), because I need process them differently. So I'm trying to use lookAhead & <|>, something like: format1Header = do HEADER_parser1 HEADER_parser2 return .. format2Header = do -- whatever return .. headerVersion = do version <- (lookAhead format1Header) <|> (lookAhead format2Header) return version Howerver if format1Header parser failed headerVersion just return failure without trying format2Header parser. Full source code is attached, you can load the source then just run ``main'' I searched seems similar issue had been reported: https://groups.google.com/forum/#!topic/fa.haskell/NGjQqR05-TA Is there anything I'm fundamentally wrong with lookAhead and <|> in Parsec? How can I get headerVersion works as expected? Thank you Baojun -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: la.hs Type: text/x-haskell Size: 1710 bytes Desc: not available URL: From kai at kzhang.org Fri May 2 21:44:46 2014 From: kai at kzhang.org (Kai Zhang) Date: Fri, 2 May 2014 14:44:46 -0700 Subject: [Haskell-cafe] Experimenting a new plotting library Message-ID: Hi cafe, I'm experimenting a new plotting library which makes use of the API of diagrams. I decided to start this work, because: 1. There is few plotting library written in pure Haskell 2. Haskell-chart, one of the most featured library, is hard to extend and there is no straightforward way to compose or modify the plots generated by this library. I had some ideas for the new library. You can get some feeling from here: https://github.com/kaizhang/haskell-plot I'm still relatively new to haskell and don't have much experience in making plots either. Hopefully I can get some suggestions from you guys and improve my programming skills through this process. -------------- next part -------------- An HTML attachment was scrubbed... URL: From roma at ro-che.info Fri May 2 21:45:42 2014 From: roma at ro-che.info (Roman Cheplyaka) Date: Sat, 3 May 2014 00:45:42 +0300 Subject: [Haskell-cafe] Parsec lookAhead with choice (<|>) doesn't work as expected? In-Reply-To: References: Message-ID: <20140502214542.GA10662@sniper> Try wrapping the first parser in 'try'. * Baojun Wang [2014-05-02 14:32:06-0700] > Hi List, > > There is my first email on haskell-cafe, I must admit haskell is a amazing > language even though I found it hard to program. > > I'm trying to use Parsec to parse a text file something like: > > format 1) > HEADER > BODY > > format 2) > BODY > > BODY = many DATA_FIELDS > > I must distinguish the format is either 1) or 2), because I need process > them differently. So I'm trying to use lookAhead & <|>, something like: > > format1Header = do > HEADER_parser1 > HEADER_parser2 > return .. > > format2Header = do > -- whatever > return .. > > headerVersion = do > version <- (lookAhead format1Header) <|> (lookAhead format2Header) > return version > > Howerver if format1Header parser failed headerVersion just return failure > without trying format2Header parser. > > Full source code is attached, you can load the source then just run ``main'' > > I searched seems similar issue had been reported: > https://groups.google.com/forum/#!topic/fa.haskell/NGjQqR05-TA > > Is there anything I'm fundamentally wrong with lookAhead and <|> in Parsec? > How can I get headerVersion works as expected? > > Thank you > Baojun -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: From wangbj at gmail.com Fri May 2 21:53:42 2014 From: wangbj at gmail.com (Baojun Wang) Date: Fri, 2 May 2014 14:53:42 -0700 Subject: [Haskell-cafe] Parsec lookAhead with choice (<|>) doesn't work as expected? In-Reply-To: <20140502214542.GA10662@sniper> References: <20140502214542.GA10662@sniper> Message-ID: Many thanks for your timely help. Just tried: nocPeekHeader = do st <- (lookAhead noc28hdr') <|> (lookAhead noc25hdr') noc28hdr' = try noc28hdr noc25hdr' = trynoc25hdr still fail with the same error: -- (input1.txt) SNOC ERROR: ERRLOG0 = 0x80030000 (input2.txt) SNOC ERROR: ERRSTATUS = 0x00000001 Right (28,"SNOC") Left "input2.txt" (line 1, column 2): unexpected "S" expecting "NOC ERROR: ERRLOG" *Main> On Fri, May 2, 2014 at 2:45 PM, Roman Cheplyaka wrote: > Try wrapping the first parser in 'try'. > > * Baojun Wang [2014-05-02 14:32:06-0700] > > Hi List, > > > > There is my first email on haskell-cafe, I must admit haskell is a > amazing > > language even though I found it hard to program. > > > > I'm trying to use Parsec to parse a text file something like: > > > > format 1) > > HEADER > > BODY > > > > format 2) > > BODY > > > > BODY = many DATA_FIELDS > > > > I must distinguish the format is either 1) or 2), because I need process > > them differently. So I'm trying to use lookAhead & <|>, something like: > > > > format1Header = do > > HEADER_parser1 > > HEADER_parser2 > > return .. > > > > format2Header = do > > -- whatever > > return .. > > > > headerVersion = do > > version <- (lookAhead format1Header) <|> (lookAhead format2Header) > > return version > > > > Howerver if format1Header parser failed headerVersion just return failure > > without trying format2Header parser. > > > > Full source code is attached, you can load the source then just run > ``main'' > > > > I searched seems similar issue had been reported: > > https://groups.google.com/forum/#!topic/fa.haskell/NGjQqR05-TA > > > > Is there anything I'm fundamentally wrong with lookAhead and <|> in > Parsec? > > How can I get headerVersion works as expected? > > > > Thank you > > Baojun > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wangbj at gmail.com Fri May 2 23:37:58 2014 From: wangbj at gmail.com (Baojun Wang) Date: Fri, 2 May 2014 16:37:58 -0700 Subject: [Haskell-cafe] Parsec lookAhead with choice (<|>) doesn't work as expected? In-Reply-To: References: <20140502214542.GA10662@sniper> Message-ID: Thanks, problem fixed by adding try, the error turns out to be something else :) On Fri, May 2, 2014 at 2:53 PM, Baojun Wang wrote: > Many thanks for your timely help. > > Just tried: > > nocPeekHeader = do > st <- (lookAhead noc28hdr') <|> (lookAhead noc25hdr') > > noc28hdr' = try noc28hdr > noc25hdr' = trynoc25hdr > > still fail with the same error: > > -- > (input1.txt) > SNOC ERROR: ERRLOG0 = 0x80030000 > > (input2.txt) > SNOC ERROR: ERRSTATUS = 0x00000001 > > Right (28,"SNOC") > Left "input2.txt" (line 1, column 2): > unexpected "S" > expecting "NOC ERROR: ERRLOG" > *Main> > > > On Fri, May 2, 2014 at 2:45 PM, Roman Cheplyaka wrote: > >> Try wrapping the first parser in 'try'. >> >> * Baojun Wang [2014-05-02 14:32:06-0700] >> > Hi List, >> > >> > There is my first email on haskell-cafe, I must admit haskell is a >> amazing >> > language even though I found it hard to program. >> > >> > I'm trying to use Parsec to parse a text file something like: >> > >> > format 1) >> > HEADER >> > BODY >> > >> > format 2) >> > BODY >> > >> > BODY = many DATA_FIELDS >> > >> > I must distinguish the format is either 1) or 2), because I need process >> > them differently. So I'm trying to use lookAhead & <|>, something like: >> > >> > format1Header = do >> > HEADER_parser1 >> > HEADER_parser2 >> > return .. >> > >> > format2Header = do >> > -- whatever >> > return .. >> > >> > headerVersion = do >> > version <- (lookAhead format1Header) <|> (lookAhead format2Header) >> > return version >> > >> > Howerver if format1Header parser failed headerVersion just return >> failure >> > without trying format2Header parser. >> > >> > Full source code is attached, you can load the source then just run >> ``main'' >> > >> > I searched seems similar issue had been reported: >> > https://groups.google.com/forum/#!topic/fa.haskell/NGjQqR05-TA >> > >> > Is there anything I'm fundamentally wrong with lookAhead and <|> in >> Parsec? >> > How can I get headerVersion works as expected? >> > >> > Thank you >> > Baojun >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuuzetsu at fuuzetsu.co.uk Sat May 3 08:21:18 2014 From: fuuzetsu at fuuzetsu.co.uk (Mateusz Kowalczyk) Date: Sat, 03 May 2014 10:21:18 +0200 Subject: [Haskell-cafe] Parsec lookAhead with choice (<|>) doesn't work as expected? In-Reply-To: References: <20140502214542.GA10662@sniper> Message-ID: <5364A6FE.2040807@fuuzetsu.co.uk> On 05/03/2014 01:37 AM, Baojun Wang wrote: > Thanks, problem fixed by adding try, the error turns out to be something > else :) > I'd like to note that Attoparsec backtracks by default, might be worth looking into. > > On Fri, May 2, 2014 at 2:53 PM, Baojun Wang wrote: > >> Many thanks for your timely help. >> >> Just tried: >> >> nocPeekHeader = do >> st <- (lookAhead noc28hdr') <|> (lookAhead noc25hdr') >> >> noc28hdr' = try noc28hdr >> noc25hdr' = trynoc25hdr >> >> still fail with the same error: >> >> -- >> (input1.txt) >> SNOC ERROR: ERRLOG0 = 0x80030000 >> >> (input2.txt) >> SNOC ERROR: ERRSTATUS = 0x00000001 >> >> Right (28,"SNOC") >> Left "input2.txt" (line 1, column 2): >> unexpected "S" >> expecting "NOC ERROR: ERRLOG" >> *Main> >> >> >> On Fri, May 2, 2014 at 2:45 PM, Roman Cheplyaka wrote: >> >>> Try wrapping the first parser in 'try'. >>> >>> * Baojun Wang [2014-05-02 14:32:06-0700] >>>> Hi List, >>>> >>>> There is my first email on haskell-cafe, I must admit haskell is a >>> amazing >>>> language even though I found it hard to program. >>>> >>>> I'm trying to use Parsec to parse a text file something like: >>>> >>>> format 1) >>>> HEADER >>>> BODY >>>> >>>> format 2) >>>> BODY >>>> >>>> BODY = many DATA_FIELDS >>>> >>>> I must distinguish the format is either 1) or 2), because I need process >>>> them differently. So I'm trying to use lookAhead & <|>, something like: >>>> >>>> format1Header = do >>>> HEADER_parser1 >>>> HEADER_parser2 >>>> return .. >>>> >>>> format2Header = do >>>> -- whatever >>>> return .. >>>> >>>> headerVersion = do >>>> version <- (lookAhead format1Header) <|> (lookAhead format2Header) >>>> return version >>>> >>>> Howerver if format1Header parser failed headerVersion just return >>> failure >>>> without trying format2Header parser. >>>> >>>> Full source code is attached, you can load the source then just run >>> ``main'' >>>> >>>> I searched seems similar issue had been reported: >>>> https://groups.google.com/forum/#!topic/fa.haskell/NGjQqR05-TA >>>> >>>> Is there anything I'm fundamentally wrong with lookAhead and <|> in >>> Parsec? >>>> How can I get headerVersion works as expected? >>>> >>>> Thank you >>>> Baojun >>> >>> >> > > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -- Mateusz K. From althainz at gmail.com Sat May 3 10:16:40 2014 From: althainz at gmail.com (Peter Althainz) Date: Sat, 3 May 2014 12:16:40 +0200 Subject: [Haskell-cafe] extensible records - Vinyl - alternatives? Message-ID: Dear All, I'm searching a handsome library for handling large amounts of configuration data in a flexible manner. So to speak I want to use some kind of inheritance of data fields. I think this is where the extensible records discussion is a proper description of my use case. I've found 2 libraries making this work, so far: HList Vinyl I currently prefer Vinyl due to the complex types in HList, lens compatibiliy, named labels. (I love the HList and OOHaskel papers, but for practical use, I currently prefer Vinyl). What do you think, what is the best way nowadays to use extensible records? Is Vinyl a good choice from your point of view? regards Peter -------------- next part -------------- An HTML attachment was scrubbed... URL: From omari at smileystation.com Sat May 3 14:13:12 2014 From: omari at smileystation.com (Omari Norman) Date: Sat, 3 May 2014 10:13:12 -0400 Subject: [Haskell-cafe] cabal repl fails with GHC 7.8.2 Message-ID: I have a package for which "cabal repl" works fine with cabal version 1.20 and GHC 7.6.3. The package has a lot of FFI bindings and uses hsc2hs, so getting a REPL without "cabal repl" is a pain. The package also comes with the C sources that get linked in. But with GHC 7.8.2, "cabal repl" fails with: Loading object (static) dist/build/decnumber/src/decDouble.o ... /usr/bin/ld: dist/build/decnumber/src/decDouble.o: relocation R_X86_64_32S against `DPD2BIN' can not be used when making a shared object; recompile with -fPIC Any idea on how to fix this? "cabal build" and "cabal install" work fine and I can even build and execute a test binary against the library. It seems the problem is just with "cabal repl". Thanks. Omari From haskell at nand.wakku.to Sat May 3 14:40:20 2014 From: haskell at nand.wakku.to (Niklas Haas) Date: Sat, 3 May 2014 16:40:20 +0200 Subject: [Haskell-cafe] cabal repl fails with GHC 7.8.2 In-Reply-To: References: Message-ID: <20140503164020.GB2607@nanodesu.localdomain> On Sat, 3 May 2014 10:13:12 -0400, Omari Norman wrote: > I have a package for which "cabal repl" works fine with cabal version > 1.20 and GHC 7.6.3. The package has a lot of FFI bindings and uses > hsc2hs, so getting a REPL without "cabal repl" is a pain. The package > also comes with the C sources that get linked in. > > But with GHC 7.8.2, "cabal repl" fails with: > > Loading object (static) dist/build/decnumber/src/decDouble.o ... > /usr/bin/ld: dist/build/decnumber/src/decDouble.o: relocation > R_X86_64_32S against `DPD2BIN' can not be used when making a shared > object; recompile with -fPIC > > Any idea on how to fix this? "cabal build" and "cabal install" work > fine and I can even build and execute a test binary against the > library. It seems the problem is just with "cabal repl". > > Thanks. > Omari Have you tried cleaning the entire build tree with `cabal clean` or just getting rid of the temporary files in general? I've run into this issue before, and I think it might just have something to do with mixing object files across different versions of GHC or similar. From omari at smileystation.com Sat May 3 14:45:43 2014 From: omari at smileystation.com (Omari Norman) Date: Sat, 3 May 2014 10:45:43 -0400 Subject: [Haskell-cafe] cabal repl fails with GHC 7.8.2 In-Reply-To: <20140503164020.GB2607@nanodesu.localdomain> References: <20140503164020.GB2607@nanodesu.localdomain> Message-ID: On Sat, May 3, 2014 at 10:40 AM, Niklas Haas wrote: > Have you tried cleaning the entire build tree with `cabal clean` or > just getting rid of the temporary files in general? Yes, multiple times. "cabal clean" and "git clean" both. Re-running "cabal repl" then automatically configures the package again and compiles all 40 of my modules, and then fails with the link error. From johan.tibell at gmail.com Sat May 3 15:42:11 2014 From: johan.tibell at gmail.com (Johan Tibell) Date: Sat, 3 May 2014 17:42:11 +0200 Subject: [Haskell-cafe] cabal repl fails with GHC 7.8.2 In-Reply-To: References: <20140503164020.GB2607@nanodesu.localdomain> Message-ID: This might be due to using an older cabal (i.e. 1.16) to build part of the packages that are now installed in ~/.ghc. If you blow away that directory (and reinstall your user-installed packages) that might help. On Sat, May 3, 2014 at 4:45 PM, Omari Norman wrote: > On Sat, May 3, 2014 at 10:40 AM, Niklas Haas > wrote: > > > Have you tried cleaning the entire build tree with `cabal clean` or > > just getting rid of the temporary files in general? > > Yes, multiple times. "cabal clean" and "git clean" both. Re-running > "cabal repl" then automatically configures the package again and > compiles all 40 of my modules, and then fails with the link error. > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From acowley at seas.upenn.edu Sat May 3 16:21:50 2014 From: acowley at seas.upenn.edu (Anthony Cowley) Date: Sat, 3 May 2014 12:21:50 -0400 Subject: [Haskell-cafe] extensible records - Vinyl - alternatives? In-Reply-To: References: Message-ID: <6D3709BD-60B0-41CD-9965-8E1F94FDEE9D@seas.upenn.edu> Disclaimer: I do contribute to Vinyl, so I'm not objective. Things I like about vinyl: - It is, for the most part, pretty simple. You can reimplement it in very few lines of code, which is good so you don't feel like you're getting locked into someone else's choices. I take advantage of this when exploring design spaces all the time. - It is, for the most part, pretty fast. You might be reluctant to introduce an abstraction in code whose performance you care about. You might think the abstraction is only worth it when complexity reaches a certain level. Vinyl's repo has a benchmark suite of *dead simple* usage that demonstrates minimal loss of performance. I really like this! Otoh, the HList contributors are amazing, so being able to benefit from their expertise is quite appealing. Anthony > On May 3, 2014, at 6:16 AM, Peter Althainz wrote: > > Dear All, > > I'm searching a handsome library for handling large amounts of configuration data in a flexible manner. So to speak I want to use some kind of inheritance of data fields. I think this is where the extensible records discussion is a proper description of my use case. > > I've found 2 libraries making this work, so far: > > HList > Vinyl > > I currently prefer Vinyl due to the complex types in HList, lens compatibiliy, named labels. (I love the HList and OOHaskel papers, but for practical use, I currently prefer Vinyl). > > What do you think, what is the best way nowadays to use extensible records? Is Vinyl a good choice from your point of view? > > regards > Peter > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From vogt.adam at gmail.com Sat May 3 16:54:23 2014 From: vogt.adam at gmail.com (adam vogt) Date: Sat, 3 May 2014 12:54:23 -0400 Subject: [Haskell-cafe] extensible records - Vinyl - alternatives? In-Reply-To: References: Message-ID: Hello Peter, Could you show what you mean by "named labels"? Vinyl is a fine choice, but have you looked at HList >= 0.3? The lenses/labels done with Data.HList.Labelable are prettier than the vinyl alternative in my biased opinion. Furthermore, they support changing types in the record unlike vinyl (ie. they provide a Lens not Lens'). HList is a bit slow at compile time if you make records with many fields. That situation may improve soon if we take advantage of the ordering on Symbol that ghc-7.8 introduced. In other words, we will probably follow the lead of and make Records sorted by their labels. There are quite a few other libraries . Also consider lens' makeClassy as another solution to the records problem. Regards, Adam On Sat, May 3, 2014 at 6:16 AM, Peter Althainz wrote: > Dear All, > > I'm searching a handsome library for handling large amounts of configuration > data in a flexible manner. So to speak I want to use some kind of > inheritance of data fields. I think this is where the extensible records > discussion is a proper description of my use case. > > I've found 2 libraries making this work, so far: > > HList > Vinyl > > I currently prefer Vinyl due to the complex types in HList, lens > compatibiliy, named labels. (I love the HList and OOHaskel papers, but for > practical use, I currently prefer Vinyl). > > What do you think, what is the best way nowadays to use extensible records? > Is Vinyl a good choice from your point of view? > > regards > Peter > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > From omari at smileystation.com Sat May 3 17:38:51 2014 From: omari at smileystation.com (Omari Norman) Date: Sat, 3 May 2014 13:38:51 -0400 Subject: [Haskell-cafe] cabal repl fails with GHC 7.8.2 In-Reply-To: References: <20140503164020.GB2607@nanodesu.localdomain> Message-ID: On Sat, May 3, 2014 at 11:42 AM, Johan Tibell wrote: > This might be due to using an older cabal (i.e. 1.16) to build part of the > packages that are now installed in ~/.ghc. If you blow away that directory > (and reinstall your user-installed packages) that might help. This package doesn't depend on any Haskell libraries that don't ship with GHC. Doing rm -rf ~/.ghc && rm -rf dist && cabal repl doesn't fix anything--cabal repl still doesn't work with GHC 7.8.2, but works with 7.6.3. I do notice that under GHC 7.6.3, it seems that ghci itself links the C object files and then the .hs files are interpreted, while under 7.8.2 it seems that the .hs modules are being built before ghci even starts up. Might this problem be arising because 7.8 switched to the system linker? I don't know enough about linkers or about how GHC does linking to make an informed guess. From haskell at nand.wakku.to Sat May 3 17:44:17 2014 From: haskell at nand.wakku.to (Niklas Haas) Date: Sat, 3 May 2014 19:44:17 +0200 Subject: [Haskell-cafe] cabal repl fails with GHC 7.8.2 In-Reply-To: References: <20140503164020.GB2607@nanodesu.localdomain> Message-ID: <20140503194417.GB1912@nanodesu.localdomain> On Sat, 3 May 2014 13:38:51 -0400, Omari Norman wrote: > rm -rf ~/.ghc && rm -rf dist && cabal repl I'm not sure if I'm barking up the wrong tree but have you tried running `cabal configure` manually? I don't seem it mentioned in any of your posts. If you're relying on `cabal repl` and `cabal build` to auto-reconfigure the last version, wouldn't that mean it still uses the previously configured version of GHC? I would try `cabal clean && cabal configure && cabal build && cabal repl`. From omari at smileystation.com Sat May 3 17:53:38 2014 From: omari at smileystation.com (Omari Norman) Date: Sat, 3 May 2014 13:53:38 -0400 Subject: [Haskell-cafe] cabal repl fails with GHC 7.8.2 In-Reply-To: <20140503194417.GB1912@nanodesu.localdomain> References: <20140503164020.GB2607@nanodesu.localdomain> <20140503194417.GB1912@nanodesu.localdomain> Message-ID: On Sat, May 3, 2014 at 1:44 PM, Niklas Haas wrote: > I would try `cabal clean && cabal configure && cabal build && cabal repl`. I tried rm -rf ~/.ghc && rm -rf dist && cabal clean && cabal configure && cabal build && cabal repl Same problem. I also tried downgrading to cabal-1.18.0.3; same problem with GHC 7.8.2. From corentin.dupont at gmail.com Sat May 3 18:02:18 2014 From: corentin.dupont at gmail.com (Corentin Dupont) Date: Sat, 3 May 2014 20:02:18 +0200 Subject: [Haskell-cafe] Composable events: Applicative and Alternative Message-ID: Hi Cafe!! For my game Nomyx, I am using events that the player can program. For example, the player can register a callback that will be triggered when a new player arrives. He can also program some forms (with buttons, checkboxes, textboxes...) to appear on the Web GUI. The problem is those events are not composable: he has to create and handle them one by one. So I'm thinking of making those events composable by making them an instance of Applicative and Alternative. For Applicative, this makes events composable very much like in Applicative-Functors and Reform. I can build neat composed events such as (full program below): onInputMyRecord :: Event MyRecord onInputMyRecord = MyRecord <$> onInputText <*> onInputCheckbox For Alternative, I haven't seen any example of it on the net. The idea is that the first event that fires is used to build the alternative: onInputMyAlternative :: Event Bool onInputMyAlternative = (const True <$> onInputButton) <|> (const False <$> onInputButton) Here is an example program: {-# LANGUAGE GADTs #-} module ComposableEvents where import Control.Applicative import Data.Time import Data.Traversable type PlayerNumber = Int data Event a where OnInputText :: PlayerNumber -> Event String -- A textbox will be created for the player. When filled, this event will fire and return the result OnInputCheckbox :: PlayerNumber -> Event Bool -- Idem with a checkbox OnInputButton :: PlayerNumber -> Event () -- Idem with a button OnTime :: UTCTime -> Event () -- time event EventSum :: Event a -> Event a -> Event a -- The first event to fire will be returned EventProduct :: Event (a -> b) -> Event a -> Event b -- both events should fire, and then the result is returned Fmap :: (a -> b) -> Event a -> Event b -- transforms the value returned by an event. Pure :: a -> Event a -- Create a fake event. The result is useable with no delay. Empty :: Event a -- An event that is never fired. instance Functor Event where fmap = Fmap instance Applicative Event where pure = Pure (<*>) = EventProduct instance Alternative Event where (<|>) = EventSum empty = Empty onInputText = OnInputText onInputCheckbox = OnInputCheckbox onInputButton = OnInputButton onTime = OnTime -- A product type data MyRecord = MyRecord String Bool -- A sum type data MyAlternative = A | B -- Using the Applicative instance, we can build a product type from two separate event results. -- The event callback should be called only when all two events have fired. onInputMyRecord :: Event MyRecord onInputMyRecord = MyRecord <$> onInputText 1 <*> onInputCheckbox 1 -- other possible implementation (given a monad instance) -- onInputMyRecord' = do -- s <- onInputText -- b <- onInputCheckbox -- return $ MyRecord s b -- Using the Alternative instance, we build a sum type. -- The event callback should be called when the first event have fired. onInputMyAlternative :: Event MyAlternative onInputMyAlternative = (const A <$> onInputButton 1) <|> (const B <$> onInputButton 1) allPlayers = [1 .. 10] -- Now complex events can be created, such as voting systems: voteEvent :: UTCTime -> Event ([Maybe Bool]) voteEvent time = sequenceA $ map (singleVote time) allPlayers singleVote :: UTCTime -> PlayerNumber -> Event (Maybe Bool) singleVote timeLimit pn = (Just <$> onInputCheckbox pn) <|> (const Nothing <$> onTime timeLimit) vote :: UTCTime -> Event Bool vote timeLimit = unanimity <$> (voteEvent timeLimit) unanimity :: [Maybe Bool] -> Bool unanimity = all (== Just True) --Evaluation --evalEvent :: Event a -> State Game a --evalEvent = undefined With this DSL, I can create complex events such as time limited votes very neatly... There is much left to do for a full implem: the way to register callbacks on complex events, the evaluator and the event manager. Have you heard about a similar implementation? It seems pretty useful. Maybe in FRP frameworks? Thanks a lot!! Corentin PS: I copied this example also in https://github.com/cdupont/Nomyx-design/blob/master/ComposableEvents.hs. -------------- next part -------------- An HTML attachment was scrubbed... URL: From vogt.adam at gmail.com Sat May 3 18:23:21 2014 From: vogt.adam at gmail.com (adam vogt) Date: Sat, 3 May 2014 14:23:21 -0400 Subject: [Haskell-cafe] cabal repl fails with GHC 7.8.2 In-Reply-To: References: <20140503164020.GB2607@nanodesu.localdomain> <20140503194417.GB1912@nanodesu.localdomain> Message-ID: Hello Omari, I think I've seen what might be the same issue. Could you try adding a cc-options: -fPIC like: https://github.com/aavogt/HOpenCV/blob/master/HOpenCV.cabal#L83 ? Regards, Adam On Sat, May 3, 2014 at 1:53 PM, Omari Norman wrote: > On Sat, May 3, 2014 at 1:44 PM, Niklas Haas wrote: >> I would try `cabal clean && cabal configure && cabal build && cabal repl`. > > I tried > > rm -rf ~/.ghc && rm -rf dist && cabal clean && cabal configure && > cabal build && cabal repl > > Same problem. > > I also tried downgrading to cabal-1.18.0.3; same problem with GHC 7.8.2. > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From omari at smileystation.com Sat May 3 18:58:28 2014 From: omari at smileystation.com (Omari Norman) Date: Sat, 3 May 2014 14:58:28 -0400 Subject: [Haskell-cafe] cabal repl fails with GHC 7.8.2 In-Reply-To: References: <20140503164020.GB2607@nanodesu.localdomain> <20140503194417.GB1912@nanodesu.localdomain> Message-ID: Hi Adam, On Sat, May 3, 2014 at 2:23 PM, adam vogt wrote: > I think I've seen what might be the same issue. Could you try adding a > cc-options: -fPIC like: > https://github.com/aavogt/HOpenCV/blob/master/HOpenCV.cabal#L83 ? Now I get Loading object (static) dist/build/decnumber/src/decDouble.o ... ghc: panic! (the 'impossible' happened) (GHC version 7.8.2 for x86_64-unknown-linux): Loading temp shared object failed: /tmp/ghc414_0/ghc414_1.so: undefined symbol: BCD2DPD Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug Thanks, Omari From vogt.adam at gmail.com Sat May 3 20:53:33 2014 From: vogt.adam at gmail.com (adam vogt) Date: Sat, 3 May 2014 16:53:33 -0400 Subject: [Haskell-cafe] cabal repl fails with GHC 7.8.2 In-Reply-To: References: <20140503164020.GB2607@nanodesu.localdomain> <20140503194417.GB1912@nanodesu.localdomain> Message-ID: On Sat, May 3, 2014 at 2:58 PM, Omari Norman wrote: > Hi Adam, > > On Sat, May 3, 2014 at 2:23 PM, adam vogt wrote: > >> I think I've seen what might be the same issue. Could you try adding a >> cc-options: -fPIC like: >> https://github.com/aavogt/HOpenCV/blob/master/HOpenCV.cabal#L83 ? > > Now I get > > Loading object (static) dist/build/decnumber/src/decDouble.o ... ghc: > panic! (the 'impossible' happened) > (GHC version 7.8.2 for x86_64-unknown-linux): > Loading temp shared object failed: /tmp/ghc414_0/ghc414_1.so: > undefined symbol: BCD2DPD > > Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug > Hi Omari, I had a look at deka. It seems you need to list the decContext.c and decQuad.c in the other order in the cabal file to make the .o files show up in the right order in the call to ghc (you can see it with cabal repl -v). If anything it is odd that ghc-7.6 accepts the objects in the "wrong" order. Regards, Adam From carter.schonwald at gmail.com Sat May 3 21:54:02 2014 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Sat, 3 May 2014 17:54:02 -0400 Subject: [Haskell-cafe] cabal repl fails with GHC 7.8.2 In-Reply-To: References: <20140503164020.GB2607@nanodesu.localdomain> <20140503194417.GB1912@nanodesu.localdomain> Message-ID: sounds like you have a stale / cabal 1.16 style ~/.cabal/config could you do "mv ~/.cabal/config ~/.cabal/config-old ; cabal update " then rebuild the universe? On Sat, May 3, 2014 at 4:53 PM, adam vogt wrote: > On Sat, May 3, 2014 at 2:58 PM, Omari Norman > wrote: > > Hi Adam, > > > > On Sat, May 3, 2014 at 2:23 PM, adam vogt wrote: > > > >> I think I've seen what might be the same issue. Could you try adding a > >> cc-options: -fPIC like: > >> https://github.com/aavogt/HOpenCV/blob/master/HOpenCV.cabal#L83 ? > > > > Now I get > > > > Loading object (static) dist/build/decnumber/src/decDouble.o ... ghc: > > panic! (the 'impossible' happened) > > (GHC version 7.8.2 for x86_64-unknown-linux): > > Loading temp shared object failed: /tmp/ghc414_0/ghc414_1.so: > > undefined symbol: BCD2DPD > > > > Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug > > > > Hi Omari, > > I had a look at deka. It seems you need to list the decContext.c and > decQuad.c in the other order in the cabal file to make the .o files > show up in the right order in the call to ghc (you can see it with > cabal repl -v). > > If anything it is odd that ghc-7.6 accepts the objects in the "wrong" > order. > > Regards, > Adam > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ian.tuomi at aalto.fi Sat May 3 22:07:51 2014 From: ian.tuomi at aalto.fi (Ian Tuomi) Date: Sun, 4 May 2014 01:07:51 +0300 Subject: [Haskell-cafe] Haskell Programming Font with Ligatures In-Reply-To: References: <1025dd06-1b73-435c-902b-302a654fd1c0@googlegroups.com> <8c27a5dd-f8a1-44bd-8882-d3f3092fb7d9@googlegroups.com> Message-ID: <48A92C0E-7C03-4A41-8B9C-0B1C8FE8EAFA@aalto.fi> On 1 May 2014, at 22:33, Evan Laforge wrote: > Just to verify, this only works in those few terminals that support > ligatures in fixed-width fonts, right? Correct. It seems OSX would give you ligatures "for free" with the included text rendering, but most terminals implement text in some other more complicated way. > I tried on OSX with iTerm2 and > no ligatures are rendered, just separate characters. But it's on the > "not supported" list so no surprise. Anyone happen know how to get OS > X font rendering to do it? The iterm guys are very responsive to > feature requests or patches. I tried, see https://code.google.com/p/iterm2/issues/detail?id=2974 for more information. -Ian From omari at smileystation.com Sun May 4 01:32:10 2014 From: omari at smileystation.com (Omari Norman) Date: Sat, 3 May 2014 21:32:10 -0400 Subject: [Haskell-cafe] cabal repl fails with GHC 7.8.2 In-Reply-To: References: <20140503164020.GB2607@nanodesu.localdomain> <20140503194417.GB1912@nanodesu.localdomain> Message-ID: On Sat, May 3, 2014 at 5:54 PM, Carter Schonwald wrote: > sounds like you have a stale / cabal 1.16 style ~/.cabal/config > > could you do "mv ~/.cabal/config ~/.cabal/config-old ; cabal update " > > then rebuild the universe? Unfortunately that didn't help anything. From omari at smileystation.com Sun May 4 01:34:50 2014 From: omari at smileystation.com (Omari Norman) Date: Sat, 3 May 2014 21:34:50 -0400 Subject: [Haskell-cafe] cabal repl fails with GHC 7.8.2 In-Reply-To: References: <20140503164020.GB2607@nanodesu.localdomain> <20140503194417.GB1912@nanodesu.localdomain> Message-ID: > I had a look at deka. It seems you need to list the decContext.c and > decQuad.c in the other order in the cabal file to make the .o files > show up in the right order in the call to ghc (you can see it with > cabal repl -v). Indeed, flipping the two and adding -fPIC to cc-options: in the cabal file made cabal repl work. Thanks a bunch. The version I'm working on now links in several more C object files and I'm having the same problem there; I am reading up on linkers and fiddling around with it. From omari at smileystation.com Sun May 4 02:32:29 2014 From: omari at smileystation.com (Omari Norman) Date: Sat, 3 May 2014 22:32:29 -0400 Subject: [Haskell-cafe] cabal repl fails with GHC 7.8.2 In-Reply-To: References: <20140503164020.GB2607@nanodesu.localdomain> <20140503194417.GB1912@nanodesu.localdomain> Message-ID: On Sat, May 3, 2014 at 9:34 PM, Omari Norman wrote: >> I had a look at deka. It seems you need to list the decContext.c and >> decQuad.c in the other order in the cabal file to make the .o files >> show up in the right order in the call to ghc (you can see it with >> cabal repl -v). > > Indeed, flipping the two and adding -fPIC to cc-options: in the cabal > file made cabal repl work. Thanks a bunch. > > The version I'm working on now links in several more C object files > and I'm having the same problem there; I am reading up on linkers and > fiddling around with it. What I figured out is that cabal and/or ghci need to have the C object files listed so that the earlier object files provide the symbols that are needed by the later object files. This is the opposite order one would expect with a linker, where it is generally best to list object files with undefined symbols first, and then list the libraries that provide those objects later. This sort of cycle fixes the problem: 1. Get error message 2. Use grep and nm to rummage around in dist/build/**/*.o to see what object file provides the missing symbol 3. Rearrange your c-sources to put the needed file earlier 4. Repeat The library I'm using has no circular dependencies, so I got it working this way. No -fPIC is needed. It seems the C object files are loaded statically and GHCi will not keep track of undefined symbols and wait to find them later. Why earlier versions did this is unclear; as the error message suggests I will file a bug. Thanks everybody for your help! --Omari From agocorona at gmail.com Sun May 4 08:15:33 2014 From: agocorona at gmail.com (Alberto G. Corona ) Date: Sun, 4 May 2014 10:15:33 +0200 Subject: [Haskell-cafe] extensible records - Vinyl - alternatives? In-Reply-To: References: Message-ID: Are there any lens implementation of OOHaskell?. That would produce a massive exodus from the OO comunity to haskell. 2014-05-03 18:54 GMT+02:00 adam vogt : > Hello Peter, > > Could you show what you mean by "named labels"? > > Vinyl is a fine choice, but have you looked at HList >= 0.3? The > lenses/labels done with Data.HList.Labelable are prettier than the > vinyl alternative in my biased opinion. Furthermore, they support > changing types in the record unlike vinyl (ie. they provide a Lens > not Lens'). > > HList is a bit slow at compile time > if you make > records with many fields. That situation may improve soon if we take > advantage of the ordering on Symbol that ghc-7.8 introduced. In other > words, we will probably follow the lead of > and make Records sorted by > their labels. > > There are quite a few other libraries > >. > Also consider lens' makeClassy as another solution to the records > problem. > > Regards, > Adam > > On Sat, May 3, 2014 at 6:16 AM, Peter Althainz wrote: > > Dear All, > > > > I'm searching a handsome library for handling large amounts of > configuration > > data in a flexible manner. So to speak I want to use some kind of > > inheritance of data fields. I think this is where the extensible records > > discussion is a proper description of my use case. > > > > I've found 2 libraries making this work, so far: > > > > HList > > Vinyl > > > > I currently prefer Vinyl due to the complex types in HList, lens > > compatibiliy, named labels. (I love the HList and OOHaskel papers, but > for > > practical use, I currently prefer Vinyl). > > > > What do you think, what is the best way nowadays to use extensible > records? > > Is Vinyl a good choice from your point of view? > > > > regards > > Peter > > > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://www.haskell.org/mailman/listinfo/haskell-cafe > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -- Alberto. -------------- next part -------------- An HTML attachment was scrubbed... URL: From s.j.thompson at kent.ac.uk Sun May 4 09:49:07 2014 From: s.j.thompson at kent.ac.uk (Simon Thompson) Date: Sun, 4 May 2014 10:49:07 +0100 Subject: [Haskell-cafe] Fwd: SBLP 2014 new deadline References: <201405031440.s43EeLbG002505@easychair.org> Message-ID: CALL FOR PAPERS - NEW DEADLINE: May 23rd 18th Brazilian Symposium on Programming Languages (SBLP 2014) A member of CBSoft joint conference http://www.ic.ufal.br/evento/cbsoft2014/ to be held in Maceio, Brazil. SBLP happens on Thursday, Oct 2nd, and Friday, Oct 3rd. CBSoft dates are September 28, 2014 to October 3, 2014 This CFP is also available at the webpage of the event: http://www.ic.ufal.br/evento/cbsoft2014/en/call-for-papers-sblp.html IMPORTANT DATES Paper abstract submission: May 23rd, 2014 Full paper submission: May 23rd, 2014 Notification of acceptance: June 27th, 2014 Final papers due: July 11th, 2014 INTRODUCTION The 18th Brazilian Symposium on Programming Languages, SBLP 2014, will be held in Maceio, a beautiful city in the Northeastern part of Brazil. The conference will happen on October 2nd, and October 3rd, 2014. SBLP provides a venue for researchers and practitioners interested in the fundamental principles and innovations in the design and implementation of programming languages and systems. SBLP 2014 invites authors to contribute with technical papers related (but not limited) to: * Program generation and transformation, including domain-specific languages and model-driven development in the context of programming languages. * Programming paradigms and styles, including functional, object-oriented, aspect-oriented, scripting languages, real-time, service-oriented, multithreaded, parallel, and distributed programming. * Formal semantics and theoretical foundations, including denotational, operational, algebraic and categorical. * Program analysis and verification, including type systems, static analysis and abstract interpretation. * Programming language design and implementation, including new programming models, programming language environments, compilation and interpretation techniques. SUBMISSIONS Contributions should be written in Portuguese or English. Papers should fall into one of two different categories: full papers, with at most 15 pages, or short papers, with at most 5 pages. Accepted papers written in English will be published in a volume of Lecture Notes in Computer Science (LNCS), by Springer. For this reason, all papers must be prepared using the LNCS template, available at http://www.springer.com/computer/lncs?SGWID=0-164-6-793341-0. We encourage the submission of short papers reporting partial results of on-going master dissertations or doctoral theses. Submissions should be done through the SBLP 2014 page at EasyChair, which is available at http://www.easychair.org/conferences/?conf=sblp2014. As in previous editions, a journal's special issue, with selected papers from accepted contributions, is anticipated. Selected papers from the 2003 to the 2008 editions of SBLP were published in special issues of the Journal of Universal Computer Science, by Springer. The post-proceedings of SBLP from 2009 to 2012, also with selected papers from the conference, have been published as special issues of Science of Computer Programming, by Elsevier. KEYNOTE SPEAKERS Louis-Noel Pouchet, University of California Los Angeles Fabrice Rastello, INRIA PROGRAMME CHAIR Fernando Magno Quintao Pereira, UFMG PROGRAMME COMMITTEE Alberto Pardo, Universidad de la Republica Alex Garcia, IME Alvaro Moreira, Federal University of Rio Grande do Sul Andre Rauber Du Bois, Federal University of Pelotas Carlos Camar??o, Federal University of Minas Gerais Christiano Braga, Fluminense Federal University Fabio Mascarenhas, Federal University of Rio de Janeiro Fabrice Rastello, INRIA Fernando Pereira, Federal University of Minas Gerais Fernando Castor, Federal University of Pernambuco Francisco Carvalho-Junior, Federal University of Ceara Hans-Wolfgang Loidl, Heriot-Watt University Jeremy Singer University of Glasgow Jo??o Saraiva, University of Minho Joao F. Ferreira, Teesside University Louis-Noel Pouchet, University of California, Los Angeles Lucilia Figueiredo, Federal University of Ouro Preto Luis Barbosa, University of Minho Manuel A. Martins, University of Aveiro Marcello Bonsangue, Leiden University Marcelo Maia, Federal University of Uberlandia Marcelo D'Amorim, Federal University of Pernambuco Mariza Bigonha, Federal University of Minas Gerais Martin Musicante, Federal University of Rio Grande do Norte Noemi Rodriguez, PUC-Rio Peter Mosses, Swansea University Rafael Lins, Federal University of Pernambuco Renato Cerqueira, PUC-Rio Roberto Bigonha, Federal University of Minas Gerais Roberto Ierusalimschy PUC-Rio Rodrigo Geraldo, Federal University of Ouro Preto Sandro Rigo, State University of Campinas Sergio Medeiros, Federal University of Rio Grande do Norte Simon Thompson, University of Kent Varmo Vene, University of Tartu Zongyan Qiu Peking University Simon Thompson | Professor of Logic and Computation School of Computing | University of Kent | Canterbury, CT2 7NF, UK s.j.thompson at kent.ac.uk | M +44 7986 085754 | W www.cs.kent.ac.uk/~sjt From tim at dockerz.net Sun May 4 11:10:00 2014 From: tim at dockerz.net (Tim Docker) Date: Sun, 4 May 2014 21:10:00 +1000 Subject: [Haskell-cafe] Experimenting a new plotting library In-Reply-To: References: Message-ID: On 3 May 2014, at 7:44 am, Kai Zhang wrote: > 1. There is few plotting library written in pure Haskell > 2. Haskell-chart, one of the most featured library, is hard to extend and there is no straightforward way to compose or modify the plots generated by this library. The chart library is pure haskell when using the diagrams backend. What do you mean by compose or modify the plots? It?s reasonably straightforward to have it produce a diagram, which can then be composed or modified with any of the diagrams tools. Some sample code is shown below. Tim (chart library maintainer) {-# LANGUAGE FlexibleContexts #-} import Graphics.Rendering.Chart import Data.Colour import Data.Colour.Names import Data.Colour.SRGB import Control.Lens import Data.Default.Class import Graphics.Rendering.Chart.Backend.Diagrams import qualified Diagrams.Prelude as D import qualified Diagrams.Backend.SVG as D chart :: Renderable (LayoutPick Double Double Double) chart = layoutToRenderable $ layout_title .~ "Amplitude Modulation" $ layout_plots .~ [toPlot sinusoid1] $ layout_plot_background .~ Just (solidFillStyle $ opaque white) $ def where am x = (sin (x*pi/45) + 1) / 2 * (sin (x*pi/5)) sinusoid1 = plot_lines_values .~ [[ (x,(am x)) | x <- [0,(0.5)..400]]] $ plot_lines_style .~ solidLine 1 (opaque blue) $ plot_lines_title .~"am" $ def mkDiagram :: (D.Backend b D.R2, D.Renderable (D.Path D.R2) b) => IO (D.Diagram b D.R2) mkDiagram = do env <- defaultEnv vectorAlignmentFns 800 400 return (fst (runBackendR env chart)) From mantkiew at gsd.uwaterloo.ca Sun May 4 12:56:35 2014 From: mantkiew at gsd.uwaterloo.ca (mantkiew at gsd.uwaterloo.ca) Date: Sun, 04 May 2014 08:56:35 -0400 Subject: [Haskell-cafe] extensible records - Vinyl - alternatives? In-Reply-To: References: Message-ID: <20140504125635.6004884.62257.6866@gsd.uwaterloo.ca> An HTML attachment was scrubbed... URL: -------------- next part -------------- _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe at haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe From omari at smileystation.com Sun May 4 13:28:30 2014 From: omari at smileystation.com (Omari Norman) Date: Sun, 4 May 2014 09:28:30 -0400 Subject: [Haskell-cafe] cabal repl fails with GHC 7.8.2 In-Reply-To: References: <20140503164020.GB2607@nanodesu.localdomain> <20140503194417.GB1912@nanodesu.localdomain> Message-ID: On Sat, May 3, 2014 at 10:32 PM, Omari Norman wrote: > What I figured out is that cabal and/or ghci need to have the C object > files listed so that the earlier object files provide the symbols that > are needed by the later object files. This is the opposite order one > would expect with a linker, where it is generally best to list object > files with undefined symbols first, and then list the libraries that > provide those objects later. > > This sort of cycle fixes the problem: > > 1. Get error message > 2. Use grep and nm to rummage around in dist/build/**/*.o to see what > object file provides the missing symbol > 3. Rearrange your c-sources to put the needed file earlier > 4. Repeat > > The library I'm using has no circular dependencies, so I got it > working this way. No -fPIC is needed. My mistake - in addition, you do need to have the cc-options: -fPIC in the .cabal file. Bug here: http://ghc.haskell.org/trac/ghc/ticket/9074 From job.vranish at gmail.com Sun May 4 16:00:47 2014 From: job.vranish at gmail.com (Job Vranish) Date: Sun, 4 May 2014 12:00:47 -0400 Subject: [Haskell-cafe] wanted: Function to break circular data dependencies Message-ID: Is a function like the following possible?: avoidCircularDataDependency :: a -> a -> a avoidCircularDataDependency a b = ? I want avoidCircularDataDependency to evaluate 'a', but if in the process of evaluating 'a' its own result is demanded (which normally would result in an infinite loop) it returns 'b' otherwise it returns 'a' . I've often found myself wanting a function like this. It would make certain kinds of knot-tying/cycle detection _much_ easier. Is there any reason why this function can't/shouldn't exist? - Job -------------- next part -------------- An HTML attachment was scrubbed... URL: From corentin.dupont at gmail.com Sun May 4 16:36:19 2014 From: corentin.dupont at gmail.com (Corentin Dupont) Date: Sun, 4 May 2014 18:36:19 +0200 Subject: [Haskell-cafe] wanted: Function to break circular data dependencies In-Reply-To: References: Message-ID: Not all recursive functions are infinite loops... In general it's impossible to detect an infinite loop: it's the "Halting Problem". IMO, the only way to do that is with a watchdog. You launch the evaluation in a separate thread, watch it, and if it doesn't finish you kill it and return a default value. But maybe it's also possible to forbid any recursive program by analysing the AST? I've used a watchdog in Nomyx (inspired from Mueval): --Sets a watchdog to kill the evaluation thread if it doesn't finishes. -- The function starts both the evaluation thread and the watchdog thread, and blocks awaiting the result. -- Option 1: the evaluation thread finishes before the watchdog. The MVar is filled with the result, -- which unblocks the main thread. The watchdog then finishes latter, and fills the MVar with Nothing. -- Option 2: the watchdog finishes before the evaluation thread. The eval thread is killed, and the -- MVar is filled with Nothing, which unblocks the main thread. The watchdog finishes. evalWithWatchdog' :: NFData a => IO a -> IO (Maybe a) evalWithWatchdog' s = do mvar <- newEmptyMVar hSetBuffering stdout NoBuffering --start evaluation thread id <- forkOS $ do s' <- s let s'' = force s' putMVar mvar (Just s'') --start watchdog thread forkIO $ watchDog 3 id mvar takeMVar mvar -- | Fork off a thread which will sleep and then kill off the specified thread. watchDog :: Int -> ThreadId -> MVar (Maybe a) -> IO () watchDog tout tid mvar = do threadDelay (tout * 1000000) killThread tid putMVar mvar Nothing On Sun, May 4, 2014 at 6:00 PM, Job Vranish wrote: > Is a function like the following possible?: > > avoidCircularDataDependency :: a -> a -> a > avoidCircularDataDependency a b = ? > > I want avoidCircularDataDependency to evaluate 'a', but if in the process > of evaluating 'a' its own result is demanded (which normally would result > in an infinite loop) it returns 'b' otherwise it returns 'a' . > > I've often found myself wanting a function like this. It would make > certain kinds of knot-tying/cycle detection _much_ easier. > > Is there any reason why this function can't/shouldn't exist? > > > - Job > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kai at kzhang.org Sun May 4 17:58:35 2014 From: kai at kzhang.org (Kai Zhang) Date: Sun, 4 May 2014 10:58:35 -0700 Subject: [Haskell-cafe] Experimenting a new plotting library In-Reply-To: References: Message-ID: Hi Tim, Thank you for commenting. As I said before, Chart is a wonderful library. Although it has most features we need, I personally feel that it's cumbersome to make plots or define new plots by Chart. So I would like to experiment a new library which makes this process more natural and intuitive. For example, to make a plot, we can 1. generate axes from data by calling: xAxis = realAxis rangeOfX padding opts yAxis = realAxis rangeOfY padding opts 2. Assemble axes: area = plotArea 5.5 4.8 ( yAxis -- left axis , def -- top axis, using default axis which is a line , def -- right axis , xAxis -- bottom axis ) 3. make delayed plots which are functions. Given a point map provided by plot area, they can generate actual plots. ps = points xs ys def l = line xs ys def 3. attach any number and any types of plots to plot area: plot = area <+ (ps, BL) <+ (l, BL) We have four axes in plot area, so you can attach plots to plot area by any two of the axes, for example, you can do area <+ (ps, BR) <+ (l, BL) <+ (l, TL) <+ (l, TR) Each intermediate step can be easily customized separately and independently without worrying about other parts. And styling can be done by calling APIs of Diagrams. On Sun, May 4, 2014 at 4:10 AM, Tim Docker wrote: > > On 3 May 2014, at 7:44 am, Kai Zhang wrote: > > > 1. There is few plotting library written in pure Haskell > > 2. Haskell-chart, one of the most featured library, is hard to extend > and there is no straightforward way to compose or modify the plots > generated by this library. > > The chart library is pure haskell when using the diagrams backend. > > What do you mean by compose or modify the plots? It?s reasonably > straightforward to have it produce a diagram, which can then be composed or > modified with any of the diagrams tools. Some sample code is shown below. > > Tim (chart library maintainer) > > > {-# LANGUAGE FlexibleContexts #-} > import Graphics.Rendering.Chart > import Data.Colour > import Data.Colour.Names > import Data.Colour.SRGB > import Control.Lens > import Data.Default.Class > > import Graphics.Rendering.Chart.Backend.Diagrams > import qualified Diagrams.Prelude as D > import qualified Diagrams.Backend.SVG as D > > chart :: Renderable (LayoutPick Double Double Double) > chart = layoutToRenderable > $ layout_title .~ "Amplitude Modulation" > $ layout_plots .~ [toPlot sinusoid1] > $ layout_plot_background .~ Just (solidFillStyle $ opaque white) > $ def > where > am x = (sin (x*pi/45) + 1) / 2 * (sin (x*pi/5)) > > sinusoid1 = plot_lines_values .~ [[ (x,(am x)) | x <- [0,(0.5)..400]]] > $ plot_lines_style .~ solidLine 1 (opaque blue) > $ plot_lines_title .~"am" > $ def > > mkDiagram :: (D.Backend b D.R2, D.Renderable (D.Path D.R2) b) => IO > (D.Diagram b D.R2) > mkDiagram = do > env <- defaultEnv vectorAlignmentFns 800 400 > return (fst (runBackendR env chart)) > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From joeyadams3.14159 at gmail.com Sun May 4 18:46:39 2014 From: joeyadams3.14159 at gmail.com (Joey Adams) Date: Sun, 4 May 2014 14:46:39 -0400 Subject: [Haskell-cafe] wanted: Function to break circular data dependencies In-Reply-To: References: Message-ID: Job isn't trying to solve the halting problem, but to catch a specific type of infinite loop--an expression that demands itself in its own evaluation. Example: fix (\n -> n+1) :: Int This produces an infinite loop (or throws NonTermination) because to evaluate n, you have to evaluate n and then do something to the result. On Sun, May 4, 2014 at 12:36 PM, Corentin Dupont wrote: > Not all recursive functions are infinite loops... In general it's > impossible to detect an infinite loop: it's the "Halting Problem". > IMO, the only way to do that is with a watchdog. You launch the evaluation > in a separate thread, watch it, and if it doesn't finish you kill it and > return a default value. > But maybe it's also possible to forbid any recursive program by analysing > the AST? > > I've used a watchdog in Nomyx (inspired from Mueval): > > --Sets a watchdog to kill the evaluation thread if it doesn't finishes. > -- The function starts both the evaluation thread and the watchdog thread, > and blocks awaiting the result. > -- Option 1: the evaluation thread finishes before the watchdog. The MVar > is filled with the result, > -- which unblocks the main thread. The watchdog then finishes latter, and > fills the MVar with Nothing. > -- Option 2: the watchdog finishes before the evaluation thread. The eval > thread is killed, and the > -- MVar is filled with Nothing, which unblocks the main thread. The > watchdog finishes. > evalWithWatchdog' :: NFData a => IO a -> IO (Maybe a) > evalWithWatchdog' s = do > mvar <- newEmptyMVar > hSetBuffering stdout NoBuffering > --start evaluation thread > id <- forkOS $ do > s' <- s > let s'' = force s' > putMVar mvar (Just s'') > --start watchdog thread > forkIO $ watchDog 3 id mvar > takeMVar mvar > -- | Fork off a thread which will sleep and then kill off the specified > thread. > watchDog :: Int -> ThreadId -> MVar (Maybe a) -> IO () > watchDog tout tid mvar = do > threadDelay (tout * 1000000) > killThread tid > putMVar mvar Nothing > > > On Sun, May 4, 2014 at 6:00 PM, Job Vranish wrote: > >> Is a function like the following possible?: >> >> avoidCircularDataDependency :: a -> a -> a >> avoidCircularDataDependency a b = ? >> >> I want avoidCircularDataDependency to evaluate 'a', but if in the process >> of evaluating 'a' its own result is demanded (which normally would result >> in an infinite loop) it returns 'b' otherwise it returns 'a' . >> >> I've often found myself wanting a function like this. It would make >> certain kinds of knot-tying/cycle detection _much_ easier. >> >> Is there any reason why this function can't/shouldn't exist? >> >> >> - Job >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> >> > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben.franksen at online.de Sun May 4 18:56:09 2014 From: ben.franksen at online.de (Ben Franksen) Date: Sun, 04 May 2014 20:56:09 +0200 Subject: [Haskell-cafe] wanted: Function to break circular data dependencies References: Message-ID: Doesn't ghc detect this with "black holes" or something? Maybe just catch http://hackage.haskell.org/package/base-4.7.0.0/docs/Control-Exception.html#t:NonTermination ? Cheers Ben Joey Adams wrote: > Job isn't trying to solve the halting problem, but to catch a specific > type of infinite loop--an expression that demands itself in its own > evaluation. Example: > > fix (\n -> n+1) :: Int > > This produces an infinite loop (or throws NonTermination) because to > evaluate n, you have to evaluate n and then do something to the result. > > On Sun, May 4, 2014 at 12:36 PM, Corentin Dupont > wrote: > >> Not all recursive functions are infinite loops... In general it's >> impossible to detect an infinite loop: it's the "Halting Problem". >> IMO, the only way to do that is with a watchdog. You launch the >> evaluation in a separate thread, watch it, and if it doesn't finish you >> kill it and return a default value. >> But maybe it's also possible to forbid any recursive program by analysing >> the AST? >> >> I've used a watchdog in Nomyx (inspired from Mueval): >> >> --Sets a watchdog to kill the evaluation thread if it doesn't finishes. >> -- The function starts both the evaluation thread and the watchdog >> thread, and blocks awaiting the result. >> -- Option 1: the evaluation thread finishes before the watchdog. The MVar >> is filled with the result, >> -- which unblocks the main thread. The watchdog then finishes latter, >> and fills the MVar with Nothing. >> -- Option 2: the watchdog finishes before the evaluation thread. The eval >> thread is killed, and the >> -- MVar is filled with Nothing, which unblocks the main thread. The >> watchdog finishes. >> evalWithWatchdog' :: NFData a => IO a -> IO (Maybe a) >> evalWithWatchdog' s = do >> mvar <- newEmptyMVar >> hSetBuffering stdout NoBuffering >> --start evaluation thread >> id <- forkOS $ do >> s' <- s >> let s'' = force s' >> putMVar mvar (Just s'') >> --start watchdog thread >> forkIO $ watchDog 3 id mvar >> takeMVar mvar >> -- | Fork off a thread which will sleep and then kill off the specified >> thread. >> watchDog :: Int -> ThreadId -> MVar (Maybe a) -> IO () >> watchDog tout tid mvar = do >> threadDelay (tout * 1000000) >> killThread tid >> putMVar mvar Nothing >> >> >> On Sun, May 4, 2014 at 6:00 PM, Job Vranish >> wrote: >> >>> Is a function like the following possible?: >>> >>> avoidCircularDataDependency :: a -> a -> a >>> avoidCircularDataDependency a b = ? >>> >>> I want avoidCircularDataDependency to evaluate 'a', but if in the >>> process of evaluating 'a' its own result is demanded (which normally >>> would result in an infinite loop) it returns 'b' otherwise it returns >>> 'a' . >>> >>> I've often found myself wanting a function like this. It would make >>> certain kinds of knot-tying/cycle detection _much_ easier. >>> >>> Is there any reason why this function can't/shouldn't exist? >>> >>> >>> - Job >>> >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://www.haskell.org/mailman/listinfo/haskell-cafe >>> >>> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> >> -- "Make it so they have to reboot after every typo." -- Scott Adams From mathijs at bluescreen303.nl Sun May 4 19:39:52 2014 From: mathijs at bluescreen303.nl (Mathijs Kwik) Date: Sun, 04 May 2014 21:39:52 +0200 Subject: [Haskell-cafe] wanted: Function to break circular data dependencies In-Reply-To: (Joey Adams's message of "Sun, 4 May 2014 14:46:39 -0400") References: Message-ID: <87fvkptjsn.fsf@bluescreen303.nl> Joey Adams writes: > Job isn't trying to solve the halting problem, but to catch a specific type > of infinite loop--an expression that demands itself in its own evaluation. > Example: > > fix (\n -> n+1) :: Int An expression that demands itself isn't necessarily an infinite loop either. So this still boils down to the halting problem. a :: [Int] a = [length a * 2, length a * 3, length a * 4] > > This produces an infinite loop (or throws NonTermination) because to > evaluate n, you have to evaluate n and then do something to the result. > > On Sun, May 4, 2014 at 12:36 PM, Corentin Dupont > wrote: > >> Not all recursive functions are infinite loops... In general it's >> impossible to detect an infinite loop: it's the "Halting Problem". >> IMO, the only way to do that is with a watchdog. You launch the evaluation >> in a separate thread, watch it, and if it doesn't finish you kill it and >> return a default value. >> But maybe it's also possible to forbid any recursive program by analysing >> the AST? >> >> I've used a watchdog in Nomyx (inspired from Mueval): >> >> --Sets a watchdog to kill the evaluation thread if it doesn't finishes. >> -- The function starts both the evaluation thread and the watchdog thread, >> and blocks awaiting the result. >> -- Option 1: the evaluation thread finishes before the watchdog. The MVar >> is filled with the result, >> -- which unblocks the main thread. The watchdog then finishes latter, and >> fills the MVar with Nothing. >> -- Option 2: the watchdog finishes before the evaluation thread. The eval >> thread is killed, and the >> -- MVar is filled with Nothing, which unblocks the main thread. The >> watchdog finishes. >> evalWithWatchdog' :: NFData a => IO a -> IO (Maybe a) >> evalWithWatchdog' s = do >> mvar <- newEmptyMVar >> hSetBuffering stdout NoBuffering >> --start evaluation thread >> id <- forkOS $ do >> s' <- s >> let s'' = force s' >> putMVar mvar (Just s'') >> --start watchdog thread >> forkIO $ watchDog 3 id mvar >> takeMVar mvar >> -- | Fork off a thread which will sleep and then kill off the specified >> thread. >> watchDog :: Int -> ThreadId -> MVar (Maybe a) -> IO () >> watchDog tout tid mvar = do >> threadDelay (tout * 1000000) >> killThread tid >> putMVar mvar Nothing >> >> >> On Sun, May 4, 2014 at 6:00 PM, Job Vranish wrote: >> >>> Is a function like the following possible?: >>> >>> avoidCircularDataDependency :: a -> a -> a >>> avoidCircularDataDependency a b = ? >>> >>> I want avoidCircularDataDependency to evaluate 'a', but if in the process >>> of evaluating 'a' its own result is demanded (which normally would result >>> in an infinite loop) it returns 'b' otherwise it returns 'a' . >>> >>> I've often found myself wanting a function like this. It would make >>> certain kinds of knot-tying/cycle detection _much_ easier. >>> >>> Is there any reason why this function can't/shouldn't exist? >>> >>> >>> - Job >>> >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://www.haskell.org/mailman/listinfo/haskell-cafe >>> >>> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> >> > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From alois.cochard at gmail.com Sun May 4 19:47:17 2014 From: alois.cochard at gmail.com (Alois Cochard) Date: Sun, 4 May 2014 20:47:17 +0100 Subject: [Haskell-cafe] [ANN] codex 0.0.2 - generate tags file from dependencies Message-ID: Hi, Just to let you know that I released a new version of 'codex' (a tool which allow to generate a tags[1] file for a given cabal project using the sources of all the dependencies of that project). The main new feature is the support of "workspace resolution", which basically mean that if you have the following projects: ~/projects/foo ~/projects/bar Where 'foo' have a dependency on 'bar'... when you run `codex update` in 'foo' directory it will generate tags using the sources available in the sibling directory 'bar' instead of taking it from hackage (as long as versions match). It's specially useful when working on multiple modules, kudos to Edward Kmett for the original idea. [1]Those tags file basically contain references to functions/types definition in source code and allow "jump to definition" like functionality in text editors. source: http://github.com/aloiscochard/codex hackage: http://hackage.haskell.org/package/codex -- *Alois Cochard* http://twitter.com/aloiscochard http://github.com/aloiscochard -------------- next part -------------- An HTML attachment was scrubbed... URL: From agocorona at gmail.com Sun May 4 20:28:18 2014 From: agocorona at gmail.com (Alberto G. Corona ) Date: Sun, 4 May 2014 22:28:18 +0200 Subject: [Haskell-cafe] extensible records - Vinyl - alternatives? In-Reply-To: <20140504125635.6004884.62257.6866@gsd.uwaterloo.ca> References: <20140504125635.6004884.62257.6866@gsd.uwaterloo.ca> Message-ID: hmmm.. I doubt that the solution mentioned in the link can cover all the cases mentioned in the OOHaskell paper. The best OO EDSL must be something like OOHaskell with nice method invocation syntax. 2014-05-04 14:56 GMT+02:00 : > ?I found this nice stackoverflow answer. > > ? > http://stackoverflow.com/questions/20910331/how-do-i-model-inheritance-in-haskell > > It seems that the "inheritance " pattern proposed there could be nicely > automated, that is have an EDSL allowing me to write > > ``` > Camera inherits Pos, Vel > ``` > > which would get desugared according to the pattern as in the answer. > > Has anybody done anything similar? > > Michal > > *From: *Alberto G. Corona > *Sent: *Sunday, May 4, 2014 4:15 AM > *To: *adam vogt > *Cc: *Peter Althainz; haskell-cafe > *Subject: *Re: [Haskell-cafe] extensible records - Vinyl - alternatives? > > Are there any lens implementation of OOHaskell?. That would produce a > massive exodus from the OO comunity to haskell. > > > 2014-05-03 18:54 GMT+02:00 adam vogt : > >> Hello Peter, >> >> Could you show what you mean by "named labels"? >> >> Vinyl is a fine choice, but have you looked at HList >= 0.3? The >> lenses/labels done with Data.HList.Labelable are prettier than the >> vinyl alternative in my biased opinion. Furthermore, they support >> changing types in the record unlike vinyl (ie. they provide a Lens >> not Lens'). >> >> HList is a bit slow at compile time >> if you make >> records with many fields. That situation may improve soon if we take >> advantage of the ordering on Symbol that ghc-7.8 introduced. In other >> words, we will probably follow the lead of >> and make Records sorted by >> their labels. >> >> There are quite a few other libraries >> < >> http://www.haskell.org/haskellwiki/Extensible_record#Libraries_on_hackage >> >. >> Also consider lens' makeClassy as another solution to the records >> problem. >> >> Regards, >> Adam >> >> On Sat, May 3, 2014 at 6:16 AM, Peter Althainz >> wrote: >> > Dear All, >> > >> > I'm searching a handsome library for handling large amounts of >> configuration >> > data in a flexible manner. So to speak I want to use some kind of >> > inheritance of data fields. I think this is where the extensible records >> > discussion is a proper description of my use case. >> > >> > I've found 2 libraries making this work, so far: >> > >> > HList >> > Vinyl >> > >> > I currently prefer Vinyl due to the complex types in HList, lens >> > compatibiliy, named labels. (I love the HList and OOHaskel papers, but >> for >> > practical use, I currently prefer Vinyl). >> > >> > What do you think, what is the best way nowadays to use extensible >> records? >> > Is Vinyl a good choice from your point of view? >> > >> > regards >> > Peter >> > >> > _______________________________________________ >> > Haskell-Cafe mailing list >> > Haskell-Cafe at haskell.org >> > http://www.haskell.org/mailman/listinfo/haskell-cafe >> > >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> > > > > -- > Alberto. > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -- Alberto. -------------- next part -------------- An HTML attachment was scrubbed... URL: From corentin.dupont at gmail.com Sun May 4 20:34:34 2014 From: corentin.dupont at gmail.com (Corentin Dupont) Date: Sun, 4 May 2014 22:34:34 +0200 Subject: [Haskell-cafe] Quick question on Lens Message-ID: Hello! I have a record like this: data A = { _bs :: [B]} funcA :: State A () funcA = bs ??? funcB funcB :: State B () funcB = ... What lens operator should I use instead of ???, to update all my Bs? Cheers, Corentin -------------- next part -------------- An HTML attachment was scrubbed... URL: From daniel.trstenjak at gmail.com Sun May 4 20:46:05 2014 From: daniel.trstenjak at gmail.com (Daniel Trstenjak) Date: Sun, 4 May 2014 22:46:05 +0200 Subject: [Haskell-cafe] Quick question on Lens In-Reply-To: References: Message-ID: <20140504204605.GA15783@machine> Hi Corentin, On Sun, May 04, 2014 at 10:34:34PM +0200, Corentin Dupont wrote: > I have a record like this: > > data A = { _bs :: [B]} > > funcA :: State A () > funcA = bs ??? funcB > > funcB :: State B () > funcB = ... You might have something like: funcA :: State A () funcA = bs . traversed %= funcB funcB :: B -> B funcB = ... Greetings, Daniel From tim at dockerz.net Sun May 4 21:14:08 2014 From: tim at dockerz.net (Tim Docker) Date: Mon, 5 May 2014 07:14:08 +1000 Subject: [Haskell-cafe] Experimenting a new plotting library In-Reply-To: References: Message-ID: Some of the things that increase the complexity of the chart library are: - strongly typed axes (the library would be somewhat simpler if all axes were just doubles) - achieving a balance between useful defaults and flexibility - constraints between distinct visual elements - the lack of ?first class" text handling in the current diagrams library I?ll follow your experiments with interest. Tim On 5 May 2014, at 3:58 am, Kai Zhang wrote: > Hi Tim, > > Thank you for commenting. As I said before, Chart is a wonderful library. Although it has most features we need, I personally feel that it's cumbersome to make plots or define new plots by Chart. So I would like to experiment a new library which makes this process more natural and intuitive. For example, to make a plot, we can > > 1. generate axes from data by calling: > > xAxis = realAxis rangeOfX padding opts > yAxis = realAxis rangeOfY padding opts > > 2. Assemble axes: > > area = plotArea 5.5 4.8 > ( yAxis -- left axis > , def -- top axis, using default axis which is a line > , def -- right axis > , xAxis -- bottom axis > ) > > 3. make delayed plots which are functions. Given a point map provided by plot area, they can generate actual plots. > > ps = points xs ys def > l = line xs ys def > > 3. attach any number and any types of plots to plot area: > > plot = area <+ (ps, BL) <+ (l, BL) > > We have four axes in plot area, so you can attach plots to plot area by any two of the axes, for example, you can do > > area <+ (ps, BR) <+ (l, BL) <+ (l, TL) <+ (l, TR) > > Each intermediate step can be easily customized separately and independently without worrying about other parts. And styling can be done by calling APIs of Diagrams. > > > On Sun, May 4, 2014 at 4:10 AM, Tim Docker wrote: > > On 3 May 2014, at 7:44 am, Kai Zhang wrote: > > > 1. There is few plotting library written in pure Haskell > > 2. Haskell-chart, one of the most featured library, is hard to extend and there is no straightforward way to compose or modify the plots generated by this library. > > The chart library is pure haskell when using the diagrams backend. > > What do you mean by compose or modify the plots? It?s reasonably straightforward to have it produce a diagram, which can then be composed or modified with any of the diagrams tools. Some sample code is shown below. > > Tim (chart library maintainer) > > > {-# LANGUAGE FlexibleContexts #-} > import Graphics.Rendering.Chart > import Data.Colour > import Data.Colour.Names > import Data.Colour.SRGB > import Control.Lens > import Data.Default.Class > > import Graphics.Rendering.Chart.Backend.Diagrams > import qualified Diagrams.Prelude as D > import qualified Diagrams.Backend.SVG as D > > chart :: Renderable (LayoutPick Double Double Double) > chart = layoutToRenderable > $ layout_title .~ "Amplitude Modulation" > $ layout_plots .~ [toPlot sinusoid1] > $ layout_plot_background .~ Just (solidFillStyle $ opaque white) > $ def > where > am x = (sin (x*pi/45) + 1) / 2 * (sin (x*pi/5)) > > sinusoid1 = plot_lines_values .~ [[ (x,(am x)) | x <- [0,(0.5)..400]]] > $ plot_lines_style .~ solidLine 1 (opaque blue) > $ plot_lines_title .~"am" > $ def > > mkDiagram :: (D.Backend b D.R2, D.Renderable (D.Path D.R2) b) => IO (D.Diagram b D.R2) > mkDiagram = do > env <- defaultEnv vectorAlignmentFns 800 400 > return (fst (runBackendR env chart)) > > From haskell at nand.wakku.to Sun May 4 21:15:39 2014 From: haskell at nand.wakku.to (Niklas Haas) Date: Sun, 4 May 2014 23:15:39 +0200 Subject: [Haskell-cafe] Quick question on Lens In-Reply-To: References: Message-ID: <20140504231539.GB19864@nanodesu.localdomain> On Sun, 4 May 2014 22:34:34 +0200, Corentin Dupont wrote: > Hello! > I have a record like this: > > data A = { _bs :: [B]} > > funcA :: State A () > funcA = bs ??? funcB > > funcB :: State B () > funcB = ... > > What lens operator should I use instead of ???, to update all my Bs? > > Cheers, > Corentin zoom (bs.traverse) :: State B () -> State A () From joeyadams3.14159 at gmail.com Mon May 5 03:39:12 2014 From: joeyadams3.14159 at gmail.com (Joey Adams) Date: Sun, 4 May 2014 23:39:12 -0400 Subject: [Haskell-cafe] wanted: Function to break circular data dependencies In-Reply-To: <87fvkptjsn.fsf@bluescreen303.nl> References: <87fvkptjsn.fsf@bluescreen303.nl> Message-ID: On Sun, May 4, 2014 at 3:39 PM, Mathijs Kwik wrote: > An expression that demands itself isn't necessarily an infinite loop > either. So this still boils down to the halting problem. > > a :: [Int] > a = [length a * 2, length a * 3, length a * 4] > To be more precise, I believe we're looking to catch an expression where evaluating it to head-normal form demands itself already evaluated in head-normal form. In your example, there is no loop because `length a` can be evaluated without evaluating any of the items in `a`. But you get an infinite loop if you make cons strict in the item: {-# LANGUAGE BangPatterns #-} import Prelude hiding (length) -- | List whose cons is strict in the value. data SList a = Nil | Cons !a (SList a) deriving Show infixr 5 `Cons` length :: SList a -> Int length xs0 = go 0 xs0 where go !n Nil = n go !n (Cons _ xs) = go (n+1) xs a :: SList Int a = (length a * 2) `Cons` (length a * 3) `Cons` (length a * 4) `Cons` Nil main :: IO () main = print a -------------- next part -------------- An HTML attachment was scrubbed... URL: From althainz at gmail.com Mon May 5 07:21:35 2014 From: althainz at gmail.com (Peter Althainz) Date: Mon, 5 May 2014 09:21:35 +0200 Subject: [Haskell-cafe] extensible records - Vinyl - alternatives? In-Reply-To: References: Message-ID: Hi Adam, thanks for your answer, I will re-check HList with Labelable labels. With regards to your question "named labels": good point, all records indeed have "named labels" so what was my statement? I actually thought that Vinyl does keep run-time information of the labels from a Blog about vinyl-gl, but actually I'm not so sure about it anymore, so it is more a question: do those alternatives of extensible records differentiate by the way they keep runtime information of labels? regards Peter 2014-05-03 18:54 GMT+02:00 adam vogt : > Hello Peter, > > Could you show what you mean by "named labels"? > > Vinyl is a fine choice, but have you looked at HList >= 0.3? The > lenses/labels done with Data.HList.Labelable are prettier than the > vinyl alternative in my biased opinion. Furthermore, they support > changing types in the record unlike vinyl (ie. they provide a Lens > not Lens'). > > HList is a bit slow at compile time > if you make > records with many fields. That situation may improve soon if we take > advantage of the ordering on Symbol that ghc-7.8 introduced. In other > words, we will probably follow the lead of > and make Records sorted by > their labels. > > There are quite a few other libraries > >. > Also consider lens' makeClassy as another solution to the records > problem. > > Regards, > Adam > > On Sat, May 3, 2014 at 6:16 AM, Peter Althainz wrote: > > Dear All, > > > > I'm searching a handsome library for handling large amounts of > configuration > > data in a flexible manner. So to speak I want to use some kind of > > inheritance of data fields. I think this is where the extensible records > > discussion is a proper description of my use case. > > > > I've found 2 libraries making this work, so far: > > > > HList > > Vinyl > > > > I currently prefer Vinyl due to the complex types in HList, lens > > compatibiliy, named labels. (I love the HList and OOHaskel papers, but > for > > practical use, I currently prefer Vinyl). > > > > What do you think, what is the best way nowadays to use extensible > records? > > Is Vinyl a good choice from your point of view? > > > > regards > > Peter > > > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://www.haskell.org/mailman/listinfo/haskell-cafe > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vogt.adam at gmail.com Mon May 5 07:34:28 2014 From: vogt.adam at gmail.com (adam vogt) Date: Mon, 5 May 2014 03:34:28 -0400 Subject: [Haskell-cafe] extensible records - Vinyl - alternatives? In-Reply-To: References: Message-ID: Hi Alberto, The examples in http://code.haskell.org/OOHaskell/ need some work to compile with the current GHC and HList. The examples don't involve nesting of records, so it's not really clear that involving lens would make those examples more compelling. Regards, Adam On Sun, May 4, 2014 at 4:15 AM, Alberto G. Corona wrote: > Are there any lens implementation of OOHaskell?. That would produce a > massive exodus from the OO comunity to haskell. > > > 2014-05-03 18:54 GMT+02:00 adam vogt : > >> Hello Peter, >> >> Could you show what you mean by "named labels"? >> >> Vinyl is a fine choice, but have you looked at HList >= 0.3? The >> lenses/labels done with Data.HList.Labelable are prettier than the >> vinyl alternative in my biased opinion. Furthermore, they support >> changing types in the record unlike vinyl (ie. they provide a Lens >> not Lens'). >> >> HList is a bit slow at compile time >> if you make >> records with many fields. That situation may improve soon if we take >> advantage of the ordering on Symbol that ghc-7.8 introduced. In other >> words, we will probably follow the lead of >> and make Records sorted by >> their labels. >> >> There are quite a few other libraries >> >> . >> Also consider lens' makeClassy as another solution to the records >> problem. >> >> Regards, >> Adam >> >> On Sat, May 3, 2014 at 6:16 AM, Peter Althainz wrote: >> > Dear All, >> > >> > I'm searching a handsome library for handling large amounts of >> > configuration >> > data in a flexible manner. So to speak I want to use some kind of >> > inheritance of data fields. I think this is where the extensible records >> > discussion is a proper description of my use case. >> > >> > I've found 2 libraries making this work, so far: >> > >> > HList >> > Vinyl >> > >> > I currently prefer Vinyl due to the complex types in HList, lens >> > compatibiliy, named labels. (I love the HList and OOHaskel papers, but >> > for >> > practical use, I currently prefer Vinyl). >> > >> > What do you think, what is the best way nowadays to use extensible >> > records? >> > Is Vinyl a good choice from your point of view? >> > >> > regards >> > Peter >> > >> > _______________________________________________ >> > Haskell-Cafe mailing list >> > Haskell-Cafe at haskell.org >> > http://www.haskell.org/mailman/listinfo/haskell-cafe >> > >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe > > > > > -- > Alberto. From agocorona at gmail.com Mon May 5 08:15:30 2014 From: agocorona at gmail.com (Alberto G. Corona ) Date: Mon, 5 May 2014 10:15:30 +0200 Subject: [Haskell-cafe] extensible records - Vinyl - alternatives? In-Reply-To: References: Message-ID: Hi adam, This is highly speculative, and I?m not an expert on lens (not even a newbie), but I think that it can be applied to more than plain haskell records. In the other side The OOHaskell solution, that uses HList, is a better Object oriented system than the Object system in many OO languages. But the syntax is ugly. Maybe lens can give the syntactic sugar and some more composability. This is the OOHaskell paper: http://arxiv.org/pdf/cs/0509027v1.pdf More than evolving the actual code, I mean to use the ideas and solve the problems mentioned in this paper. IMHO the Stack overflow solution that you mention above has the problems associated with type classes mentioned in this paper. It add getters and setters to type classes but it does not meet other requrements necessary for being the better OO language possible. The OO people are not impressed when they see their favorite paradigm as a haskell sublanguage, but I?m sure that they would burn their homes and will convert to haskellism if they, in addition to getters and setters, see the right syntax for method invocation and inheritance. 2014-05-05 9:34 GMT+02:00 adam vogt : > Hi Alberto, > > The examples in http://code.haskell.org/OOHaskell/ need some work to > compile with the current GHC and HList. The examples don't involve > nesting of records, so it's not really clear that involving lens would > make those examples more compelling. > > Regards, > Adam > > On Sun, May 4, 2014 at 4:15 AM, Alberto G. Corona > wrote: > > Are there any lens implementation of OOHaskell?. That would produce a > > massive exodus from the OO comunity to haskell. > > > > > > 2014-05-03 18:54 GMT+02:00 adam vogt : > > > >> Hello Peter, > >> > >> Could you show what you mean by "named labels"? > >> > >> Vinyl is a fine choice, but have you looked at HList >= 0.3? The > >> lenses/labels done with Data.HList.Labelable are prettier than the > >> vinyl alternative in my biased opinion. Furthermore, they support > >> changing types in the record unlike vinyl (ie. they provide a Lens > >> not Lens'). > >> > >> HList is a bit slow at compile time > >> if you make > >> records with many fields. That situation may improve soon if we take > >> advantage of the ordering on Symbol that ghc-7.8 introduced. In other > >> words, we will probably follow the lead of > >> and make Records sorted by > >> their labels. > >> > >> There are quite a few other libraries > >> > >> < > http://www.haskell.org/haskellwiki/Extensible_record#Libraries_on_hackage > >. > >> Also consider lens' makeClassy as another solution to the records > >> problem. > >> > >> Regards, > >> Adam > >> > >> On Sat, May 3, 2014 at 6:16 AM, Peter Althainz > wrote: > >> > Dear All, > >> > > >> > I'm searching a handsome library for handling large amounts of > >> > configuration > >> > data in a flexible manner. So to speak I want to use some kind of > >> > inheritance of data fields. I think this is where the extensible > records > >> > discussion is a proper description of my use case. > >> > > >> > I've found 2 libraries making this work, so far: > >> > > >> > HList > >> > Vinyl > >> > > >> > I currently prefer Vinyl due to the complex types in HList, lens > >> > compatibiliy, named labels. (I love the HList and OOHaskel papers, but > >> > for > >> > practical use, I currently prefer Vinyl). > >> > > >> > What do you think, what is the best way nowadays to use extensible > >> > records? > >> > Is Vinyl a good choice from your point of view? > >> > > >> > regards > >> > Peter > >> > > >> > _______________________________________________ > >> > Haskell-Cafe mailing list > >> > Haskell-Cafe at haskell.org > >> > http://www.haskell.org/mailman/listinfo/haskell-cafe > >> > > >> _______________________________________________ > >> Haskell-Cafe mailing list > >> Haskell-Cafe at haskell.org > >> http://www.haskell.org/mailman/listinfo/haskell-cafe > > > > > > > > > > -- > > Alberto. > -- Alberto. -------------- next part -------------- An HTML attachment was scrubbed... URL: From vogt.adam at gmail.com Mon May 5 08:25:43 2014 From: vogt.adam at gmail.com (adam vogt) Date: Mon, 5 May 2014 04:25:43 -0400 Subject: [Haskell-cafe] extensible records - Vinyl - alternatives? In-Reply-To: References: Message-ID: Hi Peter, If you compare the two, you can see that some parts are nearly the same: ::: ~ Tagged :& ~ HCons RNil ~ HNil The labels aren't there at runtime in either library, since the label that is part of ::: (or Tagged) is missing from the data constructor (ie. it is a phantom type). But you can still define functions that depend on the type of a record: see the Show instances of either record type for example. So in some weak sense you have the same "runtime information of labels" in both libraries. Regards, Adam On Mon, May 5, 2014 at 3:21 AM, Peter Althainz wrote: > Hi Adam, > > thanks for your answer, I will re-check HList with Labelable labels. With > regards to your question "named labels": good point, all records indeed have > "named labels" so what was my statement? I actually thought that Vinyl does > keep run-time information of the labels from a Blog about vinyl-gl, but > actually I'm not so sure about it anymore, so it is more a question: do > those alternatives of extensible records differentiate by the way they keep > runtime information of labels? > > regards > Peter > > > 2014-05-03 18:54 GMT+02:00 adam vogt : >> >> Hello Peter, >> >> >> Could you show what you mean by "named labels"? >> >> Vinyl is a fine choice, but have you looked at HList >= 0.3? The >> lenses/labels done with Data.HList.Labelable are prettier than the >> vinyl alternative in my biased opinion. Furthermore, they support >> changing types in the record unlike vinyl (ie. they provide a Lens >> not Lens'). >> >> HList is a bit slow at compile time >> if you make >> records with many fields. That situation may improve soon if we take >> advantage of the ordering on Symbol that ghc-7.8 introduced. In other >> words, we will probably follow the lead of >> and make Records sorted by >> their labels. >> >> There are quite a few other libraries >> >> . >> Also consider lens' makeClassy as another solution to the records >> problem. >> >> Regards, >> Adam >> >> On Sat, May 3, 2014 at 6:16 AM, Peter Althainz wrote: >> > Dear All, >> > >> > I'm searching a handsome library for handling large amounts of >> > configuration >> > data in a flexible manner. So to speak I want to use some kind of >> > inheritance of data fields. I think this is where the extensible records >> > discussion is a proper description of my use case. >> > >> > I've found 2 libraries making this work, so far: >> > >> > HList >> > Vinyl >> > >> > I currently prefer Vinyl due to the complex types in HList, lens >> > compatibiliy, named labels. (I love the HList and OOHaskel papers, but >> > for >> > practical use, I currently prefer Vinyl). >> > >> > What do you think, what is the best way nowadays to use extensible >> > records? >> > Is Vinyl a good choice from your point of view? >> > >> > regards >> > Peter >> > >> > _______________________________________________ >> > Haskell-Cafe mailing list >> > Haskell-Cafe at haskell.org >> > http://www.haskell.org/mailman/listinfo/haskell-cafe >> > > > From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Mon May 5 08:36:44 2014 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Mon, 5 May 2014 09:36:44 +0100 Subject: [Haskell-cafe] extensible records - Vinyl - alternatives? In-Reply-To: References: Message-ID: <20140505083644.GL896@weber> On Mon, May 05, 2014 at 10:15:30AM +0200, Alberto G. Corona wrote: > The OOHaskell solution, that uses HList, is a better Object oriented > system than the Object system in many OO languages. That's very interesting. Could you say a bit more about why? Tom From roma at ro-che.info Mon May 5 09:06:16 2014 From: roma at ro-che.info (Roman Cheplyaka) Date: Mon, 5 May 2014 12:06:16 +0300 Subject: [Haskell-cafe] extensible records - Vinyl - alternatives? In-Reply-To: References: Message-ID: <20140505090616.GA5697@sniper> * Alberto G. Corona [2014-05-04 10:15:33+0200] > Are there any lens implementation of OOHaskell?. That would produce a > massive exodus from the OO comunity to haskell. I bet it would not. Roman -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: From agocorona at gmail.com Mon May 5 09:10:35 2014 From: agocorona at gmail.com (Alberto G. Corona ) Date: Mon, 5 May 2014 11:10:35 +0200 Subject: [Haskell-cafe] extensible records - Vinyl - alternatives? In-Reply-To: <20140505083644.GL896@weber> References: <20140505083644.GL896@weber> Message-ID: First, sorry for parasitizing this thread with this unrelated subject. Tom, The OOHaskell paper gives encapsulation. mutable state, inheritance, overriding, It uses haskell type safety to the limit, and virtual methods among other things. That is more than what most OO languages can offer (specially type checking) These things are important in the mind of the OO people. Type classes while providing other different and more powerful advantages, do not cover these requirements. They are also very important for translating without pain, many tons of object oriented code to Haskell. 2014-05-05 10:36 GMT+02:00 Tom Ellis < tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk>: > On Mon, May 05, 2014 at 10:15:30AM +0200, Alberto G. Corona wrote: > > The OOHaskell solution, that uses HList, is a better Object oriented > > system than the Object system in many OO languages. > > That's very interesting. Could you say a bit more about why? > > Tom > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -- Alberto. -------------- next part -------------- An HTML attachment was scrubbed... URL: From komadori at gekkou.co.uk Mon May 5 09:59:17 2014 From: komadori at gekkou.co.uk (Robin KAY) Date: Mon, 05 May 2014 10:59:17 +0100 Subject: [Haskell-cafe] ANN: hsqml-0.3.0.0 supports Qt 5 Message-ID: <536760F5.2040409@gekkou.co.uk> Dear All, I would like to announce version 0.3.0.0 of the HsQML graphics library, a Haskell binding to the Qt Quick framework. The library allows you to write graphical applications where the front-end is written in Qt Quick's QML language (incorporating JavaScript) and the back-end is written in Haskell. The two layers are coupled together via a facility to define custom JavaScript objects through which QML code can call into Haskell and vice versa. Documentation including a brief tutorial is available on my web-site [1]. HsQML requires an installation of Qt 5 (including Qt Quick) present on your path. This is the first release to support Qt 5 and it has been a much requested feature. Several other new features are also introduced in this release, including support for marshalling lists and signalling property notifications. For more information, please see the release announcement [2]. The release is available for download from Hackage [3] along with a demo application implementing Nine Men's Morris [4] and some other sample programs [5]. Linux, Windows, and Mac OS platforms should all be supported. [1] http://www.gekkou.co.uk/software/hsqml [2] http://blog.gekkou.co.uk/2014/05/hsqml-0300-released-now-with-qt-5.html [3] http://hackage.haskell.org/package/hsqml-0.3.0.0 [4] http://hackage.haskell.org/package/hsqml-demo-morris-0.3.0.0 [5] http://hackage.haskell.org/package/hsqml-demo-samples-0.3.0.0 Regards, -- Robin KAY From acowley at seas.upenn.edu Mon May 5 14:12:06 2014 From: acowley at seas.upenn.edu (Anthony Cowley) Date: Mon, 5 May 2014 10:12:06 -0400 Subject: [Haskell-cafe] extensible records - Vinyl - alternatives? In-Reply-To: References: Message-ID: <3CFBD657-2143-4E2F-91B8-B424D392FD98@seas.upenn.edu> > On May 5, 2014, at 3:21 AM, Peter Althainz wrote: > > Hi Adam, > > thanks for your answer, I will re-check HList with Labelable labels. With regards to your question "named labels": good point, all records indeed have "named labels" so what was my statement? I actually thought that Vinyl does keep run-time information of the labels from a Blog about vinyl-gl, but actually I'm not so sure about it anymore, so it is more a question: do those alternatives of extensible records differentiate by the way they keep runtime information of labels? We have runtime information due to singleton types. When using the Symbol kind, you can demote your type-level label to a value-level String. This is not unique to Vinyl. Anthony > > regards > Peter > > > 2014-05-03 18:54 GMT+02:00 adam vogt : >> Hello Peter, >> >> Could you show what you mean by "named labels"? >> >> Vinyl is a fine choice, but have you looked at HList >= 0.3? The >> lenses/labels done with Data.HList.Labelable are prettier than the >> vinyl alternative in my biased opinion. Furthermore, they support >> changing types in the record unlike vinyl (ie. they provide a Lens >> not Lens'). >> >> HList is a bit slow at compile time >> if you make >> records with many fields. That situation may improve soon if we take >> advantage of the ordering on Symbol that ghc-7.8 introduced. In other >> words, we will probably follow the lead of >> and make Records sorted by >> their labels. >> >> There are quite a few other libraries >> . >> Also consider lens' makeClassy as another solution to the records >> problem. >> >> Regards, >> Adam >> >> On Sat, May 3, 2014 at 6:16 AM, Peter Althainz wrote: >> > Dear All, >> > >> > I'm searching a handsome library for handling large amounts of configuration >> > data in a flexible manner. So to speak I want to use some kind of >> > inheritance of data fields. I think this is where the extensible records >> > discussion is a proper description of my use case. >> > >> > I've found 2 libraries making this work, so far: >> > >> > HList >> > Vinyl >> > >> > I currently prefer Vinyl due to the complex types in HList, lens >> > compatibiliy, named labels. (I love the HList and OOHaskel papers, but for >> > practical use, I currently prefer Vinyl). >> > >> > What do you think, what is the best way nowadays to use extensible records? >> > Is Vinyl a good choice from your point of view? >> > >> > regards >> > Peter >> > >> > _______________________________________________ >> > Haskell-Cafe mailing list >> > Haskell-Cafe at haskell.org >> > http://www.haskell.org/mailman/listinfo/haskell-cafe >> > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe -------------- next part -------------- An HTML attachment was scrubbed... URL: From corentin.dupont at gmail.com Mon May 5 22:31:41 2014 From: corentin.dupont at gmail.com (Corentin Dupont) Date: Tue, 6 May 2014 00:31:41 +0200 Subject: [Haskell-cafe] Questions about Functor, Applicative, Monad Message-ID: Hi everybody! Two questions in one: - When you define and instance of a Monad, why don't you get the Applicative and Functor instances for free? I seem that you can mechanically write them. - Do you have examples of things that are Functors but not Applicative? Applicative but not Monads? Tchuss Corentin -------------- next part -------------- An HTML attachment was scrubbed... URL: From miguelimo38 at yandex.ru Mon May 5 22:48:57 2014 From: miguelimo38 at yandex.ru (MigMit) Date: Tue, 6 May 2014 02:48:57 +0400 Subject: [Haskell-cafe] Questions about Functor, Applicative, Monad In-Reply-To: References: Message-ID: <678C191A-2ADF-4943-ADD9-31685CFD868C@yandex.ru> newtype Const a b = Const a instance Functor (Const a) where fmap _ (Const a) = Const a pure :: b -> Const a b -- it's the same as just "b -> a" instance Monoid a => Applicative (Const a) where pure _ = Const mempty Const a1 <*> Const a2 = Const (a1 `mappend` a2) (>>=) :: Monoid a => Const a b -> (b -> Const a c) -> Const a c -- ? -- it's isomorphic to just "a -> (b -> a) -> a" -- note that "return b >>= h ~ h b", so, we need "bind :: a -> (b -> a) -> a" such that -- bind mempty h = h b -- whatever that "b" is. ?????????? ? iPad > 06 ??? 2014 ?., ? 2:31, Corentin Dupont ???????(?): > > Hi everybody! > Two questions in one: > - When you define and instance of a Monad, why don't you get the Applicative and Functor instances for free? I seem that you can mechanically write them. > - Do you have examples of things that are Functors but not Applicative? Applicative but not Monads? > > Tchuss > Corentin > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From kenn at kennknowles.com Mon May 5 22:54:01 2014 From: kenn at kennknowles.com (Kenn Knowles) Date: Mon, 5 May 2014 18:54:01 -0400 Subject: [Haskell-cafe] Questions about Functor, Applicative, Monad In-Reply-To: References: Message-ID: Hi Corentin, This may be a good answer for some of your questions: http://stackoverflow.com/questions/7220436/good-examples-of-not-a-functor-functor-applicative-monad Kenn On Mon, May 5, 2014 at 6:31 PM, Corentin Dupont wrote: > Hi everybody! > Two questions in one: > - When you define and instance of a Monad, why don't you get the > Applicative and Functor instances for free? I seem that you can > mechanically write them. > - Do you have examples of things that are Functors but not Applicative? > Applicative but not Monads? > > Tchuss > Corentin > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrew at operationaldynamics.com Tue May 6 06:45:03 2014 From: andrew at operationaldynamics.com (Andrew Cowie) Date: Tue, 06 May 2014 16:45:03 +1000 Subject: [Haskell-cafe] Cabal exit codes when work to be done Message-ID: <1399358703.10207.2.camel@nervous-energy.bridge.anchor.net.au> Is there a way to run e.g. `cabal install --only-dependencies` and have it return a non-zero exit code if, for instance, there IS something to do? I tried `--dry-run` but the exit code is still 0 if something is missing. [or have it return non-zero if there isn't work to do, or...] AfC Sydney From patrick.john.wheeler at gmail.com Tue May 6 06:59:30 2014 From: patrick.john.wheeler at gmail.com (Patrick Wheeler) Date: Tue, 6 May 2014 01:59:30 -0500 Subject: [Haskell-cafe] Cabal exit codes when work to be done In-Reply-To: <1399358703.10207.2.camel@nervous-energy.bridge.anchor.net.au> References: <1399358703.10207.2.camel@nervous-energy.bridge.anchor.net.au> Message-ID: `cabal configure` returns a non-zero exit code if something needs to be installed. Does that work as an alternative? Patrick On Tue, May 6, 2014 at 1:45 AM, Andrew Cowie wrote: > Is there a way to run e.g. `cabal install --only-dependencies` and have > it return a non-zero exit code if, for instance, there IS something to > do? > > I tried `--dry-run` but the exit code is still 0 if something is > missing. > > [or have it return non-zero if there isn't work to do, or...] > > AfC > Sydney > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -- Patrick Wheeler Patrick.John.Wheeler at gmail.com Patrick.J.Wheeler at rice.edu Patrick.Wheeler at colorado.edu -------------- next part -------------- An HTML attachment was scrubbed... URL: From chriswarbo at googlemail.com Tue May 6 09:38:17 2014 From: chriswarbo at googlemail.com (Chris Warburton) Date: Tue, 06 May 2014 10:38:17 +0100 Subject: [Haskell-cafe] wanted: Function to break circular data dependencies In-Reply-To: (Job Vranish's message of "Sun, 4 May 2014 12:00:47 -0400") References: Message-ID: <86iopjfdrq.fsf@gmail.com> Job Vranish writes: > I've often found myself wanting a function like this. It would make certain > kinds of knot-tying/cycle detection _much_ easier. > > Is there any reason why this function can't/shouldn't exist? This makes me think of the more widely-known 'parallel OR' operator, which evaluates its arguments in parallel and returns whichever finishes evaluating first. This operator cannot be implemented in Lambda Calculus, but it can in Haskell (via threads). Unfortunately Googling for 'haskell "parallel or"' brings up sentence fragments ('...parallel or concurrent...') rather than a parallel or implementation. You couldn't use parallel or as-is, since your "fallback" value will probably evaluate faster than your "real" value most of the time, but it may give you hints. Cheers, Chris From hesselink at gmail.com Tue May 6 10:24:59 2014 From: hesselink at gmail.com (Erik Hesselink) Date: Tue, 6 May 2014 12:24:59 +0200 Subject: [Haskell-cafe] wanted: Function to break circular data dependencies In-Reply-To: <86iopjfdrq.fsf@gmail.com> References: <86iopjfdrq.fsf@gmail.com> Message-ID: On Tue, May 6, 2014 at 11:38 AM, Chris Warburton wrote: > Job Vranish writes: > >> I've often found myself wanting a function like this. It would make certain >> kinds of knot-tying/cycle detection _much_ easier. >> >> Is there any reason why this function can't/shouldn't exist? > > This makes me think of the more widely-known 'parallel OR' operator, > which evaluates its arguments in parallel and returns whichever finishes > evaluating first. > > This operator cannot be implemented in Lambda Calculus, but it can in > Haskell (via threads). Unfortunately Googling for 'haskell "parallel > or"' brings up sentence fragments ('...parallel or concurrent...') > rather than a parallel or implementation. Perhaps you are looking for 'unamb' [0]? Erik [0] http://hackage.haskell.org/package/unamb From corentin.dupont at gmail.com Tue May 6 11:48:13 2014 From: corentin.dupont at gmail.com (Corentin Dupont) Date: Tue, 6 May 2014 13:48:13 +0200 Subject: [Haskell-cafe] wanted: Function to break circular data dependencies In-Reply-To: References: <86iopjfdrq.fsf@gmail.com> Message-ID: Great, I didn't know unamb! Specially the function "race" included: race :: IOa -> IOa -> IOa Race two actions against each other in separate threads, and pick whichever finishes first. See also amb. Could it be used to build a watchdog? Simply by providing one of the two arguments as an action that waits and then gives a default value. On Tue, May 6, 2014 at 12:24 PM, Erik Hesselink wrote: > On Tue, May 6, 2014 at 11:38 AM, Chris Warburton > wrote: > > Job Vranish writes: > > > >> I've often found myself wanting a function like this. It would make > certain > >> kinds of knot-tying/cycle detection _much_ easier. > >> > >> Is there any reason why this function can't/shouldn't exist? > > > > This makes me think of the more widely-known 'parallel OR' operator, > > which evaluates its arguments in parallel and returns whichever finishes > > evaluating first. > > > > This operator cannot be implemented in Lambda Calculus, but it can in > > Haskell (via threads). Unfortunately Googling for 'haskell "parallel > > or"' brings up sentence fragments ('...parallel or concurrent...') > > rather than a parallel or implementation. > > Perhaps you are looking for 'unamb' [0]? > > Erik > > [0] http://hackage.haskell.org/package/unamb > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From alois.cochard at gmail.com Tue May 6 12:13:28 2014 From: alois.cochard at gmail.com (Alois Cochard) Date: Tue, 6 May 2014 13:13:28 +0100 Subject: [Haskell-cafe] wanted: Function to break circular data dependencies In-Reply-To: References: <86iopjfdrq.fsf@gmail.com> Message-ID: Just to say there is similar functionality in Marlow's async library: http://hackage.haskell.org/package/async-2.0.1.5/docs/Control-Concurrent-Async.html#g:8 http://hackage.haskell.org/package/async-2.0.1.5/docs/Control-Concurrent-Async.html#g:6 Might overkill for your issue, but I thought it was worth mentioning it. On 6 May 2014 12:48, Corentin Dupont wrote: > Great, I didn't know unamb! Specially the function "race" included: > > race :: IOa -> > IOa -> > IOa > Race two actions against each other in separate threads, and pick > whichever finishes first. See also amb. > > > Could it be used to build a watchdog? Simply by providing one of the two > arguments as an action that waits and then gives a default value. > > > On Tue, May 6, 2014 at 12:24 PM, Erik Hesselink wrote: > >> On Tue, May 6, 2014 at 11:38 AM, Chris Warburton >> wrote: >> > Job Vranish writes: >> > >> >> I've often found myself wanting a function like this. It would make >> certain >> >> kinds of knot-tying/cycle detection _much_ easier. >> >> >> >> Is there any reason why this function can't/shouldn't exist? >> > >> > This makes me think of the more widely-known 'parallel OR' operator, >> > which evaluates its arguments in parallel and returns whichever finishes >> > evaluating first. >> > >> > This operator cannot be implemented in Lambda Calculus, but it can in >> > Haskell (via threads). Unfortunately Googling for 'haskell "parallel >> > or"' brings up sentence fragments ('...parallel or concurrent...') >> > rather than a parallel or implementation. >> >> Perhaps you are looking for 'unamb' [0]? >> >> Erik >> >> [0] http://hackage.haskell.org/package/unamb >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -- *Alois Cochard* http://aloiscochard.blogspot.com http://twitter.com/aloiscochard http://github.com/aloiscochard -------------- next part -------------- An HTML attachment was scrubbed... URL: From lambda.fairy at gmail.com Tue May 6 23:08:46 2014 From: lambda.fairy at gmail.com (Chris Wong) Date: Wed, 7 May 2014 11:08:46 +1200 Subject: [Haskell-cafe] wanted: Function to break circular data dependencies In-Reply-To: References: <86iopjfdrq.fsf@gmail.com> Message-ID: On Tue, May 6, 2014 at 11:48 PM, Corentin Dupont wrote: > Great, I didn't know unamb! Specially the function "race" included: > > race :: IO a -> IO a -> IO a > Race two actions against each other in separate threads, and pick whichever > finishes first. See also amb. > > Could it be used to build a watchdog? Simply by providing one of the two > arguments as an action that waits and then gives a default value. If you simply want a timeout, then I'd suggest System.Timeout instead[1] [1] http://hackage.haskell.org/package/base-4.7.0.0/docs/System-Timeout.html > > On Tue, May 6, 2014 at 12:24 PM, Erik Hesselink wrote: >> >> On Tue, May 6, 2014 at 11:38 AM, Chris Warburton >> wrote: >> > Job Vranish writes: >> > >> >> I've often found myself wanting a function like this. It would make >> >> certain >> >> kinds of knot-tying/cycle detection _much_ easier. >> >> >> >> Is there any reason why this function can't/shouldn't exist? >> > >> > This makes me think of the more widely-known 'parallel OR' operator, >> > which evaluates its arguments in parallel and returns whichever finishes >> > evaluating first. >> > >> > This operator cannot be implemented in Lambda Calculus, but it can in >> > Haskell (via threads). Unfortunately Googling for 'haskell "parallel >> > or"' brings up sentence fragments ('...parallel or concurrent...') >> > rather than a parallel or implementation. >> >> Perhaps you are looking for 'unamb' [0]? >> >> Erik >> >> [0] http://hackage.haskell.org/package/unamb >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe > > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > From lgreg.meredith at biosimilarity.com Wed May 7 00:19:06 2014 From: lgreg.meredith at biosimilarity.com (Greg Meredith) Date: Tue, 6 May 2014 17:19:06 -0700 Subject: [Haskell-cafe] Splicious is now accepting applications for alpha user trials Message-ID: Dear Haskellians and CurriedOnes, Splicious is now accepting applications for alpha user trials . To learn more about splicious, apart from that it is written in a higher-kinded functional language and makes extremely cool use of delimited continuations, please check out these links. - splicious and distributed identity - splicious, BitCoin, content creation, curation, and sharing - Vlad Patryshev's review of splicious - The specialK white paper - A link to our crowd funding site Love to all, --greg -- L.G. Meredith Managing Partner Biosimilarity LLC 1219 NW 83rd St Seattle, WA 98117 +1 206.650.3740 http://biosimilarity.blogspot.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at eax.me Wed May 7 07:48:45 2014 From: mail at eax.me (Alexander Alexeev) Date: Wed, 7 May 2014 11:48:45 +0400 Subject: [Haskell-cafe] I would like to add haskell-russian@ mailing list to "User groups" wiki page Message-ID: <20140507114845.3aaad32d@portege> Hello. Could someone add https://groups.google.com/forum/#!aboutgroup/haskell-russian ... to this wiki page http://www.haskell.org/haskellwiki/User_groups#Russia ... please? Or I could do it by myself if someone would create me an account at Haskell Wiki. Username I would like to have - eax (like @ Hackege). -- Best regards, Alexander Alexeev http://eax.me/ From roma at ro-che.info Wed May 7 07:52:48 2014 From: roma at ro-che.info (Roman Cheplyaka) Date: Wed, 7 May 2014 10:52:48 +0300 Subject: [Haskell-cafe] I would like to add haskell-russian@ mailing list to "User groups" wiki page In-Reply-To: <20140507114845.3aaad32d@portege> References: <20140507114845.3aaad32d@portege> Message-ID: <20140507075248.GB21025@sniper> * Alexander Alexeev [2014-05-07 11:48:45+0400] > Hello. > > Could someone add > > https://groups.google.com/forum/#!aboutgroup/haskell-russian > > ... to this wiki page > > http://www.haskell.org/haskellwiki/User_groups#Russia > > ... please? Done. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: From mail at eax.me Wed May 7 08:01:30 2014 From: mail at eax.me (Alexander Alexeev) Date: Wed, 7 May 2014 12:01:30 +0400 Subject: [Haskell-cafe] I would like to add haskell-russian@ mailing list to "User groups" wiki page In-Reply-To: <20140507075248.GB21025@sniper> References: <20140507114845.3aaad32d@portege> <20140507075248.GB21025@sniper> Message-ID: <20140507120130.26ae7c19@portege> Thanks a lot! > * Alexander Alexeev [2014-05-07 11:48:45+0400] > > Hello. > > > > Could someone add > > > > https://groups.google.com/forum/#!aboutgroup/haskell-russian > > > > ... to this wiki page > > > > http://www.haskell.org/haskellwiki/User_groups#Russia > > > > ... please? > > Done. -- Best regards, Alexander Alexeev http://eax.me/ From palotai.robin at gmail.com Wed May 7 19:43:48 2014 From: palotai.robin at gmail.com (Robin Palotai) Date: Wed, 7 May 2014 21:43:48 +0200 Subject: [Haskell-cafe] Need pointer to explain CPU usage Message-ID: Hello List, I have a tiny scotty-based application, which when compiled and started in profiling mode, consumes 10x CPU it does in normal mode. Interestingly, if I fire a request on the app, CPU usage drops to minimal after finishing the request for a while. But after a few minutes it starts consuming 10x CPU again. First I would have suspected scotty, however collecting time profiling info with -p, -P or -Pa doesn't reveal much. That still not rules scotty out however. To make matters worse, I inspect strange time profiling tick count I can't explain - the .prof file says "2 ticks @ 1000 us", while the application was clearly running idle for a good few seconds. Any ideas what am I missing? Thanks, Robin From brucker at spamfence.net Wed May 7 20:37:34 2014 From: brucker at spamfence.net (Achim D. Brucker) Date: Wed, 7 May 2014 22:37:34 +0200 Subject: [Haskell-cafe] OCL 2014: First Call for Papers Message-ID: <20140507203734.GA2522@fujikawa.home.brucker.ch> (Apologies for duplicates) CALL FOR PAPERS 14th International Workshop on OCL and Textual Modeling Applications and Case Studies (OCL 2014) Co-located with ACM/IEEE 17th International Conference on Model Driven Engineering Languages and Systems (MODELS 2014) September 28-30 (tbc), 2014, VALENCIA, SPAIN http://www.software.imdea.org/OCL2014/ Modeling started out with UML and its precursors as a graphical notation. Such visual representations enable direct intuitive capturing of reality, but some of their features are difficult to formalize and lack the level of precision required to create complete and unambiguous specifications. Limitations of the graphical notations encouraged the development of text-based modeling languages that either integrate with or replace graphical notations for modeling. Typical examples of such languages are OCL, textual MOF, Epsilon, and Alloy. Textual modeling languages have their roots in formal language paradigms like logic, programming and databases. The goal of this workshop is create a forum where researchers and practitioners interested in building models using OCL or other kinds of textual languages can directly interact, report advances, share results, identify tools for language development, and discuss appropriate standards. In particular, the workshop will encourage discussions for achieving synergy from different modeling language concepts and modeling language use. The close interaction will enable researchers and practitioners to identify common interests and options for potential cooperation. Topics of interest include (but are not limited to) =================================================== - Mappings between textual modeling languages and other languages/formalisms - Algorithms, evaluation strategies and optimizations in the context of textual modeling languages for -- validation, verification, and testing, -- model transformation and code generation, -- metamodeling and DSLs, and -- query and constraint specifications - Alternative graphical/textual notations for textual modeling languages - Evolution, transformation and simplification of textual modeling expressions - Libraries, templates and patterns for textual modeling languages - Complexity results for textual modeling languages - Quality models and benchmarks for comparing and evaluating textual modeling tools and algorithms - Successful applications of textual modeling languages - Case studies on industrial applications of textual modeling languages - Experience reports -- usage of textual modeling languages and tools in complex domains, -- usability of textual modeling languages and tools for end-users - Empirical studies about the benefits and drawbacks of textual modeling languages - Innovative textual modeling tools - Comparison, evaluation and integration of modeling languages - Correlation between modeling languages and modeling tasks This year, we particularly encourage submissions describing applications and case studies of textual modeling as well as test suites and benchmark collections for evaluating textual modeling tools. Venue ===== The workshop will be organized as a part of MODELS 2014 Conference in Valencia, Spain. It continues the series of OCL workshops held at UML/MODELS conferences: York (2000), Toronto (2001), San Francisco (2003), Lisbon (2004), Montego Bay (2005), Genova (2006), Nashville (2007), Toulouse (2008), Denver (2009), Oslo (2010), Zurich (2011, at the TOOLs conference), 2012 in Innsbruck, and 2013 in Miami. Similar to its predecessors, the workshop addresses both people from academia and industry. The aim is to provide a forum for addressing integration of OCL and other textual modeling languages, as well as tools for textual modeling, and for disseminating good practice and discussing the new requirements for textual modeling. Workshop Format =============== The workshop will include short (about 15 min) presentations, parallel sessions of working groups, and sum-up discussions. Submissions =========== Two types of papers will be considered: * short papers (6 pages) and * full papers (10 pages) in LNCS format. Submissions should be uploaded to EasyChair (https://www.easychair.org/conferences/?conf=ocl2014). The program committee will review the submissions (minimum 2 reviews per paper, usually 3 reviews) and select papers according to their relevance and interest for discussions that will take place at the workshop. Accepted papers will be published online in a pre-conference edition of CEUR (http://www.ceur-ws.org). Authors of selected papers will be invited to submit an extended version of their workshop paper to a special issue of the Electronic Communications of the EASST (http://journal.ub.tu-berlin.de/eceasst) Important Dates =============== Submission of papers: July 11, 2014 Notification: August 8, 2014 Workshop date: one day during September 28-30, 2014 Organizers ========== Achim D. Brucker, SAP AG, Germany Carolina Dania, IMDEA Software Institute, Madrid, Spain Geri Georg, Colorado State University, Fort Collins, Colorado, USA Martin Gogolla, University of Bremen, Germany Programme Committee (partly confirmation pending) =================== Michael Altenhofen, SAP AG, Germany Thomas Baar, University of Applied Sciences Berlin, Germany Mira Balaban, Ben-Gurion University of the Negev, Israel Tricia Balfe, Nomos Software, Ireland Fabian Buettner, Ecole des Mines de Nantes, France Achim D. Brucker, SAP AG, Germany Jordi Cabot, INRIA-Ecole des Mines de Nantes, France Yoonsik Cheon, University of Texas, USA Dan Chiorean, Babes-Bolyai University, Romania Robert Clariso, Universitat Oberta de Catalunya, Spain Tony Clark, Middlesex University, UK Manuel Clavel, IMDEA Software Institute, Madrid, Spain Carolina Dania, IMDEA Software Institute, Madrid, Spain Birgit Demuth, Technische Universitat Dresden, Germany Marina Egea, Atos Research, Madrid, Spain Geri Georg, Colorado State University, Fort Collins, Colorado, USA Martin Gogolla, University of Bremen, Germany Pieter Van Gorp, Eindhoven University of Technology, The Netherlands Heinrich Hussmann, LMU Munchen, Germany Tihamer Levendovszky, Vanderbilt University, USA Shahar Maoz, Tel Aviv University, Israel Istvan Rath, Budapest University of Technology and Economics, Hungary Bernhard Rumpe, RWTH Aachen, Germany Shane Sendall, Snowie Research SA, Switzerland Michael Wahler, ABB Switzerland Ltd Corporate Research, Switzerland Claas Wilke, Technische Universitat Dresden, Germany Edward Willink, Willink Transformations Ltd., UK Burkhart Wolff, Univ Paris-Sud, France Steffen Zschaler, King?s College, London, UK -- Dr. Achim D. Brucker, SAP AG, Vincenz-Priessnitz-Str. 1, D-76131 Karlsruhe Phone: +49 6227 7-52595, http://www.brucker.ch/ From dstcruz at gmail.com Thu May 8 03:26:13 2014 From: dstcruz at gmail.com (Daniel Santa Cruz) Date: Wed, 7 May 2014 23:26:13 -0400 Subject: [Haskell-cafe] Haskell Weekly News: Issue 294 Message-ID: Welcome to issue 294 of the HWN, an issue covering crowd-sourced bits of information about Haskell from around the web. This issue covers from April 27 to May 3, 2014 Quotes of the Week * roconnor: oh no. edwardk and I can never meet otherwise it will be revealed that I am actually him in a very short costume. * edwardk: I'm a product mostly of old Wadler monad papers and TaPL with some Cale thrown in. * benzrf: zippers are fun / they are zippy! / anyway bye Top Reddit Stories * Nikki and the Robots (FOSS Haskell game) has been greenlit on Steam Domain: steamcommunity.com, Score: 130, Comments: 7 Original: [1] http://goo.gl/VgbYzB On Reddit: [2] http://goo.gl/rsKKLn * So I re-implemented Freenet in Haskell, what now? Domain: self.haskell, Score: 85, Comments: 34 Original: [3] http://goo.gl/yLHLD4 On Reddit: [4] http://goo.gl/yLHLD4 * Meditations on learning Haskell from an ex-Clojure user Domain: bitemyapp.com, Score: 79, Comments: 113 Original: [5] http://goo.gl/twtYw2 On Reddit: [6] http://goo.gl/JICvqo * The printer Haskell deserves Domain: chrisdone.com, Score: 77, Comments: 24 Original: [7] http://goo.gl/x8VL1J On Reddit: [8] http://goo.gl/AvMuIo * Erik Meijer: The Curse of the Excluded Middle Domain: queue.acm.org, Score: 76, Comments: 93 Original: [9] http://goo.gl/QbpX9M On Reddit: [10] http://goo.gl/IpliOH * My road to Haskell Domain: alfredodinapoli.com, Score: 74, Comments: 40 Original: [11] http://goo.gl/6oHuNf On Reddit: [12] http://goo.gl/7ER3JC * The Identity monad trick Domain: chrisdone.com, Score: 58, Comments: 62 Original: [13] http://goo.gl/mpL1fa On Reddit: [14] http://goo.gl/Z2fMeB * ekg 0.4 released Domain: blog.johantibell.com, Score: 57, Comments: 5 Original: [15] http://goo.gl/5XZ86C On Reddit: [16] http://goo.gl/Ef3ShV * Evan Czaplicki: Stop saying "the ___ monad" Domain: groups.google.com, Score: 54, Comments: 56 Original: [17] http://goo.gl/36WH0W On Reddit: [18] http://goo.gl/mzcSZi * Thinking in Types Domain: robots.thoughtbot.com, Score: 47, Comments: 28 Original: [19] http://goo.gl/k4bRuD On Reddit: [20] http://goo.gl/G1dbac * Disemboweling WAI (aka gutting out conduit) Domain: yesodweb.com, Score: 46, Comments: 102 Original: [21] http://goo.gl/EQ6hJi On Reddit: [22] http://goo.gl/CQefwI * GHC Status Report, May 2014 Domain: ghc.haskell.org, Score: 44, Comments: 14 Original: [23] http://goo.gl/UbUiIx On Reddit: [24] http://goo.gl/SXY310 * What Do You Think Is Impeding Haskell From Getting Mainstream Adoption? Domain: forbes.com, Score: 44, Comments: 237 Original: [25] http://goo.gl/Qn77nm On Reddit: [26] http://goo.gl/EIQOBr * Pattern Synonyms for Dates and an IRC Bot Domain: fpcomplete.com, Score: 43, Comments: 15 Original: [27] http://goo.gl/LSThZm On Reddit: [28] http://goo.gl/sE3y6p * Elm 0.12.1 - Fast Immutable Arrays Domain: elm-lang.org, Score: 40, Comments: 6 Original: [29] http://goo.gl/rbo80l On Reddit: [30] http://goo.gl/FoC4un * PureScript 0.5 Released Domain: github.com, Score: 38, Comments: 24 Original: [31] http://goo.gl/3cffJq On Reddit: [32] http://goo.gl/AtjJPK * Why category theory matters Domain: rs.io, Score: 38, Comments: 36 Original: [33] http://goo.gl/LQCAk1 On Reddit: [34] http://goo.gl/8xZ9bo Top StackOverflow Questions * What is a good reason to use a type signature for functions when the compiler can infer the types votes: 14, answers: 4 Read on SO: [35] http://goo.gl/48G9iZ * Difference between Monad and Applicative in Haskell votes: 9, answers: 5 Read on SO: [36] http://goo.gl/dL3a4s Until next time, [37]+Daniel Santa Cruz References 1. http://steamcommunity.com/sharedfiles/filedetails/?id=107105028 2. http://www.reddit.com/r/haskell/comments/24fw5k/nikki_and_the_robots_foss_haskell_game_has_been/ 3. http://www.reddit.com/r/haskell/comments/24hjak/so_i_reimplemented_freenet_in_haskell_what_now/ 4. http://www.reddit.com/r/haskell/comments/24hjak/so_i_reimplemented_freenet_in_haskell_what_now/ 5. http://bitemyapp.com/posts/2014-04-29-meditations-on-learning-haskell.html 6. http://www.reddit.com/r/haskell/comments/24adiv/meditations_on_learning_haskell_from_an_exclojure/ 7. http://chrisdone.com/posts/the-printer-haskell-deserves 8. http://www.reddit.com/r/haskell/comments/246iir/the_printer_haskell_deserves/ 9. http://queue.acm.org/detail.cfm?ref=rss&id=2611829 10. http://www.reddit.com/r/haskell/comments/243fm4/erik_meijer_the_curse_of_the_excluded_middle/ 11. http://www.alfredodinapoli.com/posts/2014-04-27-my-road-to-haskell.html 12. http://www.reddit.com/r/haskell/comments/246qty/my_road_to_haskell/ 13. http://chrisdone.com/posts/identity-monad 14. http://www.reddit.com/r/haskell/comments/24cq0u/the_identity_monad_trick/ 15. http://blog.johantibell.com/2014/05/ekg-04-released.html 16. http://www.reddit.com/r/haskell/comments/24g513/ekg_04_released/ 17. https://groups.google.com/forum/m/#!topic/elm-discuss/1acyOfxvasA 18. http://www.reddit.com/r/haskell/comments/24kvwh/evan_czaplicki_stop_saying_the_monad/ 19. http://robots.thoughtbot.com/thinking-in-types 20. http://www.reddit.com/r/haskell/comments/24k2wz/thinking_in_types/ 21. http://www.yesodweb.com/blog/2014/04/disemboweling-wai 22. http://www.reddit.com/r/haskell/comments/246e39/disemboweling_wai_aka_gutting_out_conduit/ 23. https://ghc.haskell.org/trac/ghc/wiki/Status/May14 24. http://www.reddit.com/r/haskell/comments/246fos/ghc_status_report_may_2014/ 25. http://www.forbes.com/sites/quora/2014/04/29/what-do-you-think-is-impeding-haskell-from-getting-mainstream-adoption/ 26. http://www.reddit.com/r/haskell/comments/24ddu3/what_do_you_think_is_impeding_haskell_from/ 27. https://www.fpcomplete.com/user/icelandj/Pattern%20synonyms 28. http://www.reddit.com/r/haskell/comments/24fvyz/pattern_synonyms_for_dates_and_an_irc_bot/ 29. http://elm-lang.org/blog/announce/0.12.1.elm 30. http://www.reddit.com/r/haskell/comments/24jo48/elm_0121_fast_immutable_arrays/ 31. https://github.com/purescript/purescript/releases/tag/v0.5.0 32. http://www.reddit.com/r/haskell/comments/244z52/purescript_05_released/ 33. http://rs.io/2014/04/30/why-category-theory-matters.html 34. http://www.reddit.com/r/haskell/comments/24nhfc/why_category_theory_matters/ 35. http://stackoverflow.com/questions/23401698/what-is-a-good-reason-to-use-a-type-signature-for-functions-when-the-compiler-ca 36. http://stackoverflow.com/questions/23342184/difference-between-monad-and-applicative-in-haskell 37. https://plus.google.com/105107667630152149014/about -------------- next part -------------- An HTML attachment was scrubbed... URL: From hesselink at gmail.com Thu May 8 06:35:19 2014 From: hesselink at gmail.com (Erik Hesselink) Date: Thu, 8 May 2014 08:35:19 +0200 Subject: [Haskell-cafe] Need pointer to explain CPU usage In-Reply-To: References: Message-ID: Could it be idle time garbage collection [0]? You can try turning it off with '+RTS -I0'. Erik [0] http://www.haskell.org/ghc/docs/7.6.3/html/users_guide/runtime-control.html#idp38498400 On Wed, May 7, 2014 at 9:43 PM, Robin Palotai wrote: > Hello List, > > I have a tiny scotty-based application, which when compiled and > started in profiling mode, consumes 10x CPU it does in normal mode. > > Interestingly, if I fire a request on the app, CPU usage drops to > minimal after finishing the request for a while. But after a few > minutes it starts consuming 10x CPU again. > > First I would have suspected scotty, however collecting time profiling > info with -p, -P or -Pa doesn't reveal much. That still not rules > scotty out however. > > To make matters worse, I inspect strange time profiling tick count I > can't explain - the .prof file says "2 ticks @ 1000 us", while the > application was clearly running idle for a good few seconds. > > Any ideas what am I missing? > > Thanks, > Robin > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From palotai.robin at gmail.com Thu May 8 06:56:06 2014 From: palotai.robin at gmail.com (Robin Palotai) Date: Thu, 8 May 2014 08:56:06 +0200 Subject: [Haskell-cafe] Need pointer to explain CPU usage In-Reply-To: References: Message-ID: Erik: I tried -I0 in the mean time, without effect. By the way it is GHC 7.6.3, flags are -threaded -rtsopts -O2 -caf-all -auto-all, runtime flags are +RTS -N -I0. Also, recent runs didn't show the behavior where CPU would go to zero after serving a request (goes back to 10% immediately after finishing), but this is a bit flaky. If I decrease the base tick rate with -V0.01, the CPU usage is lower - not sure if that is indicative. 2014-05-08 8:35 GMT+02:00 Erik Hesselink : > Could it be idle time garbage collection [0]? You can try turning it > off with '+RTS -I0'. > > Erik > > [0] http://www.haskell.org/ghc/docs/7.6.3/html/users_guide/runtime-control.html#idp38498400 > > On Wed, May 7, 2014 at 9:43 PM, Robin Palotai wrote: >> Hello List, >> >> I have a tiny scotty-based application, which when compiled and >> started in profiling mode, consumes 10x CPU it does in normal mode. >> >> Interestingly, if I fire a request on the app, CPU usage drops to >> minimal after finishing the request for a while. But after a few >> minutes it starts consuming 10x CPU again. >> >> First I would have suspected scotty, however collecting time profiling >> info with -p, -P or -Pa doesn't reveal much. That still not rules >> scotty out however. >> >> To make matters worse, I inspect strange time profiling tick count I >> can't explain - the .prof file says "2 ticks @ 1000 us", while the >> application was clearly running idle for a good few seconds. >> >> Any ideas what am I missing? >> >> Thanks, >> Robin >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe From madjestic13 at gmail.com Thu May 8 12:08:52 2014 From: madjestic13 at gmail.com (Vlad Lopatin) Date: Thu, 8 May 2014 14:08:52 +0200 Subject: [Haskell-cafe] reactive-banana GLFW-b event register example Message-ID: Hello List, I am trying to make the following quasi-code example work: registerMouseButton :: IO (Event MouseButton) registerMouseButton = do(addHandler, fire) <- newAddHandler setMouseButtonCallback $ \button _ -> fire button fromAddHandler addHandler According to http://stackoverflow.com/questions/8631816/reactive-banana-how-to-create-an-addhandlerit looks like it should be something straightforward. Can somebody show an example of a functional code that registers a key or a mouse event? Thanks, Vladimir -------------- next part -------------- An HTML attachment was scrubbed... URL: From dagitj at gmail.com Thu May 8 17:52:49 2014 From: dagitj at gmail.com (Jason Dagit) Date: Thu, 8 May 2014 10:52:49 -0700 Subject: [Haskell-cafe] reactive-banana GLFW-b event register example In-Reply-To: References: Message-ID: On Thu, May 8, 2014 at 5:08 AM, Vlad Lopatin wrote: > Hello List, > > I am trying to make the following quasi-code example work: > > registerMouseButton :: IO (Event MouseButton) > registerMouseButton = do(addHandler, fire) <- newAddHandler > setMouseButtonCallback $ \button _ -> fire button > fromAddHandler addHandler > > > According to > http://stackoverflow.com/questions/8631816/reactive-banana-how-to-create-an-addhandlerit looks like it should be something straightforward. > > Can somebody show an example of a functional code that registers a key or > a mouse event? > I don't have mouse registration, but this code should work for keys: https://github.com/dagit/1GAM/blob/master/pong/reactive-banana/Main.hs#L114 I haven't tested it in a while, but according to the git log I tested it against reactive-banana and GLFW-b at some point :) Jason -------------- next part -------------- An HTML attachment was scrubbed... URL: From madjestic13 at gmail.com Thu May 8 21:48:00 2014 From: madjestic13 at gmail.com (Vlad Lopatin) Date: Thu, 8 May 2014 23:48:00 +0200 Subject: [Haskell-cafe] reactive-banana GLFW-b event register example In-Reply-To: References: Message-ID: Thanks, Jason! The example compiled. I thing that's exactly what I need to break through this. I am going to study your code for some time now. On 8 May 2014 19:52, Jason Dagit wrote: > > > > On Thu, May 8, 2014 at 5:08 AM, Vlad Lopatin wrote: > >> Hello List, >> >> I am trying to make the following quasi-code example work: >> >> registerMouseButton :: IO (Event MouseButton) >> registerMouseButton = do(addHandler, fire) <- newAddHandler >> setMouseButtonCallback $ \button _ -> fire button >> fromAddHandler addHandler >> >> >> According to >> http://stackoverflow.com/questions/8631816/reactive-banana-how-to-create-an-addhandlerit looks like it should be something straightforward. >> >> Can somebody show an example of a functional code that registers a key or >> a mouse event? >> > > I don't have mouse registration, but this code should work for keys: > https://github.com/dagit/1GAM/blob/master/pong/reactive-banana/Main.hs#L114 > > I haven't tested it in a while, but according to the git log I tested it > against reactive-banana and GLFW-b at some point :) > > Jason > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dagitj at gmail.com Thu May 8 23:15:53 2014 From: dagitj at gmail.com (Jason Dagit) Date: Thu, 8 May 2014 16:15:53 -0700 Subject: [Haskell-cafe] reactive-banana GLFW-b event register example In-Reply-To: References: Message-ID: On Thu, May 8, 2014 at 2:48 PM, Vlad Lopatin wrote: > Thanks, Jason! The example compiled. I thing that's exactly what I need > to break through this. I am going to study your code for some time now. > Sure. That was a toy I wrote to learn basic FRP. I should warn you, because of the integration it has a massive space leak and quickly becomes unresponsive. Browse around in that repo for other version of pong that are playable. If I recall correctly, the yampa version works pretty well. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mwm at mired.org Thu May 8 23:18:02 2014 From: mwm at mired.org (Mike Meyer) Date: Thu, 8 May 2014 18:18:02 -0500 Subject: [Haskell-cafe] Templates as typeclasses? Message-ID: In going over yet again the many failings of template frameworks for building web apps, I recalled some of the features of the best of the lot, and wondered if those features might be useful in a Haskell template framework. Python's Cheetah tool makes templates almost fully functional members of Python's OO system. A template can inherit from a Python class or another template, and a Python class can inherit from a template. Which makes me wonder if something similar might not be useful in a Haskell template framework. Possibly have each template create an appropriate datatype and make it as an instance of the Template typeclass (and possibly others). Is there already a Haskell web framework that does something like this? Would it actually add value to a framework? Thanks, Mike -------------- next part -------------- An HTML attachment was scrubbed... URL: From kyle.marek.spartz at gmail.com Thu May 8 23:44:38 2014 From: kyle.marek.spartz at gmail.com (Kyle Marek-Spartz) Date: Thu, 8 May 2014 18:44:38 -0500 Subject: [Haskell-cafe] Templates as typeclasses? In-Reply-To: References: Message-ID: You may be interested in http://hackage.haskell.org/package/shakespeare ? Kyle Marek-Spartz On May 8, 2014, 6:18:02 PM, Mike Meyer wrote: In going over yet again the many failings of template frameworks for building web apps, I recalled some of the features of the best of the lot, and wondered if those features might be useful in a Haskell template framework. Python's Cheetah tool makes templates almost fully functional members of Python's OO system. A template can inherit from a Python class or another template, and a Python class can inherit from a template. Which makes me wonder if something similar might not be useful in a Haskell template framework. Possibly have each template create an appropriate datatype and make it as an instance of the Template typeclass (and possibly others). Is there already a Haskell web framework that does something like this? Would it actually add value to a framework? Thanks, Mike _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe at haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -------------- next part -------------- An HTML attachment was scrubbed... URL: From oleg at okmij.org Fri May 9 02:37:09 2014 From: oleg at okmij.org (oleg at okmij.org) Date: 9 May 2014 02:37:09 -0000 Subject: [Haskell-cafe] ML Family Workshop -- Last call for presentations Message-ID: <20140509023709.16086.qmail@www1.g3.pair.com> Important dates Monday May 19 (any time zone): Abstract submission Monday June 30: Author notification Thursday September 4, 2014: ML Family Workshop Higher-order, Typed, Inferred, Strict: ACM SIGPLAN ML Family Workshop Thursday September 4, 2014, Gothenburg, Sweden (immediately following ICFP and preceding OCaml Users and Developers Workshop) Call For Papers http://okmij.org/ftp/ML/ML14.html ML is a very large family of programming languages that includes Standard ML, OCaml, F#, SML#, Manticore, MetaOCaml, JoCaml, Alice ML, Dependent ML, Flow Caml, and many others. All ML languages, beside the great deal of syntax, share several fundamental traits. They are all higher-order, strict, mostly pure, and typed, with algebraic and other data types. Their type systems inherit from Hindley-Milner. The development of these languages has inspired a significant amount of computer science research and influenced a number of programming languages, including Haskell, Scala and Clojure, as well as Rust, ATS and many others. ML workshops have been held in affiliation with ICFP continuously since 2005. This workshop specifically aims to recognize the entire extended ML family and to provide the forum to present and discuss common issues, both practical (compilation techniques, implementations of concurrency and parallelism, programming for the Web) and theoretical (fancy types, module systems, metaprogramming). The scope of the workshop includes all aspects of the design, semantics, theory, application, implementation, and teaching of the members of the ML family. We also encourage presentations from related languages (such as Scala, Rust, Nemerle, ATS, etc.), to exchange experience of further developing ML ideas. The ML family workshop will be held in close coordination with the OCaml Users and Developers Workshop. Format Since 2010, the ML workshop has adopted an informal model. Presentations are selected from submitted abstracts. There are no published proceedings, so any contributions may be submitted for publication elsewhere. We hope that this format encourages the presentation of exciting (if unpolished) research and deliver a lively workshop atmosphere. Each presentation should take 20-25 minutes, except demos, which should take 10-15 minutes. The exact time will be decided based on the number of accepted submissions. The presentations will likely be recorded. Post-conference proceedings The post-proceedings of selected papers from the ML Family and the OCaml Users and Developers workshops will be published in the Electronic Proceedings in Theoretical Computer Science (EPTCS). The Program Committee shall invite interested authors of selected presentations to expand their abstract for inclusion in the proceedings. The submissions are to be reviewed according to the EPTCS standards. Coordination with the OCaml Users and Developers Workshop The OCaml workshop is seen as more practical and is dedicated in significant part to the OCaml community building and the evolution of the OCaml system. In contrast, the ML family workshop is not focused on any language in particular, is more research oriented, and deals with general issues of the ML-style programming and type systems. Yet there is an overlap, which we are keen to explore in various ways. The authors who feel their submission fits both workshops are encouraged to mention it at submission time or contact the Program Chairs. Scope We acknowledge the whole breadth of the ML family and aim to include languages that are closely related (although not by blood), such as Rust, ATS, Scala, Typed Clojure. Those languages have implemented and investigated run-time and type system choices that may be worth considering for OCaml, F# and other ML languages. We also hope that the exposure to the state of the art ML might favorably influence those related languages. Specifically, we seek research presentations on topics including but not limited to * Design: concurrency, distribution and mobility, programming for the web and embedded systems, handling semi-structured data, facilitating interactive programming, higher forms of polymorphism, generic programming, objects * Implementation: compilation techniques, interpreters, type checkers, partial evaluators, runtime systems, garbage collectors, etc. * Type systems: fancy types, inference, effects, overloading, modules, contracts, specifications and assertions, dynamic typing, error reporting, etc. * Applications: case studies, experience reports, pearls, etc. * Environments: libraries, tools, editors, debuggers, cross-language interoperability, functional data structures, etc. * Education: ML and ML-like languages in college or high-school, in general or computer science curriculum. Four kinds of submissions will be accepted: Informed Positions, Research Presentations, Experience Reports and Demos. * Informed Positions: A justified argument for or against a language feature. The argument must be substantiated, either theoretically (e.g., by a demonstration of (un)soundness, an inference algorithm, a complexity analysis), empirically or by a substantial experience. Personal experience is accepted as justification so long as it is extensive and illustrated with concrete examples. * Research Presentations: Research presentations should describe new ideas, experimental results, or significant advances in ML-related projects. We especially encourage presentations that describe work in progress, that outline a future research agenda, or that encourage lively discussion. These presentations should be structured in a way which can be, at least in part, of interest to (advanced) users. * Experience Reports: Users are invited to submit Experience Reports about their use of ML and related languages. These presentations do not need to contain original research but they should tell an interesting story to researchers or other advanced users, such as an innovative or unexpected use of advanced features or a description of the challenges they are facing or attempting to solve. * Demos: Live demonstrations or short tutorials should show new developments, interesting prototypes, or work in progress, in the form of tools, libraries, or applications built on or related to ML. (You will need to provide all the hardware and software required for your demo; the workshop organizers are only able to provide a projector.) Submission Submissions should be at most two pages, in PDF format, and printable on US Letter or A4 sized paper. A submission should have a synopsis (2-3 lines) and a body between 1 and 2 pages, in one- or two-column layout. The synopsis should be suitable for inclusion in the workshop program. Submissions must be uploaded to the workshop submission website before the submission deadline (Monday May 19, 2014). For any question concerning the scope of the workshop or the submission process, please contact the program chair. Program Committee Kenichi Asai Ochanomizu University, Japan Matthew Fluet Rochester Institute of Technology, USA Jacques Garrigue Nagoya University, Japan Dave Herman Mozilla, USA Stefan Holdermans Vector Fabrics, Netherlands Oleg Kiselyov (Chair) Monterey, CA, USA Keiko Nakata Tallinn University of Technology, Estonia Didier Remy INRIA Paris-Rocquencourt, France Zhong Shao Yale University, USA Hongwei Xi Boston University, USA From reilithion at gmail.com Fri May 9 04:57:44 2014 From: reilithion at gmail.com (Lucas Paul) Date: Thu, 8 May 2014 22:57:44 -0600 Subject: [Haskell-cafe] Unicode Haskell source -- Yippie! In-Reply-To: <53597D2D.6060107@nh2.me> References: <53597D2D.6060107@nh2.me> Message-ID: Since I saw there wasn't one yet, I have taken the liberty of writing a PKGBUILD for Hasklig and uploading it to the Arch AUR. Anyone running Arch can now get Hasklig from the AUR package otf-hasklig. On Thu, Apr 24, 2014 at 3:07 PM, Niklas Hamb?chen wrote: > A smart, recently proposed alternative is using a font that does this > automatically for you: https://github.com/i-tu/Hasklig > > In my opinion, this gives you all benefits of unicode syntax without > imposing the drawbacks on others, and you don't even have to set up a > custom input method to conveniently type them in. > > Quoting: > > Some Haskell programmers have resorted to unicode symbols in code as a > solution (?, ? etc.). This opens a whole new can of worms. In addition > to encoding/compatibility problems and all the reasons it never worked > out for APL, these symbols are one-character-wide and therefore > eye-strainingly small. > > Hasklig solves this problem the way typographers have always solved > ill-fitting characters which co-occur often: ligatures. The underlying > code stays the same ? only the representation changes. From mwm at mired.org Fri May 9 05:32:33 2014 From: mwm at mired.org (Mike Meyer) Date: Fri, 9 May 2014 00:32:33 -0500 Subject: [Haskell-cafe] Templates as typeclasses? In-Reply-To: References: Message-ID: I don't see it. Hamlet et al are similar to other Haskell web template system, which means similar to most other web template systems, except with better typing. The result of compiling a template isn't a type, nor is it a function of any kind - it's just data. The type of that data varies a little depending on the content, but can be identical for different templates, so there's no unique type for a template as there is with Cheetah. While the static typing one finds in haskell web template systems is better than the dynamic typing in Cheetah and other templates based on dynamically typed languages, that's inside the templates. The objects generated by the templates don't do much of anything to let the application author leverage the type system, which is what makes Cheetah stand out from other web template systems. On Thu, May 8, 2014 at 6:44 PM, Kyle Marek-Spartz < kyle.marek.spartz at gmail.com> wrote: > You may be interested in http://hackage.haskell.org/package/shakespeare > > ? > Kyle Marek-Spartz > > > > On May 8, 2014, 6:18:02 PM, Mike Meyer wrote: > ------------------------------ > In going over yet again the many failings of template frameworks for > building web apps, I recalled some of the features of the best of the lot, > and wondered if those features might be useful in a Haskell template > framework. > > Python's Cheetah tool makes templates almost fully functional members of > Python's OO system. A template can inherit from a Python class or another > template, and a Python class can inherit from a template. > > Which makes me wonder if something similar might not be useful in a > Haskell template framework. Possibly have each template create an > appropriate datatype and make it as an instance of the Template typeclass > (and possibly others). > > Is there already a Haskell web framework that does something like this? > Would it actually add value to a framework? > > Thanks, > Mike > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From han.joosten.han at gmail.com Fri May 9 06:51:56 2014 From: han.joosten.han at gmail.com (Han Joosten) Date: Fri, 9 May 2014 08:51:56 +0200 Subject: [Haskell-cafe] Announcement: First Dutch FinTech Hackaton Message-ID: Hi all, Always wanted to show the industry what Functional Programming can do? Have a look at http://dutchfintechhackathon.nl/ for this is a great opportunity to do so! please spread the word, I think it would be very cool if a FP-team would participate. Cheers! Han Joosten -------------- next part -------------- An HTML attachment was scrubbed... URL: From haskell at ibotty.net Fri May 9 07:11:44 2014 From: haskell at ibotty.net (Tobias Florek) Date: Fri, 09 May 2014 09:11:44 +0200 Subject: [Haskell-cafe] Templates as typeclasses? In-Reply-To: References: Message-ID: <536C7FB0.2040505@ibotty.net> hi, >The objects generated by the templates don't do much of > anything to let the application author leverage the type system, which > is what makes Cheetah stand out from other web template systems. can you elaborate on that point? i would really like to see an example on what you mean. for another datapoint, have a look at hastache's use of generics hackage.haskell.org/package/hastache/docs/Text-Hastache.html tobias florek From mwm at mired.org Fri May 9 07:34:52 2014 From: mwm at mired.org (Mike Meyer) Date: Fri, 9 May 2014 02:34:52 -0500 Subject: [Haskell-cafe] Templates as typeclasses? In-Reply-To: <536C7FB0.2040505@ibotty.net> References: <536C7FB0.2040505@ibotty.net> Message-ID: On Fri, May 9, 2014 at 2:11 AM, Tobias Florek wrote: > hi, > > The objects generated by the templates don't do much of >> anything to let the application author leverage the type system, which >> is what makes Cheetah stand out from other web template systems. >> > > can you elaborate on that point? i would really like to see an example on > what you mean. > > for another datapoint, have a look at hastache's use of generics > hackage.haskell.org/package/hastache/docs/Text-Hastache.html I mentioned that briefly in the original message: A Cheetah template is a Python class. It can inherit from Python classes, and Python classes can inherit from it. A standard usage is to have a page template that sets up headers and footers, and make your pages are all children of that class. While header/footer support is a stock feature of any modern templating system, Cheetah does it by leveraging it's integration into the Python class system instead of providing a specific mechanism for it. If you need something to happen on the server when the page renders - that doesn't leave any traces in the output - you can subclass the template with a standard Python class and provide that functionality. You then use the Python subclass just like a regular template. Again, the behavior isn't special, but doing it takes no special machinery, just leveraging Cheetah templates being classes. You can find simple examples of this in the Cheetah docs: http://www.cheetahtemplate.org/docs/users_guide_html_multipage/howWorks.objoriented.html -------------- next part -------------- An HTML attachment was scrubbed... URL: From ian.tuomi at aalto.fi Fri May 9 07:44:56 2014 From: ian.tuomi at aalto.fi (Ian Tuomi) Date: Fri, 9 May 2014 10:44:56 +0300 Subject: [Haskell-cafe] Unicode Haskell source -- Yippie! In-Reply-To: References: <53597D2D.6060107@nh2.me> Message-ID: <8D38C5D1-3143-4DA3-BD0E-A9FAD7E70CC7@aalto.fi> On 9 May 2014, at 7:57, Lucas Paul wrote: > Since I saw there wasn't one yet, I have taken the liberty of writing > a PKGBUILD for Hasklig and uploading it to the Arch AUR. Anyone > running Arch can now get Hasklig from the AUR package otf-hasklig. That's great! Thank you very much for doing this. -Ian From tdammers at gmail.com Fri May 9 07:51:52 2014 From: tdammers at gmail.com (Tobias Dammers) Date: Fri, 9 May 2014 09:51:52 +0200 Subject: [Haskell-cafe] Templates as typeclasses? In-Reply-To: References: Message-ID: <20140509075151.GA32214@yemaya> I think what you're after is a template language implemented as an EDSL, that is, a domain-specific language embedded in the host language, such that the template language's building blocks are language constructs in the host language. The various Haskell template systems take varying approaches here. The ones I can think of are: - EDSL's, like Blaze, where templates are Haskell functions composed of other Haskell functions. E.g.: `myTemplate = div $ do { h1 "hello"; p $ toHtml $ toNameCase username }` - Quasi-quoters, where the parsed template gets injected into the host Haskell code at compile time, before type checking even. Some of these have syntax constructs for popping Haskell code back into the template. Example: `[template|

Hello

{{ toNameCase username }}

|] - Preprocessors, where you run your Haskell source through an external tool before compiling it. Example: `template =

"Hello"

toNameCase username

` - Full-on templates, where you feed template source to a template compiler or interpreter with an explicit context, e.g.: `runTemplate "myTemplate.tpl" [("username", toNameCase username)]` I think it should even be possible to build some sort of hybrid that can run in several modes, e.g. you'd run it through an interpreter during development (for faster development cycles, skipping the build step), but for production you compile them into your binary (for easier deployment, better performance, and static type checks). I haven't seen anything like that though so far, at least not industry-strength. Have experimented with the idea myself, but then again, the result isn't quite there yet. On Thu, May 08, 2014 at 06:18:02PM -0500, Mike Meyer wrote: > In going over yet again the many failings of template frameworks for > building web apps, I recalled some of the features of the best of the lot, > and wondered if those features might be useful in a Haskell template > framework. > > Python's Cheetah tool makes templates almost fully functional members of > Python's OO system. A template can inherit from a Python class or another > template, and a Python class can inherit from a template. > > Which makes me wonder if something similar might not be useful in a Haskell > template framework. Possibly have each template create an appropriate > datatype and make it as an instance of the Template typeclass (and > possibly others). > > Is there already a Haskell web framework that does something like this? > Would it actually add value to a framework? > > Thanks, > Mike > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From tdammers at gmail.com Fri May 9 08:15:38 2014 From: tdammers at gmail.com (Tobias Dammers) Date: Fri, 9 May 2014 10:15:38 +0200 Subject: [Haskell-cafe] Templates as typeclasses? In-Reply-To: References: <536C7FB0.2040505@ibotty.net> Message-ID: <20140509081537.GA17898@yemaya> You can do similar things with Haskell EDSL-style template systems such as Blaze, except that Haskell is not an OOP language, so you will be using different abstractions instead. Still, the big picture with these is that template building blocks are language elements, and template code and regular code can be mixed freely. The `h1` function from Blaze is just another Haskell function; it takes a MarkdownM () value and returns a MarkdownM (), and because MarkdownM happens to be a Monad, you can use do notation to sequence HTML elements. MarkdownM () is also an instance of IsString, so if you enable -XOverloadedStrings, you can use string literals to produce HTML text nodes. This means that you can write, in plain Haskell: h1 $ do span "Hello, " span "world!" ...and it'll produce

Hello, world!

. For the common case where you have a "master" template and an incarnation, you could write a master template that takes its inner blocks as arguments, e.g.: masterT :: Text -> Html -> Html -> Html masterT titleText headerExtra content = do html $ do header $ do title $ toHtml titleText headerExtra body $ do h1 $ toHtml titleText div ! class_ "content" $ content footer $ "This is my super footer!" If you want something that behaves more like inheritance, the best way IMO would be to define the available blocks as a record type, e.g.: data TemplateBlocks = TemplateBlocks { tbTitleText :: Text , tbHeaderExtra :: Html , tbContent :: Html } -- Then provide some sensible defaults: defTemplateBlocks :: TemplateBlocks defTemplateBlocks = TemplateBlocks { tbTitleText = "My super web app" , tbHeaderExtra = return () , tbContent = return () } -- and then your master template becomes: masterT :: TemplateBlocks -> Html masterT tb = do html $ do header $ do title $ toHtml $ tbTitleText tb tbHeaderExtra tb body $ do h1 $ toHtml $ tbTitleText tb div ! class_ "content" $ tbContent tb footer $ "This is my super footer!" -- And then you can call it with the defaults, overriding -- as needed: masterT $ defTemplateBlocks { tbTitleText = "Homepage" , tbContent = div "Hello, world!" } Now, if you want to use template blocks *inside* template blocks, you need to alter your blocks a tiny bit in order to read other blocks into them: data TemplateBlocks = TemplateBlocks { tbTitleText :: Text , tbHeaderExtra :: TemplateBlocks -> Html , tbContent :: TemplateBlocks -> Html } -- now you could do, for example: masterT $ defTemplateBlocks { tbTitleText = "Homepage" , tbContent tb = div $ do "Hello, world!" "You are here: " toHtml $ tbTitleText tb } Now if MarkupM were implemented as a monad transformer, we could even stack it on top of a MonadReader TemplateBlocks to avoid passing the tb parameter explicitly, and lensify the whole thing, but oh well. (BTW, is anyone aware of any efforts in making Blaze into a transformer?) On Fri, May 09, 2014 at 02:34:52AM -0500, Mike Meyer wrote: > On Fri, May 9, 2014 at 2:11 AM, Tobias Florek wrote: > > > hi, > > > > The objects generated by the templates don't do much of > >> anything to let the application author leverage the type system, which > >> is what makes Cheetah stand out from other web template systems. > >> > > > > can you elaborate on that point? i would really like to see an example on > > what you mean. > > > > for another datapoint, have a look at hastache's use of generics > > hackage.haskell.org/package/hastache/docs/Text-Hastache.html > > > I mentioned that briefly in the original message: A Cheetah template is a > Python class. It can inherit from Python classes, and Python classes can > inherit from it. > > A standard usage is to have a page template that sets up headers and > footers, and make your pages are all children of that class. While > header/footer support is a stock feature of any modern templating system, > Cheetah does it by leveraging it's integration into the Python class system > instead of providing a specific mechanism for it. > > If you need something to happen on the server when the page renders - that > doesn't leave any traces in the output - you can subclass the template with > a standard Python class and provide that functionality. You then use the > Python subclass just like a regular template. Again, the behavior isn't > special, but doing it takes no special machinery, just leveraging Cheetah > templates being classes. > > You can find simple examples of this in the Cheetah docs: > http://www.cheetahtemplate.org/docs/users_guide_html_multipage/howWorks.objoriented.html > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From agocorona at gmail.com Fri May 9 10:39:54 2014 From: agocorona at gmail.com (Alberto G. Corona ) Date: Fri, 9 May 2014 12:39:54 +0200 Subject: [Haskell-cafe] Templates as typeclasses? In-Reply-To: <20140509081537.GA17898@yemaya> References: <536C7FB0.2040505@ibotty.net> <20140509081537.GA17898@yemaya> Message-ID: Hi Mike, all. Haskell prefer composability over inheritance. Composition is on site, while inheritance can be hidden to the programmer and it can be too rigid. What happens if I create my framework around a class template with header and footer and later I need to program web services with it? I need to create more classes for each particular problem and so on in the framework. It is possible that these classes don?t fit the need of every particular problem. In the other side, a basic set of combinators can fit any problem. So inheritance can become bad magic. While composability gives freedom. For those of you that may not know about it, MFlow [1] templates use composition of formlets called widgets. A MFlow page has type: View renderingFormat monad returnValue It is made by the applicative and monadic composition of formets with the same type. I can have: import MFlow.Wai.Blaze.Html.All myTemplate body= html <<< myheader **> body <** myfooter where myheader = .... myfoother = ... with "html" a blaze-html combinator. "myHeader" and "myfooter" are widgets. body is the parameter widget that I give to the template. the operator **> ignores the result of the first term like *> if whe define: type Widget a= View Text.Blaze.Html IO a then: myTemplate:: Widget a -> Widget a I can alternatively do it using classes. I define a class: class Template where header:: Widget () body :: Widget a footer :: Widget () data MyTemp a = ..... instance Template (MyTemp a) where ... .. myTemplate mytemp= html << header mytemp **> body mytemp <** footer mytemp It seems cumbresome, rigid and redundant to me, like many OO code.. What "header" means in that class? it includes also the html
tag or it is simply some common html for all pages at the beginning? It is probable that this class definition is not appropriate for all pages. neither the combinator version. but with an EDSL I can create page template variants faster for my particular problem. But some particular problem can justify the creation of class templates in order to enforce some requirements and make use of the extra level of abstraction that it brings. As shown above, It is possible to do it in Haskell and MFlow. But this is not IMHO the right base design assumption for a (Haskell) web framework. It may be for some particular problem. [1] http://mflowdemo.herokuapp.com 2014-05-09 10:15 GMT+02:00 Tobias Dammers : > You can do similar things with Haskell EDSL-style template systems such > as Blaze, except that Haskell is not an OOP language, so you will be > using different abstractions instead. > > Still, the big picture with these is that template building blocks are > language elements, and template code and regular code can be mixed > freely. The `h1` function from Blaze is just another Haskell function; > it takes a MarkdownM () value and returns a MarkdownM (), and because > MarkdownM happens to be a Monad, you can use do notation to sequence > HTML elements. MarkdownM () is also an instance of IsString, so if you > enable -XOverloadedStrings, you can use string literals to produce HTML > text nodes. This means that you can write, in plain Haskell: > > h1 $ do > span "Hello, " > span "world!" > > ...and it'll produce

Hello, world!

. > > For the common case where you have a "master" template and an > incarnation, you could write a master template that takes its inner > blocks as arguments, e.g.: > > masterT :: Text -> Html -> Html -> Html > masterT titleText headerExtra content = do > html $ do > header $ do > title $ toHtml titleText > headerExtra > body $ do > h1 $ toHtml titleText > div ! class_ "content" $ content > footer $ "This is my super footer!" > > If you want something that behaves more like inheritance, the best way > IMO would be to define the available blocks as a record type, e.g.: > > data TemplateBlocks = > TemplateBlocks > { tbTitleText :: Text > , tbHeaderExtra :: Html > , tbContent :: Html > } > -- Then provide some sensible defaults: > defTemplateBlocks :: TemplateBlocks > defTemplateBlocks = > TemplateBlocks > { tbTitleText = "My super web app" > , tbHeaderExtra = return () > , tbContent = return () > } > -- and then your master template becomes: > masterT :: TemplateBlocks -> Html > masterT tb = do > html $ do > header $ do > title $ toHtml $ tbTitleText tb > tbHeaderExtra tb > body $ do > h1 $ toHtml $ tbTitleText tb > div ! class_ "content" $ tbContent tb > footer $ "This is my super footer!" > -- And then you can call it with the defaults, overriding > -- as needed: > masterT $ defTemplateBlocks > { tbTitleText = "Homepage" > , tbContent = div "Hello, world!" > } > > Now, if you want to use template blocks *inside* template blocks, you > need to alter your blocks a tiny bit in order to read other blocks into > them: > > data TemplateBlocks = > TemplateBlocks > { tbTitleText :: Text > , tbHeaderExtra :: TemplateBlocks -> Html > , tbContent :: TemplateBlocks -> Html > } > -- now you could do, for example: > masterT $ defTemplateBlocks > { tbTitleText = "Homepage" > , tbContent tb = > div $ do > "Hello, world!" > "You are here: " > toHtml $ tbTitleText tb > } > > Now if MarkupM were implemented as a monad transformer, we could even > stack it on top of a MonadReader TemplateBlocks to avoid passing the tb > parameter explicitly, and lensify the whole thing, but oh well. (BTW, is > anyone aware of any efforts in making Blaze into a transformer?) > > On Fri, May 09, 2014 at 02:34:52AM -0500, Mike Meyer wrote: > > On Fri, May 9, 2014 at 2:11 AM, Tobias Florek > wrote: > > > > > hi, > > > > > > The objects generated by the templates don't do much of > > >> anything to let the application author leverage the type system, which > > >> is what makes Cheetah stand out from other web template systems. > > >> > > > > > > can you elaborate on that point? i would really like to see an example > on > > > what you mean. > > > > > > for another datapoint, have a look at hastache's use of generics > > > hackage.haskell.org/package/hastache/docs/Text-Hastache.html > > > > > > I mentioned that briefly in the original message: A Cheetah template is a > > Python class. It can inherit from Python classes, and Python classes can > > inherit from it. > > > > A standard usage is to have a page template that sets up headers and > > footers, and make your pages are all children of that class. While > > header/footer support is a stock feature of any modern templating system, > > Cheetah does it by leveraging it's integration into the Python class > system > > instead of providing a specific mechanism for it. > > > > If you need something to happen on the server when the page renders - > that > > doesn't leave any traces in the output - you can subclass the template > with > > a standard Python class and provide that functionality. You then use the > > Python subclass just like a regular template. Again, the behavior isn't > > special, but doing it takes no special machinery, just leveraging Cheetah > > templates being classes. > > > > You can find simple examples of this in the Cheetah docs: > > > http://www.cheetahtemplate.org/docs/users_guide_html_multipage/howWorks.objoriented.html > > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://www.haskell.org/mailman/listinfo/haskell-cafe > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -- Alberto. -------------- next part -------------- An HTML attachment was scrubbed... URL: From oleg at okmij.org Fri May 9 10:55:34 2014 From: oleg at okmij.org (oleg at okmij.org) Date: 9 May 2014 10:55:34 -0000 Subject: [Haskell-cafe] Templates as typeclasses? Message-ID: <20140509105534.79174.qmail@www1.g3.pair.com> Tobias Dammers wrote: > You can do similar things with Haskell EDSL-style template systems such > as Blaze... > > Still, the big picture with these is that template building blocks are > language elements, and template code and regular code can be mixed > freely. The `h1` function from Blaze is just another Haskell function; > it takes a MarkdownM () value and returns a MarkdownM (), and because > MarkdownM happens to be a Monad, you can use do notation to sequence > HTML elements. MarkdownM () is also an instance of IsString, so if you > enable -XOverloadedStrings, you can use string literals to produce HTML > text nodes. This means that you can write, in plain Haskell: > > h1 $ do > span "Hello, " > span "world!" > > ...and it'll produce

Hello, world!

. In this regard it is worth mentioning HSXML http://okmij.org/ftp/Scheme/xml.html#typed-SXML The document in HSXML is a monoid rather than a monad. It is hard to find a good reason for the document be a monad except for using a do notation, which is not needed in HSXML. The above "Hello, World!" example looks in HSXML as h1 (span "Hello") (span "world!") (Note that we don't need the space after `Hello'.) This produces the desired output (in plain text, HTML or XML). If we don't need span, we can just write h1 "Hello" "world!" The main difference from Blaze shows up if we attempt h1 (p "Hello") "world!" It will be a type error. The error message says No instance for (Build (DC CT_inline d0) (DC CT_block d0) t) arising from a use of `h1' No instance for (Build (DC CT_inline d0) (DC CT_block d0) (DC CT_inline d0)) arising from a use of `p' That is, (p "Hello") produces block-level content and h1 requires its children to be inline-level. HSXML thus implements the block/inline content model of HTML. Arbitrary many content content-level tags may be defined (in fact, HSXML, besides block/inline elements uses document-, attribute-, and table-level elements). It is possible for the same element to be usable in different contexts (e.g., 'title' can be either an attribute or an element used within 'head'). It is rendered differently in different contexts. Although the document itself is just a monoid rather than a monad, rendering a document can be in a monad. For instance, one of the rendering engines works in an IO monad so it can validate local links as the document is rendered. The resulting document does not have dead local links. > For the common case where you have a "master" template and an > incarnation, you could write a master template that takes its inner > blocks as arguments, e.g.: It is very easy to do that in HSXML. Here is an example, the top template for the ChangeLog: toHTML :: MDoc d => CLHead d -> DC CT_root d toHTML (CLHead attrs updates) = document (head (title (cdata (ha_title attrs))) (meta_tag (description (cdata (ha_description attrs)))) author_address (meta_tag (pub_date (ha_DateRevision attrs))) (head_link LR_top (href (ha_top attrs)) (title "All you can find here")) ) (body (h1 "Log of changes on" (aref (ha_top attrs) "this site")) (p nbsp) updates (change_log_prev (ha_history_first attrs)) (change_log_prev (ha_history_last attrs)) ) (One could omit many parentheses using $, but I like parentheses in this context). From P.Achten at cs.ru.nl Fri May 9 13:37:31 2014 From: P.Achten at cs.ru.nl (Peter Achten) Date: Fri, 09 May 2014 15:37:31 +0200 Subject: [Haskell-cafe] [TFPIE2014] final call for participation Message-ID: <536CDA1B.9000700@cs.ru.nl> [FINAL CALL FOR PARTICIPATION] 3rd International Workshop on Trends in Functional Programming in Education (TFPIE 2014) May 25, 2014 Utrecht University Soesterberg, The Netherlands (http://www.cs.uwyo.edu/~jlc/tfpie14/) The 3rd International Workshop on Trends in Functional Programming in Education, TFPIE 2014, will be co-located with the Symposium on Trends in Functional Programming (TFP 2014) at Soesterberg, at the ?Kontakt der Kontinenten? hotel in the Netherlands on Sunday, May 25th. TFP will follow from May 26-28. The goal of TFPIE is to gather researchers, teachers and professionals that use, or are interested in the use of, functional programming in education. TFPIE aims to be a venue where novel ideas, classroom-tested ideas and work-in-progress on the use of functional programming in education are discussed. The one-day workshop will foster a spirit of open discussion by having a review process for publication after the workshop. The program chair of TFPIE 2014 will screen submissions to ensure that all presentations are within scope and are of interest to participants. Potential presenters are invited to submit an extended abstract (4-6 pages) or a draft paper (up to 16 pages) in EPTCS style. The authors of accepted presentations will have their preprints and their slides made available on the workshop's website/wiki. Visitors to the TFPIE 2014 website/wiki will be able to add comments. This includes presenters who may respond to comments and questions as well as provide pointers to improvements and follow-up work. After the workshop, presenters will be invited to submit (a revised version of) their article for review. The PC will select the best articles for publication in the journal Electronic Proceedings in Theoretical Computer Science (EPTCS). Articles not selected for presentation and extended abstracts will not be formally reviewed by the PC. TFPIE workshops have previously been held in St Andrews, Scotland (2012) and in Provo Utah, USA (2013). ** Invited Speaker ** TFPIE is pleased to announce that professor Johan Jeuring of Utrecht University and Open University, both in The Netherlands is giving an invited talk entitled: "Automatic tutoring and assessing functional programs". ** Program Committee ** James Caldwell, (Program Chair) University of Wyoming Peter Achten, Radboud University, Nijmgen Edwin Brady, University of St Andrews, St Andrews Jurriaan Hage, Universiteit Utrecht Philip Holzenspies, University of Twente Daniel R. Licata, Wesleyan University Marco T Morazan, Seton Hall University Christian Skalka, University of Vermont David Van Horn, Northeastern University ** Program ** The preliminary program of TFPIE 2014 is available at the home site of TFPIE 2014 and the TFPIE wiki (http://wiki.science.ru.nl/tfpie/Main_Page). This year's edition features 14 talks. The program is closed with a plenary discussion. ** Important Dates ** * 1 February 2014: TFPIE submissions open on easychair. * 14 April 2014: Early registration for TFP closes * 21 April 2014: Submission deadline for draft TFPIE papers and abstracts * 27 April 2014: Notification of acceptance for presentation * 15 May 2014: Registration for TFPIE closes - as does late registration for TFP * 25 May 2014: Presentations in Soesterberg, Netherlands * 29 June 2014: Full papers for EPTCS proceedings due * 16 August 2014: Notification of acceptance for proceedings * 8 September 2014: Camera ready copy due for EPTCS Submission of an abstract implies no obligation to submit a full paper; abstracts with no corresponding full versions by the full paper deadline will be considered as withdrawn. At least one author from each accepted presentation must attend the workshop. From mwm at mired.org Fri May 9 16:03:26 2014 From: mwm at mired.org (Mike Meyer) Date: Fri, 9 May 2014 11:03:26 -0500 Subject: [Haskell-cafe] Templates as typeclasses? In-Reply-To: <20140509081537.GA17898@yemaya> References: <536C7FB0.2040505@ibotty.net> <20140509081537.GA17898@yemaya> Message-ID: On Fri, May 9, 2014 at 3:15 AM, Tobias Dammers wrote: > You can do similar things with Haskell EDSL-style template systems such > as Blaze, except that Haskell is not an OOP language, so you will be > using different abstractions instead. All true, and things like Blaze are much nicer than most template systems. I've even got a Python templating system using an architecture similar to blaze (html tags are composeable functions) that fit in between the two. However, that's about the syntax for creating templates, not their fundamental nature. And of course this would use different abstractions. What's interesting isn't the abstractions, it's that they're obtained by moving templates into the type system. To take a step back: In most template systems (including Blaze), "template" is a type provided by the system, and you create an element of that type which you can then combine in some way with data to render, creating something that can be sent to a web browser. Exactly how "render" is implemented varies from system to system: methods on the template class, macros, and functions you pass a template to have all been used. In Cheetah, template is an abstract base class (typeclass being the closest Haskell analogue). A template is a class that implements that ABC (a datatype that's an instance of the typeclass in Haskell). You can treat it just like any other class. That includes creating an instance of the class (an element of the datatype) that can then be combined with data and rendered. > Still, the big picture with these is that template building blocks are > language elements, and template code and regular code can be mixed > freely. And the big picture for Cheetah is that the template building blocks are TYPE elements. That's what's interesting. The functionality that falls out of it naturally depends on the type system, and is generally uninteresting. The questions I'd actually like answered is whether any Haskell template system uses a similar architecture, and whether doing so provides any interesting functionality. > If you want something that behaves more like inheritance, I don't. As stated above, that's uninteresting. I doubt if a web app developer ever wanted inheritance. Or a monad. Any more than a carpenter ever wanted a 10mm drill bit. > Now if MarkupM were implemented as a monad transformer, we could even > stack it on top of a MonadReader TemplateBlocks to avoid passing the tb > parameter explicitly, and lensify the whole thing, but oh well. (BTW, is > anyone aware of any efforts in making Blaze into a transformer?) And if MarkupM were a typeclass, and your templates a datatype, then you could think about implementing your templates as monad transformers, instead of needing it to be done in MarkupM. Thanks, From mwm at mired.org Fri May 9 16:58:34 2014 From: mwm at mired.org (Mike Meyer) Date: Fri, 9 May 2014 11:58:34 -0500 Subject: [Haskell-cafe] Templates as typeclasses? In-Reply-To: References: <536C7FB0.2040505@ibotty.net> <20140509081537.GA17898@yemaya> Message-ID: On Fri, May 9, 2014 at 5:39 AM, Alberto G. Corona wrote: Hi Mike, all. Hi Alberto, Seems like you're the first person to try and answer the question I've asked. Thank you. > What happens if I create my framework around a class template with header and footer and later I need to program web services with it? I need to create more classes for each particular problem and so on in the framework. It is possible that these classes don?t fit the need of every particular problem. That would be a bad design. It isn't inheritance here that's the problem, it's the class hierarchy. At least, that's my first though on it. > In the other side, a basic set of combinators can fit any problem. So inheritance can become bad magic. While composability gives freedom. Right. And good types give power. Haskell shows you can have both. > I can alternatively do it using classes. I define a class: > > class Template where > header:: Widget () > body :: Widget a > footer :: Widget () That might work for a single template, but as you note, it's to inflexible to use for many kinds of template. If I were going to do this (and I'm probably not), it'd be more like: class Template a where render :: String -- generate a static string of bytes -- provide instances of Monad, Monoid, and whatever else you -- think might be handy as well. instance Template Blaze.Html where render = renderHtml That's all part of the framework. Then your template system should swallow your EDSL, and produce something like: data MyPage = MyPage Template Template Template instance Template MyPage where render (MyPage head foot body) = ... (or maybe it should use a record, or a tuple, or something else). This isn't that much difference from something like Blaze. Except that the templates being datatypes instead of functions means you can make them instances of other typeclasses. I built one Cheetah template system where the templates generated config files (we had hundreds of the silly things), and made them a subclass of a FilePath type as well. So you could not only get them to provide the contents of a file, but you could get them to tell you the name of the file the content went into. > It seems cumbresome, rigid and redundant to me, like many OO code.. Yes, but if you change it so that your typeclass just handles the thing common to all templates (rendering), and your template data types have the elements specific to them, it becomes less so. The question is does doing it this way buy you anything, and is that enough to justify the extra mechanisms involved? > What "header" means in that class? it includes also the html
tag or it is simply some common html for all pages at the beginning? It is probable that this class definition is not appropriate for all pages. neither the combinator version. but with an EDSL I can create page template variants faster for my particular problem. The class no longer has "header", the data type does. And it means what the data type needs it to. > But this is not IMHO the right base design assumption for a (Haskell) web framework. It may be for some particular problem. That may well be the case, even if you get the architecture closer to what Cheetah is doing. That's what I'm trying to find out. Thanks, Mike -------------- next part -------------- An HTML attachment was scrubbed... URL: From john at gocatch.com Sat May 10 05:48:38 2014 From: john at gocatch.com (John Ky) Date: Sat, 10 May 2014 15:48:38 +1000 Subject: [Haskell-cafe] Custome monoid mappend on HashMap and HashSet values Message-ID: Hello, Does anyone have an example on how I might be able to use monoids to mappend a HashMap Int (HashMap Int Int) together? Cheers, -John -- Sydney, Australia -------------- next part -------------- An HTML attachment was scrubbed... URL: From alexander.vershilov at gmail.com Sat May 10 06:07:01 2014 From: alexander.vershilov at gmail.com (Alexander V Vershilov) Date: Sat, 10 May 2014 10:07:01 +0400 Subject: [Haskell-cafe] Custome monoid mappend on HashMap and HashSet values In-Reply-To: References: Message-ID: Hi, John. You can always use newtype wrapper if you need to overload existing method behavior: newtype MyHashMap a b = MyHashMap { unMy :: HashMap a b} instance Monoid (MyHasMap a b) where mempty = MyHasMap mempty mappend a b = your_overloaded_function Then just wrap and unwrap your data to do a custom mappend, also you can write a wrapper function, in case if you'll restrict types then it may work only for the types you need: (<~>) :: HashMap Int (HashMap Int Int) -> HashMap Int (HashMap Int Int) -> HashMap Int (HashMap Int Int) a <~> b = unMy $ (<>) `on` MyHashMap a b -- Alexander -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuuzetsu at fuuzetsu.co.uk Sat May 10 06:40:26 2014 From: fuuzetsu at fuuzetsu.co.uk (Mateusz Kowalczyk) Date: Sat, 10 May 2014 08:40:26 +0200 Subject: [Haskell-cafe] Haddock issue tracker is now on GitHub. Message-ID: <536DC9DA.3030904@fuuzetsu.co.uk> Greetings, The Haddock issue tracker now lives at [1]. The reasoning is that a lot of people have a GitHub account already and signing up just for Trac is tedious. Hopefully this will also allow people to see more easily what's going on. This also removes the maintenance load from Haskell infrastructure: the Trac instance has been bitrotting quite a bit and recently even sending out e-mail about tickets stopped working. Old issues have been migrated over so the ticket numbers still correspond. Please file any new issues or make issue comments on GitHub. If you do not wish to use GitHub (which is fairly understandable) then please send me the report directly and I will create one for you. Thanks. [1]: https://github.com/haskell/haddock/issues?state=open -- Mateusz K. From komadori at gekkou.co.uk Sat May 10 09:33:12 2014 From: komadori at gekkou.co.uk (Robin KAY) Date: Sat, 10 May 2014 10:33:12 +0100 Subject: [Haskell-cafe] ANN: hsqml-0.3.0.0 supports Qt 5 In-Reply-To: <06a2efd1-3668-4866-99fe-7faea2cf3c16@googlegroups.com> References: <536760F5.2040409@gekkou.co.uk> <06a2efd1-3668-4866-99fe-7faea2cf3c16@googlegroups.com> Message-ID: <536DF258.8010206@gekkou.co.uk> Dear Andrew, On 09/05/14 16:42, Andrew Voron wrote: [snip] > I've tryed to compile sample project on windows - it compiles good, but > outputs: > Segmentation fault/access violation in generated code > when I'm trying to start executables. As described in the installation section on my web-site [1], this problem is most likely caused by an incompatibility between the MinGW tool-chains shipped with the Haskell Platform and with the Qt binaries. In fact, writing that in the docs was probably too coy, as the latest Haskell Platform and the latest official Qt SDK for Windows will not work together. In the past, this was not the case but the respective copies of MinGW/gcc must now be too far out of step with each other. A relatively simple fix I have found to work is to modify the GHC settings file to point to the version of gcc.exe inside the Qt SDK distribution rather than GHC's. Otherwise, you could build your own Qt binaries using GHC's MinGW but that is rather more involved. [1] http://www.gekkou.co.uk/software/hsqml/#installation Regards, -- Robin KAY From musicdenotation at gmail.com Sat May 10 10:53:49 2014 From: musicdenotation at gmail.com (Brian Nguyen) Date: Sat, 10 May 2014 17:53:49 +0700 Subject: [Haskell-cafe] Bug in GHC (probably parser) regarding GADTs Message-ID: The following does not work: data Foo a where {Foo :: (->) a (Foo a)} Someone please file a bug for me, I can't on my computer. -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.wobben at home.nl Sat May 10 11:51:15 2014 From: r.wobben at home.nl (Roelof Wobben) Date: Sat, 10 May 2014 13:51:15 +0200 Subject: [Haskell-cafe] what did I do wrong Message-ID: <536E12B3.9080305@home.nl> An HTML attachment was scrubbed... URL: From mathijs at bluescreen303.nl Sat May 10 11:55:29 2014 From: mathijs at bluescreen303.nl (Mathijs Kwik) Date: Sat, 10 May 2014 13:55:29 +0200 Subject: [Haskell-cafe] what did I do wrong In-Reply-To: <536E12B3.9080305@home.nl> (Roelof Wobben's message of "Sat, 10 May 2014 13:51:15 +0200") References: <536E12B3.9080305@home.nl> Message-ID: <877g5trgpa.fsf@bluescreen303.nl> Roelof Wobben writes: > Hello, > > I have to find the center of 2 points as a assigment for a course on fpcomplete. This is no homework because I do a self-study. > > So I did this: > > center (x1,y1) (x2,y2) = ( ((x1+x2)/2),((y1+y2)/2) ) > main = print $ center ((1,2), (3, 4)) should be: center (x1,y1) (x2,y2) = ( ((x1+x2)/2),((y1+y2)/2) ) main = print $ center (1,2) (3, 4) > > but now I see this error message : > > Main.hs at 2:8-2:13 > > * No instance for (Show (((t0, t1), (t2, t3)) -> ((t0, t1), (t2, t3)))) arising from a use of `print' Possible fix: add an instance declaration for (Show (((t0, > t1), (t2, t3)) -> ((t0, t1), (t2, t3)))) In the expression: print In the expression: print $ center ((1, 2), (3, 4)) In an equation for `main': main = print $ > center ((1, 2), (3, 4)) > > Roelof > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From r.wobben at home.nl Sat May 10 12:00:33 2014 From: r.wobben at home.nl (Roelof Wobben) Date: Sat, 10 May 2014 14:00:33 +0200 Subject: [Haskell-cafe] what did I do wrong In-Reply-To: <877g5trgpa.fsf@bluescreen303.nl> References: <536E12B3.9080305@home.nl> <877g5trgpa.fsf@bluescreen303.nl> Message-ID: <536E14E1.9010103@home.nl> Mathijs Kwik schreef op 10-5-2014 13:55: > Roelof Wobben writes: > >> Hello, >> >> I have to find the center of 2 points as a assigment for a course on fpcomplete. This is no homework because I do a self-study. >> >> So I did this: >> >> center (x1,y1) (x2,y2) = ( ((x1+x2)/2),((y1+y2)/2) ) >> main = print $ center ((1,2), (3, 4)) > should be: > > center (x1,y1) (x2,y2) = ( ((x1+x2)/2),((y1+y2)/2) ) > main = print $ center (1,2) (3, 4) > > oke, as I see you changed the main function but I have to make the center function work not change the main function. Roelof From alexander at plaimi.net Sat May 10 12:03:57 2014 From: alexander at plaimi.net (Alexander Berntsen) Date: Sat, 10 May 2014 14:03:57 +0200 Subject: [Haskell-cafe] what did I do wrong In-Reply-To: <536E14E1.9010103@home.nl> References: <536E12B3.9080305@home.nl> <877g5trgpa.fsf@bluescreen303.nl> <536E14E1.9010103@home.nl> Message-ID: <536E15AD.9050707@plaimi.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 10/05/14 14:00, Roelof Wobben wrote: > as I see you changed the main function but I have to make the > center function work not change the main function. Your center function takes two tuples, but you give it a tuple of two tuples. (foo, bar) (fu, baz) is not the same as ((foo, bar), (fu, baz)) Do you see this? The latter is one value, a tuple of tuples. The former, which is what your function expects, is two values. Given the function add x y = x+y You are calling it by "add (1, 2)", when you should be calling it simply by "add 1 2". Hope this helped. - -- Alexander alexander at plaimi.net https://secure.plaimi.net/~alexander -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iF4EAREIAAYFAlNuFa0ACgkQRtClrXBQc7WaKgEAqqTU61+Kw/SBbqXMXtW9cY+F Og1VJefDYsBKPxzYf/UA/jmJYe075tinDK7fDGvNSvFu8no/NDx8Sl567lWJ/NFm =r8Ol -----END PGP SIGNATURE----- From osagerprairie at gmail.com Sat May 10 12:04:11 2014 From: osagerprairie at gmail.com (Osager Prairie) Date: Sat, 10 May 2014 14:04:11 +0200 Subject: [Haskell-cafe] what did I do wrong In-Reply-To: <536E12B3.9080305@home.nl> References: <536E12B3.9080305@home.nl> Message-ID: you should do : main = print $ center (1,2), (3, 4) On Sat, May 10, 2014 at 1:51 PM, Roelof Wobben wrote: > Hello, > > I have to find the center of 2 points as a assigment for a course on > fpcomplete. This is no homework because I do a self-study. > > So I did this: > > center (x1,y1) (x2,y2) = ( ((x1+x2)/2),((y1+y2)/2) ) > main = print $ center ((1,2), (3, 4)) > > but now I see this error message : > > Main.hs at 2:8-2:13 > > - No instance for (Show (((t0, t1), (t2, t3)) -> ((t0, t1), (t2, > t3)))) arising from a use of `print' Possible fix: add an instance > declaration for (Show (((t0, t1), (t2, t3)) -> ((t0, t1), (t2, t3)))) In > the expression: print In the expression: print $ center ((1, 2), (3, 4)) In > an equation for `main': main = print $ center ((1, 2), (3, 4)) > > Roelof > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From corentin.dupont at gmail.com Sat May 10 12:05:29 2014 From: corentin.dupont at gmail.com (Corentin Dupont) Date: Sat, 10 May 2014 14:05:29 +0200 Subject: [Haskell-cafe] what did I do wrong In-Reply-To: <536E14E1.9010103@home.nl> References: <536E12B3.9080305@home.nl> <877g5trgpa.fsf@bluescreen303.nl> <536E14E1.9010103@home.nl> Message-ID: Hi, remember that in Haskell argument application is just a space, not using parenthesis and comma like in some imperative languages. In Java: myFunc (a, b) Is equivalent in Haskell to: myfunc a b so center ((1,2), (3, 4)) is a function applied to only one arguement (a tuple of tuples) On Sat, May 10, 2014 at 2:00 PM, Roelof Wobben wrote: > Mathijs Kwik schreef op 10-5-2014 13:55: > > Roelof Wobben writes: >> >> Hello, >>> >>> I have to find the center of 2 points as a assigment for a course on >>> fpcomplete. This is no homework because I do a self-study. >>> >>> So I did this: >>> >>> center (x1,y1) (x2,y2) = ( ((x1+x2)/2),((y1+y2)/2) ) >>> main = print $ center ((1,2), (3, 4)) >>> >> should be: >> >> center (x1,y1) (x2,y2) = ( ((x1+x2)/2),((y1+y2)/2) ) >> main = print $ center (1,2) (3, 4) >> >> >> > oke, > > as I see you changed the main function but I have to make the center > function work not change the main function. > > > Roelof > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From eir at cis.upenn.edu Sat May 10 13:04:39 2014 From: eir at cis.upenn.edu (Richard Eisenberg) Date: Sat, 10 May 2014 09:04:39 -0400 Subject: [Haskell-cafe] Bug in GHC (probably parser) regarding GADTs In-Reply-To: References: Message-ID: <99FB8F45-FC2C-4216-880D-8219E46F3DA5@cis.upenn.edu> Posted, as https://ghc.haskell.org/trac/ghc/ticket/9096 Thanks! On May 10, 2014, at 6:53 AM, Brian Nguyen wrote: > The following does not work: > > data Foo a where {Foo :: (->) a (Foo a)} -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.wobben at home.nl Sat May 10 14:32:56 2014 From: r.wobben at home.nl (Roelof Wobben) Date: Sat, 10 May 2014 16:32:56 +0200 Subject: [Haskell-cafe] loop problem Message-ID: <536E3898.3070301@home.nl> An HTML attachment was scrubbed... URL: From karl at karlv.net Sat May 10 14:38:34 2014 From: karl at karlv.net (Karl Voelker) Date: Sat, 10 May 2014 07:38:34 -0700 Subject: [Haskell-cafe] loop problem In-Reply-To: <536E3898.3070301@home.nl> References: <536E3898.3070301@home.nl> Message-ID: <1399732714.1493.115847241.67C1CA13@webmail.messagingengine.com> On Sat, May 10, 2014, at 07:32 AM, Roelof Wobben wrote: So somthing is wrong at this line x n = n * n But its looking well to me. That line would be fine as a definition at the top level. But to nest a definition inside an expression, you need to introduce it with "let" or "where". -Karl -------------- next part -------------- An HTML attachment was scrubbed... URL: From mlen at mlen.pl Sat May 10 15:01:24 2014 From: mlen at mlen.pl (Mateusz Lenik) Date: Sat, 10 May 2014 17:01:24 +0200 Subject: [Haskell-cafe] loop problem In-Reply-To: <536E3898.3070301@home.nl> References: <536E3898.3070301@home.nl> Message-ID: <20140510150124.GB20527@polaris.local> Hi, There are several issues with the code: - type annotation states that the function returns 'IO ()', while on the else branch 'IO Int' is returned. To fix it you should either change the returned type to 'IO Int' or replace 'return n' with 'return ()'; - in do notation you have to use let syntax, so 'x n = n * n' should be 'let x n = n * n'; - this brings us to another issue in line 'putStrLn (show x n)', which is equivalent to 'putStrLn ((show x) n)'. You should put parentheses explicitly to fix it, or change x definition to 'let x = n * n', so that you can just write 'putStrLn (show x)'. Cheers! Mateusz On Sat, May 10, 2014 at 04:32:56PM +0200, Roelof Wobben wrote: > Hello, > > I have to make a loop where on the number 1 - 100 the square is > calculated. > > So I did this : > > loop :: Int -> IO () > loop n = do > if n <= 100 > then do > x n = n * n; > putStrLn (show n ); > putChar ' '; > putStrLn (show x n); > loop (n + 1); > else > return n ; > > main :: IO () > main = loop 1 > > but now I see this error message : > > * Main.hs at 5:13-5:14 > parse error on input `=' > * * > undefine > :: IO () > > So somthing is wrong at this line x n = n * n > But its looking well to me. > > Where did I take the wrong lane or were did I misunderstood something. > Give me a tip or a explanation please and not a answer. > Otherwise I do not learn anything . > > Roelof > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe -- mlen -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 833 bytes Desc: not available URL: From r.wobben at home.nl Sat May 10 15:22:14 2014 From: r.wobben at home.nl (Roelof Wobben) Date: Sat, 10 May 2014 17:22:14 +0200 Subject: [Haskell-cafe] loop problem In-Reply-To: <20140510150124.GB20527@polaris.local> References: <536E3898.3070301@home.nl> <20140510150124.GB20527@polaris.local> Message-ID: <536E4426.9090303@home.nl> Mateusz Lenik schreef op 10-5-2014 17:01: > Hi, > > There are several issues with the code: > > - type annotation states that the function returns 'IO ()', while on the else > branch 'IO Int' is returned. To fix it you should either change the returned > type to 'IO Int' or replace 'return n' with 'return ()'; > - in do notation you have to use let syntax, so 'x n = n * n' should be > 'let x n = n * n'; > - this brings us to another issue in line 'putStrLn (show x n)', which is > equivalent to 'putStrLn ((show x) n)'. You should put parentheses explicitly > to fix it, or change x definition to 'let x = n * n', so that you can just > write 'putStrLn (show x)'. > > Cheers! > Mateusz > > Is it valid Haskell if I change the putStrln to putStrln ( show n * n) so I do not have to use the let command. Another question if I change return n with return () does the loop ever end. My feeling says not because the value of n is never updated for the loop. Roelof From alex.solla at gmail.com Sat May 10 15:37:56 2014 From: alex.solla at gmail.com (Alexander Solla) Date: Sat, 10 May 2014 08:37:56 -0700 Subject: [Haskell-cafe] confusion about cabal-install install Message-ID: I'm trying to install cabal-install. I ran: $ cabal update && cabal install cabal-install After compiling, cabal reported: Installing executable(s) in /home/ajs/.cabal/bin Installed cabal-install-1.20.0.1 But now consider: $ cabal --version cabal-install version 1.16.0.2 using version 1.16.0 of the Cabal library $ which cabal /home/ajs/.cabal/bin/cabal $ /home/ajs/.cabal/bin/cabal --version cabal-install version 1.20.0.1 using version 1.20.0.0 of the Cabal library I am confused. My path is set to point to "$HOME/.cabal/bin/:$PATH" -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.wobben at home.nl Sat May 10 15:41:23 2014 From: r.wobben at home.nl (Roelof Wobben) Date: Sat, 10 May 2014 17:41:23 +0200 Subject: [Haskell-cafe] loop problem In-Reply-To: <536E4426.9090303@home.nl> References: <536E3898.3070301@home.nl> <20140510150124.GB20527@polaris.local> <536E4426.9090303@home.nl> Message-ID: <536E48A3.2080703@home.nl> An HTML attachment was scrubbed... URL: From t at tmh.cc Sat May 10 15:45:11 2014 From: t at tmh.cc (Taylor Hedberg) Date: Sat, 10 May 2014 08:45:11 -0700 Subject: [Haskell-cafe] loop problem In-Reply-To: <536E4426.9090303@home.nl> References: <536E3898.3070301@home.nl> <20140510150124.GB20527@polaris.local> <536E4426.9090303@home.nl> Message-ID: On Sat, May 10, 2014 at 8:22 AM, Roelof Wobben wrote: > > Is it valid Haskell if I change the putStrln to putStrln ( show n * n) so > I do not have to use the let command. > You would need to write putStrLn (show (n * n)) in order for it to parse the way you intend. Function application is left-associative. You could also use print instead of putStrLn, which is shorthand for this. Another question if I change return n with return () does the loop ever > end. My feeling says not because the value of n is never updated for the > loop. Yes, the loop would terminate. The return n in your code is not updating n. The next iteration of the loop receives a new value of n as its argument due to your passing it in with loop (n + 1). -------------- next part -------------- An HTML attachment was scrubbed... URL: From t at tmh.cc Sat May 10 15:48:50 2014 From: t at tmh.cc (Taylor Hedberg) Date: Sat, 10 May 2014 08:48:50 -0700 Subject: [Haskell-cafe] loop problem In-Reply-To: <536E48A3.2080703@home.nl> References: <536E3898.3070301@home.nl> <20140510150124.GB20527@polaris.local> <536E4426.9090303@home.nl> <536E48A3.2080703@home.nl> Message-ID: On Sat, May 10, 2014 at 8:41 AM, Roelof Wobben wrote: > > but now I see these errors : > > > - Main.hs at 8:19-8:23 > No instance for (Show (a0 -> a0)) arising from a use of `show' > Possible fix: add an instance declaration for (Show (a0 -> a0)) In the > first argument of `putStrLn', namely `(show x)' In a stmt of a 'do' block: > putStrLn (show x) In the expression: do { let x n = n * n; putStrLn (show > n); putChar ' '; putStrLn (show x); loop (n + 1) } > > Think about what type x has. -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.wobben at home.nl Sat May 10 15:53:02 2014 From: r.wobben at home.nl (Roelof Wobben) Date: Sat, 10 May 2014 17:53:02 +0200 Subject: [Haskell-cafe] loop problem In-Reply-To: References: <536E3898.3070301@home.nl> <20140510150124.GB20527@polaris.local> <536E4426.9090303@home.nl> Message-ID: <536E4B5E.4020608@home.nl> An HTML attachment was scrubbed... URL: From jochem at functor.nl Sat May 10 15:53:44 2014 From: jochem at functor.nl (Jochem Berndsen) Date: Sat, 10 May 2014 17:53:44 +0200 Subject: [Haskell-cafe] loop problem In-Reply-To: <536E4426.9090303@home.nl> References: <536E3898.3070301@home.nl> <20140510150124.GB20527@polaris.local> <536E4426.9090303@home.nl> Message-ID: <536E4B88.6050203@functor.nl> Hi Roelof, On 05/10/2014 05:22 PM, Roelof Wobben wrote: > > > Is it valid Haskell if I change the putStrln to putStrln ( show n * n) > so I do not have to use the let command. > Another question if I change return n with return () does the loop > ever end. My feeling says not because the value of n is never updated > for the loop. > Careful! show n * n is equal to (show n) * n, which is not what you wanted. Function application binds very strongly in Haskell. putStrLn (show (n*n)) is what you intended. In Haskell, you cannot 'update' values. The loop will terminate, however. Let's see why -- loop 101 will evaluate to return (). This is the action that, when performed, will do nothing. loop 100 will evaluate to do { putStrLn (show 100); putChar ' '; putStrLn (show (100 * 100)); loop (100 + 1) } This is equal to do { putStrLn (show 100); putChar ' '; putStrLn (show (100 * 100)); return () } So `loop 100' is equal to the action that, when performed, will print 100 10000 loop 99 will evaluate to do { putStrLn (show 99); putChar ' '; putStrLn (show (99 * 99)); loop (99 + 1) } which is equal to the action that, when performed, will print 99 9801 100 10000 and so on. There is only one way to actually perform an action, which is to put it into the definition of 'main'. To summarize, in Haskell there is a strict separation between the *evaluation* of values (including actions such as the above) and the *execution* of I/O, whereas most other languages conflate the two. For more information, see http://www.haskell.org/haskellwiki/Introduction_to_IO As an aside, the way this code is written is fairly unidiomatic. Haskell programmers in general like to separate I/O if possible. We'd generally write: values n = [(x, x*x) | x <- [1..n]] and then a function that writes general pairs of values. HTH, Jochem -- Jochem Berndsen | jochem at functor.nl From jochem at functor.nl Sat May 10 15:54:50 2014 From: jochem at functor.nl (Jochem Berndsen) Date: Sat, 10 May 2014 17:54:50 +0200 Subject: [Haskell-cafe] loop problem In-Reply-To: <536E4B5E.4020608@home.nl> References: <536E3898.3070301@home.nl> <20140510150124.GB20527@polaris.local> <536E4426.9090303@home.nl> <536E4B5E.4020608@home.nl> Message-ID: <536E4BCA.1060705@functor.nl> On 05/10/2014 05:53 PM, Roelof Wobben wrote: > Thanks , it's working now like this : > > loop :: Int -> IO () > loop n = do > if n <= 100 > then do > putStrLn (show n ); > putChar ' '; > putStrLn (show (n * n )) ; > loop (n + 1); > else > return () ; > > main :: IO () > main = loop 1 > > But the outcome looks like this: > > 1 > 1 > 2 > 4 > > Can I somehow make it like this > > 1 1 > 2 4 > 3 9 > > Roelof > Take a look at the `putStr' function. It omits the newline character that putStrLn writes at the end of the string. Jochem -- Jochem Berndsen | jochem at functor.nl -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.wobben at home.nl Sat May 10 16:06:35 2014 From: r.wobben at home.nl (Roelof Wobben) Date: Sat, 10 May 2014 18:06:35 +0200 Subject: [Haskell-cafe] loop problem In-Reply-To: <536E4B88.6050203@functor.nl> References: <536E3898.3070301@home.nl> <20140510150124.GB20527@polaris.local> <536E4426.9090303@home.nl> <536E4B88.6050203@functor.nl> Message-ID: <536E4E8B.6060107@home.nl> Jochem Berndsen schreef op 10-5-2014 17:53: > Hi Roelof, > > On 05/10/2014 05:22 PM, Roelof Wobben wrote: >> >> >> Is it valid Haskell if I change the putStrln to putStrln ( show n * >> n) so I do not have to use the let command. >> Another question if I change return n with return () does the loop >> ever end. My feeling says not because the value of n is never >> updated for the loop. >> > > Careful! show n * n is equal to (show n) * n, which is not what you > wanted. Function application binds very strongly in Haskell. > putStrLn (show (n*n)) is what you intended. > > In Haskell, you cannot 'update' values. The loop will terminate, > however. Let's see why -- > > loop 101 > will evaluate to > return (). > This is the action that, when performed, will do nothing. > > loop 100 > will evaluate to > do { putStrLn (show 100); putChar ' '; putStrLn (show (100 * 100)); > loop (100 + 1) } > > This is equal to > do { putStrLn (show 100); putChar ' '; putStrLn (show (100 * 100)); > return () } > > So `loop 100' is equal to the action that, when performed, will print > 100 > 10000 > > loop 99 > will evaluate to > do { putStrLn (show 99); putChar ' '; putStrLn (show (99 * 99)); > loop (99 + 1) } > which is equal to the action that, when performed, will print > 99 > 9801 > 100 > 10000 > > and so on. > > There is only one way to actually perform an action, which is to put > it into the definition of 'main'. > To summarize, in Haskell there is a strict separation between the > *evaluation* of values (including actions such as the above) and the > *execution* of I/O, whereas most other languages conflate the two. > > For more information, see > http://www.haskell.org/haskellwiki/Introduction_to_IO > > > As an aside, the way this code is written is fairly unidiomatic. > Haskell programmers in general like to separate I/O if possible. > We'd generally write: > values n = [(x, x*x) | x <- [1..n]] > and then a function that writes general pairs of values. > > HTH, > Jochem > Oke, Im following this online course (https://www.fpcomplete.com/school/starting-with-haskell/basics-of-haskell) , Maybe I have to look at a better place to learn haskell the right way with a lot of exercises because I learn the best if I do it a lot and not only read about things. Roelof From allbery.b at gmail.com Sat May 10 16:10:03 2014 From: allbery.b at gmail.com (Brandon Allbery) Date: Sat, 10 May 2014 12:10:03 -0400 Subject: [Haskell-cafe] confusion about cabal-install install In-Reply-To: References: Message-ID: On Sat, May 10, 2014 at 11:37 AM, Alexander Solla wrote: > But now consider: > > $ cabal --version > > cabal-install version 1.16.0.2 > > using version 1.16.0 of the Cabal library > > $ which cabal > > /home/ajs/.cabal/bin/cabal > > $ /home/ajs/.cabal/bin/cabal --version > > cabal-install version 1.20.0.1 > > using version 1.20.0.0 of the Cabal library > This is why I keep, completely pointlessly, telling people to never ever use `which`. It lies. But people want the lies and get confused when they prove to be lies. Try `type cabal` --- NOT `which cabal` --- to see what is really going on. Then use `hash -r` to fix it. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.wobben at home.nl Sat May 10 16:11:41 2014 From: r.wobben at home.nl (Roelof Wobben) Date: Sat, 10 May 2014 18:11:41 +0200 Subject: [Haskell-cafe] loop problem In-Reply-To: References: <536E3898.3070301@home.nl> <20140510150124.GB20527@polaris.local> <536E4426.9090303@home.nl> <536E48A3.2080703@home.nl> Message-ID: <536E4FBD.7000000@home.nl> Stuart A. Kurtz schreef op 10-5-2014 18:02: > Dear Roelof, > > >> Thanks , it's working now like this : >> >> loop :: Int -> IO () >> loop n = do >> if n <= 100 >> then do >> putStrLn (show n ); >> putChar ' '; >> putStrLn (show (n * n )) ; >> loop (n + 1); >> else >> return () ; >> >> main :: IO () >> main = loop 1 >> >> But the outcome looks like this: >> >> 1 >> 1 >> 2 >> 4 > You're getting good advice, but this strikes me as extraordinarily unidiomatic Haskell -- it reads like a translated C program. Fixing it doesn't eliminate that sense. > > Why not this? > > main :: IO () > main = putStr . unlines . map (unwords . map show . (\n -> [n,n^2])) $ [1..100] > > Peace, > > Stu > > Like I said to another person . Im now following this course: https://www.fpcomplete.com/school/starting-with-haskell/basics-of-haskell But I get the feeling it's not a good one. Maybe find another tutorial/course where I can learn it the right way and do a lot of exercises so I can see if I understand things right. I learn the best by doing things and not only read about it. Roelof From alexander at plaimi.net Sat May 10 16:27:12 2014 From: alexander at plaimi.net (Alexander Berntsen) Date: Sat, 10 May 2014 18:27:12 +0200 Subject: [Haskell-cafe] loop problem In-Reply-To: <536E4FBD.7000000@home.nl> References: <536E3898.3070301@home.nl> <20140510150124.GB20527@polaris.local> <536E4426.9090303@home.nl> <536E48A3.2080703@home.nl> <536E4FBD.7000000@home.nl> Message-ID: <536E5360.3010702@plaimi.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Roelof, Have you considered reading LYAH[0]? It is very good, and you can make up your own exercises if there aren't enough of them for you. :-) [0] P.S. > main = putStr . unlines . map (unwords . map show . (\n -> [n,n^2])) $ [1..100] While we're having fun golfing, my attempt: mapM_ (\(x, y) -> printf "%d %d\n" x y) $ [(n, n^2) | n <- [1..100]] - -- Alexander alexander at plaimi.net https://secure.plaimi.net/~alexander -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iF4EAREIAAYFAlNuU2AACgkQRtClrXBQc7WzawEAt4TWloH3QhvC6vvHn4Xx2FAB jwwsGzhe7GR/gKYcikcA/2tR1IlDVIIERjk2AnRccuGIqmNQZeT7ODdwuiw3mbCk =WO8R -----END PGP SIGNATURE----- From r.wobben at home.nl Sat May 10 16:31:36 2014 From: r.wobben at home.nl (Roelof Wobben) Date: Sat, 10 May 2014 18:31:36 +0200 Subject: [Haskell-cafe] loop problem In-Reply-To: References: <536E3898.3070301@home.nl> <20140510150124.GB20527@polaris.local> <536E4426.9090303@home.nl> <536E48A3.2080703@home.nl> <536E4FBD.7000000@home.nl> Message-ID: <536E5468.1010009@home.nl> Stuart A. Kurtz schreef op 10-5-2014 18:17: > Dear Roelof, > > I took a quick look at the course -- it wasn't immediately evident to me where you are in it. It looks pretty good, although more examples/exercise are always welcome. > > It occurred to me, though, if you're going to write it so it looks like C, you'd might as well take advantage of Text.Printf: > > import Control.Monad > import Text.Printf > > loop :: Int -> IO () > loop n = when (n <= 100) $ do > printf "%d %d\n" n (n^2) > loop $ n+1 > > main :: IO () > main = loop 1 > > Peace, > > Stu > > Sorry that I did not make that clear. So in your oponion this could be a good way to learn haskell very good. I get the feeling on your remarks that im not really to do things the haskell way and that is what im looking for. I have looked at the book http://learnyouahaskell.com/chapters but I miss there exercises What do you think about this one : http://www.umiacs.umd.edu/~hal/docs/daume02yaht.pdf Roelof From r.wobben at home.nl Sat May 10 16:37:49 2014 From: r.wobben at home.nl (Roelof Wobben) Date: Sat, 10 May 2014 18:37:49 +0200 Subject: [Haskell-cafe] loop problem In-Reply-To: <536E5360.3010702@plaimi.net> References: <536E3898.3070301@home.nl> <20140510150124.GB20527@polaris.local> <536E4426.9090303@home.nl> <536E48A3.2080703@home.nl> <536E4FBD.7000000@home.nl> <536E5360.3010702@plaimi.net> Message-ID: <536E55DD.1070803@home.nl> Alexander Berntsen schreef op 10-5-2014 18:27: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA256 > > Roelof, > > Have you considered reading LYAH[0]? It is very good, and you can make up your own exercises if there aren't enough of them for you. :-) > > [0] > > yes, but I never find exercises there where I must do something. I find a lot of examples but maybe I missed them. Roelof From ian at skybluetrades.net Sat May 10 16:41:10 2014 From: ian at skybluetrades.net (Ian Ross) Date: Sat, 10 May 2014 18:41:10 +0200 Subject: [Haskell-cafe] loop problem In-Reply-To: <536E55DD.1070803@home.nl> References: <536E3898.3070301@home.nl> <20140510150124.GB20527@polaris.local> <536E4426.9090303@home.nl> <536E48A3.2080703@home.nl> <536E4FBD.7000000@home.nl> <536E5360.3010702@plaimi.net> <536E55DD.1070803@home.nl> Message-ID: You could try https://github.com/NICTA/course which is *all* exercises! On 10 May 2014 18:37, Roelof Wobben wrote: > Alexander Berntsen schreef op 10-5-2014 18:27: > >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA256 >> >> Roelof, >> >> Have you considered reading LYAH[0]? It is very good, and you can make up >> your own exercises if there aren't enough of them for you. :-) >> >> [0] >> >> >> > yes, but I never find exercises there where I must do something. > I find a lot of examples > but maybe I missed them. > > Roelof > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -- Ian Ross Tel: +43(0)6804451378 ian at skybluetrades.net www.skybluetrades.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From samcaldwell at utexas.edu Sat May 10 17:26:41 2014 From: samcaldwell at utexas.edu (Sam Caldwell) Date: Sat, 10 May 2014 12:26:41 -0500 Subject: [Haskell-cafe] loop problem In-Reply-To: References: <536E3898.3070301@home.nl> <20140510150124.GB20527@polaris.local> <536E4426.9090303@home.nl> <536E48A3.2080703@home.nl> <536E4FBD.7000000@home.nl> <536E5360.3010702@plaimi.net> <536E55DD.1070803@home.nl> Message-ID: Additionally, there's http://www.seas.upenn.edu/~cis194/lectures.html Also a number of other resources for beginners are listed here: https://gist.github.com/bitemyapp/8739525 On Sat, May 10, 2014 at 11:41 AM, Ian Ross wrote: > You could try https://github.com/NICTA/course which is *all* exercises! > > > On 10 May 2014 18:37, Roelof Wobben wrote: > >> Alexander Berntsen schreef op 10-5-2014 18:27: >> >>> -----BEGIN PGP SIGNED MESSAGE----- >>> Hash: SHA256 >>> >>> Roelof, >>> >>> Have you considered reading LYAH[0]? It is very good, and you can make >>> up your own exercises if there aren't enough of them for you. :-) >>> >>> [0] >>> >>> >>> >> yes, but I never find exercises there where I must do something. >> I find a lot of examples >> but maybe I missed them. >> >> Roelof >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> > > > > -- > Ian Ross Tel: +43(0)6804451378 ian at skybluetrades.net > www.skybluetrades.net > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From stuart at cs.uchicago.edu Sat May 10 17:45:06 2014 From: stuart at cs.uchicago.edu (Stuart A. Kurtz) Date: Sat, 10 May 2014 12:45:06 -0500 Subject: [Haskell-cafe] loop problem In-Reply-To: <536E5360.3010702@plaimi.net> References: <536E3898.3070301@home.nl> <20140510150124.GB20527@polaris.local> <536E4426.9090303@home.nl> <536E48A3.2080703@home.nl> <536E4FBD.7000000@home.nl> <536E5360.3010702@plaimi.net> Message-ID: <690D733C-A314-46BF-9577-6C6B4F925888@cs.uchicago.edu> Dear Alexander, > While we're having fun golfing, my attempt: > > mapM_ (\(x, y) -> printf "%d %d\n" x y) $ [(n, n^2) | n <- [1..100]] Nice, although I'm a bit perplexed as to why it typechecks without hints, whereas the following (which avoids the boxing/unboxing of pairs) does not: mapM_ (\n -> printf "%d %d" n (n^2)) [1..100] Peace, Stu From alexander at plaimi.net Sat May 10 17:49:41 2014 From: alexander at plaimi.net (Alexander Berntsen) Date: Sat, 10 May 2014 19:49:41 +0200 Subject: [Haskell-cafe] loop problem In-Reply-To: <690D733C-A314-46BF-9577-6C6B4F925888@cs.uchicago.edu> References: <536E3898.3070301@home.nl> <20140510150124.GB20527@polaris.local> <536E4426.9090303@home.nl> <536E48A3.2080703@home.nl> <536E4FBD.7000000@home.nl> <536E5360.3010702@plaimi.net> <690D733C-A314-46BF-9577-6C6B4F925888@cs.uchicago.edu> Message-ID: <536E66B5.10706@plaimi.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 10/05/14 19:45, Stuart A. Kurtz wrote: > Nice, although I'm a bit perplexed as to why it typechecks without > hints, whereas the following (which avoids the boxing/unboxing of > pairs) does not: > > mapM_ (\n -> printf "%d %d" n (n^2)) [1..100] This type checks and works fine in GHCi. ? :t mapM_ (\n -> printf "%d %d" n (n^2)) [1..100] mapM_ (\n -> printf "%d %d" n (n^2)) [1..100] :: (Monad m, PrintfType (m b)) => m ( ? mapM_ (\n -> printf "%d %d" n (n^2)) [1..100] 1 12 43 94 165 256 367 498 649 8110 10011 12112 14413 16914 19615 22516 25617 28918 32419 36120 40021 44122 48423 52924 57625 62526 67627 72928 78429 84130 90031 96132 102433 108934 115635 122536 129637 136938 144439 152140 160041 168142 176443 184944 193645 202546 211647 220948 230449 240150 250051 260152 270453 280954 291655 302556 313657 324958 336459 348160 360061 372162 384463 396964 409665 422566 435667 448968 462469 476170 490071 504172 518473 532974 547675 562576 577677 592978 608479 624180 640081 656182 672483 688984 705685 722586 739687 756988 774489 792190 810091 828192 846493 864994 883695 902596 921697 940998 960499 9801100 10000 But if I chuck it in a source file and attempt to runhaskell or compile it, this fails with a very nasty error. Oh, what fun! To make it work ni a source file, you need a type signature in there somewhere. E.g.: main = mapM_ (\n -> printf "%d %d" (n :: Int) (n^2)) [1..100] This works fine. This is indeed interesting! Someone care to additionally make it enlightening as well? - -- Alexander alexander at plaimi.net https://secure.plaimi.net/~alexander -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iF4EAREIAAYFAlNuZrUACgkQRtClrXBQc7U7+wD/QKhDvJawLyzziks+QZ2ypVQz qSglFRu+TCsNXQJqrVsA/jmS8x3xit3lypPX3y3Lmctl9tgudSLsPxccba5qcYXd =CiiY -----END PGP SIGNATURE----- From allbery.b at gmail.com Sat May 10 17:59:14 2014 From: allbery.b at gmail.com (Brandon Allbery) Date: Sat, 10 May 2014 13:59:14 -0400 Subject: [Haskell-cafe] loop problem In-Reply-To: <536E66B5.10706@plaimi.net> References: <536E3898.3070301@home.nl> <20140510150124.GB20527@polaris.local> <536E4426.9090303@home.nl> <536E48A3.2080703@home.nl> <536E4FBD.7000000@home.nl> <536E5360.3010702@plaimi.net> <690D733C-A314-46BF-9577-6C6B4F925888@cs.uchicago.edu> <536E66B5.10706@plaimi.net> Message-ID: On Sat, May 10, 2014 at 1:49 PM, Alexander Berntsen wrote: > But if I chuck it in a source file and attempt to runhaskell or compile > it, this fails with a very nasty error. Oh, what fun! To make it work ni > a source file, you need a type signature in there somewhere. E.g.: > > main = mapM_ (\n -> printf "%d %d" (n :: Int) (n^2)) [1..100] > > This works fine. This is indeed interesting! Someone care to > additionally make it enlightening as well? http://www.haskell.org/ghc/docs/latest/html/users_guide/interactive-evaluation.html#extended-default-rules -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From jwlato at gmail.com Sat May 10 18:06:16 2014 From: jwlato at gmail.com (John Lato) Date: Sat, 10 May 2014 11:06:16 -0700 Subject: [Haskell-cafe] confusion about cabal-install install In-Reply-To: References: Message-ID: On May 10, 2014 9:10 AM, "Brandon Allbery" wrote: > > On Sat, May 10, 2014 at 11:37 AM, Alexander Solla wrote: >> >> But now consider: >> >> $ cabal --version >> >> cabal-install version 1.16.0.2 >> >> using version 1.16.0 of the Cabal library >> >> $ which cabal >> >> /home/ajs/.cabal/bin/cabal >> >> $ /home/ajs/.cabal/bin/cabal --version >> >> cabal-install version 1.20.0.1 >> >> using version 1.20.0.0 of the Cabal library > > This is why I keep, completely pointlessly, telling people to never ever use `which`. It lies. But people want the lies and get confused when they prove to be lies. > > Try `type cabal` --- NOT `which cabal` --- to see what is really going on. Then use `hash -r` to fix it. Off-topic, but I just read a recounting of a guy recovering a system from a fork bomb, so he could only use shell builtins. And of course some sysadmin had aliased type to which, hanging the shell. So follow Brandon's advice, and don't alias type. -------------- next part -------------- An HTML attachment was scrubbed... URL: From stuart at cs.uchicago.edu Sat May 10 18:09:54 2014 From: stuart at cs.uchicago.edu (Stuart A. Kurtz) Date: Sat, 10 May 2014 13:09:54 -0500 Subject: [Haskell-cafe] loop problem In-Reply-To: <536E66B5.10706@plaimi.net> References: <536E3898.3070301@home.nl> <20140510150124.GB20527@polaris.local> <536E4426.9090303@home.nl> <536E48A3.2080703@home.nl> <536E4FBD.7000000@home.nl> <536E5360.3010702@plaimi.net> <690D733C-A314-46BF-9577-6C6B4F925888@cs.uchicago.edu> <536E66B5.10706@plaimi.net> Message-ID: <25982639-8682-4F86-B621-5C32C6FF68A6@cs.uchicago.edu> Dear Alexander, On May 10, 2014, at 12:49 PM, Alexander Berntsen wrote: > ? mapM_ (\n -> printf "%d %d" n (n^2)) [1..100] > 1 12 43 94 165 256 367 498 649 8110 10011 12112 14413 16914 19615 22516 > 25617 28918 32419 36120 40021 44122 48423 52924 57625 62526 67627 72928 > 78429 84130 90031 96132 102433 108934 115635 122536 129637 136938 144439 > 152140 160041 168142 176443 184944 193645 202546 211647 220948 230449 > 240150 250051 260152 270453 280954 291655 302556 313657 324958 336459 > 348160 360061 372162 384463 396964 409665 422566 435667 448968 462469 > 476170 490071 504172 518473 532974 547675 562576 577677 592978 608479 > 624180 640081 656182 672483 688984 705685 722586 739687 756988 774489 > 792190 810091 828192 846493 864994 883695 902596 921697 940998 960499 > 9801100 10000 Yeah, it is better with the \n ;-). Peace, Stu From r.wobben at home.nl Sat May 10 18:27:41 2014 From: r.wobben at home.nl (Roelof Wobben) Date: Sat, 10 May 2014 20:27:41 +0200 Subject: [Haskell-cafe] intelij idea and haskell Message-ID: <536E6F9D.5060507@home.nl> Hello, Does anyone ever tried intelij idea with Haskell. I know there is a plugin. I know Intelij from the fact that I have tried to programm in Clojure and I like the enviroment. Roelof From bob at redivi.com Sat May 10 18:29:10 2014 From: bob at redivi.com (Bob Ippolito) Date: Sat, 10 May 2014 11:29:10 -0700 Subject: [Haskell-cafe] loop problem In-Reply-To: <536E5468.1010009@home.nl> References: <536E3898.3070301@home.nl> <20140510150124.GB20527@polaris.local> <536E4426.9090303@home.nl> <536E48A3.2080703@home.nl> <536E4FBD.7000000@home.nl> <536E5468.1010009@home.nl> Message-ID: On Saturday, May 10, 2014, Roelof Wobben wrote: > Stuart A. Kurtz schreef op 10-5-2014 18:17: > >> Dear Roelof, >> >> I took a quick look at the course -- it wasn't immediately evident to me >> where you are in it. It looks pretty good, although more examples/exercise >> are always welcome. >> >> It occurred to me, though, if you're going to write it so it looks like >> C, you'd might as well take advantage of Text.Printf: >> >> import Control.Monad >> import Text.Printf >> >> loop :: Int -> IO () >> loop n = when (n <= 100) $ do >> printf "%d %d\n" n (n^2) >> loop $ n+1 >> >> main :: IO () >> main = loop 1 >> >> Peace, >> >> Stu >> >> >> > Sorry that I did not make that clear. > So in your oponion this could be a good way to learn haskell very good. > > I get the feeling on your remarks that im not really to do things the > haskell way and that is what im looking for. > I have looked at the book http://learnyouahaskell.com/chapters but I > miss there exercises > > What do you think about this one : http://www.umiacs.umd.edu/~ > hal/docs/daume02yaht.pdf > > http://exercism.io/ has a lot of Haskell exercises and community code review is part of the site so you won't have to ask for help elsewhere. -bob -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.wobben at home.nl Sat May 10 18:36:58 2014 From: r.wobben at home.nl (Roelof Wobben) Date: Sat, 10 May 2014 20:36:58 +0200 Subject: [Haskell-cafe] loop problem In-Reply-To: References: <536E3898.3070301@home.nl> <20140510150124.GB20527@polaris.local> <536E4426.9090303@home.nl> <536E48A3.2080703@home.nl> <536E4FBD.7000000@home.nl> <536E5468.1010009@home.nl> Message-ID: <536E71CA.5050605@home.nl> An HTML attachment was scrubbed... URL: From r.wobben at home.nl Sat May 10 20:33:06 2014 From: r.wobben at home.nl (Roelof Wobben) Date: Sat, 10 May 2014 22:33:06 +0200 Subject: [Haskell-cafe] loop problem In-Reply-To: References: <536E3898.3070301@home.nl> <20140510150124.GB20527@polaris.local> <536E4426.9090303@home.nl> <536E48A3.2080703@home.nl> <536E4FBD.7000000@home.nl> Message-ID: <536E8D02.2030108@home.nl> An HTML attachment was scrubbed... URL: From mwm at mired.org Sat May 10 20:34:14 2014 From: mwm at mired.org (Mike Meyer) Date: Sat, 10 May 2014 15:34:14 -0500 Subject: [Haskell-cafe] loop problem In-Reply-To: References: <536E3898.3070301@home.nl> <20140510150124.GB20527@polaris.local> <536E4426.9090303@home.nl> <536E48A3.2080703@home.nl> <536E4FBD.7000000@home.nl> <536E5360.3010702@plaimi.net> <536E55DD.1070803@home.nl> Message-ID: On Sat, May 10, 2014 at 11:41 AM, Ian Ross wrote: > You could try https://github.com/NICTA/course which is *all* exercises! > > If you just want exercises, try doing some of the problems at Project Euler https://projecteuler.net/problems. These are pretty heavy on the math, though. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mwm at mired.org Sat May 10 20:37:26 2014 From: mwm at mired.org (Mike Meyer) Date: Sat, 10 May 2014 15:37:26 -0500 Subject: [Haskell-cafe] loop problem In-Reply-To: References: <536E3898.3070301@home.nl> <20140510150124.GB20527@polaris.local> <536E4426.9090303@home.nl> <536E48A3.2080703@home.nl> <536E4FBD.7000000@home.nl> <536E5360.3010702@plaimi.net> <536E55DD.1070803@home.nl> Message-ID: On Sat, May 10, 2014 at 12:26 PM, Sam Caldwell wrote: > Additionally, there's http://www.seas.upenn.edu/~cis194/lectures.html > That (or possibly an earlier version) is also available on the School of Haskell (with interactive code) at https://www.fpcomplete.com/school/starting-with-haskell/introduction-to-haskell -------------- next part -------------- An HTML attachment was scrubbed... URL: From jkarni at gmail.com Sat May 10 23:55:43 2014 From: jkarni at gmail.com (Julian Arni) Date: Sun, 11 May 2014 01:55:43 +0200 Subject: [Haskell-cafe] ANN: th-alpha Message-ID: Hello Cafe, I just uploaded th-alpha to hackage [1]. This package primarily provides one function, 'areExpAEq', which compares expressions for alpha equivalence (equivalence modulo renaming of bound variables): >> areExpAEq [| \x -> x |] [| \y -> y |] True Pretty unambitious, but I found myself needing this when testing another library that uses Template Haskell, and it might be useful to others in that same situation. Cheers, Julian [1] https://hackage.haskell.org/package/th-alpha-0.1.0.2 -------------- next part -------------- An HTML attachment was scrubbed... URL: From john at gocatch.com Sun May 11 05:31:39 2014 From: john at gocatch.com (John Ky) Date: Sun, 11 May 2014 15:31:39 +1000 Subject: [Haskell-cafe] Custome monoid mappend on HashMap and HashSet values In-Reply-To: References: Message-ID: Thanks Alexander and Tran, So I went through the whole process of defining newtype, but it was quite a long process. My code below. Surely it would make more sense if the HashMap monoid were defined in terms of the monoid of its value type? In that case you could choose the monoid for the value to take the left value, which would be the equivalent of the current behaviour. Cheers, -John import qualified Control.Applicative as A import Data.Hashable import qualified Data.HashMap.Lazy as M import Data.Monoid newtype HashMap k v = HashMap (M.HashMap k v) instance (Eq k, Hashable k, Monoid v) => Monoid (HashMap k v) where mempty = empty mappend (HashMap a) (HashMap b) = HashMap (M.unionWith mappend a b) empty :: HashMap k v empty = HashMap M.empty singleton :: Hashable k => k -> v -> HashMap k v singleton k v = HashMap (M.singleton k v) null :: HashMap k v -> Bool null (HashMap m) = M.null m size :: HashMap k v -> Int size (HashMap m) = M.size $ m member :: (Eq k, Hashable k) => k -> HashMap k a -> Bool member k (HashMap m) = M.member k m lookup :: (Eq k, Hashable k) => k -> HashMap k v -> Maybe v lookup k (HashMap m) = M.lookup k m lookupDefault :: (Eq k, Hashable k) => v -> k -> HashMap k v -> v lookupDefault v k (HashMap m) = M.lookupDefault v k m (!) :: (Eq k, Hashable k) => HashMap k v -> k -> v (!) (HashMap m) k = (M.!) m k insert :: (Eq k, Hashable k) => k -> v -> HashMap k v -> HashMap k v insert k v (HashMap m) = HashMap (M.insert k v m) insertWith :: (Eq k, Hashable k) => (v -> v -> v) -> k -> v -> HashMap k v -> HashMap k v insertWith f k v (HashMap m) = HashMap (M.insertWith f k v m) delete :: (Eq k, Hashable k) => k -> HashMap k v -> HashMap k v delete k (HashMap m) = HashMap $ M.delete k m adjust :: (Eq k, Hashable k) => (v -> v) -> k -> HashMap k v -> HashMap k v adjust f k (HashMap m) = HashMap $ M.adjust f k m union :: (Eq k, Hashable k) => HashMap k v -> HashMap k v -> HashMap k v union (HashMap a) (HashMap b) = HashMap (M.union a b) unionWith :: (Eq k, Hashable k) => (v -> v -> v) -> HashMap k v -> HashMap k v -> HashMap k v unionWith f (HashMap a) (HashMap b) = HashMap (M.unionWith f a b) unions :: (Eq k, Hashable k) => [HashMap k v] -> HashMap k v unions ms = HashMap (M.unions [un m | m <- ms]) where un (HashMap m) = m map :: (v1 -> v2) -> HashMap k v1 -> HashMap k v2 map f (HashMap m) = HashMap (M.map f m) --mapWithKey :: (k -> v1 -> v2) -> HashMap k v1 -> HashMap k v2 --mapWithKey f (HashMap m) = HashMap (M.mapWithKey f m) traverseWithKey :: A.Applicative f => (k -> v1 -> f v2) -> HashMap k v1 -> f (HashMap k v2) traverseWithKey f (HashMap m) = HashMap `fmap` (M.traverseWithKey f m) difference :: (Eq k, Hashable k) => HashMap k v -> HashMap k w -> HashMap k v difference (HashMap a) (HashMap b) = HashMap (M.difference a b) intersection :: (Eq k, Hashable k) => HashMap k v -> HashMap k w -> HashMap k v intersection (HashMap a) (HashMap b) = HashMap (M.intersection a b) intersectionWith :: (Eq k, Hashable k) => (v1 -> v2 -> v3) -> HashMap k v1 -> HashMap k v2 -> HashMap k v3 intersectionWith f (HashMap a) (HashMap b) = HashMap (M.intersectionWith f a b) foldl' :: (a -> v -> a) -> a -> HashMap k v -> a foldl' f v (HashMap m) = M.foldl' f v m foldlWithKey' :: (a -> k -> v -> a) -> a -> HashMap k v -> a foldlWithKey' f v (HashMap m) = M.foldlWithKey' f v m foldr :: (v -> a -> a) -> a -> HashMap k v -> a foldr f v (HashMap m) = M.foldr f v m foldrWithKey :: (k -> v -> a -> a) -> a -> HashMap k v -> a foldrWithKey f v (HashMap m) = M.foldrWithKey f v m filter :: (v -> Bool) -> HashMap k v -> HashMap k v filter f (HashMap m) = HashMap (M.filter f m) filterWithKey :: (k -> v -> Bool) -> HashMap k v -> HashMap k v filterWithKey f (HashMap m) = HashMap (M.filterWithKey f m) keys :: HashMap k v -> [k] keys (HashMap m) = M.keys m elems :: HashMap k v -> [v] elems (HashMap m) = M.elems m toList :: HashMap k v -> [(k, v)] toList (HashMap m) = M.toList m fromList :: (Eq k, Hashable k) => [(k, v)] -> HashMap k v fromList kvs = HashMap (M.fromList kvs) fromListWith :: (Eq k, Hashable k) => (v -> v -> v) -> [(k, v)] -> HashMap k v fromListWith f kvs = HashMap (M.fromListWith f kvs) On 10 May 2014 16:07, Alexander V Vershilov wrote: > Hi, John. > > You can always use newtype wrapper if you need to overload existing method > behavior: > > newtype MyHashMap a b = MyHashMap { unMy :: HashMap a b} > > instance Monoid (MyHasMap a b) where > mempty = MyHasMap mempty > mappend a b = your_overloaded_function > > Then just wrap and unwrap your data to do a custom mappend, also you can > write a wrapper function, in case if you'll restrict types then it may work > only for the types you need: > > (<~>) :: HashMap Int (HashMap Int Int) -> HashMap Int (HashMap Int Int) -> > HashMap Int (HashMap Int Int) > a <~> b = unMy $ (<>) `on` MyHashMap a b > > -- > Alexander > -- Sydney, Australia -------------- next part -------------- An HTML attachment was scrubbed... URL: From john at gocatch.com Sun May 11 06:11:52 2014 From: john at gocatch.com (John Ky) Date: Sun, 11 May 2014 16:11:52 +1000 Subject: [Haskell-cafe] Custome monoid mappend on HashMap and HashSet values In-Reply-To: References: Message-ID: Hmmm - I lie, it isn't equivalent. Only works if the HashMap value is a monoid over the left operation. In which case isn't it better not to define the monoid for HashMap at all? On 11 May 2014 15:31, John Ky wrote: > > Thanks Alexander and Tran, > > So I went through the whole process of defining newtype, but it was quite > a long process. My code below. > > Surely it would make more sense if the HashMap monoid were defined in > terms of the monoid of its value type? > > In that case you could choose the monoid for the value to take the left > value, which would be the equivalent of the current behaviour. > > Cheers, > > -John > > import qualified Control.Applicative as A > import Data.Hashable > import qualified Data.HashMap.Lazy as M > import Data.Monoid > > newtype HashMap k v = HashMap (M.HashMap k v) > > instance (Eq k, Hashable k, Monoid v) => Monoid (HashMap k v) where > mempty = empty > mappend (HashMap a) (HashMap b) = HashMap (M.unionWith mappend a b) > > empty :: HashMap k v > empty = HashMap M.empty > > singleton :: Hashable k => k -> v -> HashMap k v > singleton k v = HashMap (M.singleton k v) > > null :: HashMap k v -> Bool > null (HashMap m) = M.null m > > size :: HashMap k v -> Int > size (HashMap m) = M.size $ m > > member :: (Eq k, Hashable k) => k -> HashMap k a -> Bool > member k (HashMap m) = M.member k m > > lookup :: (Eq k, Hashable k) => k -> HashMap k v -> Maybe v > lookup k (HashMap m) = M.lookup k m > > lookupDefault :: (Eq k, Hashable k) => v -> k -> HashMap k v -> v > lookupDefault v k (HashMap m) = M.lookupDefault v k m > > (!) :: (Eq k, Hashable k) => HashMap k v -> k -> v > (!) (HashMap m) k = (M.!) m k > > insert :: (Eq k, Hashable k) => k -> v -> HashMap k v -> HashMap k v > insert k v (HashMap m) = HashMap (M.insert k v m) > > insertWith :: (Eq k, Hashable k) => (v -> v -> v) -> k -> v -> HashMap k v > -> HashMap k v > insertWith f k v (HashMap m) = HashMap (M.insertWith f k v m) > > delete :: (Eq k, Hashable k) => k -> HashMap k v -> HashMap k v > delete k (HashMap m) = HashMap $ M.delete k m > > adjust :: (Eq k, Hashable k) => (v -> v) -> k -> HashMap k v -> HashMap k v > adjust f k (HashMap m) = HashMap $ M.adjust f k m > > union :: (Eq k, Hashable k) => HashMap k v -> HashMap k v -> HashMap k v > union (HashMap a) (HashMap b) = HashMap (M.union a b) > > unionWith :: (Eq k, Hashable k) => (v -> v -> v) -> HashMap k v -> HashMap > k v -> HashMap k v > unionWith f (HashMap a) (HashMap b) = HashMap (M.unionWith f a b) > > unions :: (Eq k, Hashable k) => [HashMap k v] -> HashMap k v > unions ms = HashMap (M.unions [un m | m <- ms]) > where un (HashMap m) = m > > map :: (v1 -> v2) -> HashMap k v1 -> HashMap k v2 > map f (HashMap m) = HashMap (M.map f m) > > --mapWithKey :: (k -> v1 -> v2) -> HashMap k v1 -> HashMap k v2 > --mapWithKey f (HashMap m) = HashMap (M.mapWithKey f m) > > traverseWithKey :: A.Applicative f => (k -> v1 -> f v2) -> HashMap k v1 -> > f (HashMap k v2) > traverseWithKey f (HashMap m) = HashMap `fmap` (M.traverseWithKey f m) > > difference :: (Eq k, Hashable k) => HashMap k v -> HashMap k w -> HashMap > k v > difference (HashMap a) (HashMap b) = HashMap (M.difference a b) > > intersection :: (Eq k, Hashable k) => HashMap k v -> HashMap k w -> > HashMap k v > intersection (HashMap a) (HashMap b) = HashMap (M.intersection a b) > > intersectionWith :: (Eq k, Hashable k) => (v1 -> v2 -> v3) -> HashMap k v1 > -> HashMap k v2 -> HashMap k v3 > intersectionWith f (HashMap a) (HashMap b) = HashMap (M.intersectionWith f > a b) > > foldl' :: (a -> v -> a) -> a -> HashMap k v -> a > foldl' f v (HashMap m) = M.foldl' f v m > > foldlWithKey' :: (a -> k -> v -> a) -> a -> HashMap k v -> a > foldlWithKey' f v (HashMap m) = M.foldlWithKey' f v m > > foldr :: (v -> a -> a) -> a -> HashMap k v -> a > foldr f v (HashMap m) = M.foldr f v m > > foldrWithKey :: (k -> v -> a -> a) -> a -> HashMap k v -> a > foldrWithKey f v (HashMap m) = M.foldrWithKey f v m > > filter :: (v -> Bool) -> HashMap k v -> HashMap k v > filter f (HashMap m) = HashMap (M.filter f m) > > filterWithKey :: (k -> v -> Bool) -> HashMap k v -> HashMap k v > filterWithKey f (HashMap m) = HashMap (M.filterWithKey f m) > > keys :: HashMap k v -> [k] > keys (HashMap m) = M.keys m > > elems :: HashMap k v -> [v] > elems (HashMap m) = M.elems m > > toList :: HashMap k v -> [(k, v)] > toList (HashMap m) = M.toList m > > fromList :: (Eq k, Hashable k) => [(k, v)] -> HashMap k v > fromList kvs = HashMap (M.fromList kvs) > > fromListWith :: (Eq k, Hashable k) => (v -> v -> v) -> [(k, v)] -> HashMap > k v > fromListWith f kvs = HashMap (M.fromListWith f kvs) > > > > > > On 10 May 2014 16:07, Alexander V Vershilov > wrote: > >> Hi, John. >> >> You can always use newtype wrapper if you need to overload existing >> method behavior: >> >> newtype MyHashMap a b = MyHashMap { unMy :: HashMap a b} >> >> instance Monoid (MyHasMap a b) where >> mempty = MyHasMap mempty >> mappend a b = your_overloaded_function >> >> Then just wrap and unwrap your data to do a custom mappend, also you can >> write a wrapper function, in case if you'll restrict types then it may work >> only for the types you need: >> >> (<~>) :: HashMap Int (HashMap Int Int) -> HashMap Int (HashMap Int Int) >> -> HashMap Int (HashMap Int Int) >> a <~> b = unMy $ (<>) `on` MyHashMap a b >> >> -- >> Alexander >> > > -- Sydney, Australia -------------- next part -------------- An HTML attachment was scrubbed... URL: From simon at banquise.net Sun May 11 06:45:35 2014 From: simon at banquise.net (Simon Marechal) Date: Sun, 11 May 2014 08:45:35 +0200 Subject: [Haskell-cafe] Custome monoid mappend on HashMap and HashSet values In-Reply-To: References: Message-ID: <536F1C8F.9000005@banquise.net> On 05/11/2014 07:31 AM, John Ky wrote: > So I went through the whole process of defining newtype, but it was > quite a long process. My code below. I use the lens library, so I don't have to work that hard. I wanted a Map instance where the <> operation is unionWith (+) : https://github.com/bartavelle/7startups/blob/fd7c3437bff1e5d4046728de836016a80918c02a/Startups/Utils.hs#L27-L53 As you can see, there is a lot less code involved, and I get "for free" the following equivalents : M.member k m -> has (ix k) m M.lookup k m -> view (at k) m M.lookupDefault v k m -> view (at k . non v) m M.insert k v m -> (at k ?= v) m M.delete k m -> (at k .= Nothing) m M.map -> fmap M.traverseWithKey -> itraverse M.toList -> itoList All the union/difference/intersection operations can't be expressed with lens AFAIK, so if you need them you'll have to rewrite them as you did. Because of the typeclass approach, the same "lensy" code will work with any key/value container, so you can refactor without having to touch all the "M." in your code, and forget whether it is lookupDefault or findWithDefault. From r.wobben at home.nl Sun May 11 07:58:40 2014 From: r.wobben at home.nl (Roelof Wobben) Date: Sun, 11 May 2014 09:58:40 +0200 Subject: [Haskell-cafe] loop problem In-Reply-To: References: <536E3898.3070301@home.nl> <20140510150124.GB20527@polaris.local> <536E4426.9090303@home.nl> <536E48A3.2080703@home.nl> <536E4FBD.7000000@home.nl> <536E5360.3010702@plaimi.net> <536E55DD.1070803@home.nl> Message-ID: <536F2DB0.3030207@home.nl> An HTML attachment was scrubbed... URL: From alexander at plaimi.net Sun May 11 13:29:24 2014 From: alexander at plaimi.net (Alexander Berntsen) Date: Sun, 11 May 2014 15:29:24 +0200 Subject: [Haskell-cafe] loop problem In-Reply-To: References: <536E3898.3070301@home.nl> <20140510150124.GB20527@polaris.local> <536E4426.9090303@home.nl> <536E48A3.2080703@home.nl> <536E4FBD.7000000@home.nl> <536E5360.3010702@plaimi.net> <690D733C-A314-46BF-9577-6C6B4F925888@cs.uchicago.edu> <536E66B5.10706@plaimi.net> Message-ID: <536F7B34.7020600@plaimi.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 10/05/14 19:59, Brandon Allbery wrote: > http://www.haskell.org/ghc/docs/latest/html/users_guide/interactive-evaluation.html#extended-default-rules Very > cool. Thanks for the link. - -- Alexander alexander at plaimi.net https://secure.plaimi.net/~alexander -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iF4EAREIAAYFAlNvezQACgkQRtClrXBQc7UEdgD+JopCmOmLU3Ajp4lMAQJv3g3b 3RRi2WzHIyAQnvYTJsgA/38yDsqUSOOvR10fKlsk41+w2nL3Mt9oKsCh523DKIQP =NYMz -----END PGP SIGNATURE----- From roma at ro-che.info Sun May 11 13:58:57 2014 From: roma at ro-che.info (Roman Cheplyaka) Date: Sun, 11 May 2014 16:58:57 +0300 Subject: [Haskell-cafe] confusion about cabal-install install In-Reply-To: References: Message-ID: <20140511135856.GA634@sniper> * Brandon Allbery [2014-05-10 12:10:03-0400] > On Sat, May 10, 2014 at 11:37 AM, Alexander Solla wrote: > > > But now consider: > > > > $ cabal --version > > > > cabal-install version 1.16.0.2 > > > > using version 1.16.0 of the Cabal library > > > > $ which cabal > > > > /home/ajs/.cabal/bin/cabal > > > > $ /home/ajs/.cabal/bin/cabal --version > > > > cabal-install version 1.20.0.1 > > > > using version 1.20.0.0 of the Cabal library > > > This is why I keep, completely pointlessly, telling people to never ever > use `which`. It lies. But people want the lies and get confused when they > prove to be lies. > > Try `type cabal` --- NOT `which cabal` --- to see what is really going on. > Then use `hash -r` to fix it. This problem is specific to bash, I believe. In zsh: % which which which: shell built-in command While `type` is POSIX, the output of `which` (for external commands) is better suited for use in command substitutions, so I mostly prefer it. And once one is aware of the PATH caching, the problem above isn't hard to recognize anyway. Roman -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: From allbery.b at gmail.com Sun May 11 14:08:10 2014 From: allbery.b at gmail.com (Brandon Allbery) Date: Sun, 11 May 2014 10:08:10 -0400 Subject: [Haskell-cafe] confusion about cabal-install install In-Reply-To: <20140511135856.GA634@sniper> References: <20140511135856.GA634@sniper> Message-ID: On Sun, May 11, 2014 at 9:58 AM, Roman Cheplyaka wrote: > This problem is specific to bash, I believe. > Yes, it's only specific to the shell that 99%+ of users use. I guess to you that means it's sufficiently irrelevant that you need to publicly dispute it? Seriously, don't make assumptions, get out of the habit of using something that may or may not work and don't spread those habits to people who don't know any better. "type" is specified by POSIX and required to show what the current shell will do. Use it. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From nbouscal at gmail.com Sun May 11 14:13:55 2014 From: nbouscal at gmail.com (Nathan Bouscal) Date: Sun, 11 May 2014 10:13:55 -0400 Subject: [Haskell-cafe] confusion about cabal-install install In-Reply-To: References: <20140511135856.GA634@sniper> Message-ID: On Sun, May 11, 2014 at 10:08 AM, Brandon Allbery wrote: > On Sun, May 11, 2014 at 9:58 AM, Roman Cheplyaka wrote: > >> This problem is specific to bash, I believe. >> > > Yes, it's only specific to the shell that 99%+ of users use. > Really? At least a third of the people I know use zsh. Not claiming to be a representative sample, but 99%+ sounds unrealistic. I was glad that Roman sent his reply, as it was directly useful for me. > I guess to you that means it's sufficiently irrelevant that you need to > publicly dispute it? > > Seriously, don't make assumptions, get out of the habit of using something > that may or may not work and don't spread those habits to people who don't > know any better. "type" is specified by POSIX and required to show what the > current shell will do. Use it. > > -- > brandon s allbery kf8nh sine nomine > associates > allbery.b at gmail.com > ballbery at sinenomine.net > unix, openafs, kerberos, infrastructure, xmonad > http://sinenomine.net > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From john at gocatch.com Sun May 11 14:29:19 2014 From: john at gocatch.com (John Ky) Date: Mon, 12 May 2014 00:29:19 +1000 Subject: [Haskell-cafe] cabal install lens fails Message-ID: Hi Haskell Cafe, Anyone know about this error? Installing library in /Users/johnky/Library/Haskell/ghc-7.6.3/lib/reflection-1.4/lib Registering reflection-1.4... Installed reflection-1.4 Configuring mtl-2.0.1.0... Building mtl-2.0.1.0... Preprocessing library mtl-2.0.1.0... [ 1 of 21] Compiling Control.Monad.Writer.Class ( Control/Monad/Writer/Class.hs, dist/build/Control/Monad/Writer/Class.o ) [ 2 of 21] Compiling Control.Monad.State.Class ( Control/Monad/State/Class.hs, dist/build/Control/Monad/State/Class.o ) [ 3 of 21] Compiling Control.Monad.Reader.Class ( Control/Monad/Reader/Class.hs, dist/build/Control/Monad/Reader/Class.o ) [ 4 of 21] Compiling Control.Monad.RWS.Class ( Control/Monad/RWS/Class.hs, dist/build/Control/Monad/RWS/Class.o ) [ 5 of 21] Compiling Control.Monad.Identity ( Control/Monad/Identity.hs, dist/build/Control/Monad/Identity.o ) [ 6 of 21] Compiling Control.Monad.Error.Class ( Control/Monad/Error/Class.hs, dist/build/Control/Monad/Error/Class.o ) Control/Monad/Error/Class.hs:93:18: Not in scope: `catch' Failed to install mtl-2.0.1.0 Cheers, -John -- Sydney, Australia -------------- next part -------------- An HTML attachment was scrubbed... URL: From mlen at mlen.pl Sun May 11 14:37:18 2014 From: mlen at mlen.pl (Mateusz Lenik) Date: Sun, 11 May 2014 16:37:18 +0200 Subject: [Haskell-cafe] cabal install lens fails In-Reply-To: References: Message-ID: <20140511143718.GA33491@polaris.local> Hi John, I ran into it on 7.8.2, the solution was to install aeson, free and lens (in this order). This is due to the fact that: > This is related to the recent update of transformers. If you could wait a few > days until the packages depending on transformers are upgraded, you shouldn't > run into any issues installing lens. Source: http://stackoverflow.com/questions/23510242/cabal-dependency-resolution-fail-for-lens Cheers, Mateusz On Mon, May 12, 2014 at 12:29:19AM +1000, John Ky wrote: > Hi Haskell Cafe, > > Anyone know about this error? > > Installing library in > /Users/johnky/Library/Haskell/ghc-7.6.3/lib/reflection-1.4/lib > Registering reflection-1.4... > Installed reflection-1.4 > Configuring mtl-2.0.1.0... > Building mtl-2.0.1.0... > Preprocessing library mtl-2.0.1.0... > [ 1 of 21] Compiling Control.Monad.Writer.Class ( > Control/Monad/Writer/Class.hs, dist/build/Control/Monad/Writer/Class.o ) > [ 2 of 21] Compiling Control.Monad.State.Class ( > Control/Monad/State/Class.hs, dist/build/Control/Monad/State/Class.o ) > [ 3 of 21] Compiling Control.Monad.Reader.Class ( > Control/Monad/Reader/Class.hs, dist/build/Control/Monad/Reader/Class.o ) > [ 4 of 21] Compiling Control.Monad.RWS.Class ( Control/Monad/RWS/Class.hs, > dist/build/Control/Monad/RWS/Class.o ) > [ 5 of 21] Compiling Control.Monad.Identity ( Control/Monad/Identity.hs, > dist/build/Control/Monad/Identity.o ) > [ 6 of 21] Compiling Control.Monad.Error.Class ( > Control/Monad/Error/Class.hs, dist/build/Control/Monad/Error/Class.o ) > > Control/Monad/Error/Class.hs:93:18: Not in scope: `catch' > Failed to install mtl-2.0.1.0 > > Cheers, > > -John > > -- > > Sydney, Australia > > > > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 833 bytes Desc: not available URL: From schlepptop at henning-thielemann.de Sun May 11 20:26:55 2014 From: schlepptop at henning-thielemann.de (Henning Thielemann) Date: Sun, 11 May 2014 22:26:55 +0200 Subject: [Haskell-cafe] [Haskell] ANNOUNCE: jhc-0.8.1 In-Reply-To: References: Message-ID: <536FDD0F.50601@henning-thielemann.de> Am 11.05.2014 22:20, schrieb John Meacham: > After a hiatus, jhc 0.8.1 is released. Could you clarify the current relation between jhc and ajhc. Are they independent from each other, or does ajhc still pull all features from jhc? From john at repetae.net Sun May 11 20:34:47 2014 From: john at repetae.net (John Meacham) Date: Sun, 11 May 2014 13:34:47 -0700 Subject: [Haskell-cafe] [Haskell] ANNOUNCE: jhc-0.8.1 In-Reply-To: <536FDD0F.50601@henning-thielemann.de> References: <536FDD0F.50601@henning-thielemann.de> Message-ID: On Sun, May 11, 2014 at 1:26 PM, Henning Thielemann wrote: > Could you clarify the current relation between jhc and ajhc. Are they > independent from each other, or does ajhc still pull all features from jhc? I try to pull what I can back from ajhc, I had to take a break from developing jhc for a bit (grumble) so it was easier for kiwamu to branch on his own. As long as we don't diverge too much, there shouldn't be an issue sharing any patches between them. I don't see us diverging much as kiwamu is working mainly on the embedded targets, I'm in the process of revamping the intermediate representation to allow faster/better/easier optimizations and fixing some warts on the type system with the powers of hindsight and some inspiring papers by SPJ :) John From victorsmiller at gmail.com Sun May 11 20:46:46 2014 From: victorsmiller at gmail.com (Victor Miller) Date: Sun, 11 May 2014 16:46:46 -0400 Subject: [Haskell-cafe] Installation of package text failing installation on ghc 7.6.3 Message-ID: I just downloaded the latest Haskell platform (I realize that ghc might not be up-to-date in this) for my macbook. I installed it, which appeared to go without problems. However, when I tried to update the package text, I get the errors below. I suspect that the first error (not recognizing ' in a comment) cascades through the rest. How do you suggest fixing this (other than getting Bryan do drop the apostrophe :-))? Victor Configuring text-1.1.1.2... Building text-1.1.1.2... Preprocessing library text-1.1.1.2... Data/Text.hs:9:52: warning: missing terminating ' character [-Winvalid-pp-token] -- Copyright : (c) 2009, 2010, 2011, 2012 Bryan O'Sullivan, ^ Data/Text.hs:90:12: warning: missing terminating ' character [-Winvalid-pp-token] , foldl' ^ Data/Text.hs:92:13: warning: missing terminating ' character [-Winvalid-pp-token] , foldl1' ^ Data/Text.hs:151:14: warning: missing terminating ' character [-Winvalid-pp-token] --, lines' ^ Data/Text.hs:269:15: warning: missing terminating '"' character [-Winvalid-pp-token] -- character \"�\" (U+FFFD). Functions that perform this ^ Data/Text.hs:271:5: warning: missing terminating '"' character [-Winvalid-pp-token] -- \"Performs replacement on invalid scalar values\". ^ Data/Text.hs:304:12: warning: missing terminating '"' character [-Winvalid-pp-token] -- phrase \"Subject to fusion\". ^ Data/Text.hs:440:3: error: invalid preprocessing directive #-} ^ Data/Text.hs:477:4: error: invalid preprocessing directive #-} ^ -------------- next part -------------- An HTML attachment was scrubbed... URL: From carter.schonwald at gmail.com Sun May 11 20:55:26 2014 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Sun, 11 May 2014 16:55:26 -0400 Subject: [Haskell-cafe] Installation of package text failing installation on ghc 7.6.3 In-Reply-To: References: Message-ID: you just upgraded to xcode 5 but you haven't updated you SETTINGS file please follow the directions here: https://gist.github.com/cartazio/7131371 (these directions can be found via http://www.haskell.org/platform/mac.html) if you wish to check their authenticity :) On Sun, May 11, 2014 at 4:46 PM, Victor Miller wrote: > I just downloaded the latest Haskell platform (I realize that ghc might > not be up-to-date in this) for my macbook. I installed it, which appeared > to go without problems. However, when I tried to update the package text, > I get the errors below. I suspect that the first error (not recognizing ' > in a comment) cascades through the rest. How do you suggest fixing this > (other than getting Bryan do drop the apostrophe :-))? > > Victor > > Configuring text-1.1.1.2... > > Building text-1.1.1.2... > > Preprocessing library text-1.1.1.2... > > > Data/Text.hs:9:52: > > warning: missing terminating ' character [-Winvalid-pp-token] > > -- Copyright : (c) 2009, 2010, 2011, 2012 Bryan O'Sullivan, > > ^ > > > Data/Text.hs:90:12: > > warning: missing terminating ' character [-Winvalid-pp-token] > > , foldl' > > ^ > > > Data/Text.hs:92:13: > > warning: missing terminating ' character [-Winvalid-pp-token] > > , foldl1' > > ^ > > > Data/Text.hs:151:14: > > warning: missing terminating ' character [-Winvalid-pp-token] > > --, lines' > > ^ > > > Data/Text.hs:269:15: > > warning: missing terminating '"' character [-Winvalid-pp-token] > > -- character \"�\" (U+FFFD). Functions that perform this > > ^ > > > Data/Text.hs:271:5: > > warning: missing terminating '"' character [-Winvalid-pp-token] > > -- \"Performs replacement on invalid scalar values\". > > ^ > > > Data/Text.hs:304:12: > > warning: missing terminating '"' character [-Winvalid-pp-token] > > -- phrase \"Subject to fusion\". > > ^ > > > Data/Text.hs:440:3: > > error: invalid preprocessing directive > > #-} > > ^ > > > Data/Text.hs:477:4: > > error: invalid preprocessing directive > > #-} > > ^ > > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Sun May 11 20:56:07 2014 From: allbery.b at gmail.com (Brandon Allbery) Date: Sun, 11 May 2014 16:56:07 -0400 Subject: [Haskell-cafe] Installation of package text failing installation on ghc 7.6.3 In-Reply-To: References: Message-ID: On Sun, May 11, 2014 at 4:46 PM, Victor Miller wrote: > I just downloaded the latest Haskell platform (I realize that ghc might > not be up-to-date in this) for my macbook. I installed it, which appeared > to go without problems. However, when I tried to update the package text, > I get the errors below. I suspect that the first error (not recognizing ' > in a comment) cascades through the rest. How do you suggest fixing this > (other than getting Bryan do drop the apostrophe :-))? > This is the reason the Platform hasn't been updated yet (will happen later this month) --- anything using the CPP extension is broken on OS X with Xcode 5.0.2 or later, because its cpp is not compatible with Haskell code. If you install the Platform via MacPorts or Homebrew then you will get one built using gcc, and this won't happen. Alternatively there is a patch you can apply to work around most (but not all) of the incompatibilities; see http://www.haskell.org/platform/mac.html under "Xcode 5 & OS X 10.9 (Mavericks)" (note that that heading is actually in error, as 10.8 will also show the problem if an Xcode beyond 5.0.1 is installed). Alternately you can wait for the new Platform release later this month, which will be based on ghc 7.8.2 which has its own workaround for the incompatibility. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From victorsmiller at gmail.com Sun May 11 21:06:03 2014 From: victorsmiller at gmail.com (Victor Miller) Date: Sun, 11 May 2014 17:06:03 -0400 Subject: [Haskell-cafe] Installation of package text failing installation on ghc 7.6.3 In-Reply-To: References: Message-ID: Brandon, Thanks. I read the instructions too hastily. I ran ghc-clang-wrapper before I installed the new platform :-(. Now it's working. Victor On Sun, May 11, 2014 at 4:56 PM, Brandon Allbery wrote: > On Sun, May 11, 2014 at 4:46 PM, Victor Miller wrote: > >> I just downloaded the latest Haskell platform (I realize that ghc might >> not be up-to-date in this) for my macbook. I installed it, which appeared >> to go without problems. However, when I tried to update the package text, >> I get the errors below. I suspect that the first error (not recognizing ' >> in a comment) cascades through the rest. How do you suggest fixing this >> (other than getting Bryan do drop the apostrophe :-))? >> > > This is the reason the Platform hasn't been updated yet (will happen later > this month) --- anything using the CPP extension is broken on OS X with > Xcode 5.0.2 or later, because its cpp is not compatible with Haskell code. > > If you install the Platform via MacPorts or Homebrew then you will get one > built using gcc, and this won't happen. Alternatively there is a patch you > can apply to work around most (but not all) of the incompatibilities; see > http://www.haskell.org/platform/mac.html under "Xcode 5 & OS X 10.9 > (Mavericks)" (note that that heading is actually in error, as 10.8 will > also show the problem if an Xcode beyond 5.0.1 is installed). > > Alternately you can wait for the new Platform release later this month, > which will be based on ghc 7.8.2 which has its own workaround for the > incompatibility. > > -- > brandon s allbery kf8nh sine nomine > associates > allbery.b at gmail.com > ballbery at sinenomine.net > unix, openafs, kerberos, infrastructure, xmonad > http://sinenomine.net > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kiwamu at debian.or.jp Sun May 11 22:33:04 2014 From: kiwamu at debian.or.jp (Kiwamu Okabe) Date: Mon, 12 May 2014 07:33:04 +0900 Subject: [Haskell-cafe] [Haskell] ANNOUNCE: jhc-0.8.1 In-Reply-To: References: <536FDD0F.50601@henning-thielemann.de> Message-ID: Hi John. On Mon, May 12, 2014 at 5:34 AM, John Meacham wrote: > I try to pull what I can back from ajhc, I had to take a break from > developing jhc for a bit (grumble) so it was easier for kiwamu to > branch on his own. As long as we don't diverge too much, there > shouldn't be an issue sharing any patches between them. I don't see us > diverging much as kiwamu is working mainly on the embedded targets, I'll try to darcs-send Ajhc's remain patch to jhc. > I'm in the process of revamping the intermediate representation to > allow faster/better/easier optimizations and fixing some warts on the > type system with the powers of hindsight and some inspiring papers by > SPJ :) Umm.... I'll try to understand your design, and believe your design is so crazy. ;) Thank's a lot for your brain, -- Kiwamu Okabe at METASEPI DESIGN From domdere at domdere.com Sun May 11 22:45:16 2014 From: domdere at domdere.com (Dom De Re) Date: Mon, 12 May 2014 08:45:16 +1000 Subject: [Haskell-cafe] Custome monoid mappend on HashMap and HashSet values In-Reply-To: References: Message-ID: Hey John, Its a bit tedious to rewrite the library for an entire type when you newtype it. Typically I would newtype it, write the custom instance for it, but I would still use the main type everywhere where i am not using the custom instance. This would reduce your code to: newtype MyHashMap k v = MyHashMap {toHashMap :: (M.HashMap k v)} instance (Eq k, Hashable k, Monoid v) => Monoid (MyHashMap k v) where mempty = empty mappend (MyHashMap a) (MyHashMap b) = MyHashMap (M.unionWith mappend a b) empty :: MyHashMap k v empty = MyHashMap M.empty It has the following main benefit: HashMap is a common data structure that a lot of users are familiar with a single "goto" source for the docs ( http://hackage.haskell.org/package/unordered-containers), when users or collaborators look at the type and they see HashMap in there they either know exactly how it behaves already or they know where to go to find a complete definition, without having to also look at what implicit local instances are in scope (like in Scala). If the code inside a function isnt using your overridden monoid instance then you may as well give them a function that works with the more widely spread type, rather than getting them to needlessly wrap it into your type. Even if you are then you still may as well use the plain (Lazy/Strict) HashMap type in the signature of your function so again people are more familiar with the value thats going in, and explicitly wrap and unwrap the values in the body of your function. This way again when someone reads your code they know whats going in and whats coming out and they can see that the monoid instance is being overwritten. e.g (I might be missing some constraints): unionWithAppendAll :: (Eq k, Hashable k) => [M.HashMap k v] -> M.HashMap k v unionWithAppendAll x = toHashMap (fold myhashmaps) -- unwrap it aftr yo have used your monoid instance where -- wrap your values myhashmaps :: [MyHashMap k v] myhashmaps = fmap MyHashMap x -- I wrote it that way to try and make what is going on more clear, but it can be written more concisely as: unionWithAppendAll :: (Eq k, Hashable k) => [M.HashMap k v] -> M.HashMap k v unionWithAppendAll = toHashMap . foldMap MyHashMap where fold and foldMap are described here: http://hackage.haskell.org/package/base-4.3.1.0/docs/Data-Foldable.html#v:fold If you were writing a library that might be shared, this allows you to not expose MyHashMap in your interface if you dont believe that the MyHashMap Monoid instance has any use for anyone else besides your specific purpose in your particular library. It can even simplify your module for your collaborators. Thanks, Dom. On Sun, May 11, 2014 at 3:31 PM, John Ky wrote: > > Thanks Alexander and Tran, > > So I went through the whole process of defining newtype, but it was quite > a long process. My code below. > > Surely it would make more sense if the HashMap monoid were defined in > terms of the monoid of its value type? > > In that case you could choose the monoid for the value to take the left > value, which would be the equivalent of the current behaviour. > > Cheers, > > -John > > import qualified Control.Applicative as A > import Data.Hashable > import qualified Data.HashMap.Lazy as M > import Data.Monoid > > newtype HashMap k v = HashMap (M.HashMap k v) > > instance (Eq k, Hashable k, Monoid v) => Monoid (HashMap k v) where > mempty = empty > mappend (HashMap a) (HashMap b) = HashMap (M.unionWith mappend a b) > > empty :: HashMap k v > empty = HashMap M.empty > > singleton :: Hashable k => k -> v -> HashMap k v > singleton k v = HashMap (M.singleton k v) > > null :: HashMap k v -> Bool > null (HashMap m) = M.null m > > size :: HashMap k v -> Int > size (HashMap m) = M.size $ m > > member :: (Eq k, Hashable k) => k -> HashMap k a -> Bool > member k (HashMap m) = M.member k m > > lookup :: (Eq k, Hashable k) => k -> HashMap k v -> Maybe v > lookup k (HashMap m) = M.lookup k m > > lookupDefault :: (Eq k, Hashable k) => v -> k -> HashMap k v -> v > lookupDefault v k (HashMap m) = M.lookupDefault v k m > > (!) :: (Eq k, Hashable k) => HashMap k v -> k -> v > (!) (HashMap m) k = (M.!) m k > > insert :: (Eq k, Hashable k) => k -> v -> HashMap k v -> HashMap k v > insert k v (HashMap m) = HashMap (M.insert k v m) > > insertWith :: (Eq k, Hashable k) => (v -> v -> v) -> k -> v -> HashMap k v > -> HashMap k v > insertWith f k v (HashMap m) = HashMap (M.insertWith f k v m) > > delete :: (Eq k, Hashable k) => k -> HashMap k v -> HashMap k v > delete k (HashMap m) = HashMap $ M.delete k m > > adjust :: (Eq k, Hashable k) => (v -> v) -> k -> HashMap k v -> HashMap k v > adjust f k (HashMap m) = HashMap $ M.adjust f k m > > union :: (Eq k, Hashable k) => HashMap k v -> HashMap k v -> HashMap k v > union (HashMap a) (HashMap b) = HashMap (M.union a b) > > unionWith :: (Eq k, Hashable k) => (v -> v -> v) -> HashMap k v -> HashMap > k v -> HashMap k v > unionWith f (HashMap a) (HashMap b) = HashMap (M.unionWith f a b) > > unions :: (Eq k, Hashable k) => [HashMap k v] -> HashMap k v > unions ms = HashMap (M.unions [un m | m <- ms]) > where un (HashMap m) = m > > map :: (v1 -> v2) -> HashMap k v1 -> HashMap k v2 > map f (HashMap m) = HashMap (M.map f m) > > --mapWithKey :: (k -> v1 -> v2) -> HashMap k v1 -> HashMap k v2 > --mapWithKey f (HashMap m) = HashMap (M.mapWithKey f m) > > traverseWithKey :: A.Applicative f => (k -> v1 -> f v2) -> HashMap k v1 -> > f (HashMap k v2) > traverseWithKey f (HashMap m) = HashMap `fmap` (M.traverseWithKey f m) > > difference :: (Eq k, Hashable k) => HashMap k v -> HashMap k w -> HashMap > k v > difference (HashMap a) (HashMap b) = HashMap (M.difference a b) > > intersection :: (Eq k, Hashable k) => HashMap k v -> HashMap k w -> > HashMap k v > intersection (HashMap a) (HashMap b) = HashMap (M.intersection a b) > > intersectionWith :: (Eq k, Hashable k) => (v1 -> v2 -> v3) -> HashMap k v1 > -> HashMap k v2 -> HashMap k v3 > intersectionWith f (HashMap a) (HashMap b) = HashMap (M.intersectionWith f > a b) > > foldl' :: (a -> v -> a) -> a -> HashMap k v -> a > foldl' f v (HashMap m) = M.foldl' f v m > > foldlWithKey' :: (a -> k -> v -> a) -> a -> HashMap k v -> a > foldlWithKey' f v (HashMap m) = M.foldlWithKey' f v m > > foldr :: (v -> a -> a) -> a -> HashMap k v -> a > foldr f v (HashMap m) = M.foldr f v m > > foldrWithKey :: (k -> v -> a -> a) -> a -> HashMap k v -> a > foldrWithKey f v (HashMap m) = M.foldrWithKey f v m > > filter :: (v -> Bool) -> HashMap k v -> HashMap k v > filter f (HashMap m) = HashMap (M.filter f m) > > filterWithKey :: (k -> v -> Bool) -> HashMap k v -> HashMap k v > filterWithKey f (HashMap m) = HashMap (M.filterWithKey f m) > > keys :: HashMap k v -> [k] > keys (HashMap m) = M.keys m > > elems :: HashMap k v -> [v] > elems (HashMap m) = M.elems m > > toList :: HashMap k v -> [(k, v)] > toList (HashMap m) = M.toList m > > fromList :: (Eq k, Hashable k) => [(k, v)] -> HashMap k v > fromList kvs = HashMap (M.fromList kvs) > > fromListWith :: (Eq k, Hashable k) => (v -> v -> v) -> [(k, v)] -> HashMap > k v > fromListWith f kvs = HashMap (M.fromListWith f kvs) > > > > > > On 10 May 2014 16:07, Alexander V Vershilov > wrote: > >> Hi, John. >> >> You can always use newtype wrapper if you need to overload existing >> method behavior: >> >> newtype MyHashMap a b = MyHashMap { unMy :: HashMap a b} >> >> instance Monoid (MyHasMap a b) where >> mempty = MyHasMap mempty >> mappend a b = your_overloaded_function >> >> Then just wrap and unwrap your data to do a custom mappend, also you can >> write a wrapper function, in case if you'll restrict types then it may work >> only for the types you need: >> >> (<~>) :: HashMap Int (HashMap Int Int) -> HashMap Int (HashMap Int Int) >> -> HashMap Int (HashMap Int Int) >> a <~> b = unMy $ (<>) `on` MyHashMap a b >> >> -- >> Alexander >> > > > > Sydney, Australia > > > > > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From john at gocatch.com Sun May 11 23:50:57 2014 From: john at gocatch.com (John Ky) Date: Mon, 12 May 2014 09:50:57 +1000 Subject: [Haskell-cafe] cabal install lens fails In-Reply-To: <20140511143718.GA33491@polaris.local> References: <20140511143718.GA33491@polaris.local> Message-ID: Hmmm .. still not installing on my OS X system. I'm falling back to running in docker with: apt-get install -y libghc-lens-dev Cheers, -John On 12 May 2014 00:37, Mateusz Lenik wrote: > Hi John, > > I ran into it on 7.8.2, the solution was to install aeson, free and lens > (in > this order). This is due to the fact that: > > > This is related to the recent update of transformers. If you could wait > a few > > days until the packages depending on transformers are upgraded, you > shouldn't > > run into any issues installing lens. > > Source: > http://stackoverflow.com/questions/23510242/cabal-dependency-resolution-fail-for-lens > > Cheers, > Mateusz > > On Mon, May 12, 2014 at 12:29:19AM +1000, John Ky wrote: > > Hi Haskell Cafe, > > > > Anyone know about this error? > > > > Installing library in > > /Users/johnky/Library/Haskell/ghc-7.6.3/lib/reflection-1.4/lib > > Registering reflection-1.4... > > Installed reflection-1.4 > > Configuring mtl-2.0.1.0... > > Building mtl-2.0.1.0... > > Preprocessing library mtl-2.0.1.0... > > [ 1 of 21] Compiling Control.Monad.Writer.Class ( > > Control/Monad/Writer/Class.hs, dist/build/Control/Monad/Writer/Class.o ) > > [ 2 of 21] Compiling Control.Monad.State.Class ( > > Control/Monad/State/Class.hs, dist/build/Control/Monad/State/Class.o ) > > [ 3 of 21] Compiling Control.Monad.Reader.Class ( > > Control/Monad/Reader/Class.hs, dist/build/Control/Monad/Reader/Class.o ) > > [ 4 of 21] Compiling Control.Monad.RWS.Class ( > Control/Monad/RWS/Class.hs, > > dist/build/Control/Monad/RWS/Class.o ) > > [ 5 of 21] Compiling Control.Monad.Identity ( Control/Monad/Identity.hs, > > dist/build/Control/Monad/Identity.o ) > > [ 6 of 21] Compiling Control.Monad.Error.Class ( > > Control/Monad/Error/Class.hs, dist/build/Control/Monad/Error/Class.o ) > > > > Control/Monad/Error/Class.hs:93:18: Not in scope: `catch' > > Failed to install mtl-2.0.1.0 > > > > Cheers, > > > > -John > > > > -- > > > > Sydney, Australia > > > > < > http://www.linkedin.com/company/goCatch> > > < > https://play.google.com/store/apps/details?id=com.gocatchapp.goCatch&hl=en > > > > < > http://www.windowsphone.com/en-au/store/app/gocatch/d76b0eb5-bad6-429f-b99e-0ce85d953f93 > > > > > > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -- Sydney, Australia -------------- next part -------------- An HTML attachment was scrubbed... URL: From john at gocatch.com Mon May 12 00:58:45 2014 From: john at gocatch.com (John Ky) Date: Mon, 12 May 2014 10:58:45 +1000 Subject: [Haskell-cafe] Error when trying to use Hashable Message-ID: Hi Haskell Cafe, I have some code that compiles when running on GHC on OS X, but not on Ubuntu: No instance for (hashable-1.2.1.0:Data.Hashable.Class.GHashable (GHC.Generics.Rep Point)) arising from a use of `hashable-1.2.1.0:Data.Hashable.Class.$gdmhashWithSalt' Possible fix: add an instance declaration for (hashable-1.2.1.0:Data.Hashable.Class.GHashable (GHC.Generics.Rep Point)) In the expression: (hashable-1.2.1.0:Data.Hashable.Class.$gdmhashWithSalt) In an equation for `hashWithSalt': hashWithSalt = (hashable-1.2.1.0:Data.Hashable.Class.$gdmhashWithSalt) In the instance declaration for `Hashable Point' Anyone know what's happening here? Cheers, -John -- Sydney, Australia -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Mon May 12 01:03:46 2014 From: allbery.b at gmail.com (Brandon Allbery) Date: Sun, 11 May 2014 21:03:46 -0400 Subject: [Haskell-cafe] Error when trying to use Hashable In-Reply-To: References: Message-ID: On Sun, May 11, 2014 at 8:58 PM, John Ky wrote: > I have some code that compiles when running on GHC on OS X, but not on > Ubuntu: > > No instance for (hashable-1.2.1.0:Data.Hashable.Class.GHashable > (GHC.Generics.Rep Point)) > arising from a use of > `hashable-1.2.1.0:Data.Hashable.Class.$gdmhashWithSalt' > Possible fix: > add an instance declaration for > (hashable-1.2.1.0:Data.Hashable.Class.GHashable > (GHC.Generics.Rep Point)) > In the expression: > (hashable-1.2.1.0:Data.Hashable.Class.$gdmhashWithSalt) > In an equation for `hashWithSalt': > hashWithSalt > = (hashable-1.2.1.0:Data.Hashable.Class.$gdmhashWithSalt) > In the instance declaration for `Hashable Point' > The fully qualified (with package name/version) typeclass makes me think you have multiple versions of the hashable package installed, and the one your source is using is different from one pulled in by something else. ghc makes it dangerous to have multiple versions of a package installed. Use `ghc-pkg list` to make sure you have only one; if there is one in the global section and another in the local section, remove the local one and reinstall anything broken by that with `cabal install $thepackage --constraint='hashable installed'`. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From holmisen at gmail.com Mon May 12 06:13:47 2014 From: holmisen at gmail.com (Johan Holmquist) Date: Mon, 12 May 2014 08:13:47 +0200 Subject: [Haskell-cafe] what did I do wrong In-Reply-To: References: <536E12B3.9080305@home.nl> <877g5trgpa.fsf@bluescreen303.nl> <536E14E1.9010103@home.nl> Message-ID: Also, in Haskell all functions take only one parameter. If you want a function of two (as in the case of center) there are two ways to achieve that: Make the argument a tuple or make a function with the first argument returning another function taking the second. The latter approach is more common in Haskell. Your definition of center does that. foo x y = x *y is the same as foo x= \y -> x*y and foo = \x -> \y -> x*y On May 10, 2014 2:05 PM, "Corentin Dupont" wrote: > Hi, > remember that in Haskell argument application is just a space, not using > parenthesis and comma like in some imperative languages. > In Java: myFunc (a, b) > Is equivalent in Haskell to: myfunc a b > so center ((1,2), (3, 4)) is a function applied to only one arguement (a > tuple of tuples) > > > On Sat, May 10, 2014 at 2:00 PM, Roelof Wobben wrote: > >> Mathijs Kwik schreef op 10-5-2014 13:55: >> >> Roelof Wobben writes: >>> >>> Hello, >>>> >>>> I have to find the center of 2 points as a assigment for a course on >>>> fpcomplete. This is no homework because I do a self-study. >>>> >>>> So I did this: >>>> >>>> center (x1,y1) (x2,y2) = ( ((x1+x2)/2),((y1+y2)/2) ) >>>> main = print $ center ((1,2), (3, 4)) >>>> >>> should be: >>> >>> center (x1,y1) (x2,y2) = ( ((x1+x2)/2),((y1+y2)/2) ) >>> main = print $ center (1,2) (3, 4) >>> >>> >>> >> oke, >> >> as I see you changed the main function but I have to make the center >> function work not change the main function. >> >> >> Roelof >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From john at gocatch.com Mon May 12 10:05:03 2014 From: john at gocatch.com (John Ky) Date: Mon, 12 May 2014 20:05:03 +1000 Subject: [Haskell-cafe] Error when trying to use Hashable In-Reply-To: References: Message-ID: Hi Brandon, I definitely have only one instance installed: root at 26fc365ee4e6:/# ghc-pkg list | grep hash cryptohash-0.11.2 cryptohash-cryptoapi-0.1.0 hashable-1.2.1.0 hashed-storage-0.5.10 hashtables-1.0.1.8 murmur-hash-0.1.0.6 static-hash-0.0.1 The ubuntu system was built using this Dockerfile from using only standard apt-get commands: FROM ubuntu:14.04 RUN apt-get update RUN apt-get upgrade -y RUN apt-get install -y fakeroot curl dnsutils git golang jq openssh-client openssh-server redis-server telnet unzip vim wget RUN apt-get install -y ghc RUN apt-get install -y libghc-hdbc-dev RUN apt-get install -y libghc-hdbc-postgresql-dev RUN apt-get install -y libghc-hdbc-sqlite3-dev RUN apt-get install -y libghc-zeromq3-haskell-dev RUN apt-get install -y libghc-lens-dev RUN apt-get install -y libghc-aeson-dev libghc-aeson-pretty-dev libghc-lens-aeson-dev RUN apt-get install -y libghc-hashable-dev RUN apt-get install -y cabal-debian RUN apt-get install -y libghc-cryptohash-cryptoapi-dev libghc-cryptohash-dev libghc-digest-dev libghc-hashable-dev libghc-hashed-storage-dev libghc-hashtables-dev libghc-intern-dev libghc-murmur-hash-dev libghc-puremd5-dev libghc-skein-dev libghc-static-hash-dev libghc-unordered-containers-dev RUN apt-get clean Cheers, -John On 12 May 2014 11:03, Brandon Allbery wrote: > On Sun, May 11, 2014 at 8:58 PM, John Ky wrote: > >> I have some code that compiles when running on GHC on OS X, but not on >> Ubuntu: >> >> No instance for (hashable-1.2.1.0:Data.Hashable.Class.GHashable >> (GHC.Generics.Rep Point)) >> arising from a use of >> `hashable-1.2.1.0:Data.Hashable.Class.$gdmhashWithSalt' >> Possible fix: >> add an instance declaration for >> (hashable-1.2.1.0:Data.Hashable.Class.GHashable >> (GHC.Generics.Rep Point)) >> In the expression: >> (hashable-1.2.1.0:Data.Hashable.Class.$gdmhashWithSalt) >> In an equation for `hashWithSalt': >> hashWithSalt >> = (hashable-1.2.1.0:Data.Hashable.Class.$gdmhashWithSalt) >> In the instance declaration for `Hashable Point' >> > > The fully qualified (with package name/version) typeclass makes me think > you have multiple versions of the hashable package installed, and the one > your source is using is different from one pulled in by something else. > > ghc makes it dangerous to have multiple versions of a package installed. > Use `ghc-pkg list` to make sure you have only one; if there is one in the > global section and another in the local section, remove the local one and > reinstall anything broken by that with `cabal install $thepackage > --constraint='hashable installed'`. > > -- > brandon s allbery kf8nh sine nomine > associates > allbery.b at gmail.com > ballbery at sinenomine.net > unix, openafs, kerberos, infrastructure, xmonad > http://sinenomine.net > -- Sydney, Australia -------------- next part -------------- An HTML attachment was scrubbed... URL: From fuuzetsu at fuuzetsu.co.uk Mon May 12 14:56:46 2014 From: fuuzetsu at fuuzetsu.co.uk (Mateusz Kowalczyk) Date: Mon, 12 May 2014 16:56:46 +0200 Subject: [Haskell-cafe] Reading and writing to handles made with System.Process far too slow Message-ID: <5370E12E.1060409@fuuzetsu.co.uk> Hi, I'm have some business in piping some data and reading some data back out of a socket so I thought that I'd just use the ?socat? tool. I went off to System.Process just to find out that reading and writing are taking far too long. I put together a small example which only requires that you have ?cat? on your system: {-# LANGUAGE UnicodeSyntax #-} module Uzbl.WithSource where import GHC.IO.Handle ( hPutStr, hGetContents, hSetBuffering , BufferMode(..)) import System.Process ( createProcess, proc , StdStream(CreatePipe), std_out, std_in) gs ? IO String gs = do let sp = (proc "cat" []) { std_out = CreatePipe, std_in = CreatePipe } (Just hin, Just hout, _, _) ? createProcess sp -- hSetBuffering hin NoBuffering -- hSetBuffering hout NoBuffering hPutStr hin "Test data" hGetContents hout All this should effectively do is to give you back "Test data". While it *does* do that, it takes far too long. When I run ?gs?, it will start to (lazily) print the result, printing nothing but opening ?"? and then after about 2-3 seconds printing the rest and finishing. If we set buffering on the in-handle (hin) to NoBuffering, we get a slightly different behaviour: pretty much straight away we'll have ?"Test data? but then it will wait for the same amount of time to conclude that it's the end of the response. Changing buffering mode on ?hout? seems to make no difference. Setting precise number in a BlockBuffering seems to be no improvement and in the actual application I will not know how long the data I'm piping in and out will be. GHC 7.8.2, process-1.2.2.0; I'm running ?gs? in GHCi. It seems that if I change the module name to Main, make ?main = gs >>= putStrLn?, compile the file and run it, it just hangs there! If I add a newline at the end, it will print but the program will not finish. This makes me think that perhaps I should be closing handles somewhere (but if I try inside the function, I get no output, thanks lazy I/O). What I would expect this program to do is to produce same result as ?print "Test data" | cat?. -- Mateusz K. From fuuzetsu at fuuzetsu.co.uk Mon May 12 15:00:43 2014 From: fuuzetsu at fuuzetsu.co.uk (Mateusz Kowalczyk) Date: Mon, 12 May 2014 17:00:43 +0200 Subject: [Haskell-cafe] Reading and writing to handles made with System.Process far too slow In-Reply-To: <5370E12E.1060409@fuuzetsu.co.uk> References: <5370E12E.1060409@fuuzetsu.co.uk> Message-ID: <5370E21B.5030208@fuuzetsu.co.uk> On 05/12/2014 04:56 PM, Mateusz Kowalczyk wrote: > Hi, > > I'm have some business in piping some data and reading some data back > out of a socket so I thought that I'd just use the ?socat? tool. I went > off to System.Process just to find out that reading and writing are > taking far too long. > > I put together a small example which only requires that you have ?cat? > on your system: > > > {-# LANGUAGE UnicodeSyntax #-} > module Uzbl.WithSource where > > import GHC.IO.Handle ( hPutStr, hGetContents, hSetBuffering > , BufferMode(..)) > import System.Process ( createProcess, proc > , StdStream(CreatePipe), std_out, std_in) > > gs ? IO String > gs = do > let sp = (proc "cat" []) > { std_out = CreatePipe, std_in = CreatePipe } > (Just hin, Just hout, _, _) ? createProcess sp > -- hSetBuffering hin NoBuffering > -- hSetBuffering hout NoBuffering > hPutStr hin "Test data" > hGetContents hout > > > All this should effectively do is to give you back "Test data". While it > *does* do that, it takes far too long. When I run ?gs?, it will start to > (lazily) print the result, printing nothing but opening ?"? and then > after about 2-3 seconds printing the rest and finishing. > > If we set buffering on the in-handle (hin) to NoBuffering, we get a > slightly different behaviour: pretty much straight away we'll have > ?"Test data? but then it will wait for the same amount of time to > conclude that it's the end of the response. Changing buffering mode on > ?hout? seems to make no difference. Setting precise number in a > BlockBuffering seems to be no improvement and in the actual application > I will not know how long the data I'm piping in and out will be. > > GHC 7.8.2, process-1.2.2.0; I'm running ?gs? in GHCi. It seems that if I > change the module name to Main, make ?main = gs >>= putStrLn?, compile > the file and run it, it just hangs there! If I add a newline at the end, > it will print but the program will not finish. This makes me think that > perhaps I should be closing handles somewhere (but if I try inside the > function, I get no output, thanks lazy I/O). > > What I would expect this program to do is to produce same result as > ?print "Test data" | cat?. > As it often happens, I solved it straight away after posting to the list. Here's the program that behaves how I wanted it to from the start: gs ? IO String gs = do let sp = (proc "cat" []) { std_out = CreatePipe, std_in = CreatePipe } (Just hin, Just hout, _, _) ? createProcess sp hPutStr hin "Test data" hClose hin c ? hGetContents hout length c `seq` hClose hout return c -- Mateusz K. From mail at joachim-breitner.de Tue May 13 09:14:46 2014 From: mail at joachim-breitner.de (Joachim Breitner) Date: Tue, 13 May 2014 11:14:46 +0200 Subject: [Haskell-cafe] Visiting Portland 6/12-6/14 (and Eugene after that) Message-ID: <1399972486.7051.9.camel@kirk> Hi, I?ll be visiting a summer school in Eugene? in June and my travel plans include two days in Portland, (Tuesday June 12th, afternoon until Saturday, June 14th, shortly past noon). If there anybody wants to meet for keysigning/sightseeing/discussing Haskell/other stuff, let me know. Also, I?d be happy to join any interesting event such as User group meetings, and I can offer to hold a talk (most likely something Haskell related, or general Debian topics). I haven?t book accommodation yet. Useful secret tips are welcome :-) After that I?ll be in Eugene for two weeks and although the schedule is full I?m sure there will be time to meet likewise people in the evening. Or even during the event ? I would be surprised if I were there the only haskell-cafe reader that attends the summer school. Greetings, Joachim ? http://www.cs.uoregon.edu/research/summerschool/summer14/ -- Joachim ?nomeata? Breitner mail at joachim-breitner.de ? http://www.joachim-breitner.de/ Jabber: nomeata at joachim-breitner.de ? GPG-Key: 0xF0FBF51F Debian Developer: nomeata at debian.org -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: This is a digitally signed message part URL: From eijiro.sumii at gmail.com Tue May 13 10:39:57 2014 From: eijiro.sumii at gmail.com (Eijiro Sumii) Date: Tue, 13 May 2014 19:39:57 +0900 (JST) Subject: [Haskell-cafe] FLOPS 2014 call for participation (early registration deadline extended) Message-ID: <20140513.193957.521458028680991545.sumii@ecei.tohoku.ac.jp> Dear colleagues, The early registration for FLOPS 2014 (Twelfth International Symposium on Functional and Logic Programming, June 4-6, Kanazawa, Japan) is now open until May 16 Friday, 23:59 JST. - Please register *now* (that is, if you plan to attend) at: http://www.jaist.ac.jp/flops2014/registration.html - Program: http://www.jaist.ac.jp/flops2014/program.html - Invited talks by Ranjit Jhala, Shin-ya Katsumata, and Gabriele Keller: http://www.jaist.ac.jp/flops2014/invited.html - Proceedings to be published as LNCS 8475 - Hyakuman-goku Matsuri Festival http://www.kanazawa-tourism.com/eng/event/event2.php on the day after the symposium (June 7); accommodation can be extended on request basis via the registration site (use the comments field) - More information at: http://www.jaist.ac.jp/flops2014/ Thank you again, FLOPS 2014 Program Co-Chairs Michael Codish and Eijiro Sumii From gtener at gmail.com Tue May 13 12:00:21 2014 From: gtener at gmail.com (=?UTF-8?Q?Krzysztof_Skrz=C4=99tnicki?=) Date: Tue, 13 May 2014 14:00:21 +0200 Subject: [Haskell-cafe] Reading and writing to handles made with System.Process far too slow In-Reply-To: <5370E21B.5030208@fuuzetsu.co.uk> References: <5370E12E.1060409@fuuzetsu.co.uk> <5370E21B.5030208@fuuzetsu.co.uk> Message-ID: Bear in mind that this program will also hang if you write enough data to it. There is an implicit buffer when piping data between processes. When it gets filled the process trying to write to it will simply wait forever. The "cat" you are spawning will wait too because you don't actually read any data. The solution is to perform writing and reading in concurrent fashion. Just try this program: module Main where import System.Process import System.IO import Control.Concurrent r n = replicate n '.' gs :: Int -> IO String gs n = do print n let sp = (proc "cat" []) { std_out = CreatePipe, std_in = CreatePipe } (Just hin, Just hout, _, _) <- createProcess sp let cb = do hPutStr hin (r n) hClose hin -- forkIO cb cb c <- hGetContents hout length c `seq` hClose hout return c main = do print "welcome" mapM_ gs [ 2 ^ x | x <- [0..20]] print "goodbye" Without forkIO it hangs on my system with n = 2^18. If you replace "cb" with "forkIO cb" it will finish without hanging. Best regards, Krzysztof Skrz?tnicki On Mon, May 12, 2014 at 5:00 PM, Mateusz Kowalczyk wrote: > On 05/12/2014 04:56 PM, Mateusz Kowalczyk wrote: > > Hi, > > > > I'm have some business in piping some data and reading some data back > > out of a socket so I thought that I'd just use the ?socat? tool. I went > > off to System.Process just to find out that reading and writing are > > taking far too long. > > > > I put together a small example which only requires that you have ?cat? > > on your system: > > > > > > {-# LANGUAGE UnicodeSyntax #-} > > module Uzbl.WithSource where > > > > import GHC.IO.Handle ( hPutStr, hGetContents, hSetBuffering > > , BufferMode(..)) > > import System.Process ( createProcess, proc > > , StdStream(CreatePipe), std_out, std_in) > > > > gs ? IO String > > gs = do > > let sp = (proc "cat" []) > > { std_out = CreatePipe, std_in = CreatePipe } > > (Just hin, Just hout, _, _) ? createProcess sp > > -- hSetBuffering hin NoBuffering > > -- hSetBuffering hout NoBuffering > > hPutStr hin "Test data" > > hGetContents hout > > > > > > All this should effectively do is to give you back "Test data". While it > > *does* do that, it takes far too long. When I run ?gs?, it will start to > > (lazily) print the result, printing nothing but opening ?"? and then > > after about 2-3 seconds printing the rest and finishing. > > > > If we set buffering on the in-handle (hin) to NoBuffering, we get a > > slightly different behaviour: pretty much straight away we'll have > > ?"Test data? but then it will wait for the same amount of time to > > conclude that it's the end of the response. Changing buffering mode on > > ?hout? seems to make no difference. Setting precise number in a > > BlockBuffering seems to be no improvement and in the actual application > > I will not know how long the data I'm piping in and out will be. > > > > GHC 7.8.2, process-1.2.2.0; I'm running ?gs? in GHCi. It seems that if I > > change the module name to Main, make ?main = gs >>= putStrLn?, compile > > the file and run it, it just hangs there! If I add a newline at the end, > > it will print but the program will not finish. This makes me think that > > perhaps I should be closing handles somewhere (but if I try inside the > > function, I get no output, thanks lazy I/O). > > > > What I would expect this program to do is to produce same result as > > ?print "Test data" | cat?. > > > > As it often happens, I solved it straight away after posting to the > list. Here's the program that behaves how I wanted it to from the start: > > gs ? IO String > gs = do > let sp = (proc "cat" []) > { std_out = CreatePipe, std_in = CreatePipe } > (Just hin, Just hout, _, _) ? createProcess sp > hPutStr hin "Test data" > hClose hin > c ? hGetContents hout > length c `seq` hClose hout > return c > > -- > Mateusz K. > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan.miljenovic at gmail.com Tue May 13 13:18:24 2014 From: ivan.miljenovic at gmail.com (Ivan Lazar Miljenovic) Date: Tue, 13 May 2014 23:18:24 +1000 Subject: [Haskell-cafe] ANNOUNCE: graphviz-2999.17.0.0 Message-ID: It's taken me over a year, but I'm pleased to announce the latest version of my graph visualisation (via the Graphviz suite of tools) library: http://hackage.haskell.org/package/graphviz You can read all the changes in the Changelog (now linked to from the Hackage page, thanks to the magic of Hackage 2.0! :o), but here are some explicit non-API changes that people should probably be made aware of: * Parsing is currently about 8x slower than previously... because I suggested something two years ago to Malcolm Wallace on what seemed to make polyparse faster; he then released that change as part of polyparse-1.9 a year ago, but now when I do proper benchmarks (rather than the extremely limited ones I did then) I find that my changes actually make it _slower_ in real world usage. Whoops! I'm still using polyparse-1.9 in the hopes that Malcolm is able to release a point-fix release to revert my suggestion. * I'm not sure when it happened, but upstream Graphviz seems to have changed the behaviour of `dot -Tcanon` such that nodes are now interspersed among the edges (and I have been told that it's just a pretty-printer and that it's behaviour should not matter). As such, it is highly recommended that people only use the Generalised representation for parsing unless they're very sure of their input sources. One other change that people might find useful: if I ever again take so long (i.e. 4 major version releases of upstream) to update graphviz such that the various Attribute definitions are no longer valid and fail to parse, there's now (semi-experimental) support for having unrecognised attributes be parsed as an UnknownAttribute instead; but most of the other functions aren't aware of this functionality and thus you might need to duplicate a lot of code if you want to use this with other features like round-tripping. -- Ivan Lazar Miljenovic Ivan.Miljenovic at gmail.com http://IvanMiljenovic.wordpress.com From diaz.carrete at gmail.com Tue May 13 18:09:56 2014 From: diaz.carrete at gmail.com (=?UTF-8?Q?Daniel_D=C3=ADaz?=) Date: Tue, 13 May 2014 11:09:56 -0700 (PDT) Subject: [Haskell-cafe] Reading and writing to handles made with System.Process far too slow In-Reply-To: <5370E12E.1060409@fuuzetsu.co.uk> References: <5370E12E.1060409@fuuzetsu.co.uk> Message-ID: I hope you don't mind a bit of self-promotion. My process-streaminglibrary provides helper functions for process based on the pipesstreaming library. The cat example would be written like this (taken verbatim from the tutorial): example6 = exitCode show $ execute3 (shell "cat") show (surely . useProducer $ yield "aaaaaa\naaaaa") (separate (encoding T.decodeIso8859_1 ignoreLeftovers $ surely $ T.toLazyM) nop ) Returns: >>> *Right ((),("aaaaaa\naaaaa",()))* Writing stdin is done concurrently with the reading of stdout. When an exception is encountered, the library ensures that the handles are closed, the extant concurrent threads terminated, and the external process killed. Also stderr is drained even if you ignore it, to avoid deadlocks due to full buffers. http://hackage.haskell.org/package/process-streaming-0.0.1.1 http://hackage.haskell.org/package/process-streaming-0.0.1.1/docs/System-Process-Streaming-Tutorial.html http://productivedetour.blogspot.com.es/2014/02/process-pipes-process-streaming.html On Monday, May 12, 2014 4:56:46 PM UTC+2, Mateusz Kowalczyk wrote: > > Hi, > > I'm have some business in piping some data and reading some data back > out of a socket so I thought that I'd just use the ?socat? tool. I went > off to System.Process just to find out that reading and writing are > taking far too long. > > I put together a small example which only requires that you have ?cat? > on your system: > > > {-# LANGUAGE UnicodeSyntax #-} > module Uzbl.WithSource where > > import GHC.IO.Handle ( hPutStr, hGetContents, hSetBuffering > , BufferMode(..)) > import System.Process ( createProcess, proc > , StdStream(CreatePipe), std_out, std_in) > > gs ? IO String > gs = do > let sp = (proc "cat" []) > { std_out = CreatePipe, std_in = CreatePipe } > (Just hin, Just hout, _, _) ? createProcess sp > -- hSetBuffering hin NoBuffering > -- hSetBuffering hout NoBuffering > hPutStr hin "Test data" > hGetContents hout > > > All this should effectively do is to give you back "Test data". While it > *does* do that, it takes far too long. When I run ?gs?, it will start to > (lazily) print the result, printing nothing but opening ?"? and then > after about 2-3 seconds printing the rest and finishing. > > If we set buffering on the in-handle (hin) to NoBuffering, we get a > slightly different behaviour: pretty much straight away we'll have > ?"Test data? but then it will wait for the same amount of time to > conclude that it's the end of the response. Changing buffering mode on > ?hout? seems to make no difference. Setting precise number in a > BlockBuffering seems to be no improvement and in the actual application > I will not know how long the data I'm piping in and out will be. > > GHC 7.8.2, process-1.2.2.0; I'm running ?gs? in GHCi. It seems that if I > change the module name to Main, make ?main = gs >>= putStrLn?, compile > the file and run it, it just hangs there! If I add a newline at the end, > it will print but the program will not finish. This makes me think that > perhaps I should be closing handles somewhere (but if I try inside the > function, I get no output, thanks lazy I/O). > > What I would expect this program to do is to produce same result as > ?print "Test data" | cat?. > > -- > Mateusz K. > _______________________________________________ > Haskell-Cafe mailing list > Haskel... at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From carlo at carlo-hamalainen.net Wed May 14 05:34:44 2014 From: carlo at carlo-hamalainen.net (Carlo Hamalainen) Date: Wed, 14 May 2014 05:34:44 +0000 Subject: [Haskell-cafe] Get "cabal repl" to dump ghc options? Message-ID: <00000145f939c585-6d2b22c8-876b-49f4-86e7-6c67f942aedd-000000@email.amazonses.com> Hi, The cabal repl command works out a bunch of GHC options. Is there any way to dump these options without actually starting the repl? In particular, things like this: ghcOptPackageDBs = [ GlobalPackageDB , SpecificPackageDB \"/home/carlo/foo/.cabal-sandbox/x86_64-linux-ghc-7.6.3-packages.conf.d\",SpecificPackageDB \"dist/package.conf.inplace\" ] Basically it would be nice to get the contents of replOpts just before this bit of code: https://github.com/haskell/cabal/blob/master/Cabal/Distribution/Simple/GHC.hs#L792-L796 -- Carlo Hamalainen http://carlo-hamalainen.net From daniel.trstenjak at gmail.com Wed May 14 08:29:39 2014 From: daniel.trstenjak at gmail.com (Daniel Trstenjak) Date: Wed, 14 May 2014 10:29:39 +0200 Subject: [Haskell-cafe] Get "cabal repl" to dump ghc options? In-Reply-To: <00000145f939c585-6d2b22c8-876b-49f4-86e7-6c67f942aedd-000000@email.amazonses.com> References: <00000145f939c585-6d2b22c8-876b-49f4-86e7-6c67f942aedd-000000@email.amazonses.com> Message-ID: <20140514082939.GA2168@machine> Hi Carlo, On Wed, May 14, 2014 at 05:34:44AM +0000, Carlo Hamalainen wrote: > The cabal repl command works out a bunch of GHC options. Is there any > way to dump these options without actually starting the repl? > > In particular, things like this: > > ghcOptPackageDBs = [ GlobalPackageDB > , SpecificPackageDB > \"/home/carlo/foo/.cabal-sandbox/x86_64-linux-ghc-7.6.3-packages.conf.d\",SpecificPackageDB > \"dist/package.conf.inplace\" > ] cabal-cargs[1] might be of help: $> cabal-cargs --format=pure --only=package_db /home/dan/projekte/layers/.cabal-sandbox/x86_64-linux-ghc-7.6.3-packages.conf.d Greetings, Daniel [1] https://github.com/dan-t/cabal-cargs From hvr at gnu.org Wed May 14 09:52:03 2014 From: hvr at gnu.org (Herbert Valerio Riedel) Date: Wed, 14 May 2014 11:52:03 +0200 Subject: [Haskell-cafe] Get "cabal repl" to dump ghc options? In-Reply-To: <00000145f939c585-6d2b22c8-876b-49f4-86e7-6c67f942aedd-000000@email.amazonses.com> (Carlo Hamalainen's message of "Wed, 14 May 2014 05:34:44 +0000") References: <00000145f939c585-6d2b22c8-876b-49f4-86e7-6c67f942aedd-000000@email.amazonses.com> Message-ID: <87zjikadrw.fsf@gnu.org> Hi, On 2014-05-14 at 07:34:44 +0200, Carlo Hamalainen wrote: [...] > The cabal repl command works out a bunch of GHC options. Is there any > way to dump these options without actually starting the repl? Here's a hack I sometimes use to that effect: create a script 'fakeghc.sh' with the following contents (or a similiar program): ,---- | #!/bin/sh | | case "$1" in | --interactive) | echo "$*" | exit | ;; | esac | | exec ghc $* `---- and then invoke cabal like so | cabal repl --with-ghc=./fakeghci.sh HTH, hvr From miguelimo38 at yandex.ru Wed May 14 10:45:29 2014 From: miguelimo38 at yandex.ru (Miguel Mitrofanov) Date: Wed, 14 May 2014 14:45:29 +0400 Subject: [Haskell-cafe] case, GADTs, Arrows Message-ID: <739451400064329@web8h.yandex.ru> Hi Caf?! Are there EXACT rules for desugaring "case" construct in Arrow syntax? The documentation says just "The translation is similar to that of if commands". But that can't be right in case of GADTs. For example, let's say we have data A where A :: Show s => s -> A Then the following would work fine: proc () -> do a <- arr A -< "test" case a of A s -> returnA -< show s But if we abstract part of it: b :: (Arrow a, Show s) => a s String b = proc(s) -> returnA -< show s proc() -> do a <- arr A -< "test" case a of A s -> b -< s then it fails. Now, I'm not asking why exactly does it fail. I understand, that type classes are just data types, and, if arrow is fixed, then the real type of "b" would be b :: Show s -> a s String and that can't be combined with something of type a () (Show s, s). So, the second example shouldn't work at all (although the error message could use some improvement). But I'm surprised that the first one does. Another unexpected thing is that it still requires ArrowChoice from the arrow, although there are no binary alternatives here. Therefore, the rules would be quite helpful. From chrisdone at gmail.com Wed May 14 14:55:20 2014 From: chrisdone at gmail.com (Christopher Done) Date: Wed, 14 May 2014 16:55:20 +0200 Subject: [Haskell-cafe] Imports at bottom, why not? In-Reply-To: References: Message-ID: On 22 April 2014 19:59, Thiago Negri wrote: > So, why not issue import statements at the bottom of a module file? The first technical problem I see is that a compiler can't easily generate a dependency graph without first parsing the whole module. In contrast, current Haskell forbids anything but a module header, some pragmas and an import list to start any module. From R.Paterson at city.ac.uk Wed May 14 23:48:07 2014 From: R.Paterson at city.ac.uk (Ross Paterson) Date: Thu, 15 May 2014 00:48:07 +0100 Subject: [Haskell-cafe] case, GADTs, Arrows In-Reply-To: <739451400064329@web8h.yandex.ru> References: <739451400064329@web8h.yandex.ru> Message-ID: <20140514234807.GA8877@city.ac.uk> On Wed, May 14, 2014 at 02:45:29PM +0400, Miguel Mitrofanov wrote: > Are there EXACT rules for desugaring "case" construct in Arrow syntax? The documentation says just "The translation is similar to that of if commands". But that can't be right in case of GADTs. > > For example, let's say we have > > data A where A :: Show s => s -> A > > Then the following would work fine: > > proc () -> > do a <- arr A -< "test" > case a of > A s -> > returnA -< show s > > But if we abstract part of it: > > b :: (Arrow a, Show s) => a s String > b = > proc(s) -> > returnA -< show s > > proc() -> > do a <- arr A -< "test" > case a of > A s -> > b -< s > > then it fails. Actually the first one doesn't work either: it is accepted, but it generates invalid core -- the arrow translation doesn't handle existentials (this is bug #344). The translation goes proc p -> case {p1 -> c1; ...; pn -> cn} = arr (\ p -> case {p1 -> (v1, p); ...; pn -> (vn, p)}) >>> ((proc (v1, p) -> c1) ||| ... ||| (proc (vn, p) ->?c)) where vi is the tuple of variables in pi. Now if n = 1 there's no need for (|||) and therefore the ArrowChoice constraint, so that's a bit of a bug. When there are existentials we should also include the required dictionaries in the tuple, but unfortunately that's not working. (#5777 is another arrows GADT bug.) From miguelimo38 at yandex.ru Thu May 15 04:01:40 2014 From: miguelimo38 at yandex.ru (MigMit) Date: Thu, 15 May 2014 08:01:40 +0400 Subject: [Haskell-cafe] case, GADTs, Arrows In-Reply-To: <20140514234807.GA8877@city.ac.uk> References: <739451400064329@web8h.yandex.ru> <20140514234807.GA8877@city.ac.uk> Message-ID: Thanks. ?????????? ? iPhone > 15 ??? 2014 ?., ? 3:48, Ross Paterson ???????(?): > >> On Wed, May 14, 2014 at 02:45:29PM +0400, Miguel Mitrofanov wrote: >> Are there EXACT rules for desugaring "case" construct in Arrow syntax? The documentation says just "The translation is similar to that of if commands". But that can't be right in case of GADTs. >> >> For example, let's say we have >> >> data A where A :: Show s => s -> A >> >> Then the following would work fine: >> >> proc () -> >> do a <- arr A -< "test" >> case a of >> A s -> >> returnA -< show s >> >> But if we abstract part of it: >> >> b :: (Arrow a, Show s) => a s String >> b = >> proc(s) -> >> returnA -< show s >> >> proc() -> >> do a <- arr A -< "test" >> case a of >> A s -> >> b -< s >> >> then it fails. > > Actually the first one doesn't work either: it is accepted, but > it generates invalid core -- the arrow translation doesn't handle > existentials (this is bug #344). > > The translation goes > > proc p -> case {p1 -> c1; ...; pn -> cn} > = > arr (\ p -> case {p1 -> (v1, p); ...; pn -> (vn, p)}) >>> > ((proc (v1, p) -> c1) ||| ... ||| (proc (vn, p) -> c)) > > where vi is the tuple of variables in pi. Now if n = 1 there's no need > for (|||) and therefore the ArrowChoice constraint, so that's a bit of > a bug. When there are existentials we should also include the required > dictionaries in the tuple, but unfortunately that's not working. > (#5777 is another arrows GADT bug.) > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From wangbj at gmail.com Thu May 15 06:18:31 2014 From: wangbj at gmail.com (Baojun Wang) Date: Wed, 14 May 2014 23:18:31 -0700 Subject: [Haskell-cafe] possible bug in latest hackage Elf (Elf-0.27) Message-ID: Hi list, with below test program: -- ?/* test1.c: build with -g -O0 */ include static const char appmsg[] = "hello, world"; int main(int argc, char* argv[]) { fputs(appmsg, stdout); return 0; } --- elf-test1.hs module Main where import qualified Data.ByteString as B import qualified Data.ByteString.Char8 as C import Control.Monad import Data.Elf testelf = "/tmp/test1" testelfsym = C.pack "appmsg" lookupSymbol1 _ [] = Nothing lookupSymbol1 sym (t:ts) = case (snd (steName t)) of Nothing -> lookupSymbol1 sym ts Just sname -> if sname == sym then Just t else lookupSymbol1 sym ts lookupSymbol _ [] = Nothing lookupSymbol sym (t:ts) = case (lookupSymbol1 sym t) of Nothing -> lookupSymbol sym ts t1 -> t1 test1 elf symtab symbol = mapM_ (print) (elfSections elf) test2 elf symtab symbol = lookupSymbol symbol symtab test3 elf symtab symbol = lookupSymbol symbol symtab >>= \et -> findSymbolDefinition et mainloop elf symtab symbol = -- (test1 elf symtab symbol) >> print (test2 elf symtab symbol) >> print (test3 elf symtab symbol) >> return () main = do contents <- B.readFile testelf let elf = parseElf contents symtab = parseSymbolTables elf mainloop elf symtab testelfsym --- the latest Data.Elf doesn't geive correct output as expected: output will be: Just (EST {steName = (9,Just "appmsg"), steEnclosingSection = Just (ElfSection {elfSectionName = ".fini", elfSectionType = SHT_PROGBITS, elfSectionFlags = [SHF_EXECINSTR,SHF_ALLOC], elfSectionAddr = 4195908, elfSectionSize = 9, elfSectionLink = 0, elfSectionInfo = 0, elfSectionAddrAlign = 4, elfSectionEntSize = 0, elfSectionData = "H\131\236\bH\131\196\b\195"}), steType = STTObject, steBind = STBLocal, steOther = 0, steIndex = SHNIndex 14, steValue = 4195924, steSize = 13}) >From above, you can see the steEnclosingSection is wrong and offset by 1. The *correct* output should be: Just (EST {steName = (9,Just "appmsg"), steEnclosingSection = Just (ElfSection {elfSectionName = ".rodata", elfSectionType = SHT_PROGBITS, elfSectionFlags = [SHF_ALLOC], elfSectionAddr = 4195920, elfSectionSize = 17, elfSectionLink = 0, elfSectionInfo = 0, elfSectionAddrAlign = 4, elfSectionEntSize = 0, elfSectionData = "\SOH\NUL\STX\NULhello, world\NUL"}), steType = STTObject, steBind = STBLocal, steOther = 0, steIndex = SHNIndex 14, steValue = 4195924, steSize = 13}) Just "hello, world\NUL" After check Elf.hs, I found there could be two issues: 1) in sectionByIndex, (SHNIndex) should start from 0, not 1; this cause the steEnclosingSection from my exmaple offset by 1; 2) in findSymbolDefinition, start should substract the sectionAddr (base address). please see below diff for details: -- --- a/Elf.hs 2012-12-04 19:27:51.000000000 -0800 +++ b/Elf.hs 2014-05-14 22:57:01.014498515 -0700 @@ -1,5 +1,5 @@ -- | Data.Elf is a module for parsing a ByteString of an ELF file into an Elf record. -module Data.Elf ( parseElf +module Elf ( parseElf , parseSymbolTables , findSymbolDefinition , Elf(..) @@ -666,12 +666,12 @@ getSymbolTableEntries e s = -- If the size is zero, or the offset larger than the 'elfSectionData', -- then 'Nothing' is returned. findSymbolDefinition :: ElfSymbolTableEntry -> Maybe B.ByteString -findSymbolDefinition e = - let enclosingData = fmap elfSectionData (steEnclosingSection e) - start = fromIntegral (steValue e) +findSymbolDefinition e = steEnclosingSection e >>= \enclosingSection -> + let enclosingData = elfSectionData enclosingSection + start = ( (fromIntegral (steValue e)) - (fromIntegral (elfSectionAddr enclosingSection) ) ) len = fromIntegral (steSize e) - def = fmap (B.take len . B.drop start) enclosingData - in if def == Just B.empty then Nothing else def + def = (B.take len . B.drop start) enclosingData + in if def == B.empty then Nothing else Just def runGetMany :: Get a -> L.ByteString -> [a] runGetMany g bs @@ -712,7 +712,7 @@ getSymbolTableEntry e strtlb = return $ EST (nameIdx,name) sec typ bind other sTlbIdx symVal size sectionByIndex :: Elf -> ElfSectionIndex -> Maybe ElfSection -sectionByIndex e (SHNIndex i) = lookup i . zip [1..] $ (elfSections e) +sectionByIndex e (SHNIndex i) = lookup i . zip [0..] $ (elfSections e) sectionByIndex _ _ = Nothing infoToTypeAndBind :: Word8 -> (ElfSymbolType,ElfSymbolBinding) -- Would you please check above change and update Data.Elf hackage? I cannot find the author from http://hackage.haskell.org/package/elf-0.27 Thanks baojun -------------- next part -------------- An HTML attachment was scrubbed... URL: From wangbj at gmail.com Thu May 15 07:02:27 2014 From: wangbj at gmail.com (Baojun Wang) Date: Thu, 15 May 2014 00:02:27 -0700 Subject: [Haskell-cafe] possible bug in latest hackage Elf (Elf-0.27) In-Reply-To: References: Message-ID: re-format patch: -- --- a/Elf.hs 2012-12-04 19:27:51.000000000 -0800 +++ b/Elf.hs 2014-05-14 23:47:08.565983310 -0700 @@ -666,12 +666,12 @@ getSymbolTableEntries e s = -- If the size is zero, or the offset larger than the 'elfSectionData', -- then 'Nothing' is returned. findSymbolDefinition :: ElfSymbolTableEntry -> Maybe B.ByteString -findSymbolDefinition e = - let enclosingData = fmap elfSectionData (steEnclosingSection e) - start = fromIntegral (steValue e) +findSymbolDefinition e = steEnclosingSection e >>= \enclosingSection -> + let enclosingData = elfSectionData enclosingSection + start = ( (fromIntegral (steValue e)) - (fromIntegral (elfSectionAddr enclosingSection) ) ) len = fromIntegral (steSize e) - def = fmap (B.take len . B.drop start) enclosingData - in if def == Just B.empty then Nothing else def + def = (B.take len . B.drop start) enclosingData + in if def == B.empty then Nothing else Just def runGetMany :: Get a -> L.ByteString -> [a] runGetMany g bs @@ -712,7 +712,7 @@ getSymbolTableEntry e strtlb = return $ EST (nameIdx,name) sec typ bind other sTlbIdx symVal size sectionByIndex :: Elf -> ElfSectionIndex -> Maybe ElfSection -sectionByIndex e (SHNIndex i) = lookup i . zip [1..] $ (elfSections e) +sectionByIndex e (SHNIndex i) = lookup i . zip [0..] $ (elfSections e) sectionByIndex _ _ = Nothing infoToTypeAndBind :: Word8 -> (ElfSymbolType,ElfSymbolBinding) -- http://github.com/erikcharlebois/elf gives 404. Thanks Baojun On Wed, May 14, 2014 at 11:18 PM, Baojun Wang wrote: > Hi list, > > with below test program: > > -- > ?/* test1.c: build with -g -O0 */ > include > > static const char appmsg[] = "hello, world"; > > int main(int argc, char* argv[]) > { > fputs(appmsg, stdout); > > return 0; > } > > > --- elf-test1.hs > module Main where > > import qualified Data.ByteString as B > import qualified Data.ByteString.Char8 as C > > import Control.Monad > > import Data.Elf > > testelf = "/tmp/test1" > testelfsym = C.pack "appmsg" > > lookupSymbol1 _ [] = Nothing > lookupSymbol1 sym (t:ts) = > case (snd (steName t)) of > Nothing -> lookupSymbol1 sym ts > Just sname -> if sname == sym then Just t > else lookupSymbol1 sym ts > > lookupSymbol _ [] = Nothing > lookupSymbol sym (t:ts) = > case (lookupSymbol1 sym t) of > Nothing -> lookupSymbol sym ts > t1 -> t1 > > test1 elf symtab symbol = mapM_ (print) (elfSections elf) > > test2 elf symtab symbol = > lookupSymbol symbol symtab > > test3 elf symtab symbol = > lookupSymbol symbol symtab >>= \et -> > findSymbolDefinition et > > mainloop elf symtab symbol = > -- (test1 elf symtab symbol) >> > print (test2 elf symtab symbol) >> > print (test3 elf symtab symbol) >> > return () > > main = do > contents <- B.readFile testelf > let elf = parseElf contents > symtab = parseSymbolTables elf > mainloop elf symtab testelfsym > --- > > the latest Data.Elf doesn't geive correct output as expected: > > output will be: > > Just (EST {steName = (9,Just "appmsg"), steEnclosingSection = Just > (ElfSection {elfSectionName = ".fini", elfSectionType = SHT_PROGBITS, > elfSectionFlags = [SHF_EXECINSTR,SHF_ALLOC], elfSectionAddr = 4195908, > elfSectionSize = 9, elfSectionLink = 0, elfSectionInfo = 0, > elfSectionAddrAlign = 4, elfSectionEntSize = 0, elfSectionData = > "H\131\236\bH\131\196\b\195"}), steType = STTObject, steBind = STBLocal, > steOther = 0, steIndex = SHNIndex 14, steValue = 4195924, steSize = 13}) > > From above, you can see the steEnclosingSection is wrong and offset by 1. > > The *correct* output should be: > Just (EST {steName = (9,Just "appmsg"), steEnclosingSection = Just > (ElfSection {elfSectionName = ".rodata", elfSectionType = SHT_PROGBITS, > elfSectionFlags = [SHF_ALLOC], elfSectionAddr = 4195920, elfSectionSize = > 17, elfSectionLink = 0, elfSectionInfo = 0, elfSectionAddrAlign = 4, > elfSectionEntSize = 0, elfSectionData = "\SOH\NUL\STX\NULhello, > world\NUL"}), steType = STTObject, steBind = STBLocal, steOther = 0, > steIndex = SHNIndex 14, steValue = 4195924, steSize = 13}) > Just "hello, world\NUL" > > After check Elf.hs, I found there could be two issues: > 1) in sectionByIndex, (SHNIndex) should start from 0, not 1; this cause > the steEnclosingSection from my exmaple offset by 1; > 2) in findSymbolDefinition, start should substract the sectionAddr (base > address). > > please see below diff for details: > > -- > > --- a/Elf.hs 2012-12-04 19:27:51.000000000 -0800 > +++ b/Elf.hs 2014-05-14 22:57:01.014498515 -0700 > @@ -1,5 +1,5 @@ > -- | Data.Elf is a module for parsing a ByteString of an ELF file into > an Elf record. > -module Data.Elf ( parseElf > +module Elf ( parseElf > , parseSymbolTables > , findSymbolDefinition > , Elf(..) > @@ -666,12 +666,12 @@ getSymbolTableEntries e s = > -- If the size is zero, or the offset larger than the 'elfSectionData', > -- then 'Nothing' is returned. > findSymbolDefinition :: ElfSymbolTableEntry -> Maybe B.ByteString > -findSymbolDefinition e = > - let enclosingData = fmap elfSectionData (steEnclosingSection e) > - start = fromIntegral (steValue e) > +findSymbolDefinition e = steEnclosingSection e >>= \enclosingSection -> > + let enclosingData = elfSectionData enclosingSection > + start = ( (fromIntegral (steValue e)) - (fromIntegral > (elfSectionAddr enclosingSection) ) ) > len = fromIntegral (steSize e) > - def = fmap (B.take len . B.drop start) enclosingData > - in if def == Just B.empty then Nothing else def > + def = (B.take len . B.drop start) enclosingData > + in if def == B.empty then Nothing else Just def > > runGetMany :: Get a -> L.ByteString -> [a] > runGetMany g bs > @@ -712,7 +712,7 @@ getSymbolTableEntry e strtlb = > return $ EST (nameIdx,name) sec typ bind other sTlbIdx symVal size > > sectionByIndex :: Elf -> ElfSectionIndex -> Maybe ElfSection > -sectionByIndex e (SHNIndex i) = lookup i . zip [1..] $ (elfSections e) > +sectionByIndex e (SHNIndex i) = lookup i . zip [0..] $ (elfSections e) > sectionByIndex _ _ = Nothing > > infoToTypeAndBind :: Word8 -> (ElfSymbolType,ElfSymbolBinding) > > -- > > Would you please check above change and update Data.Elf hackage? I cannot > find the author from http://hackage.haskell.org/package/elf-0.27 > > Thanks > baojun > -------------- next part -------------- An HTML attachment was scrubbed... URL: From roma at ro-che.info Thu May 15 07:03:10 2014 From: roma at ro-che.info (Roman Cheplyaka) Date: Thu, 15 May 2014 10:03:10 +0300 Subject: [Haskell-cafe] ANN: fsnotify-0.1 Message-ID: <20140515070310.GA21888@sniper> A new version of fsnotify, a cross-platform filesystem notification library, is available. http://hackage.haskell.org/package/fsnotify-0.1.0.1 The main user-visible changes since the last version are: * ability to stop a listening job * ability to set a polling interval (when polling is used) * a couple of small semantic changes (see [changelog] for details) * improved documentation Plus, there was a fair bit of internal refactoring, including a new test suite. [changelog]: https://github.com/haskell-fswatch/hfsnotify/blob/master/CHANGELOG.md There's still a long-standing bug about wrong event types being generated on OS X. We know how to fix it (basically, use kqueue instead of OS X's own API), but I don't have time to do it. So if anyone is interested, help would be welcome! See https://github.com/haskell-fswatch/hfsnotify/issues/36 Thanks to Miguel Mitrofanov for providing access to an OS X host, which was extremely valuable while working on and testing this version. Roman -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: From roma at ro-che.info Thu May 15 07:30:52 2014 From: roma at ro-che.info (Roman Cheplyaka) Date: Thu, 15 May 2014 10:30:52 +0300 Subject: [Haskell-cafe] possible bug in latest hackage Elf (Elf-0.27) In-Reply-To: References: Message-ID: <20140515073052.GA23472@sniper> Hi Baojun, * Baojun Wang [2014-05-14 23:18:31-0700] > Hi list, > > ... > > Would you please check above change and update Data.Elf hackage? I cannot > find the author from http://hackage.haskell.org/package/elf-0.27 > > Thanks > baojun That page lists Erik Charlebois as a maintainer ? did you try that email? If there's no response, then you have two choices: * request package maintainership, which will take several weeks * fork the package (i.e. upload your patched version to hackage under a different name) Roman -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: From svenpanne at gmail.com Thu May 15 09:18:09 2014 From: svenpanne at gmail.com (Sven Panne) Date: Thu, 15 May 2014 11:18:09 +0200 Subject: [Haskell-cafe] possible bug in latest hackage Elf (Elf-0.27) In-Reply-To: <20140515073052.GA23472@sniper> References: <20140515073052.GA23472@sniper> Message-ID: 2014-05-15 9:30 GMT+02:00 Roman Cheplyaka : > If there's no response, then you have two choices: Actually three: Fix things locally until the "official" package is fixed. > * request package maintainership, which will take several weeks I really hope that this will take months, not weeks, see the other discussion > * fork the package (i.e. upload your patched version to hackage under a > different name) This proposal worries me quite a bit, because if everybody follows that advice, it will turn Hackage into a chaotic collection of packages with various degrees of being fixed/maintained/etc. Imagine a package 'foo', which needs a fix, and several pepole think it's a good idea to fork and fix the issue at hand. Now we have 'foo', 'foo-XY', 'foo-my-cool-acronym', ... Of course people normally have no incentive to really take over maintainership for 'foo', they just want a working 'foo' right now for their own project. Later the real maintainer re-appears after vacation/sabbatical/whatever, fixes 'foo', and continues to work on it, adding new features. Now somebody new comes to Hackage to see if there is already a package for some use case, and finds 'foo', 'foo-XY', 'foo-my-cool-acronym', ... Then it takes some non-trivial detective work to find out which packages are actually dead (again) and which is the real one. => Chaos IMHO. In a nutshell: If you are really in a hurry, fix things locally. Hackage is not the place to fork like hell. From roma at ro-che.info Thu May 15 09:34:43 2014 From: roma at ro-che.info (Roman Cheplyaka) Date: Thu, 15 May 2014 12:34:43 +0300 Subject: [Haskell-cafe] possible bug in latest hackage Elf (Elf-0.27) In-Reply-To: References: <20140515073052.GA23472@sniper> Message-ID: <20140515093443.GA26791@sniper> * Sven Panne [2014-05-15 11:18:09+0200] > 2014-05-15 9:30 GMT+02:00 Roman Cheplyaka : > > If there's no response, then you have two choices: > > Actually three: Fix things locally until the "official" package is fixed. It works when you are the end user. If you maintain an open source project that depends on a package that happened to break or otherwise have bugs, you can't tell your users to download and fix all those broken packages. Users rightly expect they should be able just `cabal install` the project (if it's well maintained). So if the package is not fixed on package promptly, forking remains the only option. > > * request package maintainership, which will take several weeks > > I really hope that this will take months, not weeks, see the other discussion I find it funny how you argue against forking, yet propose to create an even stronger incentive to fork. > > * fork the package (i.e. upload your patched version to hackage under a > > different name) > > This proposal worries me quite a bit, because if everybody follows > that advice, it will turn Hackage into a chaotic collection of > packages with various degrees of being fixed/maintained/etc. Imagine a > package 'foo', which needs a fix, and several pepole think it's a good > idea to fork and fix the issue at hand. Now we have 'foo', 'foo-XY', > 'foo-my-cool-acronym', ... Of course people normally have no incentive > to really take over maintainership for 'foo', they just want a working > 'foo' right now for their own project. Later the real maintainer > re-appears after vacation/sabbatical/whatever, fixes 'foo', and > continues to work on it, adding new features. Now somebody new comes > to Hackage to see if there is already a package for some use case, and > finds 'foo', 'foo-XY', 'foo-my-cool-acronym', ... Then it takes some > non-trivial detective work to find out which packages are actually > dead (again) and which is the real one. => Chaos IMHO. > > In a nutshell: If you are really in a hurry, fix things locally. > Hackage is not the place to fork like hell. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: From publicityifl at gmail.com Thu May 15 09:56:10 2014 From: publicityifl at gmail.com (publicityifl at gmail.com) Date: Thu, 15 May 2014 02:56:10 -0700 (PDT) Subject: [Haskell-cafe] First call for papers IFL 2014 Message-ID: <53748f3a.48ae0e0a.17e2.34d8@mx.google.com> Hello, Please, find below the first call for papers for IFL 2014. Please forward these to anyone you think may be interested. Apologies for any duplicates you may receive. best regards, Jurriaan Hage Publicity Chair of IFL --- CALL FOR PAPERS 26th SYMPOSIUM ON IMPLEMENTATION AND APPLICATION OF FUNCTIONAL LANGUAGES - IFL 2014 NORTHEASTERN UNIVERSITY/BOSTON, USA OCTOBER 1-3, 2014 http://ifl2014.github.io We are pleased to announce that the 26th edition of the IFL series will be held at Northeastern University in Boston, USA. The symposium will be held from 1st to 3rd of October 2014. Scope ----- The goal of the IFL symposia is to bring together researchers actively engaged in the implementation and application of functional and function-based programming languages. IFL 2014 will be a venue for researchers to present and discuss new ideas and concepts, work in progress, and publication-ripe results related to the implementation and application of functional languages and function-based programming. Following the IFL tradition, IFL 2014 will use a post-symposium review process to produce the formal proceedings. All participants of IFL 2014 are invited to submit either a draft paper or an extended abstract describing work to be presented at the symposium. At no time may work submitted to IFL be simultaneously submitted to other venues; submissions must adhere to ACM SIGPLAN's republication policy: http://www.sigplan.org/Resources/Policies/Republication The submissions will be screened by the program committee chair to make sure they are within the scope of IFL, and will appear in the draft proceedings distributed at the symposium. Submissions appearing in the draft proceedings are not peer-reviewed publications. Hence, publications that appear only in the draft proceedings do not count as publication for the ACM SIGPLAN republication policy. After the symposium, authors will be given the opportunity to incorporate the feedback from discussions at the symposium and will be invited to submit a revised full article for the formal review process. From the revised submissions, the program committee will select papers for the formal proceedings considering their correctness, novelty, originality, relevance, significance, and clarity. Submission Details ------------------ Submission deadline draft papers: September 1 Notification of acceptance for presentation: September 5 Early registration deadline: September 10 Late registration deadline: September 17 Submission deadline for pre-symposium proceedings: September 24 26th IFL Symposium: October 1-3 Submission deadline for post-symposium proceedings: December 15 Notification of acceptance for post-symposium proceedings: January 31 2015 Camera-ready version for post-symposium proceedings: March 15 2015 Prospective authors are encouraged to submit papers or extended abstracts to be published in the draft proceedings and to present them at the symposium. All contributions must be written in English. Papers must adhere to the standard ACM two columns conference format. For the pre-symposium proceedings we adopt a 'weak' page limit of 12 pages. For the post-symposium proceedings the page limit of 12 pages is firm. A suitable document template for LaTeX can be found at: http://www.acm.org/sigs/sigplan/authorInformation.htm Topics ------ IFL welcomes submissions describing practical and theoretical work as well as submissions describing applications and tools in the context of functional programming. If you are not sure whether your work is appropriate for IFL 2014, please contact the PC chair at samth at cs.indiana.edu. Topics of interest include, but are not limited to: - language concepts - type systems, type checking, type inferencing - compilation techniques - staged compilation - run-time function specialization - run-time code generation - partial evaluation - (abstract) interpretation - metaprogramming - generic programming - automatic program generation - array processing - concurrent/parallel programming - concurrent/parallel program execution - embedded systems - web applications - (embedded) domain specific languages - security - novel memory management techniques - run-time profiling performance measurements - debugging and tracing - virtual/abstract machine architectures - validation, verification of functional programs - tools and programming techniques - (industrial) applications Peter Landin Prize ------------------ The Peter Landin Prize is awarded to the best paper presented at the symposium every year. The honoured article is selected by the program committee based on the submissions received for the formal review process. The prize carries a cash award equivalent to 150 Euros. Programme committee ------------------- Sam Tobin-Hochstadt, Indiana University (Chair) Rinus Plasmeijer, Radboud University Nijmegen (Co-Chair) Atze Dijkstra, Utrecht University Colin Runciman, University of York Graham Hutton, University of Nottingham Mary Sheeran, Chalmers University of Technology Patricia Johann, Appalachian State University Matthew Fluet, Rochester Institute of Technology Josef Svenningsson, Chalmers University of Technology Malgorzata Biernacka, University of Wroclaw Peter Achten, Radboud Univerity Nijmegen Laura Castro, University of A Coru?a Hai Paul Liu, Intel Labs Kathryn Gray, Cambridge University Lars Bergstrom, Mozilla Research Lindsey Kuper, Indiana University Nicolas Wu, Oxford T. Stephen Strickland, University of Maryland Xavier Clerc, INRIA Venue ----- The 26th IFL will be held in association with the College of Computer and Information Science at Northeastern University. It can be reached quickly and easily by public transport. From carlo at carlo-hamalainen.net Thu May 15 11:01:55 2014 From: carlo at carlo-hamalainen.net (Carlo Hamalainen) Date: Thu, 15 May 2014 11:01:55 +0000 Subject: [Haskell-cafe] Get "cabal repl" to dump ghc options? In-Reply-To: <87zjikadrw.fsf@gnu.org> References: <00000145f939c585-6d2b22c8-876b-49f4-86e7-6c67f942aedd-000000@email.amazonses.com> <87zjikadrw.fsf@gnu.org> Message-ID: <00000145ff8bad19-958f4864-0475-45b2-9cdd-f3c0e6dbba72-000000@email.amazonses.com> On 14/05/14 11:52, Herbert Valerio Riedel wrote: > Here's a hack I sometimes use to that effect: create a script > 'fakeghc.sh' with the following contents (or a similiar program): > > ,---- > | #!/bin/sh > | > | case "$1" in > | --interactive) > | echo "$*" > | exit > | ;; > | esac > | > | exec ghc $* > `---- > > and then invoke cabal like so > > | cabal repl --with-ghc=./fakeghci.sh Thanks, I think that this will be useful for my needs. -- Carlo Hamalainen http://carlo-hamalainen.net From markus.l2ll at gmail.com Thu May 15 11:54:12 2014 From: markus.l2ll at gmail.com (=?UTF-8?B?TWFya3VzIEzDpGxs?=) Date: Thu, 15 May 2014 13:54:12 +0200 Subject: [Haskell-cafe] make "cabal repl" run a custom preprocessor before loading Message-ID: Hi Cafe, I'm wondering how to run a custom preprocessor with "cabal repl"? The case is that I have a package with an executable and a library. The executable works fine with "ghc-options: -F -pgmF ./xxx.sh" in its cabal config section, but the library seems to ignore it when I put the same line into the library's section and then run "cabal repl". Also, the substitutions didn't happen when running GHC directly with -F and -pgmF in expression mode (-e). -- Markus L?ll -------------- next part -------------- An HTML attachment was scrubbed... URL: From johan.tibell at gmail.com Thu May 15 11:59:21 2014 From: johan.tibell at gmail.com (Johan Tibell) Date: Thu, 15 May 2014 13:59:21 +0200 Subject: [Haskell-cafe] make "cabal repl" run a custom preprocessor before loading In-Reply-To: References: Message-ID: Hi Markus, On Thu, May 15, 2014 at 1:54 PM, Markus L?ll wrote: > The case is that I have a package with an executable and a library. The > executable works fine with "ghc-options: -F -pgmF ./xxx.sh" in its cabal > config section, but the library seems to ignore it when I put the same line > into the library's section and then run "cabal repl". Also, the > substitutions didn't happen when running GHC directly with -F and -pgmF in > expression mode (-e). > This is probably an oversight/limitation. Please file a bug at https://github.com/haskell/cabal/issues -- Johan -------------- next part -------------- An HTML attachment was scrubbed... URL: From markus.l2ll at gmail.com Thu May 15 11:59:48 2014 From: markus.l2ll at gmail.com (=?UTF-8?B?TWFya3VzIEzDpGxs?=) Date: Thu, 15 May 2014 13:59:48 +0200 Subject: [Haskell-cafe] make "cabal repl" run a custom preprocessor before loading In-Reply-To: References: Message-ID: So of course it does work after removing a typo in a test function! Ignore me.. On Thu, May 15, 2014 at 1:54 PM, Markus L?ll wrote: > Hi Cafe, > > I'm wondering how to run a custom preprocessor with "cabal repl"? > > The case is that I have a package with an executable and a library. The > executable works fine with "ghc-options: -F -pgmF ./xxx.sh" in its cabal > config section, but the library seems to ignore it when I put the same line > into the library's section and then run "cabal repl". Also, the > substitutions didn't happen when running GHC directly with -F and -pgmF in > expression mode (-e). > > -- > Markus L?ll > -- Markus L?ll -------------- next part -------------- An HTML attachment was scrubbed... URL: From sol at typeful.net Thu May 15 12:02:01 2014 From: sol at typeful.net (Simon Hengel) Date: Thu, 15 May 2014 20:02:01 +0800 Subject: [Haskell-cafe] make "cabal repl" run a custom preprocessor before loading In-Reply-To: References: Message-ID: <20140515120201.GB3126@x200> Hi, > I'm wondering how to run a custom preprocessor with "cabal repl"? You can try putting {-# OPTIONS_GHC -F -pgmF ... #-} at the top of your source file. That works fine for me with e.g. [1]. Cheers, Simon [1] https://github.com/sol/hspec-example/blob/master/test/Spec.hs From acowley at seas.upenn.edu Thu May 15 14:00:52 2014 From: acowley at seas.upenn.edu (Anthony Cowley) Date: Thu, 15 May 2014 10:00:52 -0400 Subject: [Haskell-cafe] possible bug in latest hackage Elf (Elf-0.27) In-Reply-To: References: <20140515073052.GA23472@sniper> Message-ID: > On May 15, 2014, at 5:18 AM, Sven Panne wrote: > > 2014-05-15 9:30 GMT+02:00 Roman Cheplyaka : >> If there's no response, then you have two choices: > > Actually three: Fix things locally until the "official" package is fixed. > >> * request package maintainership, which will take several weeks > > I really hope that this will take months, not weeks, see the other discussion > >> * fork the package (i.e. upload your patched version to hackage under a >> different name) > > This proposal worries me quite a bit, because if everybody follows > that advice, it will turn Hackage into a chaotic collection of > packages with various degrees of being fixed/maintained/etc. Imagine a > package 'foo', which needs a fix, and several pepole think it's a good > idea to fork and fix the issue at hand. Now we have 'foo', 'foo-XY', > 'foo-my-cool-acronym', ... Of course people normally have no incentive > to really take over maintainership for 'foo', they just want a working > 'foo' right now for their own project. Later the real maintainer > re-appears after vacation/sabbatical/whatever, fixes 'foo', and > continues to work on it, adding new features. Now somebody new comes > to Hackage to see if there is already a package for some use case, and > finds 'foo', 'foo-XY', 'foo-my-cool-acronym', ... Then it takes some > non-trivial detective work to find out which packages are actually > dead (again) and which is the real one. => Chaos IMHO. > > In a nutshell: If you are really in a hurry, fix things locally. > Hackage is not the place to fork like hell. But we do need a mechanism to deal with name expansion. Many of us would prefer to make package name usurpation a slow, forgiving process, but we should then contend with the fact that such a policy adds to the rate at which new packages are uploaded. If search results display, and can be sorted by, information regarding number of downloads, downloads in the last year, and latest upload date, we will be suggesting which of these variations a new user should consider. Pair this with a slow name reclaiming process, and we won't have to always consider perpetuity when coming up with package names. Preferably packages would also come with some sort of UUID independent of a user-friendly name so that they could exist on hackage without blocking new uses of a good name if one development has permanently stalled. Anthony From silvio.frischi at gmail.com Thu May 15 17:38:29 2014 From: silvio.frischi at gmail.com (silvio) Date: Thu, 15 May 2014 19:38:29 +0200 Subject: [Haskell-cafe] Object oriented haskell. Message-ID: <5374FB95.7030905@gmail.com> Hi Haskell, I've been wondering if (.) is so cool in other languages why can't we make it even cooler in haskell. And went on to implement such a (.) based on multiparameter type classes and type families. type family Output object action class Action object action where (.) :: object -> action -> Output object action I'm not sure if this has been done before like this but i didn't find anything. I used Map as an example, and here is what I ended up with: > :m -Prelude > import Prelude hiding ((.)) > import Object > import Object.Example > import Data.Map hiding (size) > let m = empty . [ 'f' := Just 1, 'o' := Just 2, 'o' := Nothing ] > m fromList [('f',Just 1),('o',Nothing)] > m . 'f' Just 1 > m . size 2 I also have a pretty cool (almost) solution to the name collision problem. Visit the project homepage for a more thorough explanation. https://github.com/yokto/object And to those who gonna hate on me because they like the (.) as function composition I have only this to say. type instance Output (b -> c) (a -> b') = (a -> c) instance (b ~ b') => Action (b -> c) (a -> b') where f . g = f Prelude.. g Have fun, Silvio From kyle.marek.spartz at gmail.com Thu May 15 17:44:32 2014 From: kyle.marek.spartz at gmail.com (Kyle Marek-Spartz) Date: Thu, 15 May 2014 12:44:32 -0500 Subject: [Haskell-cafe] Object oriented haskell. In-Reply-To: <5374FB95.7030905@gmail.com> References: <5374FB95.7030905@gmail.com> Message-ID: Recently, on LtU: http://lambda-the-ultimate.org/node/4951 Most relevantly: https://ghc.haskell.org/trac/ghc/wiki/Records/DeclaredOverloadedRecordFields/DotPostfix ? Kyle Marek-Spartz On May 15, 2014, 12:38:29 PM, silvio wrote: Hi Haskell, I've been wondering if (.) is so cool in other languages why can't we make it even cooler in haskell. And went on to implement such a (.) based on multiparameter type classes and type families. type family Output object action class Action object action where (.) :: object -> action -> Output object action I'm not sure if this has been done before like this but i didn't find anything. I used Map as an example, and here is what I ended up with: > :m -Prelude > import Prelude hiding ((.)) > import Object > import Object.Example > import Data.Map hiding (size) > let m = empty . [ 'f' := Just 1, 'o' := Just 2, 'o' := Nothing ] > m fromList [('f',Just 1),('o',Nothing)] > m . 'f' Just 1 > m . size 2 I also have a pretty cool (almost) solution to the name collision problem. Visit the project homepage for a more thorough explanation. https://github.com/yokto/object And to those who gonna hate on me because they like the (.) as function composition I have only this to say. type instance Output (b -> c) (a -> b') = (a -> c) instance (b ~ b') => Action (b -> c) (a -> b') where f . g = f Prelude.. g Have fun, Silvio _______________________________________________ Haskell-Cafe mailing list mailto:Haskell-Cafe at haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -------------- next part -------------- An HTML attachment was scrubbed... URL: From silvio.frischi at gmail.com Thu May 15 18:11:41 2014 From: silvio.frischi at gmail.com (silvio) Date: Thu, 15 May 2014 20:11:41 +0200 Subject: [Haskell-cafe] Object oriented haskell. In-Reply-To: References: <5374FB95.7030905@gmail.com> Message-ID: <5375035D.1000406@gmail.com> > relevantly: https://ghc.haskell.org/trac/ghc/wiki/Records/DeclaredOverloadedRecordFields/DotPostfix Ways in which I think my implementation is superior 1) in the proposal the thing behind the dot has to be a function. Therefore, you have to wrap everything in a function before you can use it. Something like this is not possible > [1,2,3] . 0 1 2) I'm not sure this proposal solves the name collision problem but that might just be that i don't understand it. 3) my library doesn't require any additional syntax only a few already existing extensions. And you can use a bit of template haskell to assist the creation of objects. 4) Also the proposal doesn't mention updates but if they have to be a function you cant use the same name as for the function to get a field. And you simply can't beat my syntax, in which you can use the same name for both. object . fieldName := value -- update object . fieldName -- get Silvio From davidleothomas at gmail.com Thu May 15 18:14:56 2014 From: davidleothomas at gmail.com (David Thomas) Date: Thu, 15 May 2014 11:14:56 -0700 Subject: [Haskell-cafe] Object oriented haskell. In-Reply-To: <5375035D.1000406@gmail.com> References: <5374FB95.7030905@gmail.com> <5375035D.1000406@gmail.com> Message-ID: One thing that is likely to be surprising is that (.) is right-associative, whereas in C it's left-associative. object . action . action would try to parse as object . (action . action) - which may or may not typecheck but is probably not what was intended. On Thu, May 15, 2014 at 11:11 AM, silvio wrote: >> relevantly: https://ghc.haskell.org/trac/ghc/wiki/Records/DeclaredOverloadedRecordFields/DotPostfix > > Ways in which I think my implementation is superior > > 1) in the proposal the thing behind the dot has to be a function. > Therefore, you have to wrap everything in a function before you can use > it. Something like this is not possible > >> [1,2,3] . 0 > 1 > > 2) I'm not sure this proposal solves the name collision problem but that > might just be that i don't understand it. > > 3) my library doesn't require any additional syntax only a few already > existing extensions. And you can use a bit of template haskell to assist > the creation of objects. > > 4) Also the proposal doesn't mention updates but if they have to be a > function you cant use the same name as for the function to get a field. > And you simply can't beat my syntax, in which you can use the same name > for both. > object . fieldName := value -- update > object . fieldName -- get > > Silvio > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From silvio.frischi at gmail.com Thu May 15 18:16:40 2014 From: silvio.frischi at gmail.com (silvio) Date: Thu, 15 May 2014 20:16:40 +0200 Subject: [Haskell-cafe] Object oriented haskell. In-Reply-To: References: <5374FB95.7030905@gmail.com> <5375035D.1000406@gmail.com> Message-ID: <53750488.5040709@gmail.com> you can specify the associativity using infix(l/r) expression silvio From nrujac at gmail.com Thu May 15 18:16:44 2014 From: nrujac at gmail.com (Arjun Comar) Date: Thu, 15 May 2014 14:16:44 -0400 Subject: [Haskell-cafe] Object oriented haskell. In-Reply-To: References: <5374FB95.7030905@gmail.com> Message-ID: How would setting/modification work in your scheme? This problem has been solved a couple of times within the Haskell community and you're most likely looking for a lens library. They make data accessors first class and a subset of them compose in a way that reads just like object oriented notation. For example, with `lens` you can do the following: data MyState = MyState { _person :: Person } data Person = Person { _pos :: (Int, Int) } makeLenses [''MyState, ''Person] (person.pos._1 += 1) :: State MyState () Notice that the lenses compose with (.), compose in the order you expect from OO programming (and opposite normal function composition -- though it's actually the same), and allow you to set (as well as view). The `lens` package also provides these lenses for most of base along with many other useful tools for this kind of programming (notice _1 that acts as an accessor into a tuple). On Thu, May 15, 2014 at 1:44 PM, Kyle Marek-Spartz < kyle.marek.spartz at gmail.com> wrote: > Recently, on LtU: http://lambda-the-ultimate.org/node/4951 > > Most relevantly: > https://ghc.haskell.org/trac/ghc/wiki/Records/DeclaredOverloadedRecordFields/DotPostfix > > ? > Kyle Marek-Spartz > > > > On May 15, 2014, 12:38:29 PM, silvio wrote: > ------------------------------ > > Hi Haskell, > > I've been wondering if (.) is so cool in other languages why can't we > make it even cooler in haskell. And went on to implement such a (.) > based on multiparameter type classes and type families. > > type family Output object action > class Action object action where > (.) :: object -> action -> Output object action > > I'm not sure if this has been done before like this but i didn't find > anything. > I used Map as an example, and here is what I ended up with: > > > :m -Prelude > > import Prelude hiding ((.)) > > import Object > > import Object.Example > > import Data.Map hiding (size) > > let m = empty . [ 'f' := Just 1, 'o' := Just 2, 'o' := Nothing ] > > m > fromList [('f',Just 1),('o',Nothing)] > > m . 'f' > Just 1 > > m . size > 2 > > I also have a pretty cool (almost) solution to the name collision problem. > > Visit the project homepage for a more thorough explanation. > > https://github.com/yokto/object > > And to those who gonna hate on me because they like the (.) as function > composition I have only this to say. > > type instance Output (b -> c) (a -> b') = (a -> c) > instance (b ~ b') => Action (b -> c) (a -> b') where > f . g = f Prelude.. g > > > Have fun, > > Silvio > _______________________________________________ > Haskell-Cafe mailing list > mailto:Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From silvio.frischi at gmail.com Thu May 15 18:30:20 2014 From: silvio.frischi at gmail.com (silvio) Date: Thu, 15 May 2014 20:30:20 +0200 Subject: [Haskell-cafe] Object oriented haskell. In-Reply-To: References: <5374FB95.7030905@gmail.com> Message-ID: <537507BC.4040608@gmail.com> Yes I know lenses do something similar. But they are restricted to lenses in the same way the other proposal is restricted to functions you couldn't write >[1,2,3] . 0 1 and also I don't think they solve the name collision problem either. silvio From benno.fuenfstueck at gmail.com Thu May 15 18:31:56 2014 From: benno.fuenfstueck at gmail.com (=?UTF-8?B?QmVubm8gRsO8bmZzdMO8Y2s=?=) Date: Thu, 15 May 2014 20:31:56 +0200 Subject: [Haskell-cafe] Object oriented haskell. In-Reply-To: <537507BC.4040608@gmail.com> References: <5374FB95.7030905@gmail.com> <537507BC.4040608@gmail.com> Message-ID: With lens, you can write: > [1,2,3] ^?! ix 0 1 Not that much of a difference, IMO. 2014-05-15 20:30 GMT+02:00 silvio : > Yes I know lenses do something similar. But they are restricted to > lenses in the same way the other proposal is restricted to functions you > couldn't write > > >[1,2,3] . 0 > 1 > > and also I don't think they solve the name collision problem either. > > silvio > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From alexander at plaimi.net Thu May 15 19:01:34 2014 From: alexander at plaimi.net (Alexander Berntsen) Date: Thu, 15 May 2014 21:01:34 +0200 Subject: [Haskell-cafe] Object oriented haskell. In-Reply-To: <5374FB95.7030905@gmail.com> References: <5374FB95.7030905@gmail.com> Message-ID: <53750F0E.7030208@plaimi.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 For true object-oriented Haskell, read ?Haskell's overlooked object system? by Oleg Kiselyov and Ralf L?mmel. - -- Alexander alexander at plaimi.net https://secure.plaimi.net/~alexander -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iF4EAREIAAYFAlN1Dw4ACgkQRtClrXBQc7Wc7AD+My9i1FVzCaDuprLilD9zGhRK rNaUaJNffs9FYc1BeMcBAJplpwN/nH9AjGl2SunrS8+lfbahGhsA+AYqJKIf/Qqg =2SWo -----END PGP SIGNATURE----- From allbery.b at gmail.com Thu May 15 19:06:27 2014 From: allbery.b at gmail.com (Brandon Allbery) Date: Thu, 15 May 2014 15:06:27 -0400 Subject: [Haskell-cafe] Object oriented haskell. In-Reply-To: <53750488.5040709@gmail.com> References: <5374FB95.7030905@gmail.com> <5375035D.1000406@gmail.com> <53750488.5040709@gmail.com> Message-ID: On Thu, May 15, 2014 at 2:16 PM, silvio wrote: > you can specify the associativity using infix(l/r) expression Which will break almost all existing code in order to enable something that is dubious at best given how much . is already overloaded. And gains you nothing in the way of "object oriented" as cited in your subject line --- . is the *least* of the issues involved with OO, and is used in the way you want by non-OO languages. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From vogt.adam at gmail.com Thu May 15 19:17:58 2014 From: vogt.adam at gmail.com (adam vogt) Date: Thu, 15 May 2014 15:17:58 -0400 Subject: [Haskell-cafe] Object oriented haskell. In-Reply-To: <5374FB95.7030905@gmail.com> References: <5374FB95.7030905@gmail.com> Message-ID: Hi Silvio, Somebody can still hate on your: instance (b ~ b') => Action (b -> c) (a -> b') With standard haskell we can write: >>> (read . show) (1 :: Int) :: Double 1.0 But with your '.', that's a type error: Couldn't match expected type ?Int -> Double? with actual type ?Output (String -> a0) (a1 -> String)? The type variables ?a0?, ?a1? are ambiguous I can't come up with a type annotation that makes it work out. Type inference can work out better when you have something like: class Dot a b c where (.) :: a -> b -> c instance (f ~ (b -> c), g ~ (a -> b), fg ~ (a -> c)) => Dot f g fg -- "fallback" instance is what Prelude does But composing functions overloaded like this tends to need type annotations because ghc does not allow inferring type signatures that contain ambiguous types. Also I have a couple suggestions for your code: Instead of `lookupTypeName "Object.Types.MethodOutput" *> fromMaybe (error "no MethodOutput in scope")', you probably should just refer to the actual Name ''MethodOutput. The "no MethodOutput in scope" didn't prompt me to add an "import Object.Types". I'm not sure you are expecting people to substitute their own MethodOutput (by import qualified MyModule as Object.Types (MethodOutput)). Instead of Object.Letters, you can use promoted strings (GHC.TypeLits.Symbol)? Those look prettier, and you're already stuck with ghc given the other extensions you use (TypeFamilies, PolyKinds, TemplateHaskell). Regards, Adam On Thu, May 15, 2014 at 1:38 PM, silvio wrote: > Hi Haskell, > > I've been wondering if (.) is so cool in other languages why can't we > make it even cooler in haskell. And went on to implement such a (.) > based on multiparameter type classes and type families. > > type family Output object action > class Action object action where > (.) :: object -> action -> Output object action > > I'm not sure if this has been done before like this but i didn't find > anything. > I used Map as an example, and here is what I ended up with: > >> :m -Prelude >> import Prelude hiding ((.)) >> import Object >> import Object.Example >> import Data.Map hiding (size) >> let m = empty . [ 'f' := Just 1, 'o' := Just 2, 'o' := Nothing ] >> m > fromList [('f',Just 1),('o',Nothing)] >> m . 'f' > Just 1 >> m . size > 2 > > I also have a pretty cool (almost) solution to the name collision problem. > > Visit the project homepage for a more thorough explanation. > > https://github.com/yokto/object > > And to those who gonna hate on me because they like the (.) as function > composition I have only this to say. > > type instance Output (b -> c) (a -> b') = (a -> c) > instance (b ~ b') => Action (b -> c) (a -> b') where > f . g = f Prelude.. g > > > Have fun, > > Silvio > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From silvio.frischi at gmail.com Thu May 15 19:22:37 2014 From: silvio.frischi at gmail.com (silvio) Date: Thu, 15 May 2014 21:22:37 +0200 Subject: [Haskell-cafe] Object oriented haskell. In-Reply-To: References: <5374FB95.7030905@gmail.com> Message-ID: <537513FD.6080907@gmail.com> >>>> (read . show) 1 :: Double > 1.0 actually that example works fine for me are you sure you copied it right. I.e. that you have b and b' both in both instances. silvio From vogt.adam at gmail.com Thu May 15 19:38:48 2014 From: vogt.adam at gmail.com (adam vogt) Date: Thu, 15 May 2014 15:38:48 -0400 Subject: [Haskell-cafe] Object oriented haskell. In-Reply-To: <537513FD.6080907@gmail.com> References: <5374FB95.7030905@gmail.com> <537513FD.6080907@gmail.com> Message-ID: Thanks it works. I tried it in Example.lhs, which does not import the instance from Object.hs. On Thu, May 15, 2014 at 3:22 PM, silvio wrote: >>>>> (read . show) 1 :: Double >> 1.0 > > actually that example works fine for me are you sure you copied it > right. I.e. that you have b and b' both in both instances. > > silvio From agocorona at gmail.com Thu May 15 20:17:33 2014 From: agocorona at gmail.com (Alberto G. Corona ) Date: Thu, 15 May 2014 22:17:33 +0200 Subject: [Haskell-cafe] Object oriented haskell. In-Reply-To: <53750F0E.7030208@plaimi.net> References: <5374FB95.7030905@gmail.com> <53750F0E.7030208@plaimi.net> Message-ID: 2014-05-15 21:01 GMT+02:00, Alexander Berntsen : > > For true object-oriented Haskell, read ?Haskell's overlooked object > system? by Oleg Kiselyov and Ralf L?mmel. > Which is an excellent haskell framework for OO programming in haskell but desperately need some kind of syntactic sugar to attract the OO peple. In the goal of making Haskell mainstream, it would be definitive to make haskell the best OO language besides the best imperative one. It is a matter of a bit of effort by some people to come up with an elegant notation for the ideas of this paper. > - -- > Alexander > alexander at plaimi.net > https://secure.plaimi.net/~alexander > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v2.0.22 (GNU/Linux) > Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ > > iF4EAREIAAYFAlN1Dw4ACgkQRtClrXBQc7Wc7AD+My9i1FVzCaDuprLilD9zGhRK > rNaUaJNffs9FYc1BeMcBAJplpwN/nH9AjGl2SunrS8+lfbahGhsA+AYqJKIf/Qqg > =2SWo > -----END PGP SIGNATURE----- > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -- Alberto. From miguelimo38 at yandex.ru Thu May 15 20:19:19 2014 From: miguelimo38 at yandex.ru (MigMit) Date: Fri, 16 May 2014 00:19:19 +0400 Subject: [Haskell-cafe] Object oriented haskell. In-Reply-To: References: <5374FB95.7030905@gmail.com> <53750F0E.7030208@plaimi.net> Message-ID: On 16 May 2014, at 00:17, Alberto G. Corona wrote: > 2014-05-15 21:01 GMT+02:00, Alexander Berntsen : > >> >> For true object-oriented Haskell, read ?Haskell's overlooked object >> system? by Oleg Kiselyov and Ralf L?mmel. >> > > Which is an excellent haskell framework for OO programming in > haskell but desperately need some kind of syntactic sugar to > attract the OO peple. Seems to me that FP people also need some encouragement. > > In the goal of making Haskell mainstream, it would be definitive > to make haskell the best OO language besides the best imperative > one. > > It is a matter of a bit of effort by some people to come up with > an elegant notation for the ideas of this paper. > >> - -- >> Alexander >> alexander at plaimi.net >> https://secure.plaimi.net/~alexander >> -----BEGIN PGP SIGNATURE----- >> Version: GnuPG v2.0.22 (GNU/Linux) >> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ >> >> iF4EAREIAAYFAlN1Dw4ACgkQRtClrXBQc7Wc7AD+My9i1FVzCaDuprLilD9zGhRK >> rNaUaJNffs9FYc1BeMcBAJplpwN/nH9AjGl2SunrS8+lfbahGhsA+AYqJKIf/Qqg >> =2SWo >> -----END PGP SIGNATURE----- >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> > > > -- > Alberto. > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From alexander at plaimi.net Thu May 15 20:21:11 2014 From: alexander at plaimi.net (Alexander Berntsen) Date: Thu, 15 May 2014 22:21:11 +0200 Subject: [Haskell-cafe] Object oriented haskell. In-Reply-To: References: <5374FB95.7030905@gmail.com> <53750F0E.7030208@plaimi.net> Message-ID: <537521B7.6070707@plaimi.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 On 15/05/14 22:17, Alberto G. Corona wrote: > Which is an excellent haskell framework for OO programming in > haskell but desperately need some kind of syntactic sugar to > attract the OO peple. I hate the examples in that paper with every fibre of my being. Every single cell in my body screams "THIS IS WRONG". Yet, I am in awe of them. Recommended read! It's very interesting. - -- Alexander alexander at plaimi.net https://secure.plaimi.net/~alexander -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iF4EAREIAAYFAlN1IbcACgkQRtClrXBQc7VqCwEAqEgEbQ+eqoZwf4KQxzrvmRtk yhMsaOUwi8YYJiAZa4kA/3YY4tz/tFWI5zpNGTxtbD1K5ifq9V/pO6X+4pKSOO38 =ruyQ -----END PGP SIGNATURE----- From hesselink at gmail.com Thu May 15 20:22:10 2014 From: hesselink at gmail.com (Erik Hesselink) Date: Thu, 15 May 2014 22:22:10 +0200 Subject: [Haskell-cafe] Object oriented haskell. In-Reply-To: References: <5374FB95.7030905@gmail.com> <53750F0E.7030208@plaimi.net> Message-ID: On Thu, May 15, 2014 at 10:17 PM, Alberto G. Corona wrote: > 2014-05-15 21:01 GMT+02:00, Alexander Berntsen : >> >> For true object-oriented Haskell, read ?Haskell's overlooked object >> system? by Oleg Kiselyov and Ralf L?mmel. > > Which is an excellent haskell framework for OO programming in > haskell but desperately need some kind of syntactic sugar to > attract the OO peple. > > In the goal of making Haskell mainstream, it would be definitive > to make haskell the best OO language besides the best imperative > one. I thought the goal was *not* to make Haskell mainstream? Avoid success at all costs, and all that. Erik From silvio.frischi at gmail.com Thu May 15 21:12:10 2014 From: silvio.frischi at gmail.com (silvio) Date: Thu, 15 May 2014 23:12:10 +0200 Subject: [Haskell-cafe] Object oriented haskell. In-Reply-To: References: <5374FB95.7030905@gmail.com> <53750F0E.7030208@plaimi.net> Message-ID: <53752DAA.4000807@gmail.com> I read over the first few example and it does not collide with my library. In fact, It could benefit from my library. From both (.) as well as the label construction. Actually I didn't get how they make the labels (getX). type instance Output (a .*. b) label = OOOutput (a .*. b) label type family OOOutput where OOOutput (label .=. out .*. rest) label = out OOOutput (noMatch .*. rest) label = OOOutput rest label instance Action (label .=. out .*. rest) label where (_ .=. action .*. _) . _ = action instance Action (noMatch .*. rest) label where (_ .*. rest) . b = rest . b I didn't compile this since i didn't have their code so there are probably some errors. Also I assumed their .*. are typeOperators even though they don't start with a :. But the idea should be clear. silvio From magnus at therning.org Thu May 15 21:22:46 2014 From: magnus at therning.org (Magnus Therning) Date: Thu, 15 May 2014 23:22:46 +0200 Subject: [Haskell-cafe] Object oriented haskell. In-Reply-To: <5374FB95.7030905@gmail.com> References: <5374FB95.7030905@gmail.com> Message-ID: <20140515212246.GB6176@tatooine.lan> On Thu, May 15, 2014 at 07:38:29PM +0200, silvio wrote: > Hi Haskell, > > I've been wondering if (.) is so cool in other languages why can't > we make it even cooler in haskell. And went on to implement such a > (.) based on multiparameter type classes and type families. In what languages is (.) cool, and in what way? -- Magnus Therning OpenPGP: 0xAB4DFBA4 email: magnus at therning.org jabber: magnus at therning.org twitter: magthe http://therning.org/magnus In a hierarchy, every employee tends to rise to his level of incompetence. -- The Peter Principle -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From silvio.frischi at gmail.com Thu May 15 21:37:40 2014 From: silvio.frischi at gmail.com (silvio) Date: Thu, 15 May 2014 23:37:40 +0200 Subject: [Haskell-cafe] Object oriented haskell. In-Reply-To: <20140515212246.GB6176@tatooine.lan> References: <5374FB95.7030905@gmail.com> <20140515212246.GB6176@tatooine.lan> Message-ID: <537533A4.6020400@gmail.com> > In what languages is (.) cool, and in what way? Because depending on what is before it, what is behind it can have different meanings. For me this is one of the main points. I just don't like the name collision problem in Haskell. Take something like size for instance it is pretty clear what it means yet unless you have a type class that everybody knows about you can use it on only one thing. And even if you have a simple type class some object might want to return an Int and some other might want to return an Integer. With (.) being from a multiparameter typeclass you can define for each object what it means without any of them knowing about the others. And you are not even limited to, let's call them, 'labels' like size. You can also use any other Type you want like the key of a database object or as in my example a Map. Silvio From magnus at therning.org Thu May 15 22:32:44 2014 From: magnus at therning.org (Magnus Therning) Date: Fri, 16 May 2014 00:32:44 +0200 Subject: [Haskell-cafe] Object oriented haskell. In-Reply-To: <537533A4.6020400@gmail.com> References: <5374FB95.7030905@gmail.com> <20140515212246.GB6176@tatooine.lan> <537533A4.6020400@gmail.com> Message-ID: <20140515223244.GF6176@tatooine.lan> On Thu, May 15, 2014 at 11:37:40PM +0200, silvio wrote: >> In what languages is (.) cool, and in what way? > > Because depending on what is before it, what is behind it can have > different meanings. For me this is one of the main points. I just > don't like the name collision problem in Haskell. Take something > like size for instance it is pretty clear what it means yet unless > you have a type class that everybody knows about you can use it on > only one thing. And even if you have a simple type class some object > might want to return an Int and some other might want to return an > Integer. With (.) being from a multiparameter typeclass you can > define for each object what it means without any of them knowing > about the others. And you are not even limited to, let's call them, > 'labels' like size. You can also use any other Type you want like > the key of a database object or as in my example a Map. So, slightly simplified you want to: Firstly, a notation where you put the first argument before the function/method? [1,2,3] . length -> 3 Secondly, mimic the multilayered namespaces that is commonly found in mainstream imperative OO languages? [1,2,3] . length -> 3::Int aPieceOfString . length -> 120.0::Double Just trying to understand what problem you are actually trying to solve. I've *never* thought of (.) being powerful in OO languages, mostly because I don't really think the dot is what makes an OO language. /M -- Magnus Therning OpenPGP: 0xAB4DFBA4 email: magnus at therning.org jabber: magnus at therning.org twitter: magthe http://therning.org/magnus What gets measured, gets done. -- Tom Peters -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From silvio.frischi at gmail.com Thu May 15 22:47:40 2014 From: silvio.frischi at gmail.com (silvio) Date: Fri, 16 May 2014 00:47:40 +0200 Subject: [Haskell-cafe] Object oriented haskell. In-Reply-To: <20140515223244.GF6176@tatooine.lan> References: <5374FB95.7030905@gmail.com> <20140515212246.GB6176@tatooine.lan> <537533A4.6020400@gmail.com> <20140515223244.GF6176@tatooine.lan> Message-ID: <5375440C.8050801@gmail.com> > Firstly, a notation where you put the first argument before the > function/method? > > [1,2,3] . length -> 3 > > Secondly, mimic the multilayered namespaces that is commonly found in > mainstream imperative OO languages? > > [1,2,3] . length -> 3::Int > aPieceOfString . length -> 120.0::Double > > Just trying to understand what problem you are actually trying to > solve. I've *never* thought of (.) being powerful in OO languages, > mostly because I don't really think the dot is what makes an OO > language. That's essentially it. I see that people on this thread where thinking more along the lines of inheritance. So let me add that it shouldn't be difficult to add the instances you want for your child object and then make a default instance which reverts to the parent object. It's a bit of a problem for updating stuff in a functional way since you can never be sure if a method is ment to return an object or if this is supposed to be an update. But for things in IO/STM/... it should be fine. Silvio From magnus at therning.org Thu May 15 22:57:49 2014 From: magnus at therning.org (Magnus Therning) Date: Fri, 16 May 2014 00:57:49 +0200 Subject: [Haskell-cafe] Object oriented haskell. In-Reply-To: <5375440C.8050801@gmail.com> References: <5374FB95.7030905@gmail.com> <20140515212246.GB6176@tatooine.lan> <537533A4.6020400@gmail.com> <20140515223244.GF6176@tatooine.lan> <5375440C.8050801@gmail.com> Message-ID: <20140515225749.GI6176@tatooine.lan> On Fri, May 16, 2014 at 12:47:40AM +0200, silvio wrote: >> Firstly, a notation where you put the first argument before the >> function/method? >> >> [1,2,3] . length -> 3 >> >> Secondly, mimic the multilayered namespaces that is commonly found >> in mainstream imperative OO languages? >> >> [1,2,3] . length -> 3::Int >> aPieceOfString . length -> 120.0::Double >> >> Just trying to understand what problem you are actually trying to >> solve. I've *never* thought of (.) being powerful in OO languages, >> mostly because I don't really think the dot is what makes an OO >> language. > > That's essentially it. I see that people on this thread where > thinking more along the lines of inheritance. So let me add that it > shouldn't be difficult to add the instances you want for your child > object and then make a default instance which reverts to the parent > object. It's a bit of a problem for updating stuff in a functional > way since you can never be sure if a method is ment to return an > object or if this is supposed to be an update. But for things in > IO/STM/... it should be fine. Excellent, then at least understand what you are after. I was confused by the ensuing discussion, because it so quickly moved away from what I thought you were really proposing. To be honest I've more often missed Haskell's (.) when programming in C/C++/C# than the other way around ;) /M -- Magnus Therning OpenPGP: 0xAB4DFBA4 email: magnus at therning.org jabber: magnus at therning.org twitter: magthe http://therning.org/magnus I invented the term Object-Oriented, and I can tell you I did not have C++ in mind. -- Alan Kay -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From ok at cs.otago.ac.nz Thu May 15 23:00:25 2014 From: ok at cs.otago.ac.nz (Richard A. O'Keefe) Date: Fri, 16 May 2014 11:00:25 +1200 Subject: [Haskell-cafe] Object oriented haskell. In-Reply-To: References: <5374FB95.7030905@gmail.com> <53750F0E.7030208@plaimi.net> Message-ID: On 16/05/2014, at 8:17 AM, Alberto G. Corona wrote: > Which is an excellent haskell framework for OO programming in > haskell but desperately need some kind of syntactic sugar to > attract the OO peple. Do we *want* to attract them? Why? > > In the goal of making Haskell mainstream, it would be definitive > to make haskell the best OO language besides the best imperative > one. To make Haskell "mainstream", you have to make it just like conventional C-family languages, only maybe 1% different. The whole *POINT* of Haskell is to facilitate a whole different way of thinking about programming. The more you make it resemble "mainstream" languages in order to encourage "the OO peple" to adopt it, the less benefit they will get from doing so. If you just wait a bit, Java 28 will probably have monads and lenses. From samcaldwell at utexas.edu Thu May 15 23:03:18 2014 From: samcaldwell at utexas.edu (Sam Caldwell) Date: Thu, 15 May 2014 18:03:18 -0500 Subject: [Haskell-cafe] Object oriented haskell. In-Reply-To: References: <5374FB95.7030905@gmail.com> <53750F0E.7030208@plaimi.net> Message-ID: http://bartoszmilewski.com/2014/02/26/c17-i-see-a-monad-in-your-future/ On Thu, May 15, 2014 at 6:00 PM, Richard A. O'Keefe wrote: > > On 16/05/2014, at 8:17 AM, Alberto G. Corona wrote: > > > Which is an excellent haskell framework for OO programming in > > haskell but desperately need some kind of syntactic sugar to > > attract the OO peple. > > Do we *want* to attract them? Why? > > > > In the goal of making Haskell mainstream, it would be definitive > > to make haskell the best OO language besides the best imperative > > one. > > To make Haskell "mainstream", you have to make it just like > conventional C-family languages, only maybe 1% different. > > The whole *POINT* of Haskell is to facilitate a whole different > way of thinking about programming. > > The more you make it resemble "mainstream" languages in order > to encourage "the OO peple" to adopt it, the less benefit they > will get from doing so. > > If you just wait a bit, Java 28 will probably have monads and lenses. > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vogt.adam at gmail.com Thu May 15 23:06:15 2014 From: vogt.adam at gmail.com (adam vogt) Date: Thu, 15 May 2014 19:06:15 -0400 Subject: [Haskell-cafe] Object oriented haskell. In-Reply-To: <53752DAA.4000807@gmail.com> References: <5374FB95.7030905@gmail.com> <53750F0E.7030208@plaimi.net> <53752DAA.4000807@gmail.com> Message-ID: Hi Silvio, .*. has always been a function. http://hackage.haskell.org/package/HList-0.3.4.1/docs/Data-HList-HListPrelude.html#t:HExtend is the current definition. The operations for lookup/update etc. need to be rewritten to use closed type families as you did for lookup, since GHC doesn't allow type families to use type classes. If it did, then we could do the following: instance (HasField l (Record r) v, Output (Record r) (Label l) ~ v) => Action (Record r) (Label l) where (.) = flip hLookupByLabel type instance Output (Record r) (Label l) = (HasField l (Record r) v) => v -- not allowed Regards, Adam On Thu, May 15, 2014 at 5:12 PM, silvio wrote: > I read over the first few example and it does not collide with my > library. In fact, It could benefit from my library. From both (.) as > well as the label construction. Actually I didn't get how they make the > labels (getX). > > type instance Output (a .*. b) label = OOOutput (a .*. b) label > type family OOOutput where > OOOutput (label .=. out .*. rest) label = out > OOOutput (noMatch .*. rest) label = OOOutput rest label > instance Action (label .=. out .*. rest) label where > (_ .=. action .*. _) . _ = action > instance Action (noMatch .*. rest) label where > (_ .*. rest) . b = rest . b > > I didn't compile this since i didn't have their code so there are > probably some errors. Also I assumed their .*. are typeOperators even > though they don't start with a :. But the idea should be clear. > > silvio > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From dedgrant at gmail.com Thu May 15 23:35:20 2014 From: dedgrant at gmail.com (Darren Grant) Date: Fri, 16 May 2014 01:35:20 +0200 Subject: [Haskell-cafe] Object oriented haskell. In-Reply-To: <20140515225749.GI6176@tatooine.lan> References: <5374FB95.7030905@gmail.com> <20140515212246.GB6176@tatooine.lan> <537533A4.6020400@gmail.com> <20140515223244.GF6176@tatooine.lan> <5375440C.8050801@gmail.com> <20140515225749.GI6176@tatooine.lan> Message-ID: Magnus, did you notice the Alan Kay quote that was generated for your sig? Serendipitous. :-) Haskell subsumes a great deal of semantics from many programming models. This is not to say that it is necessarily a productive end-tool replacement, but many have discovered that it is a great language to build such tools with. Cheers, Darren On May 15, 2014 4:00 PM, "Magnus Therning" wrote: > On Fri, May 16, 2014 at 12:47:40AM +0200, silvio wrote: > >> Firstly, a notation where you put the first argument before the > >> function/method? > >> > >> [1,2,3] . length -> 3 > >> > >> Secondly, mimic the multilayered namespaces that is commonly found > >> in mainstream imperative OO languages? > >> > >> [1,2,3] . length -> 3::Int > >> aPieceOfString . length -> 120.0::Double > >> > >> Just trying to understand what problem you are actually trying to > >> solve. I've *never* thought of (.) being powerful in OO languages, > >> mostly because I don't really think the dot is what makes an OO > >> language. > > > > That's essentially it. I see that people on this thread where > > thinking more along the lines of inheritance. So let me add that it > > shouldn't be difficult to add the instances you want for your child > > object and then make a default instance which reverts to the parent > > object. It's a bit of a problem for updating stuff in a functional > > way since you can never be sure if a method is ment to return an > > object or if this is supposed to be an update. But for things in > > IO/STM/... it should be fine. > > Excellent, then at least understand what you are after. I was > confused by the ensuing discussion, because it so quickly moved away > from what I thought you were really proposing. > > To be honest I've more often missed Haskell's (.) when programming in > C/C++/C# than the other way around ;) > > /M > > -- > Magnus Therning OpenPGP: 0xAB4DFBA4 > email: magnus at therning.org jabber: magnus at therning.org > twitter: magthe http://therning.org/magnus > > I invented the term Object-Oriented, and I can tell you I did not have > C++ in mind. > -- Alan Kay > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wangbj at gmail.com Fri May 16 00:39:48 2014 From: wangbj at gmail.com (Baojun Wang) Date: Thu, 15 May 2014 17:39:48 -0700 Subject: [Haskell-cafe] possible bug in latest hackage Elf (Elf-0.27) In-Reply-To: References: <20140515073052.GA23472@sniper> Message-ID: Many thanks for the input, I've sent email to the maintainer, hopefully could get reply soon :) Best Regards baojun On Thu, May 15, 2014 at 7:00 AM, Anthony Cowley wrote: > > > On May 15, 2014, at 5:18 AM, Sven Panne wrote: > > > > 2014-05-15 9:30 GMT+02:00 Roman Cheplyaka : > >> If there's no response, then you have two choices: > > > > Actually three: Fix things locally until the "official" package is fixed. > > > >> * request package maintainership, which will take several weeks > > > > I really hope that this will take months, not weeks, see the other > discussion > > > >> * fork the package (i.e. upload your patched version to hackage under a > >> different name) > > > > This proposal worries me quite a bit, because if everybody follows > > that advice, it will turn Hackage into a chaotic collection of > > packages with various degrees of being fixed/maintained/etc. Imagine a > > package 'foo', which needs a fix, and several pepole think it's a good > > idea to fork and fix the issue at hand. Now we have 'foo', 'foo-XY', > > 'foo-my-cool-acronym', ... Of course people normally have no incentive > > to really take over maintainership for 'foo', they just want a working > > 'foo' right now for their own project. Later the real maintainer > > re-appears after vacation/sabbatical/whatever, fixes 'foo', and > > continues to work on it, adding new features. Now somebody new comes > > to Hackage to see if there is already a package for some use case, and > > finds 'foo', 'foo-XY', 'foo-my-cool-acronym', ... Then it takes some > > non-trivial detective work to find out which packages are actually > > dead (again) and which is the real one. => Chaos IMHO. > > > > In a nutshell: If you are really in a hurry, fix things locally. > > Hackage is not the place to fork like hell. > > But we do need a mechanism to deal with name expansion. Many of us would > prefer to make package name usurpation a slow, forgiving process, but we > should then contend with the fact that such a policy adds to the rate at > which new packages are uploaded. If search results display, and can be > sorted by, information regarding number of downloads, downloads in the last > year, and latest upload date, we will be suggesting which of these > variations a new user should consider. Pair this with a slow name > reclaiming process, and we won't have to always consider perpetuity when > coming up with package names. > > Preferably packages would also come with some sort of UUID independent of > a user-friendly name so that they could exist on hackage without blocking > new uses of a good name if one development has permanently stalled. > > Anthony > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From john at repetae.net Fri May 16 00:45:51 2014 From: john at repetae.net (John Meacham) Date: Thu, 15 May 2014 17:45:51 -0700 Subject: [Haskell-cafe] Object oriented haskell. In-Reply-To: References: <5374FB95.7030905@gmail.com> <53750F0E.7030208@plaimi.net> Message-ID: I think every OO programmer coming to Haskell goes through this phase. They start by attempting to use a haskell typeclass as they would a class in an OO language, find it doesn't work and are a little miffed. Nevertheless they persevere and are writing servicable if not idiomatic haskell and are starting to get comfortable with Haskell's type system and experimenting in it but they still feel the gentle tug of familier design patterns(tm) and find themselves coding in a style trying to replicate them. By this point they are familier enough with the haskell type system that they start to realize they can simulate the behavior they are used to, hey, an OO class is simply a type class combined with an existential type and a default value all rolled into one! (which is more or less, completely true.) So, they start making type classes that look like OO ones, restricting their inherentence trees to be singular, using type class parameters in linear covariant position because that is what they are used to and find things good. they have replicated OO behavior, even got a working syntax down and start programming in their own brand of OO-Haskell. Then something happens. They go back to C++, or Java, or C#, and suddenly, they feel horribly restricted. They start to wonder.. like. why do methods only get to choose an implementation based on their first argument? Why the heck is the class interface and an implementation related at all? why the heck is code re-use tied to inherentence and why is multiple inheritence tricky? why am I no longer happy? They have had their flowers for algernon moment. While attempting to change haskell to an OO language, Haskell has been changing them into a type system hacker. while writing their restricted OO like class, they experimented with other models of combining type classes with concrete data, perhaps by accident and found them useful. They realized a data type they created was an instance of a class and was able to declare that after the fact without cahnging any existing code. They found that the ability for type inference to work in any direction, and represent the relationship between types was useful. They are enlightened, and look back at their OO - Haskell framework as a curiosity from their past. We all have one in our attic. An attempt at a stock pattern shoehorned into something that a single higher order function would solve. It's not a bad thing, It's part of learning Haskell. But there is a reason most of these OO proposals tend to peter out. They just are not really needed beyond a point. From trebla at vex.net Fri May 16 02:56:24 2014 From: trebla at vex.net (Albert Y. C. Lai) Date: Thu, 15 May 2014 22:56:24 -0400 Subject: [Haskell-cafe] Object oriented haskell. In-Reply-To: References: <5374FB95.7030905@gmail.com> <5375035D.1000406@gmail.com> <53750488.5040709@gmail.com> Message-ID: <53757E58.4050502@vex.net> On 14-05-15 03:06 PM, Brandon Allbery wrote: > On Thu, May 15, 2014 at 2:16 PM, silvio > wrote: > > you can specify the associativity using infix(l/r) expression > > > Which will break almost all existing code in order to enable something > that is dubious at best given how much . is already overloaded. And > gains you nothing in the way of "object oriented" as cited in your > subject line --- . is the *least* of the issues involved with OO, and is > used in the way you want by non-OO languages. What Wadler said. Talking too much syntax, too little semantics. From magnus at therning.org Fri May 16 05:19:03 2014 From: magnus at therning.org (Magnus Therning) Date: Fri, 16 May 2014 07:19:03 +0200 Subject: [Haskell-cafe] Object oriented haskell. In-Reply-To: References: <5374FB95.7030905@gmail.com> <20140515212246.GB6176@tatooine.lan> <537533A4.6020400@gmail.com> <20140515223244.GF6176@tatooine.lan> <5375440C.8050801@gmail.com> <20140515225749.GI6176@tatooine.lan> Message-ID: <20140516051903.GA885@tatooine.lan> On Fri, May 16, 2014 at 01:35:20AM +0200, Darren Grant wrote: > Magnus, did you notice the Alan Kay quote that was generated for your sig? > Serendipitous. :-) Well spotted, I didn't notice it. Serendipitous indeed! > Haskell subsumes a great deal of semantics from many programming > models. This is not to say that it is necessarily a productive > end-tool replacement, but many have discovered that it is a great > language to build such tools with. I'm convinced it IS a productive replacement in a surprising number of cases. It's just so irritating how entrenched the use of C/C++ is in the circles I move :( /M -- Magnus Therning OpenPGP: 0xAB4DFBA4 email: magnus at therning.org jabber: magnus at therning.org twitter: magthe http://therning.org/magnus I invented the term Object-Oriented, and I can tell you I did not have C++ in mind. -- Alan Kay -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From ok at cs.otago.ac.nz Fri May 16 05:43:16 2014 From: ok at cs.otago.ac.nz (Richard A. O'Keefe) Date: Fri, 16 May 2014 17:43:16 +1200 Subject: [Haskell-cafe] Object oriented haskell. In-Reply-To: <537533A4.6020400@gmail.com> References: <5374FB95.7030905@gmail.com> <20140515212246.GB6176@tatooine.lan> <537533A4.6020400@gmail.com> Message-ID: <0DB9CDDA-B47F-4A11-9A52-84F2F046DC61@cs.otago.ac.nz> On 16/05/2014, at 9:37 AM, silvio wrote: >> In what languages is (.) cool, and in what way? > > Because depending on what is before it, what is behind it can have > different meanings. That's not cool, that's majorly problematic. Ad hoc polymorphism is not good for readability. > For me this is one of the main points. I just don't > like the name collision problem in Haskell. Take something like size for > instance it is pretty clear what it means yet unless you have a type > class that everybody knows about you can use it on only one thing. For the person WRITING the code, this is a pain in the backside. For the person READING the code, it is great blessing. In Java, foo.size() could literally do ANYTHING. In Smalltalk, "x value" might be simply extracting a slot from an object or it might be invoking an arbitrarily complex operation with arbitrary side effects or (in at least one Smalltalk) it might be a special kind of synchronisation, and it's not hard to end up in situations where all three are in play. Note that the dot as such actually plays no significant role in OO. Common Lisp and Ada both can do dynamic dispatch using ordinary function call syntax. Indeed, Common Lisp shows an pretty horrible and not very principled restriction in the dotty view of the world: the dynamic call (draw Picture Canvas) can dispatch on Picture, or Canvas, or both, depending on what best suits your problem, whereas picture.Draw(canvas) can only dispatch on picture. From dedgrant at gmail.com Fri May 16 05:54:47 2014 From: dedgrant at gmail.com (Darren Grant) Date: Fri, 16 May 2014 07:54:47 +0200 Subject: [Haskell-cafe] Object oriented haskell. In-Reply-To: <20140516051903.GA885@tatooine.lan> References: <5374FB95.7030905@gmail.com> <20140515212246.GB6176@tatooine.lan> <537533A4.6020400@gmail.com> <20140515223244.GF6176@tatooine.lan> <5375440C.8050801@gmail.com> <20140515225749.GI6176@tatooine.lan> <20140516051903.GA885@tatooine.lan> Message-ID: Well for instance in game development we cover a number of different computational and creative roles. Being able to design languages that serve game development easily is a plus, or creating a solid backend infrastructure. The general tool is often a poor fit. And sometimes computational systems just have to be extremely efficient, especially on lowest common denominator targets. This is another good place for a DSL or some sort of automatic code generation, in which case Haskell can become like lisp on steroids for spitting out code consumed elsewhere. Cheers, Darren On May 15, 2014 10:21 PM, "Magnus Therning" wrote: > On Fri, May 16, 2014 at 01:35:20AM +0200, Darren Grant wrote: > > Magnus, did you notice the Alan Kay quote that was generated for your > sig? > > Serendipitous. :-) > > Well spotted, I didn't notice it. Serendipitous indeed! > > > Haskell subsumes a great deal of semantics from many programming > > models. This is not to say that it is necessarily a productive > > end-tool replacement, but many have discovered that it is a great > > language to build such tools with. > > I'm convinced it IS a productive replacement in a surprising number of > cases. It's just so irritating how entrenched the use of C/C++ is in > the circles I move :( > > /M > > -- > Magnus Therning OpenPGP: 0xAB4DFBA4 > email: magnus at therning.org jabber: magnus at therning.org > twitter: magthe http://therning.org/magnus > > I invented the term Object-Oriented, and I can tell you I did not have > C++ in mind. > -- Alan Kay > -------------- next part -------------- An HTML attachment was scrubbed... URL: From markus.l2ll at gmail.com Fri May 16 09:04:05 2014 From: markus.l2ll at gmail.com (=?UTF-8?B?TWFya3VzIEzDpGxs?=) Date: Fri, 16 May 2014 11:04:05 +0200 Subject: [Haskell-cafe] possible bug in latest hackage Elf (Elf-0.27) In-Reply-To: References: <20140515073052.GA23472@sniper> Message-ID: I would argue *for* forking. Hackage is big and consists of many packages which have only a few users, or maybe just one -- the author. I don't see all these packages if I don't go on the page and look. But when I do, I will be looking for *them*. If some popular package stops working then I would be happy to find a fork, because now I can just tell cabal about it. And if the original gets fixed, I can go back. I don't think people who fork are looking for aquiring yet another package to maintain forever, or to take it over. On Thu, May 15, 2014 at 11:18 AM, Sven Panne wrote: > 2014-05-15 9:30 GMT+02:00 Roman Cheplyaka : > > If there's no response, then you have two choices: > > Actually three: Fix things locally until the "official" package is fixed. > > > * request package maintainership, which will take several weeks > > I really hope that this will take months, not weeks, see the other > discussion > > > * fork the package (i.e. upload your patched version to hackage under a > > different name) > > This proposal worries me quite a bit, because if everybody follows > that advice, it will turn Hackage into a chaotic collection of > packages with various degrees of being fixed/maintained/etc. Imagine a > package 'foo', which needs a fix, and several pepole think it's a good > idea to fork and fix the issue at hand. Now we have 'foo', 'foo-XY', > 'foo-my-cool-acronym', ... Of course people normally have no incentive > to really take over maintainership for 'foo', they just want a working > 'foo' right now for their own project. Later the real maintainer > re-appears after vacation/sabbatical/whatever, fixes 'foo', and > continues to work on it, adding new features. Now somebody new comes > to Hackage to see if there is already a package for some use case, and > finds 'foo', 'foo-XY', 'foo-my-cool-acronym', ... Then it takes some > non-trivial detective work to find out which packages are actually > dead (again) and which is the real one. => Chaos IMHO. > > In a nutshell: If you are really in a hurry, fix things locally. > Hackage is not the place to fork like hell. > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -- Markus L?ll -------------- next part -------------- An HTML attachment was scrubbed... URL: From nicolas at incubaid.com Fri May 16 09:27:43 2014 From: nicolas at incubaid.com (Nicolas Trangez) Date: Fri, 16 May 2014 11:27:43 +0200 Subject: [Haskell-cafe] Eager forking on Hackage and inter-library compatibility (was: Re: possible bug in latest hackage Elf (Elf-0.27)) In-Reply-To: References: <20140515073052.GA23472@sniper> Message-ID: <1400232463.28725.28.camel@chi.nicolast.be> On Fri, 2014-05-16 at 11:04 +0200, Markus L?ll wrote: > I would argue *for* forking. Hackage is big and consists of many packages > which have only a few users, or maybe just one -- the author. I don't see > all these packages if I don't go on the page and look. But when I do, I > will be looking for *them*. If some popular package stops working then I > would be happy to find a fork, because now I can just tell cabal about it. > And if the original gets fixed, I can go back. I don't think people who > fork are looking for aquiring yet another package to maintain forever, or > to take it over. tl;dr: Eagerly forking is all nice and shiny for 'leaf' packages which don't expose common functionality, but causes troubles for packages which are common library dependencies. Doesn't this cause issues with library interoperability? Say there's a package which implements some standard datatype, e.g. 'vector' by author V. Then there are 2 other packages, 'vector-algorithms' by author A and 'complex-vector-algorithms' by author C. 'vector' exports a datatype 'Vector'. 'vector-algorithms' exports a function 'a :: Int -> Vector'. 'complex-vector-algorithms' exports a function 'c :: Vector -> Float'. Finally, there's the application author who wrote the function 'ingeniousCalculation :: Int -> Float; ingeniousCalculation = c . a' Now, the author of C finds an obscure bug in some function in 'vector' he uses (caused by a bug in some internal 'vector' function which requires access to non-exported internals of the Vector type), and sends a patch to V. This bug doesn't impact 'vector-algorithms' in any way. V doesn't reply within 48 hours, so C impatiently uploads 'vector-c' to Hackage, containing the fix, and updates the 'complex-vector'algorithms' dependencies from 'vector' to 'vector-c' (with whatever version constraint). At this point, the code by the application author breaks since 'vector-algorithms' uses 'Vector' from the 'vector' package, and 'complex-vector-algorithms' uses 'Vector' from 'vector-c', which are different types from a compiler perspective. I see 3 solutions: - 'vector-algorithms' needs to be updated by A to use 'vector-c', something to which A might be reluctant since it could break lots of code using 'vector-algorithms' in combination with other libraries and applications using 'vector'. - The application author needs to patch 'vector-algorithms' locally to use 'vector-c'. - The application author patches 'vector' locally to fix the bug (something V wil most likely do in a couple of days) and reverts the dependency of 'complex-vector-algorithms' from 'vector-c' back to 'vector'. None of these seem very satisfactory. So, whilst forking (in this case) provides a very 'local' solution for the 'complex-vector-algorithms' package and C, it doesn't fix anything (I'd even argue it complicates matters) in the grand scheme of things. My .02, Nicolas > > > > On Thu, May 15, 2014 at 11:18 AM, Sven Panne wrote: > > > 2014-05-15 9:30 GMT+02:00 Roman Cheplyaka : > > > If there's no response, then you have two choices: > > > > Actually three: Fix things locally until the "official" package is fixed. > > > > > * request package maintainership, which will take several weeks > > > > I really hope that this will take months, not weeks, see the other > > discussion > > > > > * fork the package (i.e. upload your patched version to hackage under a > > > different name) > > > > This proposal worries me quite a bit, because if everybody follows > > that advice, it will turn Hackage into a chaotic collection of > > packages with various degrees of being fixed/maintained/etc. Imagine a > > package 'foo', which needs a fix, and several pepole think it's a good > > idea to fork and fix the issue at hand. Now we have 'foo', 'foo-XY', > > 'foo-my-cool-acronym', ... Of course people normally have no incentive > > to really take over maintainership for 'foo', they just want a working > > 'foo' right now for their own project. Later the real maintainer > > re-appears after vacation/sabbatical/whatever, fixes 'foo', and > > continues to work on it, adding new features. Now somebody new comes > > to Hackage to see if there is already a package for some use case, and > > finds 'foo', 'foo-XY', 'foo-my-cool-acronym', ... Then it takes some > > non-trivial detective work to find out which packages are actually > > dead (again) and which is the real one. => Chaos IMHO. > > > > In a nutshell: If you are really in a hurry, fix things locally. > > Hackage is not the place to fork like hell. > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://www.haskell.org/mailman/listinfo/haskell-cafe > > > > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From johan.tibell at gmail.com Fri May 16 09:30:47 2014 From: johan.tibell at gmail.com (Johan Tibell) Date: Fri, 16 May 2014 11:30:47 +0200 Subject: [Haskell-cafe] Eager forking on Hackage and inter-library compatibility (was: Re: possible bug in latest hackage Elf (Elf-0.27)) In-Reply-To: <1400232463.28725.28.camel@chi.nicolast.be> References: <20140515073052.GA23472@sniper> <1400232463.28725.28.camel@chi.nicolast.be> Message-ID: The right thing to do is to apply a patch to a local copy of vector and use that until upstream is fixed. Uploading a new forked package doesn't solve the issue in a satisfactory way, as you observed. -------------- next part -------------- An HTML attachment was scrubbed... URL: From markus.l2ll at gmail.com Fri May 16 10:26:04 2014 From: markus.l2ll at gmail.com (=?UTF-8?B?TWFya3VzIEzDpGxs?=) Date: Fri, 16 May 2014 12:26:04 +0200 Subject: [Haskell-cafe] Eager forking on Hackage and inter-library compatibility (was: Re: possible bug in latest hackage Elf (Elf-0.27)) In-Reply-To: <1400232463.28725.28.camel@chi.nicolast.be> References: <20140515073052.GA23472@sniper> <1400232463.28725.28.camel@chi.nicolast.be> Message-ID: I now see what you mean and you are totally right. I guess what people are craving for, is a seamless solution to fix the problem quick, and have it be public right away to yourself and others who need it. Maybe this is material for a later discussion, but as just a thought, maybe the eager ones could manage an eager hackage to host their changes (a private hackage has been mentioned before). More work upfront, but might be worth it in the end. On Fri, May 16, 2014 at 11:27 AM, Nicolas Trangez wrote: > On Fri, 2014-05-16 at 11:04 +0200, Markus L?ll wrote: > > I would argue *for* forking. Hackage is big and consists of many packages > > which have only a few users, or maybe just one -- the author. I don't see > > all these packages if I don't go on the page and look. But when I do, I > > will be looking for *them*. If some popular package stops working then I > > would be happy to find a fork, because now I can just tell cabal about > it. > > And if the original gets fixed, I can go back. I don't think people who > > fork are looking for aquiring yet another package to maintain forever, or > > to take it over. > > tl;dr: Eagerly forking is all nice and shiny for 'leaf' packages which > don't expose common functionality, but causes troubles for packages > which are common library dependencies. > > Doesn't this cause issues with library interoperability? > > Say there's a package which implements some standard datatype, e.g. > 'vector' by author V. Then there are 2 other packages, > 'vector-algorithms' by author A and 'complex-vector-algorithms' by > author C. > > 'vector' exports a datatype 'Vector'. > 'vector-algorithms' exports a function 'a :: Int -> Vector'. > 'complex-vector-algorithms' exports a function 'c :: Vector -> Float'. > > Finally, there's the application author who wrote the function > 'ingeniousCalculation :: Int -> Float; ingeniousCalculation = c . a' > > Now, the author of C finds an obscure bug in some function in 'vector' > he uses (caused by a bug in some internal 'vector' function which > requires access to non-exported internals of the Vector type), and sends > a patch to V. This bug doesn't impact 'vector-algorithms' in any way. > > V doesn't reply within 48 hours, so C impatiently uploads 'vector-c' to > Hackage, containing the fix, and updates the 'complex-vector'algorithms' > dependencies from 'vector' to 'vector-c' (with whatever version > constraint). > > At this point, the code by the application author breaks since > 'vector-algorithms' uses 'Vector' from the 'vector' package, and > 'complex-vector-algorithms' uses 'Vector' from 'vector-c', which are > different types from a compiler perspective. > > I see 3 solutions: > - 'vector-algorithms' needs to be updated by A to use 'vector-c', > something to which A might be reluctant since it could break lots of > code using 'vector-algorithms' in combination with other libraries and > applications using 'vector'. > - The application author needs to patch 'vector-algorithms' locally to > use 'vector-c'. > - The application author patches 'vector' locally to fix the bug > (something V wil most likely do in a couple of days) and reverts the > dependency of 'complex-vector-algorithms' from 'vector-c' back to > 'vector'. > > None of these seem very satisfactory. > > So, whilst forking (in this case) provides a very 'local' solution for > the 'complex-vector-algorithms' package and C, it doesn't fix anything > (I'd even argue it complicates matters) in the grand scheme of things. > > My .02, > > Nicolas > > > > > > > > > On Thu, May 15, 2014 at 11:18 AM, Sven Panne > wrote: > > > > > 2014-05-15 9:30 GMT+02:00 Roman Cheplyaka : > > > > If there's no response, then you have two choices: > > > > > > Actually three: Fix things locally until the "official" package is > fixed. > > > > > > > * request package maintainership, which will take several weeks > > > > > > I really hope that this will take months, not weeks, see the other > > > discussion > > > > > > > * fork the package (i.e. upload your patched version to hackage > under a > > > > different name) > > > > > > This proposal worries me quite a bit, because if everybody follows > > > that advice, it will turn Hackage into a chaotic collection of > > > packages with various degrees of being fixed/maintained/etc. Imagine a > > > package 'foo', which needs a fix, and several pepole think it's a good > > > idea to fork and fix the issue at hand. Now we have 'foo', 'foo-XY', > > > 'foo-my-cool-acronym', ... Of course people normally have no incentive > > > to really take over maintainership for 'foo', they just want a working > > > 'foo' right now for their own project. Later the real maintainer > > > re-appears after vacation/sabbatical/whatever, fixes 'foo', and > > > continues to work on it, adding new features. Now somebody new comes > > > to Hackage to see if there is already a package for some use case, and > > > finds 'foo', 'foo-XY', 'foo-my-cool-acronym', ... Then it takes some > > > non-trivial detective work to find out which packages are actually > > > dead (again) and which is the real one. => Chaos IMHO. > > > > > > In a nutshell: If you are really in a hurry, fix things locally. > > > Hackage is not the place to fork like hell. > > > _______________________________________________ > > > Haskell-Cafe mailing list > > > Haskell-Cafe at haskell.org > > > http://www.haskell.org/mailman/listinfo/haskell-cafe > > > > > > > > > > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://www.haskell.org/mailman/listinfo/haskell-cafe > > > -- Markus L?ll -------------- next part -------------- An HTML attachment was scrubbed... URL: From tomas.carnecky at gmail.com Fri May 16 11:10:13 2014 From: tomas.carnecky at gmail.com (Tomas Carnecky) Date: Fri, 16 May 2014 13:10:13 +0200 Subject: [Haskell-cafe] Eager forking on Hackage and inter-library compatibility (was: Re: possible bug in latest hackage Elf (Elf-0.27)) In-Reply-To: References: <20140515073052.GA23472@sniper> <1400232463.28725.28.camel@chi.nicolast.be> Message-ID: Teach cabal how to install packages from a URL or even a git repository, like go or npm can. Then people can upload the patched project to (or even fork on) github/bitbucket/.. and let others know so they can update their cabal file. On Fri, May 16, 2014 at 12:26 PM, Markus L?ll wrote: > I now see what you mean and you are totally right. > > I guess what people are craving for, is a seamless solution to fix the > problem quick, and have it be public right away to yourself and others who > need it. Maybe this is material for a later discussion, but as just a > thought, maybe the eager ones could manage an eager hackage to host their > changes (a private hackage has been mentioned before). More work upfront, > but might be worth it in the end. > > > > > On Fri, May 16, 2014 at 11:27 AM, Nicolas Trangez > wrote: >> >> On Fri, 2014-05-16 at 11:04 +0200, Markus L?ll wrote: >> > I would argue *for* forking. Hackage is big and consists of many >> > packages >> > which have only a few users, or maybe just one -- the author. I don't >> > see >> > all these packages if I don't go on the page and look. But when I do, I >> > will be looking for *them*. If some popular package stops working then I >> > would be happy to find a fork, because now I can just tell cabal about >> > it. >> > And if the original gets fixed, I can go back. I don't think people who >> > fork are looking for aquiring yet another package to maintain forever, >> > or >> > to take it over. >> >> tl;dr: Eagerly forking is all nice and shiny for 'leaf' packages which >> don't expose common functionality, but causes troubles for packages >> which are common library dependencies. >> >> Doesn't this cause issues with library interoperability? >> >> Say there's a package which implements some standard datatype, e.g. >> 'vector' by author V. Then there are 2 other packages, >> 'vector-algorithms' by author A and 'complex-vector-algorithms' by >> author C. >> >> 'vector' exports a datatype 'Vector'. >> 'vector-algorithms' exports a function 'a :: Int -> Vector'. >> 'complex-vector-algorithms' exports a function 'c :: Vector -> Float'. >> >> Finally, there's the application author who wrote the function >> 'ingeniousCalculation :: Int -> Float; ingeniousCalculation = c . a' >> >> Now, the author of C finds an obscure bug in some function in 'vector' >> he uses (caused by a bug in some internal 'vector' function which >> requires access to non-exported internals of the Vector type), and sends >> a patch to V. This bug doesn't impact 'vector-algorithms' in any way. >> >> V doesn't reply within 48 hours, so C impatiently uploads 'vector-c' to >> Hackage, containing the fix, and updates the 'complex-vector'algorithms' >> dependencies from 'vector' to 'vector-c' (with whatever version >> constraint). >> >> At this point, the code by the application author breaks since >> 'vector-algorithms' uses 'Vector' from the 'vector' package, and >> 'complex-vector-algorithms' uses 'Vector' from 'vector-c', which are >> different types from a compiler perspective. >> >> I see 3 solutions: >> - 'vector-algorithms' needs to be updated by A to use 'vector-c', >> something to which A might be reluctant since it could break lots of >> code using 'vector-algorithms' in combination with other libraries and >> applications using 'vector'. >> - The application author needs to patch 'vector-algorithms' locally to >> use 'vector-c'. >> - The application author patches 'vector' locally to fix the bug >> (something V wil most likely do in a couple of days) and reverts the >> dependency of 'complex-vector-algorithms' from 'vector-c' back to >> 'vector'. >> >> None of these seem very satisfactory. >> >> So, whilst forking (in this case) provides a very 'local' solution for >> the 'complex-vector-algorithms' package and C, it doesn't fix anything >> (I'd even argue it complicates matters) in the grand scheme of things. >> >> My .02, >> >> Nicolas >> >> > >> > >> > >> > On Thu, May 15, 2014 at 11:18 AM, Sven Panne >> > wrote: >> > >> > > 2014-05-15 9:30 GMT+02:00 Roman Cheplyaka : >> > > > If there's no response, then you have two choices: >> > > >> > > Actually three: Fix things locally until the "official" package is >> > > fixed. >> > > >> > > > * request package maintainership, which will take several weeks >> > > >> > > I really hope that this will take months, not weeks, see the other >> > > discussion >> > > >> > > > * fork the package (i.e. upload your patched version to hackage >> > > > under a >> > > > different name) >> > > >> > > This proposal worries me quite a bit, because if everybody follows >> > > that advice, it will turn Hackage into a chaotic collection of >> > > packages with various degrees of being fixed/maintained/etc. Imagine a >> > > package 'foo', which needs a fix, and several pepole think it's a good >> > > idea to fork and fix the issue at hand. Now we have 'foo', 'foo-XY', >> > > 'foo-my-cool-acronym', ... Of course people normally have no incentive >> > > to really take over maintainership for 'foo', they just want a working >> > > 'foo' right now for their own project. Later the real maintainer >> > > re-appears after vacation/sabbatical/whatever, fixes 'foo', and >> > > continues to work on it, adding new features. Now somebody new comes >> > > to Hackage to see if there is already a package for some use case, and >> > > finds 'foo', 'foo-XY', 'foo-my-cool-acronym', ... Then it takes some >> > > non-trivial detective work to find out which packages are actually >> > > dead (again) and which is the real one. => Chaos IMHO. >> > > >> > > In a nutshell: If you are really in a hurry, fix things locally. >> > > Hackage is not the place to fork like hell. >> > > _______________________________________________ >> > > Haskell-Cafe mailing list >> > > Haskell-Cafe at haskell.org >> > > http://www.haskell.org/mailman/listinfo/haskell-cafe >> > > >> > >> > >> > >> > _______________________________________________ >> > Haskell-Cafe mailing list >> > Haskell-Cafe at haskell.org >> > http://www.haskell.org/mailman/listinfo/haskell-cafe >> >> > > > > -- > Markus L?ll > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > From ivan.miljenovic at gmail.com Fri May 16 11:29:45 2014 From: ivan.miljenovic at gmail.com (Ivan Lazar Miljenovic) Date: Fri, 16 May 2014 21:29:45 +1000 Subject: [Haskell-cafe] Eager forking on Hackage and inter-library compatibility (was: Re: possible bug in latest hackage Elf (Elf-0.27)) In-Reply-To: References: <20140515073052.GA23472@sniper> <1400232463.28725.28.camel@chi.nicolast.be> Message-ID: On 16 May 2014 21:10, Tomas Carnecky wrote: > Teach cabal how to install packages from a URL or even a git > repository, like go or npm can. Then people can upload the patched > project to (or even fork on) github/bitbucket/.. and let others know > so they can update their cabal file. How does that solve anything? You still end up potentially needing multiple different forks of a package! > > On Fri, May 16, 2014 at 12:26 PM, Markus L?ll wrote: >> I now see what you mean and you are totally right. >> >> I guess what people are craving for, is a seamless solution to fix the >> problem quick, and have it be public right away to yourself and others who >> need it. Maybe this is material for a later discussion, but as just a >> thought, maybe the eager ones could manage an eager hackage to host their >> changes (a private hackage has been mentioned before). More work upfront, >> but might be worth it in the end. >> >> >> >> >> On Fri, May 16, 2014 at 11:27 AM, Nicolas Trangez >> wrote: >>> >>> On Fri, 2014-05-16 at 11:04 +0200, Markus L?ll wrote: >>> > I would argue *for* forking. Hackage is big and consists of many >>> > packages >>> > which have only a few users, or maybe just one -- the author. I don't >>> > see >>> > all these packages if I don't go on the page and look. But when I do, I >>> > will be looking for *them*. If some popular package stops working then I >>> > would be happy to find a fork, because now I can just tell cabal about >>> > it. >>> > And if the original gets fixed, I can go back. I don't think people who >>> > fork are looking for aquiring yet another package to maintain forever, >>> > or >>> > to take it over. >>> >>> tl;dr: Eagerly forking is all nice and shiny for 'leaf' packages which >>> don't expose common functionality, but causes troubles for packages >>> which are common library dependencies. >>> >>> Doesn't this cause issues with library interoperability? >>> >>> Say there's a package which implements some standard datatype, e.g. >>> 'vector' by author V. Then there are 2 other packages, >>> 'vector-algorithms' by author A and 'complex-vector-algorithms' by >>> author C. >>> >>> 'vector' exports a datatype 'Vector'. >>> 'vector-algorithms' exports a function 'a :: Int -> Vector'. >>> 'complex-vector-algorithms' exports a function 'c :: Vector -> Float'. >>> >>> Finally, there's the application author who wrote the function >>> 'ingeniousCalculation :: Int -> Float; ingeniousCalculation = c . a' >>> >>> Now, the author of C finds an obscure bug in some function in 'vector' >>> he uses (caused by a bug in some internal 'vector' function which >>> requires access to non-exported internals of the Vector type), and sends >>> a patch to V. This bug doesn't impact 'vector-algorithms' in any way. >>> >>> V doesn't reply within 48 hours, so C impatiently uploads 'vector-c' to >>> Hackage, containing the fix, and updates the 'complex-vector'algorithms' >>> dependencies from 'vector' to 'vector-c' (with whatever version >>> constraint). >>> >>> At this point, the code by the application author breaks since >>> 'vector-algorithms' uses 'Vector' from the 'vector' package, and >>> 'complex-vector-algorithms' uses 'Vector' from 'vector-c', which are >>> different types from a compiler perspective. >>> >>> I see 3 solutions: >>> - 'vector-algorithms' needs to be updated by A to use 'vector-c', >>> something to which A might be reluctant since it could break lots of >>> code using 'vector-algorithms' in combination with other libraries and >>> applications using 'vector'. >>> - The application author needs to patch 'vector-algorithms' locally to >>> use 'vector-c'. >>> - The application author patches 'vector' locally to fix the bug >>> (something V wil most likely do in a couple of days) and reverts the >>> dependency of 'complex-vector-algorithms' from 'vector-c' back to >>> 'vector'. >>> >>> None of these seem very satisfactory. >>> >>> So, whilst forking (in this case) provides a very 'local' solution for >>> the 'complex-vector-algorithms' package and C, it doesn't fix anything >>> (I'd even argue it complicates matters) in the grand scheme of things. >>> >>> My .02, >>> >>> Nicolas >>> >>> > >>> > >>> > >>> > On Thu, May 15, 2014 at 11:18 AM, Sven Panne >>> > wrote: >>> > >>> > > 2014-05-15 9:30 GMT+02:00 Roman Cheplyaka : >>> > > > If there's no response, then you have two choices: >>> > > >>> > > Actually three: Fix things locally until the "official" package is >>> > > fixed. >>> > > >>> > > > * request package maintainership, which will take several weeks >>> > > >>> > > I really hope that this will take months, not weeks, see the other >>> > > discussion >>> > > >>> > > > * fork the package (i.e. upload your patched version to hackage >>> > > > under a >>> > > > different name) >>> > > >>> > > This proposal worries me quite a bit, because if everybody follows >>> > > that advice, it will turn Hackage into a chaotic collection of >>> > > packages with various degrees of being fixed/maintained/etc. Imagine a >>> > > package 'foo', which needs a fix, and several pepole think it's a good >>> > > idea to fork and fix the issue at hand. Now we have 'foo', 'foo-XY', >>> > > 'foo-my-cool-acronym', ... Of course people normally have no incentive >>> > > to really take over maintainership for 'foo', they just want a working >>> > > 'foo' right now for their own project. Later the real maintainer >>> > > re-appears after vacation/sabbatical/whatever, fixes 'foo', and >>> > > continues to work on it, adding new features. Now somebody new comes >>> > > to Hackage to see if there is already a package for some use case, and >>> > > finds 'foo', 'foo-XY', 'foo-my-cool-acronym', ... Then it takes some >>> > > non-trivial detective work to find out which packages are actually >>> > > dead (again) and which is the real one. => Chaos IMHO. >>> > > >>> > > In a nutshell: If you are really in a hurry, fix things locally. >>> > > Hackage is not the place to fork like hell. >>> > > _______________________________________________ >>> > > Haskell-Cafe mailing list >>> > > Haskell-Cafe at haskell.org >>> > > http://www.haskell.org/mailman/listinfo/haskell-cafe >>> > > >>> > >>> > >>> > >>> > _______________________________________________ >>> > Haskell-Cafe mailing list >>> > Haskell-Cafe at haskell.org >>> > http://www.haskell.org/mailman/listinfo/haskell-cafe >>> >>> >> >> >> >> -- >> Markus L?ll >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe -- Ivan Lazar Miljenovic Ivan.Miljenovic at gmail.com http://IvanMiljenovic.wordpress.com From silvio.frischi at gmail.com Fri May 16 11:54:32 2014 From: silvio.frischi at gmail.com (silvio) Date: Fri, 16 May 2014 13:54:32 +0200 Subject: [Haskell-cafe] Object oriented haskell. In-Reply-To: <0DB9CDDA-B47F-4A11-9A52-84F2F046DC61@cs.otago.ac.nz> References: <5374FB95.7030905@gmail.com> <20140515212246.GB6176@tatooine.lan> <537533A4.6020400@gmail.com> <0DB9CDDA-B47F-4A11-9A52-84F2F046DC61@cs.otago.ac.nz> Message-ID: <5375FC78.8080005@gmail.com> > For the person WRITING the code, this is a pain in the backside. > For the person READING the code, it is great blessing. Acutely, I think dot notation is great to read. > In Java, foo.size() could literally do ANYTHING. > In Smalltalk, "x value" might be simply extracting a slot from > an object or it might be invoking an arbitrarily complex operation > with arbitrary side effects or (in at least one Smalltalk) it might > be a special kind of synchronisation, and it's not hard to end up > in situations where all three are in play. I don't see how a polymorphic (.) changes anything. If the output type which is decided by the input types is 'IO a' then it can do anything if it is not IO then it can't. Just like in any other Haskell function. I concede that doku is something I yet have to think about. But that's just a question of representing the info that is already there in a readable way. silvio From hvr at gnu.org Fri May 16 12:08:35 2014 From: hvr at gnu.org (Herbert Valerio Riedel) Date: Fri, 16 May 2014 14:08:35 +0200 Subject: [Haskell-cafe] Eager forking on Hackage and inter-library compatibility In-Reply-To: (Tomas Carnecky's message of "Fri, 16 May 2014 13:10:13 +0200") References: <20140515073052.GA23472@sniper> <1400232463.28725.28.camel@chi.nicolast.be> Message-ID: <87mweisz7g.fsf@gnu.org> On 2014-05-16 at 13:10:13 +0200, Tomas Carnecky wrote: > Teach cabal how to install packages from a URL cabal install > or even a git repository, like go or npm can. not yet available as a single command, but the following comes close: cabal get -s && cd && cabal install From hvr at gnu.org Fri May 16 12:10:44 2014 From: hvr at gnu.org (Herbert Valerio Riedel) Date: Fri, 16 May 2014 14:10:44 +0200 Subject: [Haskell-cafe] Eager forking on Hackage and inter-library compatibility In-Reply-To: <87mweisz7g.fsf@gnu.org> (Herbert Valerio Riedel's message of "Fri, 16 May 2014 14:08:35 +0200") References: <20140515073052.GA23472@sniper> <1400232463.28725.28.camel@chi.nicolast.be> <87mweisz7g.fsf@gnu.org> Message-ID: <87iop5udob.fsf@gnu.org> On 2014-05-16 at 14:08:35 +0200, Herbert Valerio Riedel wrote: > On 2014-05-16 at 13:10:13 +0200, Tomas Carnecky wrote: >> Teach cabal how to install packages from a URL > > cabal install > >> or even a git repository, like go or npm can. > > not yet available as a single command, but the following comes close: > > cabal get -s && cd && cabal install sorry, should have been cabal get -s && cabal install From carter.schonwald at gmail.com Fri May 16 16:00:46 2014 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Fri, 16 May 2014 12:00:46 -0400 Subject: [Haskell-cafe] Eager forking on Hackage and inter-library compatibility (was: Re: possible bug in latest hackage Elf (Elf-0.27)) In-Reply-To: References: <20140515073052.GA23472@sniper> <1400232463.28725.28.camel@chi.nicolast.be> Message-ID: You can totally cabal install from a URL. A good example of this Johan shared a URL pointing to a Tarball when he wanted testers befor he released an update to cabal and cabal install. It's really easy. Cabal sdist the project as per usual, but instead put it somewhere online where it has a URL. Then cabal install URL. This actually works. On Friday, May 16, 2014, Ivan Lazar Miljenovic wrote: > On 16 May 2014 21:10, Tomas Carnecky > > wrote: > > Teach cabal how to install packages from a URL or even a git > > repository, like go or npm can. Then people can upload the patched > > project to (or even fork on) github/bitbucket/.. and let others know > > so they can update their cabal file. > > How does that solve anything? You still end up potentially needing > multiple different forks of a package! > > > > > On Fri, May 16, 2014 at 12:26 PM, Markus L?ll > wrote: > >> I now see what you mean and you are totally right. > >> > >> I guess what people are craving for, is a seamless solution to fix the > >> problem quick, and have it be public right away to yourself and others > who > >> need it. Maybe this is material for a later discussion, but as just a > >> thought, maybe the eager ones could manage an eager hackage to host > their > >> changes (a private hackage has been mentioned before). More work > upfront, > >> but might be worth it in the end. > >> > >> > >> > >> > >> On Fri, May 16, 2014 at 11:27 AM, Nicolas Trangez > > >> wrote: > >>> > >>> On Fri, 2014-05-16 at 11:04 +0200, Markus L?ll wrote: > >>> > I would argue *for* forking. Hackage is big and consists of many > >>> > packages > >>> > which have only a few users, or maybe just one -- the author. I don't > >>> > see > >>> > all these packages if I don't go on the page and look. But when I > do, I > >>> > will be looking for *them*. If some popular package stops working > then I > >>> > would be happy to find a fork, because now I can just tell cabal > about > >>> > it. > >>> > And if the original gets fixed, I can go back. I don't think people > who > >>> > fork are looking for aquiring yet another package to maintain > forever, > >>> > or > >>> > to take it over. > >>> > >>> tl;dr: Eagerly forking is all nice and shiny for 'leaf' packages which > >>> don't expose common functionality, but causes troubles for packages > >>> which are common library dependencies. > >>> > >>> Doesn't this cause issues with library interoperability? > >>> > >>> Say there's a package which implements some standard datatype, e.g. > >>> 'vector' by author V. Then there are 2 other packages, > >>> 'vector-algorithms' by author A and 'complex-vector-algorithms' by > >>> author C. > >>> > >>> 'vector' exports a datatype 'Vector'. > >>> 'vector-algorithms' exports a function 'a :: Int -> Vector'. > >>> 'complex-vector-algorithms' exports a function 'c :: Vector -> Float'. > >>> > >>> Finally, there's the application author who wrote the function > >>> 'ingeniousCalculation :: Int -> Float; ingeniousCalculation = c . a' > >>> > >>> Now, the author of C finds an obscure bug in some function in 'vector' > >>> he uses (caused by a bug in some internal 'vector' function which > >>> requires access to non-exported internals of the Vector type), and > sends > >>> a patch to V. This bug doesn't impact 'vector-algorithms' in any way. > >>> > >>> V doesn't reply within 48 hours, so C impatiently uploads 'vector-c' to > >>> Hackage, containing the fix, and updates the > 'complex-vector'algorithms' > >>> dependencies from 'vector' to 'vector-c' (with whatever version > >>> constraint). > >>> > >>> At this point, the code by the application author breaks since > >>> 'vector-algorithms' uses 'Vector' from the 'vector' package, and > >>> 'complex-vector-algorithms' uses 'Vector' from 'vector-c', which are > >>> different types from a compiler perspective. > >>> > >>> I see 3 solutions: > >>> - 'vector-algorithms' needs to be updated by A to use 'vector-c', > >>> something to which A might be reluctant since it could break lots of > >>> code using 'vector-algorithms' in combination with other libraries and > >>> applications using 'vector'. > >>> - The application author needs to patch 'vector-algorithms' locally to > >>> use 'vector-c'. > >>> - The application author patches 'vector' locally to fix the bug > >>> (something V wil most likely do in a couple of days) and reverts the > >>> dependency of 'complex-vector-algorithms' from 'vector-c' back to > >>> 'vector'. > >>> > >>> None of these seem very satisfactory. > >>> > >>> So, whilst forking (in this case) provides a very 'local' solution for > >>> the 'complex-vector-algorithms' package and C, it doesn't fix anything > >>> (I'd even-- > Ivan Lazar Miljenovic > Ivan.Miljenovic at gmail.com > http://IvanMiljenovic.wordpress.com > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sacha404 at gmail.com Fri May 16 17:13:27 2014 From: sacha404 at gmail.com (Sacha Sokoloski) Date: Fri, 16 May 2014 19:13:27 +0200 Subject: [Haskell-cafe] Parent Modules: Common Functions or Re-Exportation? Message-ID: <53764737.9080301@gmail.com> So as a relatively long term user of haskell at this point, one issue which I've never found a simple solution to is the one stated in the thread. That is, given modules Foo, Foo.Bar, and Foo.Baz, should Foo reexport Bar and Baz, or should Foo provide common functions for Bar and Baz? In the first case, the common functions would have to be provided by some third module Foo.Util, which for some reason I find unsatisfying, as it means all my my modules have these Util after Util after Util module floating aroudn. My natural tendency is follow the second case, but then of course when it comes to actually using the code that I've written, I no longer have such a nicely exposed interface outside of the particular library. One simply can't eat ones cake and have it too. Maybe this problem is just silly, but perhaps others have always been left feeling ambivalent across similar lines, and have somehow found a pleasant solution for when this particular crossroads is reached? Cheers, - Sacha Sokoloski From corentin.dupont at gmail.com Fri May 16 19:15:10 2014 From: corentin.dupont at gmail.com (Corentin Dupont) Date: Fri, 16 May 2014 21:15:10 +0200 Subject: [Haskell-cafe] Composable events: Applicative and Alternative In-Reply-To: References: Message-ID: I created a DSL to manage and create events (see under). It's an instance of Applicative and Alternative, which make them compose nicely. The idea is that when an event is firing, I look the corresponding event in the tree and replace it by its value using Pure. For example onInputText will trigger the display of a form with a text field on the screen, and when the player validates the form, the same onInputText is searched in the tree by the engine and replaced by the text value. This is where the difficulty begins: --> How to make Event an instance of Eq? How to search and replace through it? The problem is the EventProduct primitive, that forbids to make the DSL an instance of Eq: EventProduct :: Event (a -> b) -> Event a -> Event b Should I replace it by: EventProduct :: Event a -> Event b -> Event (a,b) But then, bye-bye Applicative/Alternative instances! How can I make the tree of events searchable/traversable and still maintain the Applicative instance? Thanks!! Corentin On Sat, May 3, 2014 at 8:02 PM, Corentin Dupont wrote: > Hi Cafe!! > > For my game Nomyx, I am using events that the player can program. For > example, the player can register a callback that will be triggered when a > new player arrives. He can also program some forms (with buttons, > checkboxes, textboxes...) to appear on the Web GUI. The problem is those > events are not composable: he has to create and handle them one by one. > > So I'm thinking of making those events composable by making them an > instance of Applicative and Alternative. > For Applicative, this makes events composable very much like in > Applicative-Functors and Reform. I can build neat composed events such as > (full program below): > > onInputMyRecord :: Event MyRecord > onInputMyRecord = MyRecord <$> onInputText <*> onInputCheckbox > > For Alternative, I haven't seen any example of it on the net. The idea is > that the first event that fires is used to build the alternative: > > onInputMyAlternative :: Event Bool > onInputMyAlternative = (True <$ onInputButton) <|> (False <$ onInputButton) > > Here is an example program: > > {-# LANGUAGE GADTs #-} > > module ComposableEvents where > > import Control.Applicative > import Data.Time > import Data.Traversable > > type PlayerNumber = Int > > data Event a where > OnInputText :: PlayerNumber -> Event String -- A textbox > will be created for the player. When filled, this event will fire and > return the result > OnInputCheckbox :: PlayerNumber -> Event Bool -- Idem with a > checkbox > OnInputButton :: PlayerNumber -> Event () -- Idem with a > button > OnTime :: UTCTime -> Event () -- time event > EventSum :: Event a -> Event a -> Event a -- The first > event to fire will be returned > EventProduct :: Event (a -> b) -> Event a -> Event b -- both events > should fire, and then the result is returned > Fmap :: (a -> b) -> Event a -> Event b -- transforms > the value returned by an event. > Pure :: a -> Event a -- Create a fake > event. The result is useable with no delay. > Empty :: Event a -- An event that > is never fired. > > instance Functor Event where > fmap = Fmap > > instance Applicative Event where > pure = Pure > (<*>) = EventProduct > > instance Alternative Event where > (<|>) = EventSum > empty = Empty > > onInputText = OnInputText > onInputCheckbox = OnInputCheckbox > onInputButton = OnInputButton > onTime = OnTime > > -- A product type > data MyRecord = MyRecord String Bool > > -- A sum type > data MyAlternative = A | B > > -- Using the Applicative instance, we can build a product type from two > separate event results. > -- The event callback should be called only when all two events have fired. > onInputMyRecord :: Event MyRecord > onInputMyRecord = MyRecord <$> onInputText 1 <*> onInputCheckbox 1 > > -- other possible implementation (given a monad instance) > -- onInputMyRecord' = do > -- s <- onInputText > -- b <- onInputCheckbox > -- return $ MyRecord s b > > -- Using the Alternative instance, we build a sum type. > -- The event callback should be called when the first event have fired. > onInputMyAlternative :: Event MyAlternative > onInputMyAlternative = (const A <$> onInputButton 1) <|> (const B <$> > onInputButton 1) > > allPlayers = [1 .. 10] > > -- Now complex events can be created, such as voting systems: > voteEvent :: UTCTime -> Event ([Maybe Bool]) > voteEvent time = sequenceA $ map (singleVote time) allPlayers > > singleVote :: UTCTime -> PlayerNumber -> Event (Maybe Bool) > singleVote timeLimit pn = (Just <$> onInputCheckbox pn) <|> (const Nothing > <$> onTime timeLimit) > > vote :: UTCTime -> Event Bool > vote timeLimit = unanimity <$> (voteEvent timeLimit) > > unanimity :: [Maybe Bool] -> Bool > unanimity = all (== Just True) > > > --Evaluation > --evalEvent :: Event a -> State Game a > --evalEvent = undefined > > With this DSL, I can create complex events such as time limited votes very > neatly... > There is much left to do for a full implem: the way to register callbacks > on complex events, the evaluator and the event manager. > Have you heard about a similar implementation? It seems pretty useful. > Maybe in FRP frameworks? > > Thanks a lot!! > Corentin > PS: I copied this example also in > https://github.com/cdupont/Nomyx-design/blob/master/ComposableEvents.hs. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tikhon at jelv.is Fri May 16 19:28:24 2014 From: tikhon at jelv.is (Tikhon Jelvis) Date: Fri, 16 May 2014 12:28:24 -0700 Subject: [Haskell-cafe] Fwd: Composable events: Applicative and Alternative In-Reply-To: References: Message-ID: Oops, forgot to include the list. ---------- Forwarded message ---------- From: Tikhon Jelvis Date: Fri, May 16, 2014 at 12:27 PM Subject: Re: [Haskell-cafe] Composable events: Applicative and Alternative To: Corentin Dupont It sounds like you're trying to solve the same problems as FRP. In fact, this was basically the original impetus for FRP: making events (and reactive programs in general) nicely composable. Perhaps you could take a look at how event streams work in frameworks like Reactive-Banana? Reactive-Banana doesn't make its events applicatives, but it's a perfectly reasonable thing to do: there's a great explanation in Conal's "Push-Pull Functional Reactive Programming"[1] in section 2.2.4. On Fri, May 16, 2014 at 12:15 PM, Corentin Dupont wrote: > > I created a DSL to manage and create events (see under). It's an instance > of Applicative and Alternative, which make them compose nicely. > The idea is that when an event is firing, I look the corresponding event > in the tree and replace it by its value using Pure. > > For example onInputText will trigger the display of a form with a text > field on the screen, and when the player validates the form, the same > onInputText is searched in the tree by the engine and replaced by the > text value. This is where the difficulty begins: > > --> How to make Event an instance of Eq? How to search and replace > through it? > > The problem is the EventProduct primitive, that forbids to make the DSL an > instance of Eq: > EventProduct :: Event (a -> b) -> Event a -> Event b > > Should I replace it by: > EventProduct :: Event a -> Event b -> Event (a,b) > > But then, bye-bye Applicative/Alternative instances! > How can I make the tree of events searchable/traversable and still > maintain the Applicative instance? > > Thanks!! > Corentin > > > On Sat, May 3, 2014 at 8:02 PM, Corentin Dupont > wrote: > >> Hi Cafe!! >> >> For my game Nomyx, I am using events that the player can program. For >> example, the player can register a callback that will be triggered when a >> new player arrives. He can also program some forms (with buttons, >> checkboxes, textboxes...) to appear on the Web GUI. The problem is those >> events are not composable: he has to create and handle them one by one. >> >> So I'm thinking of making those events composable by making them an >> instance of Applicative and Alternative. >> For Applicative, this makes events composable very much like in >> Applicative-Functors and Reform. I can build neat composed events such as >> (full program below): >> >> onInputMyRecord :: Event MyRecord >> onInputMyRecord = MyRecord <$> onInputText <*> onInputCheckbox >> >> For Alternative, I haven't seen any example of it on the net. The idea >> is that the first event that fires is used to build the alternative: >> >> onInputMyAlternative :: Event Bool >> onInputMyAlternative = (True <$ onInputButton) <|> (False <$ >> onInputButton) >> >> Here is an example program: >> >> {-# LANGUAGE GADTs #-} >> >> module ComposableEvents where >> >> import Control.Applicative >> import Data.Time >> import Data.Traversable >> >> type PlayerNumber = Int >> >> data Event a where >> OnInputText :: PlayerNumber -> Event String -- A textbox >> will be created for the player. When filled, this event will fire and >> return the result >> OnInputCheckbox :: PlayerNumber -> Event Bool -- Idem with a >> checkbox >> OnInputButton :: PlayerNumber -> Event () -- Idem with a >> button >> OnTime :: UTCTime -> Event () -- time event >> EventSum :: Event a -> Event a -> Event a -- The first >> event to fire will be returned >> EventProduct :: Event (a -> b) -> Event a -> Event b -- both events >> should fire, and then the result is returned >> Fmap :: (a -> b) -> Event a -> Event b -- transforms >> the value returned by an event. >> Pure :: a -> Event a -- Create a fake >> event. The result is useable with no delay. >> Empty :: Event a -- An event that >> is never fired. >> >> instance Functor Event where >> fmap = Fmap >> >> instance Applicative Event where >> pure = Pure >> (<*>) = EventProduct >> >> instance Alternative Event where >> (<|>) = EventSum >> empty = Empty >> >> onInputText = OnInputText >> onInputCheckbox = OnInputCheckbox >> onInputButton = OnInputButton >> onTime = OnTime >> >> -- A product type >> data MyRecord = MyRecord String Bool >> >> -- A sum type >> data MyAlternative = A | B >> >> -- Using the Applicative instance, we can build a product type from two >> separate event results. >> -- The event callback should be called only when all two events have >> fired. >> onInputMyRecord :: Event MyRecord >> onInputMyRecord = MyRecord <$> onInputText 1 <*> onInputCheckbox 1 >> >> -- other possible implementation (given a monad instance) >> -- onInputMyRecord' = do >> -- s <- onInputText >> -- b <- onInputCheckbox >> -- return $ MyRecord s b >> >> -- Using the Alternative instance, we build a sum type. >> -- The event callback should be called when the first event have fired. >> onInputMyAlternative :: Event MyAlternative >> onInputMyAlternative = (const A <$> onInputButton 1) <|> (const B <$> >> onInputButton 1) >> >> allPlayers = [1 .. 10] >> >> -- Now complex events can be created, such as voting systems: >> voteEvent :: UTCTime -> Event ([Maybe Bool]) >> voteEvent time = sequenceA $ map (singleVote time) allPlayers >> >> singleVote :: UTCTime -> PlayerNumber -> Event (Maybe Bool) >> singleVote timeLimit pn = (Just <$> onInputCheckbox pn) <|> (const >> Nothing <$> onTime timeLimit) >> >> vote :: UTCTime -> Event Bool >> vote timeLimit = unanimity <$> (voteEvent timeLimit) >> >> unanimity :: [Maybe Bool] -> Bool >> unanimity = all (== Just True) >> >> >> --Evaluation >> --evalEvent :: Event a -> State Game a >> --evalEvent = undefined >> >> With this DSL, I can create complex events such as time limited votes >> very neatly... >> There is much left to do for a full implem: the way to register callbacks >> on complex events, the evaluator and the event manager. >> Have you heard about a similar implementation? It seems pretty useful. >> Maybe in FRP frameworks? >> >> Thanks a lot!! >> Corentin >> PS: I copied this example also in >> https://github.com/cdupont/Nomyx-design/blob/master/ComposableEvents.hs. >> > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From corentin.dupont at gmail.com Fri May 16 20:01:20 2014 From: corentin.dupont at gmail.com (Corentin Dupont) Date: Fri, 16 May 2014 22:01:20 +0200 Subject: [Haskell-cafe] Fwd: Composable events: Applicative and Alternative In-Reply-To: References: Message-ID: It seems that a Behavior in Reactive-Banana is an applicative: http://hackage.haskell.org/package/reactive-banana-0.8.0.0/docs/Reactive-Banana-Combinators.html But not an Alternative, why? It seems useful to return the value of an event or another, depending on which fires first. What I want to do, is to use the Event tree for two distinct purposes: - represent the events relation, and display the necessary widgets, - store the intermediate values (in case some events already fired but not all) Does that seem reasonnable? I don't know if Reactive Banana does the second point. On Fri, May 16, 2014 at 9:28 PM, Tikhon Jelvis wrote: > Oops, forgot to include the list. > > > ---------- Forwarded message ---------- > From: Tikhon Jelvis > Date: Fri, May 16, 2014 at 12:27 PM > Subject: Re: [Haskell-cafe] Composable events: Applicative and Alternative > To: Corentin Dupont > > > It sounds like you're trying to solve the same problems as FRP. In fact, > this was basically the original impetus for FRP: making events (and > reactive programs in general) nicely composable. > > Perhaps you could take a look at how event streams work in frameworks like > Reactive-Banana? Reactive-Banana doesn't make its events applicatives, but > it's a perfectly reasonable thing to do: there's a great explanation in > Conal's "Push-Pull Functional Reactive Programming"[1] in section 2.2.4. > > > On Fri, May 16, 2014 at 12:15 PM, Corentin Dupont < > corentin.dupont at gmail.com> wrote: > >> >> I created a DSL to manage and create events (see under). It's an instance >> of Applicative and Alternative, which make them compose nicely. >> The idea is that when an event is firing, I look the corresponding event >> in the tree and replace it by its value using Pure. >> >> For example onInputText will trigger the display of a form with a text >> field on the screen, and when the player validates the form, the same >> onInputText is searched in the tree by the engine and replaced by the >> text value. This is where the difficulty begins: >> >> --> How to make Event an instance of Eq? How to search and replace >> through it? >> >> The problem is the EventProduct primitive, that forbids to make the DSL >> an instance of Eq: >> EventProduct :: Event (a -> b) -> Event a -> Event b >> >> Should I replace it by: >> EventProduct :: Event a -> Event b -> Event (a,b) >> >> But then, bye-bye Applicative/Alternative instances! >> How can I make the tree of events searchable/traversable and still >> maintain the Applicative instance? >> >> Thanks!! >> Corentin >> >> >> On Sat, May 3, 2014 at 8:02 PM, Corentin Dupont < >> corentin.dupont at gmail.com> wrote: >> >>> Hi Cafe!! >>> >>> For my game Nomyx, I am using events that the player can program. For >>> example, the player can register a callback that will be triggered when a >>> new player arrives. He can also program some forms (with buttons, >>> checkboxes, textboxes...) to appear on the Web GUI. The problem is >>> those events are not composable: he has to create and handle them one by >>> one. >>> >>> So I'm thinking of making those events composable by making them an >>> instance of Applicative and Alternative. >>> For Applicative, this makes events composable very much like in >>> Applicative-Functors and Reform. I can build neat composed events such as >>> (full program below): >>> >>> onInputMyRecord :: Event MyRecord >>> onInputMyRecord = MyRecord <$> onInputText <*> onInputCheckbox >>> >>> For Alternative, I haven't seen any example of it on the net. The idea >>> is that the first event that fires is used to build the alternative: >>> >>> onInputMyAlternative :: Event Bool >>> onInputMyAlternative = (True <$ onInputButton) <|> (False <$ >>> onInputButton) >>> >>> Here is an example program: >>> >>> {-# LANGUAGE GADTs #-} >>> >>> module ComposableEvents where >>> >>> import Control.Applicative >>> import Data.Time >>> import Data.Traversable >>> >>> type PlayerNumber = Int >>> >>> data Event a where >>> OnInputText :: PlayerNumber -> Event String -- A textbox >>> will be created for the player. When filled, this event will fire and >>> return the result >>> OnInputCheckbox :: PlayerNumber -> Event Bool -- Idem with a >>> checkbox >>> OnInputButton :: PlayerNumber -> Event () -- Idem with a >>> button >>> OnTime :: UTCTime -> Event () -- time event >>> EventSum :: Event a -> Event a -> Event a -- The first >>> event to fire will be returned >>> EventProduct :: Event (a -> b) -> Event a -> Event b -- both events >>> should fire, and then the result is returned >>> Fmap :: (a -> b) -> Event a -> Event b -- transforms >>> the value returned by an event. >>> Pure :: a -> Event a -- Create a >>> fake event. The result is useable with no delay. >>> Empty :: Event a -- An event >>> that is never fired. >>> >>> instance Functor Event where >>> fmap = Fmap >>> >>> instance Applicative Event where >>> pure = Pure >>> (<*>) = EventProduct >>> >>> instance Alternative Event where >>> (<|>) = EventSum >>> empty = Empty >>> >>> onInputText = OnInputText >>> onInputCheckbox = OnInputCheckbox >>> onInputButton = OnInputButton >>> onTime = OnTime >>> >>> -- A product type >>> data MyRecord = MyRecord String Bool >>> >>> -- A sum type >>> data MyAlternative = A | B >>> >>> -- Using the Applicative instance, we can build a product type from two >>> separate event results. >>> -- The event callback should be called only when all two events have >>> fired. >>> onInputMyRecord :: Event MyRecord >>> onInputMyRecord = MyRecord <$> onInputText 1 <*> onInputCheckbox 1 >>> >>> -- other possible implementation (given a monad instance) >>> -- onInputMyRecord' = do >>> -- s <- onInputText >>> -- b <- onInputCheckbox >>> -- return $ MyRecord s b >>> >>> -- Using the Alternative instance, we build a sum type. >>> -- The event callback should be called when the first event have fired. >>> onInputMyAlternative :: Event MyAlternative >>> onInputMyAlternative = (const A <$> onInputButton 1) <|> (const B <$> >>> onInputButton 1) >>> >>> allPlayers = [1 .. 10] >>> >>> -- Now complex events can be created, such as voting systems: >>> voteEvent :: UTCTime -> Event ([Maybe Bool]) >>> voteEvent time = sequenceA $ map (singleVote time) allPlayers >>> >>> singleVote :: UTCTime -> PlayerNumber -> Event (Maybe Bool) >>> singleVote timeLimit pn = (Just <$> onInputCheckbox pn) <|> (const >>> Nothing <$> onTime timeLimit) >>> >>> vote :: UTCTime -> Event Bool >>> vote timeLimit = unanimity <$> (voteEvent timeLimit) >>> >>> unanimity :: [Maybe Bool] -> Bool >>> unanimity = all (== Just True) >>> >>> >>> --Evaluation >>> --evalEvent :: Event a -> State Game a >>> --evalEvent = undefined >>> >>> With this DSL, I can create complex events such as time limited votes >>> very neatly... >>> There is much left to do for a full implem: the way to register >>> callbacks on complex events, the evaluator and the event manager. >>> Have you heard about a similar implementation? It seems pretty useful. >>> Maybe in FRP frameworks? >>> >>> Thanks a lot!! >>> Corentin >>> PS: I copied this example also in >>> https://github.com/cdupont/Nomyx-design/blob/master/ComposableEvents.hs. >>> >> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> >> > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tikhon at jelv.is Fri May 16 20:10:08 2014 From: tikhon at jelv.is (Tikhon Jelvis) Date: Fri, 16 May 2014 13:10:08 -0700 Subject: [Haskell-cafe] Fwd: Composable events: Applicative and Alternative In-Reply-To: References: Message-ID: Behaviors represent values like the mouse position which can change continuously, not events. Ideally, the way behaviors actually change falls below your level of abstraction, so operations which expose event-like semantics do not really fit. Reactive banana event streams have union, which sounds like the alternative behavior you want. However, I don't think they implement the applicative behavior of waiting for both, which is why they're just functors. I think you're best off just skimming the paper I linked, which does a good job of clearly explaining the core ideas and talks about reasonable functor/monad/applicative instances for streams of events. On May 16, 2014 1:01 PM, "Corentin Dupont" wrote: > It seems that a Behavior in Reactive-Banana is an applicative: > > http://hackage.haskell.org/package/reactive-banana-0.8.0.0/docs/Reactive-Banana-Combinators.html > > But not an Alternative, why? It seems useful to return the value of an > event or another, depending on which fires first. > > What I want to do, is to use the Event tree for two distinct purposes: > - represent the events relation, and display the necessary widgets, > - store the intermediate values (in case some events already fired but not > all) > > Does that seem reasonnable? I don't know if Reactive Banana does the > second point. > > > On Fri, May 16, 2014 at 9:28 PM, Tikhon Jelvis wrote: > >> Oops, forgot to include the list. >> >> >> ---------- Forwarded message ---------- >> From: Tikhon Jelvis >> Date: Fri, May 16, 2014 at 12:27 PM >> Subject: Re: [Haskell-cafe] Composable events: Applicative and Alternative >> To: Corentin Dupont >> >> >> It sounds like you're trying to solve the same problems as FRP. In fact, >> this was basically the original impetus for FRP: making events (and >> reactive programs in general) nicely composable. >> >> Perhaps you could take a look at how event streams work in frameworks >> like Reactive-Banana? Reactive-Banana doesn't make its events applicatives, >> but it's a perfectly reasonable thing to do: there's a great explanation in >> Conal's "Push-Pull Functional Reactive Programming"[1] in section 2.2.4. >> >> >> On Fri, May 16, 2014 at 12:15 PM, Corentin Dupont < >> corentin.dupont at gmail.com> wrote: >> >>> >>> I created a DSL to manage and create events (see under). It's an >>> instance of Applicative and Alternative, which make them compose nicely. >>> The idea is that when an event is firing, I look the corresponding event >>> in the tree and replace it by its value using Pure. >>> >>> For example onInputText will trigger the display of a form with a text >>> field on the screen, and when the player validates the form, the same >>> onInputText is searched in the tree by the engine and replaced by the >>> text value. This is where the difficulty begins: >>> >>> --> How to make Event an instance of Eq? How to search and replace >>> through it? >>> >>> The problem is the EventProduct primitive, that forbids to make the DSL >>> an instance of Eq: >>> EventProduct :: Event (a -> b) -> Event a -> Event b >>> >>> Should I replace it by: >>> EventProduct :: Event a -> Event b -> Event (a,b) >>> >>> But then, bye-bye Applicative/Alternative instances! >>> How can I make the tree of events searchable/traversable and still >>> maintain the Applicative instance? >>> >>> Thanks!! >>> Corentin >>> >>> >>> On Sat, May 3, 2014 at 8:02 PM, Corentin Dupont < >>> corentin.dupont at gmail.com> wrote: >>> >>>> Hi Cafe!! >>>> >>>> For my game Nomyx, I am using events that the player can program. For >>>> example, the player can register a callback that will be triggered when a >>>> new player arrives. He can also program some forms (with buttons, >>>> checkboxes, textboxes...) to appear on the Web GUI. The problem is >>>> those events are not composable: he has to create and handle them one by >>>> one. >>>> >>>> So I'm thinking of making those events composable by making them an >>>> instance of Applicative and Alternative. >>>> For Applicative, this makes events composable very much like in >>>> Applicative-Functors and Reform. I can build neat composed events such as >>>> (full program below): >>>> >>>> onInputMyRecord :: Event MyRecord >>>> onInputMyRecord = MyRecord <$> onInputText <*> onInputCheckbox >>>> >>>> For Alternative, I haven't seen any example of it on the net. The idea >>>> is that the first event that fires is used to build the alternative: >>>> >>>> onInputMyAlternative :: Event Bool >>>> onInputMyAlternative = (True <$ onInputButton) <|> (False <$ >>>> onInputButton) >>>> >>>> Here is an example program: >>>> >>>> {-# LANGUAGE GADTs #-} >>>> >>>> module ComposableEvents where >>>> >>>> import Control.Applicative >>>> import Data.Time >>>> import Data.Traversable >>>> >>>> type PlayerNumber = Int >>>> >>>> data Event a where >>>> OnInputText :: PlayerNumber -> Event String -- A textbox >>>> will be created for the player. When filled, this event will fire and >>>> return the result >>>> OnInputCheckbox :: PlayerNumber -> Event Bool -- Idem with >>>> a checkbox >>>> OnInputButton :: PlayerNumber -> Event () -- Idem with >>>> a button >>>> OnTime :: UTCTime -> Event () -- time event >>>> EventSum :: Event a -> Event a -> Event a -- The first >>>> event to fire will be returned >>>> EventProduct :: Event (a -> b) -> Event a -> Event b -- both events >>>> should fire, and then the result is returned >>>> Fmap :: (a -> b) -> Event a -> Event b -- transforms >>>> the value returned by an event. >>>> Pure :: a -> Event a -- Create a >>>> fake event. The result is useable with no delay. >>>> Empty :: Event a -- An event >>>> that is never fired. >>>> >>>> instance Functor Event where >>>> fmap = Fmap >>>> >>>> instance Applicative Event where >>>> pure = Pure >>>> (<*>) = EventProduct >>>> >>>> instance Alternative Event where >>>> (<|>) = EventSum >>>> empty = Empty >>>> >>>> onInputText = OnInputText >>>> onInputCheckbox = OnInputCheckbox >>>> onInputButton = OnInputButton >>>> onTime = OnTime >>>> >>>> -- A product type >>>> data MyRecord = MyRecord String Bool >>>> >>>> -- A sum type >>>> data MyAlternative = A | B >>>> >>>> -- Using the Applicative instance, we can build a product type from two >>>> separate event results. >>>> -- The event callback should be called only when all two events have >>>> fired. >>>> onInputMyRecord :: Event MyRecord >>>> onInputMyRecord = MyRecord <$> onInputText 1 <*> onInputCheckbox 1 >>>> >>>> -- other possible implementation (given a monad instance) >>>> -- onInputMyRecord' = do >>>> -- s <- onInputText >>>> -- b <- onInputCheckbox >>>> -- return $ MyRecord s b >>>> >>>> -- Using the Alternative instance, we build a sum type. >>>> -- The event callback should be called when the first event have fired. >>>> onInputMyAlternative :: Event MyAlternative >>>> onInputMyAlternative = (const A <$> onInputButton 1) <|> (const B <$> >>>> onInputButton 1) >>>> >>>> allPlayers = [1 .. 10] >>>> >>>> -- Now complex events can be created, such as voting systems: >>>> voteEvent :: UTCTime -> Event ([Maybe Bool]) >>>> voteEvent time = sequenceA $ map (singleVote time) allPlayers >>>> >>>> singleVote :: UTCTime -> PlayerNumber -> Event (Maybe Bool) >>>> singleVote timeLimit pn = (Just <$> onInputCheckbox pn) <|> (const >>>> Nothing <$> onTime timeLimit) >>>> >>>> vote :: UTCTime -> Event Bool >>>> vote timeLimit = unanimity <$> (voteEvent timeLimit) >>>> >>>> unanimity :: [Maybe Bool] -> Bool >>>> unanimity = all (== Just True) >>>> >>>> >>>> --Evaluation >>>> --evalEvent :: Event a -> State Game a >>>> --evalEvent = undefined >>>> >>>> With this DSL, I can create complex events such as time limited votes >>>> very neatly... >>>> There is much left to do for a full implem: the way to register >>>> callbacks on complex events, the evaluator and the event manager. >>>> Have you heard about a similar implementation? It seems pretty useful. >>>> Maybe in FRP frameworks? >>>> >>>> Thanks a lot!! >>>> Corentin >>>> PS: I copied this example also in >>>> https://github.com/cdupont/Nomyx-design/blob/master/ComposableEvents.hs >>>> . >>>> >>> >>> >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://www.haskell.org/mailman/listinfo/haskell-cafe >>> >>> >> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> >> > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From malcolm.wallace at me.com Fri May 16 20:21:21 2014 From: malcolm.wallace at me.com (Malcolm Wallace) Date: Fri, 16 May 2014 21:21:21 +0100 Subject: [Haskell-cafe] Parent Modules: Common Functions or Re-Exportation? In-Reply-To: <53764737.9080301@gmail.com> References: <53764737.9080301@gmail.com> Message-ID: <1C7DBCD5-B496-4123-96E3-2518E153A5B0@me.com> On 16 May 2014, at 18:13, Sacha Sokoloski wrote: > So as a relatively long term user of haskell at this point, one issue which I've never found a simple solution to is the one stated in the thread. That is, given modules Foo, Foo.Bar, and Foo.Baz, should Foo reexport Bar and Baz, or should Foo provide common functions for Bar and Baz? The way we tend to organise things at my workplace, we have Foo.Internal -- datatypes, implementation details Foo.Bar -- Bar-like utilities over Foo Foo.Quux -- Quux-like utilities over Quux Foo -- some useful subset of the above, hiding the implementation details For instance, often the datatypes will be exported in full from Foo.Internal, but abstractly from Foo. The real constructors and fieldnames can be used from Foo.Bar and Foo.Quux, but not externally. We actually use home-grown compiler restrictions, to ensure that Foo.Internal can only be imported from other modules under the Foo tree, so that the details do not leak. Regards, Malcolm From icfp.publicity at googlemail.com Fri May 16 20:29:18 2014 From: icfp.publicity at googlemail.com (David Van Horn) Date: Fri, 16 May 2014 16:29:18 -0400 Subject: [Haskell-cafe] ICFP 2014 Student Research Competition: Call for Submissions Message-ID: ====================================================================== CALL FOR SUBMISSION SRC at ICFP 2014 Gothenburg, Sweden 1-3 September 2014 http://www.icfpconference.org/icfp2014/src.html Co-located with the International Conference on Functional Programming (ICFP 2014) ====================================================================== Student Research Competition ------------------------ This year ICFP will host a Student Research Competition where undergraduate and postgraduate students can present posters. The SRC at the ICFP 2014 consists of three rounds: Extended abstract round: All students are encouraged to submit an extended abstract outlining their research (800 words). Poster session at ICFP 2014: Based on the abstracts, a panel of judges will select the most promising entrants to participate in the poster session which will take place at ICFP. Students who make it to this round will be eligible for some travel support to attend the conference. In the poster session, students will have the opportunity to present their work to the judges, who will select three finalists in each category* (graduate/undergraduate) to advance to the next round. ICFP presentation: The last round will consist of an oral presentation at the ICFP to compete for the final awards in each category. Prizes ----- * Both the top three graduate and the top three undergraduate winners will receive prizes of $500, $300, and $200, respectively. * All six winners will receive award medals and a two-year complimentary ACM student membership, including a subscription to ACM???s Digital Library. * The names of the winners will be posted on the SRC web site. * The overall first place winner of the SRC will be invited to participate in the ACM SRC Grand Finals, an on-line round of competitions among the winners of other conference-hosted SRCs. * Grand Finalists and their advisors will be invited to the Annual ACM Awards Banquet for an all-expenses-paid trip, where they will be recognized for their accomplishments along with other prestigious ACM award winners, including the winner of the Turing Award (also known as the Nobel Prize of Computing). * The top three graduate Grand Finalists will receive an additional $500, $300, and $200. Likewise, the top three undergraduate Grand Finalists will receive an additional $500, $300, and $200. All six Grand Finalists will receive Grand Finalist certificates. * The ACM, Microsoft Research, and our industrial partners provide financial support for students attending the SRC. You can find more information about this on the ACM website. Eligibility -------- The SRC is open to both undergraduate (not in a PhD programme) and graduate students (in a PhD programme). Upon submission, entrants must be enrolled as a student at their universities, and are ACM student members. Furthermore, there are some constraints on what kind of work may be submitted. Previously published work: Submissions should consist of original work (not yet accepted for publication). If the work is a continuation of previously published work, the submission should focus on the contribution over what has already been published. We encourage students to see this as an opportunity to get early feedback and exposure for the work they plan to submit to the next ICFP or POPL. Collaborative work: Students are encouraged to submit work they have been conducting in collaboration with others, including advisors, internship mentors, or other students. However, submissions are individual, so they must focus on the contributions of the student. Submission Details --------------- Each submission should include the student author???s name, institutional affiliation, e-mail address, and postal address; research advisor???s name; ACM student member number; category (undergraduate or graduate); research title; and an extended abstract addressing the following: * Problem and Motivation: Clearly state the problem being addressed and explain the reasons for seeking a solution to this problem. * Background and Related Work: Describe the specialized (but pertinent) background necessary to appreciate the work. Include references to the literature where appropriate, and briefly explain where your work departs from that done by others. * Approach and Uniqueness: Describe your approach in attacking the problem and clearly state how your approach is novel. * Results and Contributions: Clearly show how the results of your work contribute to computer science and explain the significance of those results. The abstract must describe the student???s individual research and must be authored solely by the student. If the work is collaborative with others and/or part of a larger group project, the abstract should make clear what the student???s role was and should focus on that portion of the work. The extended abstract must not exceed 800 words and must not be longer than 2 pages. The reference list does not count towards these limits. To submit an abstract, please register through the submission page and follow the instructions. Abstracts submitted after the deadline may be considered at the committee's discretion, but only after decisions have been made on all abstracts submitted before the deadline. If you have any problems, don't hesitate to contact the competition chair. Important Dates ------------- * Deadline for submission: 29 June * Notification of acceptance: 14 July Selection Committee ---------------- Jeremy Gibbons, University of Oxford Andrew Kennedy, Microsoft Research Cambridge Matthieu Sozeau, INRIA Paris Sam Tobin-Hochstadt, Indiana University Meng Wang, Chalmers University of Technology (Chair) Stephanie Weirich, University of Pennsylvania Transport of your poster ------------------- You can either bring your poster on your own to the conference or mail it to the local organizers: Attn.: Meng Wang Chalmers University of Technology Department of Computer Science and Engineering SE-412 96 G?teborg, Sweden If you choose to mail, please make sure that the poster will arrive at the latest on 30th August 2014. From benno.fuenfstueck at gmail.com Fri May 16 21:44:38 2014 From: benno.fuenfstueck at gmail.com (=?UTF-8?B?QmVubm8gRsO8bmZzdMO8Y2s=?=) Date: Fri, 16 May 2014 23:44:38 +0200 Subject: [Haskell-cafe] Eager forking on Hackage and inter-library compatibility (was: Re: possible bug in latest hackage Elf (Elf-0.27)) In-Reply-To: References: <20140515073052.GA23472@sniper> <1400232463.28725.28.camel@chi.nicolast.be> Message-ID: I think the problem is that it's impossible to depend on URLs. This means that the package will not be installable using just `cabal install `, but instead, an user would have to know that he first needs to install a patched version of `foo` before he can use ``. 2014-05-16 18:00 GMT+02:00 Carter Schonwald : > You can totally cabal install from a URL. > > A good example of this Johan shared a URL pointing to a Tarball when he > wanted testers befor he released an update to cabal and cabal install. > > It's really easy. Cabal sdist the project as per usual, but instead put > it somewhere online where it has a URL. Then cabal install URL. This > actually works. > > > On Friday, May 16, 2014, Ivan Lazar Miljenovic > wrote: > >> On 16 May 2014 21:10, Tomas Carnecky wrote: >> > Teach cabal how to install packages from a URL or even a git >> > repository, like go or npm can. Then people can upload the patched >> > project to (or even fork on) github/bitbucket/.. and let others know >> > so they can update their cabal file. >> >> How does that solve anything? You still end up potentially needing >> multiple different forks of a package! >> >> > >> > On Fri, May 16, 2014 at 12:26 PM, Markus L?ll >> wrote: >> >> I now see what you mean and you are totally right. >> >> >> >> I guess what people are craving for, is a seamless solution to fix the >> >> problem quick, and have it be public right away to yourself and others >> who >> >> need it. Maybe this is material for a later discussion, but as just a >> >> thought, maybe the eager ones could manage an eager hackage to host >> their >> >> changes (a private hackage has been mentioned before). More work >> upfront, >> >> but might be worth it in the end. >> >> >> >> >> >> >> >> >> >> On Fri, May 16, 2014 at 11:27 AM, Nicolas Trangez < >> nicolas at incubaid.com> >> >> wrote: >> >>> >> >>> On Fri, 2014-05-16 at 11:04 +0200, Markus L?ll wrote: >> >>> > I would argue *for* forking. Hackage is big and consists of many >> >>> > packages >> >>> > which have only a few users, or maybe just one -- the author. I >> don't >> >>> > see >> >>> > all these packages if I don't go on the page and look. But when I >> do, I >> >>> > will be looking for *them*. If some popular package stops working >> then I >> >>> > would be happy to find a fork, because now I can just tell cabal >> about >> >>> > it. >> >>> > And if the original gets fixed, I can go back. I don't think people >> who >> >>> > fork are looking for aquiring yet another package to maintain >> forever, >> >>> > or >> >>> > to take it over. >> >>> >> >>> tl;dr: Eagerly forking is all nice and shiny for 'leaf' packages which >> >>> don't expose common functionality, but causes troubles for packages >> >>> which are common library dependencies. >> >>> >> >>> Doesn't this cause issues with library interoperability? >> >>> >> >>> Say there's a package which implements some standard datatype, e.g. >> >>> 'vector' by author V. Then there are 2 other packages, >> >>> 'vector-algorithms' by author A and 'complex-vector-algorithms' by >> >>> author C. >> >>> >> >>> 'vector' exports a datatype 'Vector'. >> >>> 'vector-algorithms' exports a function 'a :: Int -> Vector'. >> >>> 'complex-vector-algorithms' exports a function 'c :: Vector -> Float'. >> >>> >> >>> Finally, there's the application author who wrote the function >> >>> 'ingeniousCalculation :: Int -> Float; ingeniousCalculation = c . a' >> >>> >> >>> Now, the author of C finds an obscure bug in some function in 'vector' >> >>> he uses (caused by a bug in some internal 'vector' function which >> >>> requires access to non-exported internals of the Vector type), and >> sends >> >>> a patch to V. This bug doesn't impact 'vector-algorithms' in any way. >> >>> >> >>> V doesn't reply within 48 hours, so C impatiently uploads 'vector-c' >> to >> >>> Hackage, containing the fix, and updates the >> 'complex-vector'algorithms' >> >>> dependencies from 'vector' to 'vector-c' (with whatever version >> >>> constraint). >> >>> >> >>> At this point, the code by the application author breaks since >> >>> 'vector-algorithms' uses 'Vector' from the 'vector' package, and >> >>> 'complex-vector-algorithms' uses 'Vector' from 'vector-c', which are >> >>> different types from a compiler perspective. >> >>> >> >>> I see 3 solutions: >> >>> - 'vector-algorithms' needs to be updated by A to use 'vector-c', >> >>> something to which A might be reluctant since it could break lots of >> >>> code using 'vector-algorithms' in combination with other libraries and >> >>> applications using 'vector'. >> >>> - The application author needs to patch 'vector-algorithms' locally to >> >>> use 'vector-c'. >> >>> - The application author patches 'vector' locally to fix the bug >> >>> (something V wil most likely do in a couple of days) and reverts the >> >>> dependency of 'complex-vector-algorithms' from 'vector-c' back to >> >>> 'vector'. >> >>> >> >>> None of these seem very satisfactory. >> >>> >> >>> So, whilst forking (in this case) provides a very 'local' solution for >> >>> the 'complex-vector-algorithms' package and C, it doesn't fix anything >> >>> (I'd even-- >> >> Ivan Lazar Miljenovic >> Ivan.Miljenovic at gmail.com >> http://IvanMiljenovic.wordpress.com >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From k at ioctl.it Fri May 16 23:44:11 2014 From: k at ioctl.it (Karsten Gebbert) Date: Sat, 17 May 2014 01:44:11 +0200 Subject: [Haskell-cafe] System.Process and -threaded Message-ID: <20140516234411.13635.52813@localhost> Hello, I'm writing a little networking wrapper around a sub-process (mplayer -idle -slave) and I'm running into some issues with the System.Process API. This is the program: > module Main where > > import System.IO > import System.Process > import Network.Socket hiding (recv) > import Network.Socket.ByteString > import Control.Concurrent > import qualified Data.ByteString.Char8 as C > > -- WARNING: when compiled with -threaded, this program is likely not going > -- to work. As soon as one writes to the stdin of the forked process, it > -- zombifies and any other command with crash this program. > > main = withSocketsDo $ do > -- network stuff > addrinfos <- getAddrInfo Nothing (Just "localhost") (Just "4000") > let serveraddr = head addrinfos > sock <- socket (addrFamily serveraddr) Stream defaultProtocol > bindSocket sock (addrAddress serveraddr) > listen sock 1 > > -- mplayer > (hand,o,e,pid) <- runInteractiveProcess "mplayer" ["-fs", "-idle", "-slave"] Nothing Nothing > hSetBinaryMode hand False > hSetBuffering hand LineBuffering > > putStrLn "listening for commands" > loop sock hand > > -- closing everything down > sClose sock > terminateProcess pid > waitForProcess pid > return () > > loop sock hand = do > (conn, _) <- accept sock > str <- recv conn 2048 > > putStr $ "received: " ++ C.unpack str > > -- write command to handler > hPutStr hand $ C.unpack str > > sClose conn > loop sock hand When compile with -threaded, the mplayer process gets zombified and hangs until I shut down the program. When compiled with non-threaded RTS (thats whats its called, correct?) I can successfully send a few commands, but then mplayer freezes. When I strace mplayer, this error is what it gets stuck on. ioctl(0, TIOCGWINSZ, 0x7fff2897a070) = -1 ENOTTY (Inappropriate ioctl for device) Apparently that means I'm trying to communicate with it as though it were a type writer. How fitting :) The commands are all simple strings as docs here: http://www.mplayerhq.hu/DOCS/tech/slave.txt My questions are these: is there anything I need to take care of when handling sub-processes like this, specifically while writing to stdin of the process, and with particular regard to -threaded? Does anybody spot a problem or something I'm overlooking when handling processes like this? I have been reading the API docs, but found no mention of potential caveats pertaining to -threaded. Thanks! k ? k at ioctl.it ? +49(0)176 / 61995110 From komendantskaya at gmail.com Sat May 17 08:38:36 2014 From: komendantskaya at gmail.com (Ekaterina Komendantskaya) Date: Sat, 17 May 2014 09:38:36 +0100 Subject: [Haskell-cafe] Research position "Coalgebraic Logic Programming for Type Inference" Message-ID: We have a fixed-term position at the School of Computing, Dundee for a postdoctoral researcher to work on the project Coalgebraic Logic Programming for Type Inference: a new generation of languages for parallelism and corecursion. More details are available below and at http://staff.computing.dundee.ac.uk/katya/CoALP/ For further inquiries please email me: Katya Komendantskaya School of Computing University of Dundee Postdoctoral Researcher in Coalgebraic Logic Programming for Type Inference Fixed-term position for 2 years (extension possible). Start date: between 1 July 2014 and 1 October 2014; Salary scale: between ?29,837 and ?33,5562 per annum. Closing Date for applications: 16 June 2014. The School of Computing at the University of Dundee invites applications for a postdoctoral researcher to work on an interdisciplinary project "Coalgebraic Logic Programming for type inference: a new generation of languages for parallelism and corecursion" ( http://staff.computing.dundee.ac.uk/katya/CoALP/). The project spans several subjects, among which are: - -- Computational Logic, - -- (Coalgebraic) Operational semantics, - -- Functional Programming; - -- Logic Programming, - -- Recursion and Corecursion in Programming languages; -- Category Theory, - -- Type Theory; - -- Compilers - -- Parallelism and Concurrency The project is jointly led by Dr E.Komendantskaya, University of Dundee and Dr J.Power, University of Bath. We are looking for a researcher to spend up to 29 months in the Dundee team developing CoALP-based type inference. This will involve close collaboration with the existing group members, as well as interaction with the project partners. Research experience of at least a PhD level in computer science or mathematics is essential, as is some knowledge of either functional programming or automated/interactive theorem provers. ************************************** Project description: The main goal of typing is to prevent the occurrence of execution errors during the running of a program. Milner formalised the idea, showing that ``well-typed programs cannot go wrong''. In practice, type structures provide a fundamental technique of reducing programmer errors. At their strongest, they cover most of the properties of interest to the verification community. A major trend in the development of functional languages is improvement in expressiveness of the underlying type system, e.g., in terms of Dependent Types, Type Classes, Generalised Algebraic Types (GADTs), Dependent Type Classes and Canonical Structures. Milner-style decidable type inference does not always suffice for such extensions (e.g. the principal type may no longer exist), and deciding well-typedness sometimes requires computation additional to compile-time type inference. Implementations of new type inference algorithms include a variety of first-order decision procedures, notably Unification and Logic Programming (LP), Constraint LP, LP embedded into interactive tactics (Coq's eauto), and LP supplemented by rewriting. A second major trend is parallelism: the absence of side-effects makes it easy to evaluate sub-expressions in parallel. Powerful abstraction mechanisms of function composition and higher-order functions play important roles in parallelisation. Three major parallel languages are Eden (explicit parallelism), Parallel ML (implicit parallelism) and Glasgow parallel Haskell (semi-explicit parallelism). Control parallelism in particular distinguishes functional languages. Type inference becomes more sophisticated and takes a bigger role in the overall program development. In this project, we have devloped a new dialect of logic programming -- Coalgebraic Logic Programming (CoALP) that features both extra expressiveness (via corecursion) and parallelism in one algorithm. We propose to use CoALP in place of LP tools currently used in type inference. With the mentioned major developments in Corecursion, Parallelism, and Typeful (functional) programming it has become vital for these disjoint communities to combine their efforts: enriched type theories rely more and more on the new generation of LP languages; coalgebraic semantics has become influential in language design; and parallel dialects of languages have huge potential in applying common techniques across the FP/LP programming paradigm. This project is unique in bringing together local and international collaborators working in the three communities. See http://staff.computing.dundee.ac.uk/katya/CoALP/ for more details. *************************************************************** Ekaterina Komendantskaya Senior Lecturer, Head of PhD Studies Room 1.04, Queen Mother Building School of Computing, University of Dundee Scotland, DD14HN Tel: (+44) 01382384820 -------------- next part -------------- An HTML attachment was scrubbed... URL: From donn at avvanta.com Sat May 17 14:04:50 2014 From: donn at avvanta.com (Donn Cave) Date: Sat, 17 May 2014 07:04:50 -0700 (PDT) Subject: [Haskell-cafe] System.Process and -threaded In-Reply-To: <20140516234411.13635.52813@localhost> References: <20140516234411.13635.52813@localhost> Message-ID: <20140517140450.6193D93C2E@mail.avvanta.com> quoth Karsten Gebbert, ... > My questions are these: is there anything I need to take care of when > handling sub-processes like this, specifically while writing to stdin of > the process, and with particular regard to -threaded? Does anybody spot > a problem or something I'm overlooking when handling processes like this? I can't say I know what's going wrong. One thing you can do when using handles on a pipe, is put "hFlush hand" after your "hPutStr hand" - that will clean up problems with buffering. Really a process level buffered I/O layer like this is very little help for your application, and adds various complexities. If you're interested, you might extract the process handles' POSIX file descriptors and use those - System.Posix.IO handleToFd, fdWrite, etc. - just as an experiment. I don't see how the problems you report really suggest that you have a buffering problem that would naturally be cured by this, though. The other generic red flag here, for -threaded, is that the threaded runtime uses POSIX signals to dispatch certain background functions. That creates a flood of signal handling interrupts that can disrupt library functions. To find out if that's a problem, you may turn that off, on the command line +RTS -V0 -RTS. Donn From haskell.beginner at gmail.com Sat May 17 14:49:24 2014 From: haskell.beginner at gmail.com (Haskell Beginner) Date: Sat, 17 May 2014 15:49:24 +0100 Subject: [Haskell-cafe] Was directed here for help with why ghc is failing to find mtl. Message-ID: This is the error message which started it all off: http://lpaste.net/104242 Then the following conversation happened: ============================================================================== --- JPMoresmau ------ First package to fail is exceptions. Just open a console and type in cabal install exceptions EclipseFP tries to put some parallel install flags that may make the errors less visible (a Cabal thing, not an EclipseFP thing). I really don't like the look of getting warnings in c code, though... --- haskell_beginner ------ $ cabal install exceptions Resolving dependencies... Configuring exceptions-0.6.1... /var/folders/3r/gvk584k50jb253024p4wxy3r0000gn/T/5187.c:1:12: warning: control reaches end of non-void function [-Wreturn-type] int foo() {} ^ 1 warning generated. Building exceptions-0.6.1... Preprocessing library exceptions-0.6.1... : cannot satisfy -package-id mtl-2.1.2-94c72af955e94b8d7b2f359dadd0cb62 (use -v for more information) Failed to install exceptions-0.6.1 cabal: Error: some packages failed to install: exceptions-0.6.1 failed during the building phase. The exception was: ExitFailure 1 $ What flags can I add to that to get a better error message? EDIT TO ADD: Again if there is another layer automatically adding flags to the above command, I know nothing about it. This includes if Haskell or cabal uses a config file. I am on a ? to my knowledge ? completely stock install of Haskell for Mac OS. --- JPMoresmau ------ cabal install -v exceptions May give more info about why the mtl package cannot be satisfied when it seems to have been installed. --- haskell_beginner ------ $ cabal install -v exceptions Reading available packages... Choosing modular solver. Resolving dependencies... Ready to install exceptions-0.6.1 Waiting for install task to finish... Extracting /Users/person/Library/Haskell/repo-cache/ hackage.haskell.org/exceptions/0.6.1/exceptions-0.6.1.tar.gz to /var/folders/3r/gvk584k50jb253024p4wxy3r0000gn/T/exceptions-0.6.1-5256... Updating exceptions.cabal with the latest revision from the index. Configuring exceptions-0.6.1... Dependency base ==4.6.0.1: using base-4.6.0.1 Dependency mtl ==2.1.2: using mtl-2.1.2 Dependency transformers ==0.3.0.0: using transformers-0.3.0.0 /var/folders/3r/gvk584k50jb253024p4wxy3r0000gn/T/5256.c:1:12: warning: control reaches end of non-void function [-Wreturn-type] int foo() {} ^ 1 warning generated. Using Cabal-1.16.0 compiled by ghc-7.6 Using compiler: ghc-7.6.3 Using install prefix: /Users/person/Library/Haskell/ghc-7.6.3/lib/exceptions-0.6.1 Binaries installed in: /Users/person/Library/Haskell/ghc-7.6.3/lib/exceptions-0.6.1/bin Libraries installed in: /Users/person/Library/Haskell/ghc-7.6.3/lib/exceptions-0.6.1/lib Private binaries installed in: /Users/person/Library/Haskell/ghc-7.6.3/lib/exceptions-0.6.1/libexec Data files installed in: /Users/person/Library/Haskell/ghc-7.6.3/lib/exceptions-0.6.1/share Documentation installed in: /Users/person/Library/Haskell/ghc-7.6.3/lib/exceptions-0.6.1/doc Using alex version 3.0.5 found on system at: /usr/bin/alex Using ar found on system at: /usr/bin/ar No c2hs found Using cpphs version 1.18.1 found on system at: /Users/person/Library/Haskell/bin/cpphs No ffihugs found Using gcc version 4.2.1 found on system at: /usr/bin/gcc Using ghc version 7.6.3 found on system at: /usr/bin/ghc Using ghc-pkg version 7.6.3 found on system at: /usr/bin/ghc-pkg No greencard found Using haddock version 2.13.2 found on system at: /usr/bin/haddock Using happy version 1.18.10 found on system at: /usr/bin/happy No hmake found Using hpc version 0.6 found on system at: /usr/bin/hpc Using hsc2hs version 0.67 found on system at: /usr/bin/hsc2hs Using hscolour version 1.20 found on system at: /Users/person/Library/Haskell/bin/HsColour No hugs found No jhc found Using ld found on system at: /usr/bin/ld No lhc found No lhc-pkg found No nhc98 found No pkg-config found Using ranlib found on system at: /usr/bin/ranlib Using strip found on system at: /usr/bin/strip Using tar found on system at: /usr/bin/tar No uhc found creating dist/build creating dist/build/autogen Building exceptions-0.6.1... Preprocessing library exceptions-0.6.1... Building library... creating dist/build /usr/bin/ghc --make -fbuilding-cabal-package -O -odir dist/build -hidir dist/build -stubdir dist/build -i -idist/build -isrc -idist/build/autogen -Idist/build/autogen -Idist/build -optP-include -optPdist/build/autogen/cabal_macros.h -package-name exceptions-0.6.1 -hide-all-packages -package-db dist/package.conf.inplace -package-id base-4.6.0.1-6c351d70a24d3e96f315cba68f3acf57 -package-id mtl-2.1.2-94c72af955e94b8d7b2f359dadd0cb62 -package-id transformers-0.3.0.0-ff2bb6ac67241ebb987351a3db564af0 -XHaskell98 Control.Monad.Catch Control.Monad.Catch.Pure -Wall -fwarn-tabs -O2 : cannot satisfy -package-id mtl-2.1.2-94c72af955e94b8d7b2f359dadd0cb62 (use -v for more information) Failed to install exceptions-0.6.1 World file is already up to date. cabal: Error: some packages failed to install: exceptions-0.6.1 failed during the building phase. The exception was: ExitFailure 1 $ Hope that helps. I don't know what to make of it. :-/ --- JPMoresmau ------ Neither do I! It seems cabal finds a mtl package to use, but when it passes the exact reference of the package (with a trailing hash to indicate the specifics of your install), ghc doesn't find it. At least it's nothing to do with EclipseFP, which is a relief (for me :-p). I suggest you post that to the Haskell-Cafe mailing list if nobody has any clue here. I know that MacOS is a bit weird sometimes with PATH and such. ============================================================================== Thus with the history of this error now told (TL;DR: read JPMoresmau's last comment above), the question I pose to this mailing list is: Why is ghc failing to find mtl? Thanks, ~Haskell Beginner -------------- next part -------------- An HTML attachment was scrubbed... URL: From carter.schonwald at gmail.com Sat May 17 17:32:11 2014 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Sat, 17 May 2014 13:32:11 -0400 Subject: [Haskell-cafe] Was directed here for help with why ghc is failing to find mtl. In-Reply-To: References: Message-ID: If you're sti having trouble with cpp, please read https://gist.github.com/cartazio/7131371 On Saturday, May 17, 2014, Haskell Beginner > wrote: > This is the error message which started it all off: > http://lpaste.net/104242 > > Then the following conversation happened: > > ============================================================================== > --- JPMoresmau ------ > > First package to fail is exceptions. Just open a console and type in > > cabal install exceptions > > EclipseFP tries to put some parallel install flags that may make the > errors less visible (a Cabal thing, not an EclipseFP thing). I really don't > like the look of getting warnings in c code, though... > > --- haskell_beginner ------ > > $ cabal install exceptions > Resolving dependencies... > Configuring exceptions-0.6.1... > > /var/folders/3r/gvk584k50jb253024p4wxy3r0000gn/T/5187.c:1:12: > warning: control reaches end of non-void function [-Wreturn-type] > int foo() {} > ^ > 1 warning generated. > Building exceptions-0.6.1... > Preprocessing library exceptions-0.6.1... > : cannot satisfy -package-id > mtl-2.1.2-94c72af955e94b8d7b2f359dadd0cb62 > (use -v for more information) > Failed to install exceptions-0.6.1 > cabal: Error: some packages failed to install: > exceptions-0.6.1 failed during the building phase. The exception was: > ExitFailure 1 > $ > > What flags can I add to that to get a better error message? > > EDIT TO ADD: > Again if there is another layer automatically adding flags to the above > command, I know nothing about it. This includes if Haskell or cabal uses a > config file. I am on a ? to my knowledge ? completely stock install of > Haskell for Mac OS. > > --- JPMoresmau ------ > > cabal install -v exceptions > > May give more info about why the mtl package cannot be satisfied when it > seems to have been installed. > > --- haskell_beginner ------ > > $ cabal install -v exceptions > Reading available packages... > Choosing modular solver. > Resolving dependencies... > Ready to install exceptions-0.6.1 > Waiting for install task to finish... > Extracting > /Users/person/Library/Haskell/repo-cache/ > hackage.haskell.org/exceptions/0.6.1/exceptions-0.6.1.tar.gz > to > /var/folders/3r/gvk584k50jb253024p4wxy3r0000gn/T/exceptions-0.6.1-5256... > Updating exceptions.cabal with the latest revision from the index. > Configuring exceptions-0.6.1... > Dependency base ==4.6.0.1: using base-4.6.0.1 > Dependency mtl ==2.1.2: using mtl-2.1.2 > Dependency transformers ==0.3.0.0: using transformers-0.3.0.0 > > /var/folders/3r/gvk584k50jb253024p4wxy3r0000gn/T/5256.c:1:12: > warning: control reaches end of non-void function [-Wreturn-type] > int foo() {} > ^ > 1 warning generated. > Using Cabal-1.16.0 compiled by ghc-7.6 > Using compiler: ghc-7.6.3 > Using install prefix: > /Users/person/Library/Haskell/ghc-7.6.3/lib/exceptions-0.6.1 > Binaries installed in: > /Users/person/Library/Haskell/ghc-7.6.3/lib/exceptions-0.6.1/bin > Libraries installed in: > /Users/person/Library/Haskell/ghc-7.6.3/lib/exceptions-0.6.1/lib > Private binaries installed in: > /Users/person/Library/Haskell/ghc-7.6.3/lib/exceptions-0.6.1/libexec > Data files installed in: > /Users/person/Library/Haskell/ghc-7.6.3/lib/exceptions-0.6.1/share > Documentation installed in: > /Users/person/Library/Haskell/ghc-7.6.3/lib/exceptions-0.6.1/doc > Using alex version 3.0.5 found on system at: /usr/bin/alex > Using ar found on system at: /usr/bin/ar > No c2hs found > Using cpphs version 1.18.1 found on system at: > /Users/person/Library/Haskell/bin/cpphs > No ffihugs found > Using gcc version 4.2.1 found on system at: /usr/bin/gcc > Using ghc version 7.6.3 found on system at: /usr/bin/ghc > Using ghc-pkg version 7.6.3 found on system at: /usr/bin/ghc-pkg > No greencard found > Using haddock version 2.13.2 found on system at: /usr/bin/haddock > Using happy version 1.18.10 found on system at: /usr/bin/happy > No hmake found > Using hpc version 0.6 found on system at: /usr/bin/hpc > Using hsc2hs version 0.67 found on system at: /usr/bin/hsc2hs > Using hscolour version 1.20 found on system at: > /Users/person/Library/Haskell/bin/HsColour > No hugs found > No jhc found > Using ld found on system at: /usr/bin/ld > No lhc found > No lhc-pkg found > No nhc98 found > No pkg-config found > Using ranlib found on system at: /usr/bin/ranlib > Using strip found on system at: /usr/bin/strip > Using tar found on system at: /usr/bin/tar > No uhc found > creating dist/build > creating dist/build/autogen > Building exceptions-0.6.1... > Preprocessing library exceptions-0.6.1... > Building library... > creating dist/build > /usr/bin/ghc --make -fbuilding-cabal-package -O -odir dist/build > -hidir dist/build -stubdir dist/build -i -idist/build -isrc > -idist/build/autogen -Idist/build/autogen -Idist/build -optP-include > -optPdist/build/autogen/cabal_macros.h -package-name exceptions-0.6.1 > -hide-all-packages -package-db dist/package.conf.inplace -package-id > base-4.6.0.1-6c351d70a24d3e96f315cba68f3acf57 -package-id > mtl-2.1.2-94c72af955e94b8d7b2f359dadd0cb62 -package-id > transformers-0.3.0.0-ff2bb6ac67241ebb987351a3db564af0 -XHaskell98 > Control.Monad.Catch Control.Monad.Catch.Pure -Wall -fwarn-tabs -O2 > : cannot satisfy -package-id > mtl-2.1.2-94c72af955e94b8d7b2f359dadd0cb62 > (use -v for more information) > Failed to install exceptions-0.6.1 > World file is already up to date. > cabal: Error: some packages failed to install: > exceptions-0.6.1 failed during the building phase. The exception was: > ExitFailure 1 > $ > > Hope that helps. I don't know what to make of it. :-/ > > --- JPMoresmau ------ > > Neither do I! It seems cabal finds a mtl package to use, but when it > passes the exact reference of the package (with a trailing hash to indicate > the specifics of your install), ghc doesn't find it. At least it's nothing > to do with EclipseFP, which is a relief (for me :-p). I suggest you post > that to the Haskell-Cafe mailing list if nobody has any clue here. I know > that MacOS is a bit weird sometimes with PATH and such. > > ============================================================================== > > Thus with the history of this error now told (TL;DR: read JPMoresmau's > last comment above), the question I pose to this mailing list is: > > Why is ghc failing to find mtl? > > Thanks, > ~Haskell Beginner > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From spam at scientician.net Sat May 17 18:18:32 2014 From: spam at scientician.net (Bardur Arantsson) Date: Sat, 17 May 2014 20:18:32 +0200 Subject: [Haskell-cafe] ghc-mod version 4.1.0 In-Reply-To: <20140501.115809.1417729316609112864.kazu@iij.ad.jp> References: <20140501.115809.1417729316609112864.kazu@iij.ad.jp> Message-ID: On 2014-05-01 04:58, Kazu Yamamoto (????) wrote: > Hello guys, > > I have released ghc-mod version 4.1.0. In this version, ghc-modi > provides "info" and "type" commands. This means that you can display > types and information of expressions very quickly on Emacs. > > http://hackage.haskell.org/package/ghc-mod > > Thanks to GHC's -fdefer-type-errors, "type" and "info" can work even > if the file contains type errors. Yay! Of course, you can make use of > GHC's hole. For more information, please read the "Types" subsection > of the following page: > > http://mew.org/~kazu/proj/ghc-mod/en/emacs.html > > Enjoy! > Hi, I've been trying this thing out (including the Emacs integration) and it's working pretty well so far, but I've run into a limitation that's a bit frustrating. I have a multi-project setup sort of like the following: project/ A/ B/ (depends on A) C/ (depends on A) D/ (depends on B + C) (where D is an executable "example" project) To compile everything I've created a sandbox for the D project in project/D/ and run all my cabal commands from there. I've added A, B, and C via the "add-source" sandbox feature. If I edit a file in the D project, ghc-mod works beautifully, but if I edit anything in A, B, or C ghc-mod (understandably) cannot find the sandbox and complains about various packages (that A, B or C depend on) not being installed. It there some way to make this work? Would it help to actually create the sandbox in the project's main directory (A, B, C, D are subdirectories) and then add them all as source? Any help/guidance in getting this to work would be appreciated. Regards, From donn at avvanta.com Sun May 18 06:25:43 2014 From: donn at avvanta.com (Donn Cave) Date: Sat, 17 May 2014 23:25:43 -0700 (PDT) Subject: [Haskell-cafe] System.Process and -threaded In-Reply-To: <20140516234411.13635.52813@localhost> References: <20140516234411.13635.52813@localhost> Message-ID: <20140518062543.BE8D393C2E@mail.avvanta.com> quoth Karsten Gebbert, ... >> -- mplayer >> (hand,o,e,pid) <- runInteractiveProcess "mplayer" ["-fs", "-idle", "-slave"] Nothing Nothing ... >> putStrLn "listening for commands" >> loop sock hand >> >> -- closing everything down >> sClose sock >> terminateProcess pid >> waitForProcess pid >> return () In an idle moment I wrote up a simplified test program, and found something interesting. When compiled with -threaded, the above code garbage-collects and finalizes "o" -- the child process' output. That tends to shorten the process life span. If I build without -threaded, or use "o" during or after the loop, no problem. Or if I build with -threaded but run with the -V0 flag, which I suppose would delay garbage collection. Donn From greg at gregorycollins.net Sun May 18 08:44:43 2014 From: greg at gregorycollins.net (Gregory Collins) Date: Sun, 18 May 2014 10:44:43 +0200 Subject: [Haskell-cafe] System.Process and -threaded In-Reply-To: <20140516234411.13635.52813@localhost> References: <20140516234411.13635.52813@localhost> Message-ID: You're not reading from the stdout or stderr of the subprocess, so either those handles get garbage collected and closed (as Donn pointed out), which will probably cause mplayer to crash, or the stdout buffer of the mplayer process will fill and further write()s to that file descriptor will block, causing deadlock. Try forking a couple of threads to keep those handles clear. G On Sat, May 17, 2014 at 1:44 AM, Karsten Gebbert wrote: > Hello, > > I'm writing a little networking wrapper around a sub-process (mplayer > -idle -slave) and I'm running into some issues with the System.Process > API. This is the program: > > > module Main where > > > > import System.IO > > import System.Process > > import Network.Socket hiding (recv) > > import Network.Socket.ByteString > > import Control.Concurrent > > import qualified Data.ByteString.Char8 as C > > > > -- WARNING: when compiled with -threaded, this program is likely not > going > > -- to work. As soon as one writes to the stdin of the forked process, it > > -- zombifies and any other command with crash this program. > > > > main = withSocketsDo $ do > > -- network stuff > > addrinfos <- getAddrInfo Nothing (Just "localhost") (Just "4000") > > let serveraddr = head addrinfos > > sock <- socket (addrFamily serveraddr) Stream defaultProtocol > > bindSocket sock (addrAddress serveraddr) > > listen sock 1 > > > > -- mplayer > > (hand,o,e,pid) <- runInteractiveProcess "mplayer" ["-fs", "-idle", > "-slave"] Nothing Nothing > > hSetBinaryMode hand False > > hSetBuffering hand LineBuffering > > > > putStrLn "listening for commands" > > loop sock hand > > > > -- closing everything down > > sClose sock > > terminateProcess pid > > waitForProcess pid > > return () > > > > loop sock hand = do > > (conn, _) <- accept sock > > str <- recv conn 2048 > > > > putStr $ "received: " ++ C.unpack str > > > > -- write command to handler > > hPutStr hand $ C.unpack str > > > > sClose conn > > loop sock hand > > > When compile with -threaded, the mplayer process gets zombified and > hangs until I shut down the program. When compiled with non-threaded RTS > (thats whats its called, correct?) I can successfully send a few > commands, but then mplayer freezes. When I strace mplayer, this error is > what it gets stuck on. > > > ioctl(0, TIOCGWINSZ, 0x7fff2897a070) = -1 ENOTTY (Inappropriate > ioctl for device) > > Apparently that means I'm trying to communicate with it as though it > were a type writer. How fitting :) > > The commands are all simple strings as docs here: > > http://www.mplayerhq.hu/DOCS/tech/slave.txt > > My questions are these: is there anything I need to take care of when > handling sub-processes like this, specifically while writing to stdin of > the process, and with particular regard to -threaded? Does anybody spot > a problem or something I'm overlooking when handling processes like this? > I have been reading the API docs, but found no mention of potential > caveats pertaining to -threaded. > > Thanks! > > k > > > ? k at ioctl.it > ? +49(0)176 / 61995110 > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -- Gregory Collins -------------- next part -------------- An HTML attachment was scrubbed... URL: From j.romildo at gmail.com Sun May 18 10:34:00 2014 From: j.romildo at gmail.com (=?iso-8859-1?Q?Jos=E9?= Romildo Malaquias) Date: Sun, 18 May 2014 07:34:00 -0300 Subject: [Haskell-cafe] Status of efl-haskell? Message-ID: <20140518103400.GA7581@jrm> Hello. I am interested in the project efl-haskell[1] a Haskell library that provides an interface to EFL (Enlightenment Foundation Libraries) and elementary (widget toolkit)[2]. The git repository[3] has seen almost no activity. It has been created and populated on Dec 2012 and has just a workaround update on Jan 2013. Is the project still being developed? [1] https://bitbucket.org/arrowdodger/efl-haskell [2] http://enlightenment.org/ [3] https://bitbucket.org/arrowdodger/efl-haskell Romildo From hsyl20 at gmail.com Sun May 18 11:04:51 2014 From: hsyl20 at gmail.com (Sylvain Henry) Date: Sun, 18 May 2014 13:04:51 +0200 Subject: [Haskell-cafe] Status of efl-haskell? In-Reply-To: <20140518103400.GA7581@jrm> References: <20140518103400.GA7581@jrm> Message-ID: Hello, I have been working on providing bindings for the EFL too [1]. However there are no bindings for Elementary because I want to provide a native Haskell widget toolkit on top of Evas/Ecore using reactive programming. It is still very experimental (see branch "Reactive") and currently I do not have much time to work on it. [1] https://github.com/hsyl20/graphics-efl -Sylvain 2014-05-18 12:34 GMT+02:00 Jos? Romildo Malaquias : > Hello. > > I am interested in the project efl-haskell[1] a Haskell library that > provides an interface to EFL (Enlightenment Foundation Libraries) and > elementary (widget toolkit)[2]. > > The git repository[3] has seen almost no activity. It has been created > and populated on Dec 2012 and has just a workaround update on Jan > 2013. Is the project still being developed? > > [1] https://bitbucket.org/arrowdodger/efl-haskell > [2] http://enlightenment.org/ > [3] https://bitbucket.org/arrowdodger/efl-haskell > > Romildo > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mwm at mired.org Sun May 18 11:30:41 2014 From: mwm at mired.org (Mike Meyer) Date: Sun, 18 May 2014 06:30:41 -0500 Subject: [Haskell-cafe] Conduits vs. lazy byte strings Message-ID: I'm working on a web app that loads a file, tweaks it a bit, then downloads the results. I'd like for it to use the minimal amount of memory possible, just as good practice. Especially since the tweaking all happens in the first K or so of the file, and the rest of it is passed through untouched. The current version uses a conduit that just reads the data to a sinkLbs to get a lazy bytestring, which is then processed. I think this will have the desired behavior (after all, the bytestring is lazy), but have this itch that says I should be doing the processing in the conduit. Someone want to tell me if I correctly understand things and the itch is just leftover imperative thinking, or the itch is right and I need to fix the code? If you're intersted, you can find the code at https://www.fpcomplete.com/user/mwm/xyzifiy -------------- next part -------------- An HTML attachment was scrubbed... URL: From martin.drautzburg at web.de Sun May 18 14:54:37 2014 From: martin.drautzburg at web.de (martin) Date: Sun, 18 May 2014 16:54:37 +0200 Subject: [Haskell-cafe] Constants in Class definitions - could not deduce Message-ID: <5378C9AD.4040408@web.de> Hello all, in my attempt to solve a Calendar related problem, I wanted to define Months and Weekdays such that I can increment a value. Unlike the "succ" Funktion in Enum my "inc" function shall circle endlessly. I came up with the following class (Ix a, Enum a) => Incrementable a where from :: a to :: a inc :: a -> a inc x = [from .. to] !! ((1 + index (from, to) x) `mod` rangeSize (from,to)) but GHC complains: /home/martin/projects/haskell/euler/p19.hs:39:65: Could not deduce (Ix a0) arising from a use of `rangeSize' from the context (Incrementable a) I suppose this is because GHC does not know that I want "to" and "from" to be taken from the same instance as x. If I replace the signature of "from" by "a -> a" and implement it by using a function which throws aways its argument, the types become clear and GHC no longer complains. Alternatively I can omit the implementation of "inc" in the class and leave that to the instances. I can easily fix the types in the instances, but this leads to some code duplication. I tried (from::a) to fix the type, but this had no effect. How is this done correctly? From claude at mathr.co.uk Sun May 18 15:14:42 2014 From: claude at mathr.co.uk (Claude Heiland-Allen) Date: Sun, 18 May 2014 16:14:42 +0100 Subject: [Haskell-cafe] Constants in Class definitions - could not deduce In-Reply-To: <5378C9AD.4040408@web.de> References: <5378C9AD.4040408@web.de> Message-ID: <5378CE62.8010605@mathr.co.uk> Hi Martin, On 18/05/14 15:54, martin wrote: > Hello all, > > in my attempt to solve a Calendar related problem, I wanted to define Months and Weekdays such that I can increment a > value. Unlike the "succ" Funktion in Enum my "inc" function shall circle endlessly. > > I came up with the following > > class (Ix a, Enum a) => Incrementable a where > from :: a > to :: a > inc :: a -> a > inc x = [from .. to] !! ((1 + index (from, to) x) `mod` rangeSize (from,to)) > > but GHC complains: > > /home/martin/projects/haskell/euler/p19.hs:39:65: > Could not deduce (Ix a0) arising from a use of `rangeSize' > from the context (Incrementable a) > > I suppose this is because GHC does not know that I want "to" and "from" to be taken from the same instance as x. If I > replace the signature of "from" by "a -> a" and implement it by using a function which throws aways its argument, the > types become clear and GHC no longer complains. > > Alternatively I can omit the implementation of "inc" in the class and leave that to the instances. I can easily fix the > types in the instances, but this leads to some code duplication. > > I tried (from::a) to fix the type, but this had no effect. How is this done correctly? You could use `asTypeOf` (which is `const` with a specialized type): class (Ix a, Enum a) => Incrementable a where from :: a to :: a inc :: a -> a inc x = [f .. t] !! ((1 + index (f, t) x) `mod` rangeSize (f,t)) where f = from `asTypeOf` x ; t = to `asTypeOf` x hth, Claude -- http://mathr.co.uk From bob at redivi.com Sun May 18 15:33:38 2014 From: bob at redivi.com (Bob Ippolito) Date: Sun, 18 May 2014 08:33:38 -0700 Subject: [Haskell-cafe] Packaging Haskell Environment for Mac App In-Reply-To: References: Message-ID: Have you made any progress on this? I have some domain experience here; I built most of the infrastructure for packaging Python apps on Mac, although it's been years since I've touched any of that. I would be happy to pitch in now that I have a little more time on my hands. On Thu, May 1, 2014 at 2:22 PM, Andrew Gibiansky wrote: > Hey all, > > [This is an xpost from Reddit, where the postseems not to be showing up for some reason...] > > I'd like to package the Haskell Platform and GHC (for GHC API) together in > one bundle in order to distribute it with a Mac app. (Specifically, I am > working on a Mac app for IHaskell , > so beginners can download that to immediately get started playing with > Haskell). > > Does anyone have any experience with this? What's the easiest way to do > this? My list of dependencies is fairly long: > > - Haskell Platform (well, all packages in it) > - A few other packages installed via cabal > - A native library (libzmq); cabal packages depend on it > - Functioning Python > 2.6ish > - GHC API > > My current best idea is to package this all in a Virtualbox VM. I need to > run a server that my Mac app client can use, so mount shared folders in the > VM so that the VM can read/write to disk and expose some ports from the VM. > If this is the best solution, what Linux distro would you suggest to use in > the VM? I'd want something very lightweight. > > I've also considered using Docker somehow, as IHaskell is already packaged > with a Dockerfile. However, I'm not sure how I'd package docker so that its > all doable via a single Mac app install. > > Ideas? Suggestions? > > Thanks! I know this isn't *directly* related to Haskell, but I'm hoping > someone here has experience packaging Haskell applications. > > -- Andrew Gibiansky > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrew.gibiansky at gmail.com Sun May 18 15:51:46 2014 From: andrew.gibiansky at gmail.com (Andrew Gibiansky) Date: Sun, 18 May 2014 08:51:46 -0700 Subject: [Haskell-cafe] Packaging Haskell Environment for Mac App In-Reply-To: References: Message-ID: I've done a bit more thinking but haven't gotten very far. I found this (awesome!) article/writeup: http://www.edsko.net/2013/02/10/comprehensive-haskell-sandboxes/ Although its tailored towards running multiple GHC versions on your own laptop, I think that perhaps it can be retrofitted towards bundling GHC+cabal in a *.app format instead. I haven't had the time to try it yet, though. If you have some extra time to pitch in, I'd certainly gladly accept any help; ping me in private or via the IHaskell github and we can figure out how to best organize that. General advice or suggestions on things to do or things to avoid also welcomed. -- Andrew On Sun, May 18, 2014 at 8:33 AM, Bob Ippolito wrote: > Have you made any progress on this? I have some domain experience here; I > built most of the infrastructure for packaging Python apps on Mac, although > it's been years since I've touched any of that. I would be happy to pitch > in now that I have a little more time on my hands. > > > On Thu, May 1, 2014 at 2:22 PM, Andrew Gibiansky < > andrew.gibiansky at gmail.com> wrote: > >> Hey all, >> >> [This is an xpost from Reddit, where the postseems not to be showing up for some reason...] >> >> I'd like to package the Haskell Platform and GHC (for GHC API) together >> in one bundle in order to distribute it with a Mac app. (Specifically, I am >> working on a Mac app for IHaskell , >> so beginners can download that to immediately get started playing with >> Haskell). >> >> Does anyone have any experience with this? What's the easiest way to do >> this? My list of dependencies is fairly long: >> >> - Haskell Platform (well, all packages in it) >> - A few other packages installed via cabal >> - A native library (libzmq); cabal packages depend on it >> - Functioning Python > 2.6ish >> - GHC API >> >> My current best idea is to package this all in a Virtualbox VM. I need to >> run a server that my Mac app client can use, so mount shared folders in the >> VM so that the VM can read/write to disk and expose some ports from the VM. >> If this is the best solution, what Linux distro would you suggest to use in >> the VM? I'd want something very lightweight. >> >> I've also considered using Docker somehow, as IHaskell is already >> packaged with a Dockerfile. However, I'm not sure how I'd package docker so >> that its all doable via a single Mac app install. >> >> Ideas? Suggestions? >> >> Thanks! I know this isn't *directly* related to Haskell, but I'm hoping >> someone here has experience packaging Haskell applications. >> >> -- Andrew Gibiansky >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From carter.schonwald at gmail.com Sun May 18 15:53:38 2014 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Sun, 18 May 2014 11:53:38 -0400 Subject: [Haskell-cafe] Packaging Haskell Environment for Mac App In-Reply-To: References: Message-ID: You could perhaps adapt and pare down the Haskell platform install for Mac. In fact, there used to be Mac pkg builder in the ghc tree until a bit over a year ago On Sunday, May 18, 2014, Bob Ippolito wrote: > Have you made any progress on this? I have some domain experience here; I > built most of the infrastructure for packaging Python apps on Mac, although > it's been years since I've touched any of that. I would be happy to pitch > in now that I have a little more time on my hands. > > > On Thu, May 1, 2014 at 2:22 PM, Andrew Gibiansky < > andrew.gibiansky at gmail.com > > wrote: > >> Hey all, >> >> [This is an xpost from Reddit, where the postseems not to be showing up for some reason...] >> >> I'd like to package the Haskell Platform and GHC (for GHC API) together >> in one bundle in order to distribute it with a Mac app. (Specifically, I am >> working on a Mac app for IHaskell , >> so beginners can download that to immediately get started playing with >> Haskell). >> >> Does anyone have any experience with this? What's the easiest way to do >> this? My list of dependencies is fairly long: >> >> - Haskell Platform (well, all packages in it) >> - A few other packages installed via cabal >> - A native library (libzmq); cabal packages depend on it >> - Functioning Python > 2.6ish >> - GHC API >> >> My current best idea is to package this all in a Virtualbox VM. I need to >> run a server that my Mac app client can use, so mount shared folders in the >> VM so that the VM can read/write to disk and expose some ports from the VM. >> If this is the best solution, what Linux distro would you suggest to use in >> the VM? I'd want something very lightweight. >> >> I've also considered using Docker somehow, as IHaskell is already >> packaged with a Dockerfile. However, I'm not sure how I'd package docker so >> that its all doable via a single Mac app install. >> >> Ideas? Suggestions? >> >> Thanks! I know this isn't *directly* related to Haskell, but I'm hoping >> someone here has experience packaging Haskell applications. >> >> -- Andrew Gibiansky >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From donn at avvanta.com Sun May 18 16:14:39 2014 From: donn at avvanta.com (Donn Cave) Date: Sun, 18 May 2014 09:14:39 -0700 (PDT) Subject: [Haskell-cafe] System.Process and -threaded In-Reply-To: References: Message-ID: <20140518161439.64E5D276C41@mail.avvanta.com> > Try forking a couple of threads to keep those handles clear. Well ... at what point do these conveniences become too much work? Quick outline of the problems we can expect to encounter if we use runInteractiveProcess: -- because of Handles for the pipe I/O -- 1. library buffering defaults are the opposite of useful 2. now we find the depending on -threaded, garbage collection may cause handles to be closed -- because all three standard units are redirected to pipes -- 3. handles are likely to be unused, contributing to problem 2 above 4. unused handles are also liable to fill with process output and block. 5. particularly with unit 2 ("stderr"), diagnostic output will be discarded unless copied to output by the parent process 6. it's tricky to handle output on two units - have to avoid blocking read, if you don't know there's output. ... and I likely am forgetting one or two more. My recommendation would be to never use this function, and instead go to a process/pipe/exec that 1. creates only the required pipe connections, usually one. 2. returns the pipe Fd rather than making it into a Handle I append an example implementation - a little crude inasmuch as it does nothing about potential exceptional conditions like exec failure. Donn ------------ module Spawn (spawnFd) where import System.Directory import System.Posix.IO import System.Posix.Process import System.Posix.Types -- -- fork process, exec file -- -- exec parameters same as executeFile -- -- Fd spec is (unit, write) from the perspective of -- the child process. -- To spawn a process that only writes output, and -- get a pipe to read that output: [(1, True)] -- To spawn a process that only reads input: [(0, False)] -- To get all three units like runInteractiveProcess: -- [(0, False), (1, True), (2, True)] -- Returned fds are not super convenient, something like -- let p0 = fromJust $ lookup 0 pipelist spawnFd :: FilePath -> Bool -> [String] -> Maybe FilePath -> Maybe [(String, String)] -> [(Fd, Bool)] -> IO ([(Fd, Fd)], ProcessID) spawnFd path search args wd env fdreq = do pp <- mapM pipu fdreq pid <- forkProcess $ childPrep pp ppp <- mapM repipe pp return (ppp, pid) where pipu (u, w) = do p <- createPipe return (u, w, p) dopipe (u, w, (p0, p1)) = do if w then dupTo p1 u else dupTo p0 u closeFd p0 closeFd p1 repipe (u, w, (p0, p1)) | w = do closeFd p1 return (u, p0) | otherwise = do closeFd p0 return (u, p1) childPrep pp = do mapM_ dopipe pp case wd of Just d -> setCurrentDirectory d _ -> return () executeFile path search args env From bob at redivi.com Sun May 18 16:37:10 2014 From: bob at redivi.com (Bob Ippolito) Date: Sun, 18 May 2014 09:37:10 -0700 Subject: [Haskell-cafe] Packaging Haskell Environment for Mac App In-Reply-To: References: Message-ID: I would recommend avoiding anything related to pkgs or installation of any kind, what you really want is a relocatable (and read-only!) .app bundle that you can put wherever you want and it just works. The annoying part, in general, is making sure that nothing has hard-coded paths and for dynamic library references the install name is relative rather than absolute. The actual building of an .app bundle is a matter of putting a few files in the right place and creating an Info.plist file for the metadata. The next (far more annoying and perhaps not really feasible) step would be trying to make it work sandboxed so you could distribute it in the app store. On Sun, May 18, 2014 at 8:53 AM, Carter Schonwald < carter.schonwald at gmail.com> wrote: > You could perhaps adapt and pare down the Haskell platform install for > Mac. > > In fact, there used to be Mac pkg builder in the ghc tree until a bit over > a year ago > > > On Sunday, May 18, 2014, Bob Ippolito wrote: > >> Have you made any progress on this? I have some domain experience here; I >> built most of the infrastructure for packaging Python apps on Mac, although >> it's been years since I've touched any of that. I would be happy to pitch >> in now that I have a little more time on my hands. >> >> >> On Thu, May 1, 2014 at 2:22 PM, Andrew Gibiansky < >> andrew.gibiansky at gmail.com> wrote: >> >>> Hey all, >>> >>> [This is an xpost from Reddit, where the postseems not to be showing up for some reason...] >>> >>> I'd like to package the Haskell Platform and GHC (for GHC API) together >>> in one bundle in order to distribute it with a Mac app. (Specifically, I am >>> working on a Mac app for IHaskell, >>> so beginners can download that to immediately get started playing with >>> Haskell). >>> >>> Does anyone have any experience with this? What's the easiest way to do >>> this? My list of dependencies is fairly long: >>> >>> - Haskell Platform (well, all packages in it) >>> - A few other packages installed via cabal >>> - A native library (libzmq); cabal packages depend on it >>> - Functioning Python > 2.6ish >>> - GHC API >>> >>> My current best idea is to package this all in a Virtualbox VM. I need >>> to run a server that my Mac app client can use, so mount shared folders in >>> the VM so that the VM can read/write to disk and expose some ports from the >>> VM. If this is the best solution, what Linux distro would you suggest to >>> use in the VM? I'd want something very lightweight. >>> >>> I've also considered using Docker somehow, as IHaskell is already >>> packaged with a Dockerfile. However, I'm not sure how I'd package docker so >>> that its all doable via a single Mac app install. >>> >>> Ideas? Suggestions? >>> >>> Thanks! I know this isn't *directly* related to Haskell, but I'm hoping >>> someone here has experience packaging Haskell applications. >>> >>> -- Andrew Gibiansky >>> >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://www.haskell.org/mailman/listinfo/haskell-cafe >>> >>> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From coreyoconnor at gmail.com Sun May 18 17:30:55 2014 From: coreyoconnor at gmail.com (Corey O'Connor) Date: Sun, 18 May 2014 10:30:55 -0700 Subject: [Haskell-cafe] Packaging Haskell Environment for Mac App In-Reply-To: References: Message-ID: How Mac implements dynamic library reference paths is documented here: * https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/dyld.1.html For a .app containing an install of the haskell platform I would think @executable_path should be used. I don't know how to apply that to a haskell platform build. Cheers, Corey -Corey O'Connor coreyoconnor at gmail.com http://corebotllc.com/ On Sun, May 18, 2014 at 9:37 AM, Bob Ippolito wrote: > I would recommend avoiding anything related to pkgs or installation of any > kind, what you really want is a relocatable (and read-only!) .app bundle > that you can put wherever you want and it just works. The annoying part, in > general, is making sure that nothing has hard-coded paths and for dynamic > library references the install name is relative rather than absolute. The > actual building of an .app bundle is a matter of putting a few files in the > right place and creating an Info.plist file for the metadata. > > The next (far more annoying and perhaps not really feasible) step would be > trying to make it work sandboxed so you could distribute it in the app > store. > > > On Sun, May 18, 2014 at 8:53 AM, Carter Schonwald < > carter.schonwald at gmail.com> wrote: > >> You could perhaps adapt and pare down the Haskell platform install for >> Mac. >> >> In fact, there used to be Mac pkg builder in the ghc tree until a bit >> over a year ago >> >> >> On Sunday, May 18, 2014, Bob Ippolito wrote: >> >>> Have you made any progress on this? I have some domain experience here; >>> I built most of the infrastructure for packaging Python apps on Mac, >>> although it's been years since I've touched any of that. I would be happy >>> to pitch in now that I have a little more time on my hands. >>> >>> >>> On Thu, May 1, 2014 at 2:22 PM, Andrew Gibiansky < >>> andrew.gibiansky at gmail.com> wrote: >>> >>>> Hey all, >>>> >>>> [This is an xpost from Reddit, where the postseems not to be showing up for some reason...] >>>> >>>> I'd like to package the Haskell Platform and GHC (for GHC API) together >>>> in one bundle in order to distribute it with a Mac app. (Specifically, I am >>>> working on a Mac app for IHaskell, >>>> so beginners can download that to immediately get started playing with >>>> Haskell). >>>> >>>> Does anyone have any experience with this? What's the easiest way to do >>>> this? My list of dependencies is fairly long: >>>> >>>> - Haskell Platform (well, all packages in it) >>>> - A few other packages installed via cabal >>>> - A native library (libzmq); cabal packages depend on it >>>> - Functioning Python > 2.6ish >>>> - GHC API >>>> >>>> My current best idea is to package this all in a Virtualbox VM. I need >>>> to run a server that my Mac app client can use, so mount shared folders in >>>> the VM so that the VM can read/write to disk and expose some ports from the >>>> VM. If this is the best solution, what Linux distro would you suggest to >>>> use in the VM? I'd want something very lightweight. >>>> >>>> I've also considered using Docker somehow, as IHaskell is already >>>> packaged with a Dockerfile. However, I'm not sure how I'd package docker so >>>> that its all doable via a single Mac app install. >>>> >>>> Ideas? Suggestions? >>>> >>>> Thanks! I know this isn't *directly* related to Haskell, but I'm >>>> hoping someone here has experience packaging Haskell applications. >>>> >>>> -- Andrew Gibiansky >>>> >>>> _______________________________________________ >>>> Haskell-Cafe mailing list >>>> Haskell-Cafe at haskell.org >>>> http://www.haskell.org/mailman/listinfo/haskell-cafe >>>> >>>> >>> > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hesselink at gmail.com Sun May 18 17:45:28 2014 From: hesselink at gmail.com (Erik Hesselink) Date: Sun, 18 May 2014 19:45:28 +0200 Subject: [Haskell-cafe] Constants in Class definitions - could not deduce In-Reply-To: <5378CE62.8010605@mathr.co.uk> References: <5378C9AD.4040408@web.de> <5378CE62.8010605@mathr.co.uk> Message-ID: On Sun, May 18, 2014 at 5:14 PM, Claude Heiland-Allen wrote: > Hi Martin, > > > On 18/05/14 15:54, martin wrote: >> >> Hello all, >> >> in my attempt to solve a Calendar related problem, I wanted to define >> Months and Weekdays such that I can increment a >> value. Unlike the "succ" Funktion in Enum my "inc" function shall circle >> endlessly. >> >> I came up with the following >> >> class (Ix a, Enum a) => Incrementable a where >> from :: a >> to :: a >> inc :: a -> a >> inc x = [from .. to] !! ((1 + index (from, to) x) `mod` rangeSize >> (from,to)) >> >> but GHC complains: >> >> /home/martin/projects/haskell/euler/p19.hs:39:65: >> Could not deduce (Ix a0) arising from a use of `rangeSize' >> from the context (Incrementable a) >> >> I suppose this is because GHC does not know that I want "to" and "from" to >> be taken from the same instance as x. If I >> replace the signature of "from" by "a -> a" and implement it by using a >> function which throws aways its argument, the >> types become clear and GHC no longer complains. >> >> Alternatively I can omit the implementation of "inc" in the class and >> leave that to the instances. I can easily fix the >> types in the instances, but this leads to some code duplication. >> >> I tried (from::a) to fix the type, but this had no effect. How is this >> done correctly? > > > You could use `asTypeOf` (which is `const` with a specialized type): > > > > class (Ix a, Enum a) => Incrementable a where > from :: a > to :: a > inc :: a -> a > inc x = [f .. t] !! ((1 + index (f, t) x) `mod` rangeSize (f,t)) > where f = from `asTypeOf` x ; t = to `asTypeOf` x Alternatively, you can turn on ScopedTypeVariables. That way, the 'a' variable from the class header is in scope in the code below it. Regards, Erik From johnw at newartisans.com Sun May 18 18:51:20 2014 From: johnw at newartisans.com (John Wiegley) Date: Sun, 18 May 2014 18:51:20 +0000 Subject: [Haskell-cafe] Conduits vs. lazy byte strings In-Reply-To: (Mike Meyer's message of "Sun, 18 May 2014 06:30:41 -0500") References: Message-ID: >>>>> Mike Meyer writes: > The current version uses a conduit that just reads the data to a sinkLbs to > get a lazy bytestring, which is then processed. sinkLbs reads the entire contents into memory, so this is the exact opposite of what you want. > Someone want to tell me if I correctly understand things and the itch is > just leftover imperative thinking, or the itch is right and I need to fix > the code? You should write a Conduit or a Sink which will do the processing you need. By default, you'll receive "chunks" at each call to "await". If you need lines, there is a linesUnbounded Conduit (as of conduit 1.1), but it still reads whole chunks into memory at a time (I believe the default chunk size is 32k)? But that's the same behavior as plain lazy I/O. Once your Conduit or Sink (i.e., Consumer) finds the data it needs, it should simply end, and not call await anymore. This will inform upstream that processing and done and that all finalizers should be executed. John From martin.drautzburg at web.de Sun May 18 22:32:36 2014 From: martin.drautzburg at web.de (martin) Date: Mon, 19 May 2014 00:32:36 +0200 Subject: [Haskell-cafe] Constants in Class definitions - could not deduce In-Reply-To: <5378CE62.8010605@mathr.co.uk> References: <5378C9AD.4040408@web.de> <5378CE62.8010605@mathr.co.uk> Message-ID: <53793504.40703@web.de> Thanks, typeOf did the trick Am 05/18/2014 05:14 PM, schrieb Claude Heiland-Allen: > Hi Martin, > > On 18/05/14 15:54, martin wrote: >> Hello all, >> >> in my attempt to solve a Calendar related problem, I wanted to define Months and Weekdays such that I can increment a >> value. Unlike the "succ" Funktion in Enum my "inc" function shall circle endlessly. >> >> I came up with the following >> >> class (Ix a, Enum a) => Incrementable a where >> from :: a >> to :: a >> inc :: a -> a >> inc x = [from .. to] !! ((1 + index (from, to) x) `mod` rangeSize (from,to)) >> >> but GHC complains: >> >> /home/martin/projects/haskell/euler/p19.hs:39:65: >> Could not deduce (Ix a0) arising from a use of `rangeSize' >> from the context (Incrementable a) >> >> I suppose this is because GHC does not know that I want "to" and "from" to be taken from the same instance as x. If I >> replace the signature of "from" by "a -> a" and implement it by using a function which throws aways its argument, the >> types become clear and GHC no longer complains. >> >> Alternatively I can omit the implementation of "inc" in the class and leave that to the instances. I can easily fix the >> types in the instances, but this leads to some code duplication. >> >> I tried (from::a) to fix the type, but this had no effect. How is this done correctly? > > You could use `asTypeOf` (which is `const` with a specialized type): > > > class (Ix a, Enum a) => Incrementable a where > from :: a > to :: a > inc :: a -> a > inc x = [f .. t] !! ((1 + index (f, t) x) `mod` rangeSize (f,t)) > where f = from `asTypeOf` x ; t = to `asTypeOf` x > > > hth, > > > Claude From j.romildo at gmail.com Mon May 19 09:51:35 2014 From: j.romildo at gmail.com (=?iso-8859-1?Q?Jos=E9?= Romildo Malaquias) Date: Mon, 19 May 2014 06:51:35 -0300 Subject: [Haskell-cafe] Making the encoding Haskell package compile with ghc-7.8.2 Message-ID: <20140519095135.GA21240@jrm> Hello. I use encodign in a Haskell application and I would like to have it working with ghc-7.8.2. So I am kindly asking to, if possible, update the encoding package[1] to be compilable with ghc-7.8.2. Currently it fails with the messages: [...] * Prepending /usr/lib64/ghc-7.8.2 to LD_LIBRARY_PATH /usr/bin/ghc -package Cabal-1.20.0.0 --make /tmp/portage/dev-haskell/encoding-0.7/work/encoding-0.7/Setup.hs -dynamic -o setup [1 of 8] Compiling Data.Static ( Data/Static.hs, Data/Static.o ) Data/Static.hs:39:28: Couldn't match expected type ?Bool? with actual type ?Int#? In the expression: eqWord# v (int2Word# 4294967295#) In the expression: if eqWord# v (int2Word# 4294967295#) then Nothing else (if (I# (word2Int# v)) > 1114111 then error (show (I# (word2Int# v)) ++ " is not a valid char (" ++ show (I# i) ++ ")") else Just (chr (I# (word2Int# v)))) /usr/bin/ghc -package Cabal-1.20.0.0 --make /tmp/portage/dev-haskell/encoding-0.7/work/encoding-0.7/Setup.hs -o setup [1 of 8] Compiling Data.Static ( Data/Static.hs, Data/Static.o ) Data/Static.hs:39:28: Couldn't match expected type ?Bool? with actual type ?Int#? In the expression: eqWord# v (int2Word# 4294967295#) In the expression: if eqWord# v (int2Word# 4294967295#) then Nothing else (if (I# (word2Int# v)) > 1114111 then error (show (I# (word2Int# v)) ++ " is not a valid char (" ++ show (I# i) ++ ")") else Just (chr (I# (word2Int# v)))) Regards, Romildo From ryan at skedge.me Mon May 19 14:40:12 2014 From: ryan at skedge.me (Ryan Trinkle) Date: Mon, 19 May 2014 10:40:12 -0400 Subject: [Haskell-cafe] Haskell Developer - Job Opening - New York, NY Message-ID: skedge.me is seeking a Haskell developer to improve and maintain our Snap-based web application stack. skedge.me is committed to using the best tool for the job throughout our software stack. That includes a mixture of cutting-edge tools like Haskell and the Nix package manager as well as tried-and-true products like PostgreSQL and Linux. Your role will be to find, use, and create tools like these to build a robust and powerful software platform to serve our clients' needs. This job requires that you be able to hit the ground running with Haskell. As part of your application, please submit a small to medium sized code sample (approximately 100 to 1000 lines) demonstrating your ability to write clear, concise, and efficient Haskell code, together with a brief English explanation of what the code does, how it works, and how to build and run it. Your Haskell code is our primary consideration in reviewing your application. However, experience with PostgreSQL, Linux, NixOS, web server programming, Varnish, AWS or other similar technologies is a plus. It is also a plus if you are local to the NYC area, as our offices are located in Midtown. To apply, please email me your resume and code sample at ryan at skedge.me. Ryan -------------- next part -------------- An HTML attachment was scrubbed... URL: From corentin.dupont at gmail.com Mon May 19 15:31:20 2014 From: corentin.dupont at gmail.com (Corentin Dupont) Date: Mon, 19 May 2014 17:31:20 +0200 Subject: [Haskell-cafe] instance Alternative (Either [a]) Message-ID: Hi guys! I'd like to implement the instance in the subject: instance Alternative (Either [a]) However the instance in Control.Monad.Trans.Error.Error gets in the way... I cannot use this one, it works only with Strings. My use case is that the Either handle in the Right a final value, or else in the Left a list of things "left to do" to compute the value. How can I do? Thanks! Corentin -------------- next part -------------- An HTML attachment was scrubbed... URL: From svenpanne at gmail.com Mon May 19 15:53:20 2014 From: svenpanne at gmail.com (Sven Panne) Date: Mon, 19 May 2014 17:53:20 +0200 Subject: [Haskell-cafe] ANNOUNCE: New OpenGL packages Message-ID: New versions of the OpenGL packages are available on Hackage: * OpenGLRaw 1.5.0.0 * GLURaw 1.4.0.1 * OpenGL 2.9.2.0 * GLUT 2.5.1.1 Cheers, S. ====================================================================== Changes in the OpenGLRaw package ====================================================================== * Don't rely on K&R features in CPP, making things easier for Mac/clang users. * Added support for OpenGL 3.2's glGetInteger64i_v and the following extensions, so now all parts of OpenGL 4.1 are supported (plus a few more): APPLE_flush_buffer_range APPLE_vertex_array_object ARB_blend_func_extended ARB_gpu_shader_fp64 ARB_sampler_objects ARB_shader_subroutine ARB_shading_language_include ARB_texture_compression_bptc ARB_texture_rgb10_a2ui ARB_texture_swizzle ARB_transform_feedback2 ARB_vertex_attrib_64bit ARB_vertex_type_2_10_10_10_rev EXT_draw_buffers2 EXT_framebuffer_blit EXT_framebuffer_multisample EXT_gpu_shader4 EXT_packed_stencil_depth EXT_texture_array EXT_texture_compression_rgtc EXT_texture_shared_exponent EXT_transform_feedback * Made naming more consistent: Abgr => ABGR Bgra => BGRA Cmyka => CMYKA Dxt1 => DXT1 Fp => FP Gpu => GPU Latc => LATC Lod => LOD S3tc => S3TC Vtc => VTC ====================================================================== Changes in the GLURaw package ====================================================================== * Don't rely on K&R features in CPP, making things easier for Mac/clang users. ====================================================================== OpenGL 2.9.2.0 ====================================================================== * Added generateMipmap?, a modern version of the deprecated generateMipmap. * Added a few missing IndexedBufferTargets. * indexedBufferSize and indexedBufferStart correctly use 64bit queries now. * Setting bindBufferRange handles Nothing correctly now. * Added missing Eq/Ord/Show instances for a few data types. ====================================================================== Changes in the GLUT package ====================================================================== * Don't rely on K&R features in CPP, making things easier for Mac/clang users. * Added ColorTriange example. From mantkiew at gsd.uwaterloo.ca Mon May 19 17:33:16 2014 From: mantkiew at gsd.uwaterloo.ca (Michal Antkiewicz) Date: Mon, 19 May 2014 13:33:16 -0400 Subject: [Haskell-cafe] ghc-mod version 4.1.0 In-Reply-To: References: <20140501.115809.1417729316609112864.kazu@iij.ad.jp> Message-ID: Hi Bardur, in such situations I use a shared sandbox instead of the "add-source". execute `cabal sandbox init --sandbox=../.shared-cabal-sandbox in each project and build A, B, C, D. Does it help with ghc-mod? Michal On Sat, May 17, 2014 at 2:18 PM, Bardur Arantsson wrote: > On 2014-05-01 04:58, Kazu Yamamoto (????) wrote: > > Hello guys, > > > > I have released ghc-mod version 4.1.0. In this version, ghc-modi > > provides "info" and "type" commands. This means that you can display > > types and information of expressions very quickly on Emacs. > > > > http://hackage.haskell.org/package/ghc-mod > > > > Thanks to GHC's -fdefer-type-errors, "type" and "info" can work even > > if the file contains type errors. Yay! Of course, you can make use of > > GHC's hole. For more information, please read the "Types" subsection > > of the following page: > > > > http://mew.org/~kazu/proj/ghc-mod/en/emacs.html > > > > Enjoy! > > > > Hi, > > I've been trying this thing out (including the Emacs integration) and > it's working pretty well so far, but I've run into a limitation that's a > bit frustrating. > > I have a multi-project setup sort of like the following: > > project/ > A/ > B/ (depends on A) > C/ (depends on A) > D/ (depends on B + C) > > (where D is an executable "example" project) > > To compile everything I've created a sandbox for the D project in > project/D/ and run all my cabal commands from there. I've added A, B, > and C via the "add-source" sandbox feature. > > If I edit a file in the D project, ghc-mod works beautifully, but if I > edit anything in A, B, or C ghc-mod (understandably) cannot find the > sandbox and complains about various packages (that A, B or C depend on) > not being installed. > > It there some way to make this work? > > Would it help to actually create the sandbox in the project's main > directory (A, B, C, D are subdirectories) and then add them all as source? > > Any help/guidance in getting this to work would be appreciated. > > Regards, > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From j.romildo at gmail.com Tue May 20 01:18:01 2014 From: j.romildo at gmail.com (=?iso-8859-1?Q?Jos=E9?= Romildo Malaquias) Date: Mon, 19 May 2014 22:18:01 -0300 Subject: [Haskell-cafe] Making the encoding Haskell package compile with ghc-7.8.2 In-Reply-To: <20140519095135.GA21240@jrm> References: <20140519095135.GA21240@jrm> Message-ID: <20140520011801.GA16338@jrm> On Mon, May 19, 2014 at 06:51:35AM -0300, Jos? Romildo Malaquias wrote: > Hello. > > I use encodign in a Haskell application and I would like to have it > working with ghc-7.8.2. > > So I am kindly asking to, if possible, update the encoding package[1] to > be compilable with ghc-7.8.2. > > Currently it fails with the messages: > > [...] > * Prepending /usr/lib64/ghc-7.8.2 to LD_LIBRARY_PATH > /usr/bin/ghc -package Cabal-1.20.0.0 --make /tmp/portage/dev-haskell/encoding-0.7/work/encoding-0.7/Setup.hs -dynamic -o setup > [1 of 8] Compiling Data.Static ( Data/Static.hs, Data/Static.o ) > Data/Static.hs:39:28: > Couldn't match expected type ?Bool? with actual type ?Int#? > In the expression: eqWord# v (int2Word# 4294967295#) > In the expression: > if eqWord# v (int2Word# 4294967295#) then > Nothing > else > (if (I# (word2Int# v)) > 1114111 then > error > (show (I# (word2Int# v)) > ++ " is not a valid char (" ++ show (I# i) ++ ")") > else > Just (chr (I# (word2Int# v)))) > /usr/bin/ghc -package Cabal-1.20.0.0 --make /tmp/portage/dev-haskell/encoding-0.7/work/encoding-0.7/Setup.hs -o setup > [1 of 8] Compiling Data.Static ( Data/Static.hs, Data/Static.o ) > > Data/Static.hs:39:28: > Couldn't match expected type ?Bool? with actual type ?Int#? > In the expression: eqWord# v (int2Word# 4294967295#) > In the expression: > if eqWord# v (int2Word# 4294967295#) then > Nothing > else > (if (I# (word2Int# v)) > 1114111 then > error > (show (I# (word2Int# v)) > ++ " is not a valid char (" ++ show (I# i) ++ ")") > else > Just (chr (I# (word2Int# v)))) With the attached patch I am able to compile encoding-0.7 with ghc-7.8.2 on my gentoo system. Maybe it can be integrated into the source code in the darcs repository. Romildo -------------- next part -------------- A non-text attachment was scrubbed... Name: encoding-0.7.ghc782.patch Type: text/x-diff Size: 1573 bytes Desc: not available URL: From michaeltbaker at gmail.com Tue May 20 04:20:11 2014 From: michaeltbaker at gmail.com (Michael Baker) Date: Mon, 19 May 2014 23:20:11 -0500 Subject: [Haskell-cafe] OpenGL performance issue on OSX Message-ID: I'm using OpenGLRaw and I'm getting 3 frames per second trying to draw 8000 triangles. When I profile the application, I see that almost all of the time is taken by a call to CGLFlushDrawable, which is apparently OSX's function for swapping the back buffer to the front buffer. Has anyone else run into a problem like this? I seem to recall a thread a while ago about a Haskell specific OpenGL performance issue, but I can't find it now. -------------- next part -------------- An HTML attachment was scrubbed... URL: From acowley at gmail.com Tue May 20 04:43:02 2014 From: acowley at gmail.com (Anthony Cowley) Date: Tue, 20 May 2014 00:43:02 -0400 Subject: [Haskell-cafe] OpenGL performance issue on OSX In-Reply-To: References: Message-ID: > On May 20, 2014, at 12:20 AM, Michael Baker wrote: > > I'm using OpenGLRaw and I'm getting 3 frames per second trying to draw 8000 triangles. When I profile the application, I see that almost all of the time is taken by a call to CGLFlushDrawable, which is apparently OSX's function for swapping the back buffer to the front buffer. Can you put the code somewhere so we can take a look? OpenGL offers 8000 ways to draw 8000 triangles. Anthony > > Has anyone else run into a problem like this? I seem to recall a thread a while ago about a Haskell specific OpenGL performance issue, but I can't find it now. > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From oleg at okmij.org Tue May 20 06:58:26 2014 From: oleg at okmij.org (oleg at okmij.org) Date: 20 May 2014 06:58:26 -0000 Subject: [Haskell-cafe] ML Family workshop - Extended deadline Message-ID: <20140520065826.84817.qmail@www1.g3.pair.com> Extended submission deadline: May 23 (Friday), any time zone Four more days to write a 2-page abstract Submissions of demos, case studies and informed opinions are particularly encouraged! Higher-order, Typed, Inferred, Strict: ACM SIGPLAN ML Family Workshop Thursday September 4, 2014, Gothenburg, Sweden (immediately following ICFP and preceding OCaml Users and Developers Workshop) Call For Papers http://okmij.org/ftp/ML/ML14.html ML is a very large family of programming languages that includes Standard ML, OCaml, F#, SML#, Manticore, MetaOCaml, JoCaml, Alice ML, Dependent ML, Flow Caml, and many others. All ML languages, beside the great deal of syntax, share several fundamental traits. They are all higher-order, strict, mostly pure, and typed, with algebraic and other data types. Their type systems inherit from Hindley-Milner. The development of these languages has inspired a significant amount of computer science research and influenced a number of programming languages, including Haskell, Scala and Clojure, as well as Rust, ATS and many others. ML workshops have been held in affiliation with ICFP continuously since 2005. This workshop specifically aims to recognize the entire extended ML family and to provide the forum to present and discuss common issues, both practical (compilation techniques, implementations of concurrency and parallelism, programming for the Web) and theoretical (fancy types, module systems, metaprogramming). The scope of the workshop includes all aspects of the design, semantics, theory, application, implementation, and teaching of the members of the ML family. We also encourage presentations from related languages (such as Scala, Rust, Nemerle, ATS, etc.), to exchange experience of further developing ML ideas. The ML family workshop will be held in close coordination with the OCaml Users and Developers Workshop. Format Since 2010, the ML workshop has adopted an informal model. Presentations are selected from submitted abstracts. There are no published proceedings, so any contributions may be submitted for publication elsewhere. We hope that this format encourages the presentation of exciting (if unpolished) research and deliver a lively workshop atmosphere. Each presentation should take 20-25 minutes, except demos, which should take 10-15 minutes. The exact time will be decided based on the number of accepted submissions. The presentations will likely be recorded. Post-conference proceedings The post-proceedings of selected papers from the ML Family and the OCaml Users and Developers workshops will be published in the Electronic Proceedings in Theoretical Computer Science (EPTCS). The Program Committee shall invite interested authors of selected presentations to expand their abstract for inclusion in the proceedings. The submissions are to be reviewed according to the EPTCS standards. Coordination with the OCaml Users and Developers Workshop The OCaml workshop is seen as more practical and is dedicated in significant part to the OCaml community building and the evolution of the OCaml system. In contrast, the ML family workshop is not focused on any language in particular, is more research oriented, and deals with general issues of the ML-style programming and type systems. Yet there is an overlap, which we are keen to explore in various ways. The authors who feel their submission fits both workshops are encouraged to mention it at submission time or contact the Program Chairs. Scope We acknowledge the whole breadth of the ML family and aim to include languages that are closely related (although not by blood), such as Rust, ATS, Scala, Typed Clojure. Those languages have implemented and investigated run-time and type system choices that may be worth considering for OCaml, F# and other ML languages. We also hope that the exposure to the state of the art ML might favorably influence those related languages. Specifically, we seek research presentations on topics including but not limited to * Design: concurrency, distribution and mobility, programming for the web and embedded systems, handling semi-structured data, facilitating interactive programming, higher forms of polymorphism, generic programming, objects * Implementation: compilation techniques, interpreters, type checkers, partial evaluators, runtime systems, garbage collectors, etc. * Type systems: fancy types, inference, effects, overloading, modules, contracts, specifications and assertions, dynamic typing, error reporting, etc. * Applications: case studies, experience reports, pearls, etc. * Environments: libraries, tools, editors, debuggers, cross-language interoperability, functional data structures, etc. * Education: ML and ML-like languages in college or high-school, in general or computer science curriculum. Four kinds of submissions will be accepted: Informed Positions, Research Presentations, Experience Reports and Demos. * Informed Positions: A justified argument for or against a language feature. The argument must be substantiated, either theoretically (e.g., by a demonstration of (un)soundness, an inference algorithm, a complexity analysis), empirically or by a substantial experience. Personal experience is accepted as justification so long as it is extensive and illustrated with concrete examples. * Research Presentations: Research presentations should describe new ideas, experimental results, or significant advances in ML-related projects. We especially encourage presentations that describe work in progress, that outline a future research agenda, or that encourage lively discussion. These presentations should be structured in a way which can be, at least in part, of interest to (advanced) users. * Experience Reports: Users are invited to submit Experience Reports about their use of ML and related languages. These presentations do not need to contain original research but they should tell an interesting story to researchers or other advanced users, such as an innovative or unexpected use of advanced features or a description of the challenges they are facing or attempting to solve. * Demos: Live demonstrations or short tutorials should show new developments, interesting prototypes, or work in progress, in the form of tools, libraries, or applications built on or related to ML. (You will need to provide all the hardware and software required for your demo; the workshop organizers are only able to provide a projector.) Important dates Friday May 23 (any time zone): Abstract submission Monday June 30: Author notification Thursday September 4, 2014: ML Family Workshop Submission Submissions should be at most two pages, in PDF format, and printable on US Letter or A4 sized paper. A submission should have a synopsis (2-3 lines) and a body between 1 and 2 pages, in one- or two-column layout. The synopsis should be suitable for inclusion in the workshop program. Submissions must be uploaded to the workshop submission website before the submission deadline (Monday May 19, 2014). For any question concerning the scope of the workshop or the submission process, please contact the program chair. Program Committee Kenichi Asai Ochanomizu University, Japan Matthew Fluet Rochester Institute of Technology, USA Jacques Garrigue Nagoya University, Japan Dave Herman Mozilla, USA Stefan Holdermans Vector Fabrics, Netherlands Oleg Kiselyov (Chair) Monterey, CA, USA Keiko Nakata Tallinn University of Technology, Estonia Didier Remy INRIA Paris-Rocquencourt, France Zhong Shao Yale University, USA Hongwei Xi Boston University, USA From alpmestan at gmail.com Tue May 20 07:06:06 2014 From: alpmestan at gmail.com (Alp Mestanogullari) Date: Tue, 20 May 2014 09:06:06 +0200 Subject: [Haskell-cafe] OpenGL performance issue on OSX In-Reply-To: References: Message-ID: Maybe you need to disable the hot switching between the default graphics card and the more powerful one? I think that was the source of a few similar issues [1]. [1]: http://gloss.ouroborus.net, question *Q: On my MacBook Pro under OSX, gloss programs freeze after displaying the first few frames* On Tue, May 20, 2014 at 6:20 AM, Michael Baker wrote: > I'm using OpenGLRaw and I'm getting 3 frames per second trying to draw > 8000 triangles. When I profile the application, I see that almost all of > the time is taken by a call to CGLFlushDrawable, which is apparently OSX's > function for swapping the back buffer to the front buffer. > > Has anyone else run into a problem like this? I seem to recall a thread a > while ago about a Haskell specific OpenGL performance issue, but I can't > find it now. > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -- Alp Mestanogullari -------------- next part -------------- An HTML attachment was scrubbed... URL: From mdorman at ironicdesign.com Tue May 20 10:43:12 2014 From: mdorman at ironicdesign.com (Michael Alan Dorman) Date: Tue, 20 May 2014 06:43:12 -0400 Subject: [Haskell-cafe] TemplateHaskell forces manual declaration ordering? Message-ID: <87wqdgpw73.fsf@ironicdesign.com> Hey, all, While refactoring some code, I moved a newtype declaration, and suddenly the compiler (up-to-date ghc-7.6.3 on Debian) started complaining that it wasn't in scope when I attempted to use it in an ADT. I'm still new to Haskell, so I assumed it was my misunderstanding, and looked for documentation of declaration ordering constraints and couldn't find any. So then I went to make a toy case to demonstrate the problem, and it worked: data Baz = Baz { foo :: Foo, bar :: !(Maybe Bar) } newtype Foo = Foo String newtype Bar = Bar String So I started looking at the differences between that and my real code, and the only thing that seemed at all signficant was that I was using TH to generate some lenses. And sure enough, adding that caused it to fail: {-# LANGUAGE TemplateHaskell #-} import Control.Lens data Baz = Baz { foo :: Foo, bar :: !(Maybe Bar) } makeLenses ''Baz newtype Foo = Foo String newtype Bar = Bar String If you feed this to ghci, you now get: test.hs:3:25: Not in scope: type constructor or class `Foo' test.hs:3:45: Not in scope: type constructor or class `Bar' Perhaps you meant `Baz' (line 3) Wondering if lens was somehow doing something so exotic it was breaking things, I tried aeson's TH support instead: {-# LANGUAGE TemplateHaskell #-} import Data.Aeson data Baz = Baz { foo :: Foo, bar :: !(Maybe Bar) } deriveJSON defaultOptions ''Baz newtype Foo = Foo String newtype Bar = Bar String Exact same error. That said, if I move the splices to the end of the file, everything works: {-# LANGUAGE TemplateHaskell #-} import Data.Aeson data Baz = Baz { foo :: Foo, bar :: !(Maybe Bar) } newtype Foo = Foo String newtype Bar = Bar String deriveJSON defaultOptions ''Baz I looked at the GHC docs on TH, and read the wiki page, and didn't see anything suggesting that this was a known limitation, nor did I see a bug in the known bug list that seemed pertinent. So, I'm wondering if I've found an actual bug, or a known limitation whose documentation should be made more prominent (since it seems to me that it has pretty dramatic implications for program structure), or what? And is there any way around it other than moving all the splices to the end of the source file? Mike. From edwards.benj at gmail.com Tue May 20 11:00:02 2014 From: edwards.benj at gmail.com (edwardsbenj@gmail.com) Date: Tue, 20 May 2014 11:00:02 +0000 Subject: [Haskell-cafe] TemplateHaskell forces manual declaration ordering? References: <87wqdgpw73.fsf@ironicdesign.com> Message-ID: Hi Michael, This is a known limitation. You can't refer to items in splices that haven't already been mentioned in the source. I don't know why it isn't (prominently) documented, it's definitely part of the folklore. Ben On Tue May 20 2014 at 11:43:25, Michael Alan Dorman < mdorman at ironicdesign.com> wrote: > Hey, all, > > While refactoring some code, I moved a newtype declaration, and suddenly > the compiler (up-to-date ghc-7.6.3 on Debian) started complaining that > it wasn't in scope when I attempted to use it in an ADT. > > I'm still new to Haskell, so I assumed it was my misunderstanding, and > looked for documentation of declaration ordering constraints and > couldn't find any. So then I went to make a toy case to demonstrate the > problem, and it worked: > > data Baz = Baz { foo :: Foo, bar :: !(Maybe Bar) } > newtype Foo = Foo String > newtype Bar = Bar String > > So I started looking at the differences between that and my real code, > and the only thing that seemed at all signficant was that I was using TH > to generate some lenses. And sure enough, adding that caused it to > fail: > > {-# LANGUAGE TemplateHaskell #-} > import Control.Lens > data Baz = Baz { foo :: Foo, bar :: !(Maybe Bar) } > makeLenses ''Baz > newtype Foo = Foo String > newtype Bar = Bar String > > If you feed this to ghci, you now get: > > test.hs:3:25: Not in scope: type constructor or class `Foo' > > test.hs:3:45: > Not in scope: type constructor or class `Bar' > Perhaps you meant `Baz' (line 3) > > Wondering if lens was somehow doing something so exotic it was breaking > things, I tried aeson's TH support instead: > > {-# LANGUAGE TemplateHaskell #-} > import Data.Aeson > data Baz = Baz { foo :: Foo, bar :: !(Maybe Bar) } > deriveJSON defaultOptions ''Baz > newtype Foo = Foo String > newtype Bar = Bar String > > Exact same error. > > That said, if I move the splices to the end of the file, everything > works: > > {-# LANGUAGE TemplateHaskell #-} > import Data.Aeson > data Baz = Baz { foo :: Foo, bar :: !(Maybe Bar) } > newtype Foo = Foo String > newtype Bar = Bar String > deriveJSON defaultOptions ''Baz > > I looked at the GHC docs on TH, and read the wiki page, and didn't see > anything suggesting that this was a known limitation, nor did I see a > bug in the known bug list that seemed pertinent. > > So, I'm wondering if I've found an actual bug, or a known limitation > whose documentation should be made more prominent (since it seems to me > that it has pretty dramatic implications for program structure), or > what? And is there any way around it other than moving all the splices > to the end of the source file? > > Mike. > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mdorman at ironicdesign.com Tue May 20 11:57:52 2014 From: mdorman at ironicdesign.com (Michael Alan Dorman) Date: Tue, 20 May 2014 07:57:52 -0400 Subject: [Haskell-cafe] TemplateHaskell forces manual declaration ordering? In-Reply-To: (edwards.benj@gmail.com's message of "Tue, 20 May 2014 11:00:02 +0000") References: <87wqdgpw73.fsf@ironicdesign.com> Message-ID: <87sio4psqn.fsf@ironicdesign.com> "edwardsbenj at gmail.com" writes: > This is a known limitation. You can't refer to items in splices that > haven't already been mentioned in the source. I don't know why it isn't > (prominently) documented, it's definitely part of the folklore. I'm sure this limitation is documented, I was just oblivious to its implications---naively, the fact that my data declaration wasn't being created by the splice would have seemed to exclude it from consideration. However, your explanation helped me think through the implications, at which point it makes perfect sense---it's not that the declaration is created by the splice, but that it is used in the splice, and must thus be amenable to being fully traversed at the point of the splice, else the splice can't complete its job and compilation can't continue. Thanks again, Mike. From silvio.frischi at gmail.com Tue May 20 12:58:49 2014 From: silvio.frischi at gmail.com (silvio) Date: Tue, 20 May 2014 14:58:49 +0200 Subject: [Haskell-cafe] extending Do notation Message-ID: <537B5189.9040108@gmail.com> #The problem > grep -r ">>=" base | head -3 getExecutablePath = _NSGetExecutablePath >>= realpath then peek p_argv >>= peek >>= peekFilePath ... = getFileSystemEncoding >>= \enc -> GHC.withCString enc fp f > grep -r "flip" base | head -3 ... (o,n,[] ) -> return (foldl (flip id) defaultOptions o, n) peekCString s = getForeignEncoding >>= flip GHC.peekCString s peekCStringLen s = getForeignEncoding >>= flip GHC.peekCStringLen s I don't know how often i've seen this one ... >>= flip ... when really we it should have been ... {...} Only because we can't just execute an IO action and fill in the result. And this list doesn't even include examples where the programmer had to resort to making a pointless temp variable just to avoid using too many complicated functions. #The solution > grep -r ">>=" base | head -3 getExecutablePath = _do realpath { _NSGetExecutablePath } then peekFilePath { peek {peek p_argv} } ... = do GHC.withCString {getFileSystemEncoding} fp f > grep -r "flip" base | head -3 ... (o,n,[] ) -> return (foldl (flip id) defaultOptions o, n) -- leave peekCString s = GHC.peekCString {getForeignEncoding} s peekCStringLen s = GHC.peekCStringLen {getForeignEncoding} s I think there is no use of {} in haskell that does not come after a key word but has an expression inside. But it could be some other syntax too. silvio From ky3 at atamo.com Tue May 20 13:29:55 2014 From: ky3 at atamo.com (Kim-Ee Yeoh) Date: Tue, 20 May 2014 20:29:55 +0700 Subject: [Haskell-cafe] extending Do notation In-Reply-To: <537B5189.9040108@gmail.com> References: <537B5189.9040108@gmail.com> Message-ID: On Tue, May 20, 2014 at 7:58 PM, silvio wrote: > I don't know how often i've seen this one > ... >>= flip ... > when really we it should have been > ... {...} > Your email is on the assertion-heavy side. Would you reconsider restating your case? Just to take a small slice, instead of > getExecutablePath = _NSGetExecutablePath >>= realpath you'd prefer to use braces like this: > getExecutablePath = _do realpath { _NSGetExecutablePath } You could already write in today's haskell: > getExecutablePath = realpath =<< _NSGetExecutablePath -- Kim-Ee -------------- next part -------------- An HTML attachment was scrubbed... URL: From silvio.frischi at gmail.com Tue May 20 13:39:45 2014 From: silvio.frischi at gmail.com (silvio) Date: Tue, 20 May 2014 15:39:45 +0200 Subject: [Haskell-cafe] extending Do notation In-Reply-To: References: <537B5189.9040108@gmail.com> Message-ID: <537B5B21.2000004@gmail.com> > Your email is on the assertion-heavy side. Would you reconsider > restating your case? 1) >>= flip is ugly 2) you can't use >>= in an if condition 3) or imagine you want to fill it in some 3-tuple or a record type. 4) res <- fmap pureFunction ioFunction === let res = pureFunction { ioFunction} There are tons of cases that we have solved with complicated combinations of operators and functions that could be displayed much clearer with this notation. silvio From haskell at nand.wakku.to Tue May 20 13:49:54 2014 From: haskell at nand.wakku.to (Niklas Haas) Date: Tue, 20 May 2014 15:49:54 +0200 Subject: [Haskell-cafe] extending Do notation In-Reply-To: <537B5B21.2000004@gmail.com> References: <537B5189.9040108@gmail.com> <537B5B21.2000004@gmail.com> Message-ID: <20140520154954.GB22099@nanodesu.localdomain> On Tue, 20 May 2014 15:39:45 +0200, silvio wrote: > > Your email is on the assertion-heavy side. Would you reconsider > > restating your case? > > 1) >>= flip is ugly > > 2) you can't use >>= in an if condition > > 3) or imagine you want to fill it in some 3-tuple or a record type. > > 4) res <- fmap pureFunction ioFunction === let res = pureFunction { > ioFunction} > > There are tons of cases that we have solved with complicated > combinations of operators and functions that could be displayed much > clearer with this notation. Are we reinventing idiom brackets here? From ky3 at atamo.com Tue May 20 14:13:35 2014 From: ky3 at atamo.com (Kim-Ee Yeoh) Date: Tue, 20 May 2014 21:13:35 +0700 Subject: [Haskell-cafe] extending Do notation In-Reply-To: <537B5B21.2000004@gmail.com> References: <537B5189.9040108@gmail.com> <537B5B21.2000004@gmail.com> Message-ID: On Tue, May 20, 2014 at 8:39 PM, silvio wrote: > 1) >>= flip is ugly > Indeed. Many things are ugly in haskell. Improvements exact their own costs too. > > 2) you can't use >>= in an if condition > Could you give an example of the if condition you want an >>= in? > > 3) or imagine you want to fill it in some 3-tuple or a record type. > What does this mean? > 4) res <- fmap pureFunction ioFunction === let res = pureFunction { > ioFunction} > >From a distance, let and monadic bind are just different forms of name binding. But haskell's let has an effectlessness that makes it declaratively different from its cousin in, say, ocaml. This is no small change you're proposing. -- Kim-Ee -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Tue May 20 14:20:54 2014 From: allbery.b at gmail.com (Brandon Allbery) Date: Tue, 20 May 2014 10:20:54 -0400 Subject: [Haskell-cafe] TemplateHaskell forces manual declaration ordering? In-Reply-To: References: <87wqdgpw73.fsf@ironicdesign.com> Message-ID: On Tue, May 20, 2014 at 7:00 AM, edwardsbenj at gmail.com < edwards.benj at gmail.com> wrote: > This is a known limitation. You can't refer to items in splices that > haven't already been mentioned in the source. I don't know why it isn't > (prominently) documented, it's definitely part of the folklore. I think it's pretty well documented? At least I recall noting it first time I looked into TH. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From edwards.benj at gmail.com Tue May 20 14:25:48 2014 From: edwards.benj at gmail.com (edwardsbenj@gmail.com) Date: Tue, 20 May 2014 14:25:48 +0000 Subject: [Haskell-cafe] TemplateHaskell forces manual declaration ordering? References: <87wqdgpw73.fsf@ironicdesign.com> Message-ID: I was making the naive assumption that if OP didn't know about it then it wasn't prominent. That perhaps was a little hasty. There is a discussion of this very thing in the official user guide. First section, 7.16.1. Syntax. Ben On Tue May 20 2014 at 15:20:54, Brandon Allbery wrote: > On Tue, May 20, 2014 at 7:00 AM, edwardsbenj at gmail.com < > edwards.benj at gmail.com> wrote: > >> This is a known limitation. You can't refer to items in splices that >> haven't already been mentioned in the source. I don't know why it isn't >> (prominently) documented, it's definitely part of the folklore. > > > I think it's pretty well documented? At least I recall noting it first > time I looked into TH. > > -- > brandon s allbery kf8nh sine nomine > associates > allbery.b at gmail.com > ballbery at sinenomine.net > unix, openafs, kerberos, infrastructure, xmonad > http://sinenomine.net > -------------- next part -------------- An HTML attachment was scrubbed... URL: From silvio.frischi at gmail.com Tue May 20 14:27:05 2014 From: silvio.frischi at gmail.com (silvio) Date: Tue, 20 May 2014 16:27:05 +0200 Subject: [Haskell-cafe] extending Do notation In-Reply-To: References: <537B5189.9040108@gmail.com> <537B5B21.2000004@gmail.com> Message-ID: <537B6639.4060703@gmail.com> > 2) you can't use >>= in an if condition look at the first if in base package that i is not a comment ok <- getProcessTimes ... if toBool ok then do since getProcess has many actument's this is good code, but imagine it was a short IO function if toBool { getProcessTimes ... } then do looks much better you can't pipe the result of getProcessTimes into the if conditional. Unless you use a lambda of course. > 3) or imagine you want to fill it in some 3-tuple or a record type. > > What does this mean? someIOFunction ({getProcessTimes ...}, foo, bar) someIOFunction (foo { bar = {getProcessTimes ...}}) > > > 4) res <- fmap pureFunction ioFunction === let res = pureFunction { > ioFunction} > > > From a distance, let and monadic bind are just different forms of name > binding. > > But haskell's let has an effectlessness that makes it declaratively > different from its cousin in, say, ocaml. > > This is no small change you're proposing. You might have misunderstood. The 'let' in the do notation is already different from the normal 'let' in that it doesn't have an 'in' for example. {} should of course only work inside a do block. silvio From michaeltbaker at gmail.com Tue May 20 15:36:20 2014 From: michaeltbaker at gmail.com (Michael Baker) Date: Tue, 20 May 2014 10:36:20 -0500 Subject: [Haskell-cafe] OpenGL performance issue on OSX In-Reply-To: References: Message-ID: On Mon, May 19, 2014 at 11:43 PM, Anthony Cowley wrote: > > > On May 20, 2014, at 12:20 AM, Michael Baker > wrote: > > > > I'm using OpenGLRaw and I'm getting 3 frames per second trying to draw > 8000 triangles. When I profile the application, I see that almost all of > the time is taken by a call to CGLFlushDrawable, which is apparently OSX's > function for swapping the back buffer to the front buffer. > > Can you put the code somewhere so we can take a look? OpenGL offers 8000 > ways to draw 8000 triangles. > > Anthony > > > > > > Has anyone else run into a problem like this? I seem to recall a thread > a while ago about a Haskell specific OpenGL performance issue, but I can't > find it now. > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://www.haskell.org/mailman/listinfo/haskell-cafe > Here's the code https://gist.github.com/MichaelBaker/4429c93f2aca04bc79bb. I think I have everything important in there. Line 53 is the one that causes the slow down. I guess some things to note are that "Triangle" is Storable and the vector I'm creating on line 14 and writing to on line 47 is a mutable storable vector. Also, thanks Alp, I'll look into this when I get home. Although I don't think my computer has more than one graphics card (it's a Macbook Air). -------------- next part -------------- An HTML attachment was scrubbed... URL: From ky3 at atamo.com Tue May 20 16:08:34 2014 From: ky3 at atamo.com (Kim-Ee Yeoh) Date: Tue, 20 May 2014 23:08:34 +0700 Subject: [Haskell-cafe] extending Do notation In-Reply-To: <537B6639.4060703@gmail.com> References: <537B5189.9040108@gmail.com> <537B5B21.2000004@gmail.com> <537B6639.4060703@gmail.com> Message-ID: On Tue, May 20, 2014 at 9:27 PM, silvio wrote: > > 4) res <- fmap pureFunction ioFunction === let res = pureFunction { > > ioFunction} > > > > > > From a distance, let and monadic bind are just different forms of name > > binding. > > > > But haskell's let has an effectlessness that makes it declaratively > > different from its cousin in, say, ocaml. > > > > This is no small change you're proposing. > > You might have misunderstood. The 'let' in the do notation is already > different from the normal 'let' in that it doesn't have an 'in' for > example. {} should of course only work inside a do block. But you know about the desugaring for let statements within do blocks, yes? There's nothing magical about let. Which is to say, there's a regularity about let that current haskell allows us to take for granted. What you're proposing makes the let in a do-block different from a let 'in' a do-block, braces notwithstanding i.e. do let ... { ... } vs do let ... in So to return to this: > 4) res <- fmap pureFunction ioFunction === let res = pureFunction { > ioFunction} If res in "let res = ..." is not referred to anywhere in the do-block created by desugaring, it's as if the let didn't exist. On the other hand, for "res <- ... ioFunction", the effect of ioFunction is realized regardless of whether res is referenced. -- Kim-Ee -------------- next part -------------- An HTML attachment was scrubbed... URL: From silvio.frischi at gmail.com Tue May 20 16:57:12 2014 From: silvio.frischi at gmail.com (silvio) Date: Tue, 20 May 2014 18:57:12 +0200 Subject: [Haskell-cafe] extending Do notation In-Reply-To: References: <537B5189.9040108@gmail.com> <537B5B21.2000004@gmail.com> <537B6639.4060703@gmail.com> Message-ID: <537B8968.40301@gmail.com> Hi stmtpart1 { exp } stmtpart2 should desugar to x <- exp stmtpart1 x stmtpart2 it's not very complicated and i don't see why it shouldn't be done in the let case but i don't care. monadic bind would be enough for me. silvio From rendel at informatik.uni-marburg.de Tue May 20 17:05:21 2014 From: rendel at informatik.uni-marburg.de (Tillmann Rendel) Date: Tue, 20 May 2014 19:05:21 +0200 Subject: [Haskell-cafe] extending Do notation In-Reply-To: <537B5B21.2000004@gmail.com> References: <537B5189.9040108@gmail.com> <537B5B21.2000004@gmail.com> Message-ID: <537B8B51.4080902@informatik.uni-marburg.de> Hi, silvio wrote: > 4) res <- fmap pureFunction ioFunction === let res = pureFunction { > ioFunction} I think this translation is wrong. The left-hand side executes the side-effects of the ioFunction exactly once. The right-hand side looks like it would execute the side-effects of ioFunction everytime res is used. Maybe you want something more like this: res <- pureFunction { ioFunction } which would desugar to something like this: res <- do temp <- ioFunction return (pureFunction temp) Can you write desugaring rules that explain how your { ... } notation would work? Tillmann From silvio.frischi at gmail.com Tue May 20 17:10:01 2014 From: silvio.frischi at gmail.com (silvio) Date: Tue, 20 May 2014 19:10:01 +0200 Subject: [Haskell-cafe] extending Do notation In-Reply-To: <537B8B51.4080902@informatik.uni-marburg.de> References: <537B5189.9040108@gmail.com> <537B5B21.2000004@gmail.com> <537B8B51.4080902@informatik.uni-marburg.de> Message-ID: <537B8C69.3040206@gmail.com> > I think this translation is wrong. The left-hand side executes the > side-effects of the ioFunction exactly once. The right-hand side looks > like it would execute the side-effects of ioFunction everytime res is used. I knew I should have left the let thing alone. It looks a bit strange to me too. But think if it this way, it's the {} that does the IO not the let. I'm not en expert in formality but it should work something like this stmtpart1 { exp } stmtpart2 should desugar to x <- exp stmtpart1 x stmtpart2 but as I said I don't insist on this working in the let case. It's not the main point. From ozgurakgun at gmail.com Tue May 20 17:17:37 2014 From: ozgurakgun at gmail.com (Ozgur Akgun) Date: Tue, 20 May 2014 18:17:37 +0100 Subject: [Haskell-cafe] extending Do notation In-Reply-To: <537B8C69.3040206@gmail.com> References: <537B5189.9040108@gmail.com> <537B5B21.2000004@gmail.com> <537B8B51.4080902@informatik.uni-marburg.de> <537B8C69.3040206@gmail.com> Message-ID: Hi Silvio, On 20 May 2014 18:10, silvio wrote: > > stmtpart1 { exp } stmtpart2 > > should desugar to > > x <- exp > stmtpart1 x stmtpart2 > As Niklas already pointed, and his message seems to have been ignored for some reason, search for "Idiom brackets" -- they solve a very similar (same?) problem. Ozgur. -------------- next part -------------- An HTML attachment was scrubbed... URL: From silvio.frischi at gmail.com Tue May 20 17:25:16 2014 From: silvio.frischi at gmail.com (silvio) Date: Tue, 20 May 2014 19:25:16 +0200 Subject: [Haskell-cafe] extending Do notation In-Reply-To: References: <537B5189.9040108@gmail.com> <537B5B21.2000004@gmail.com> <537B8B51.4080902@informatik.uni-marburg.de> <537B8C69.3040206@gmail.com> Message-ID: <537B8FFC.7060306@gmail.com> > As Niklas already pointed, and his message seems to have been ignored > for some reason, search for "Idiom brackets" -- they solve a very > similar (same?) problem. Yes I know I looked it up and it was very complicated. I didn't understand everything. But as it looks like you would have to put everything into that bracket. The idea here is that you just put the (IO a) in the bracket. silvio From rendel at informatik.uni-marburg.de Tue May 20 17:37:17 2014 From: rendel at informatik.uni-marburg.de (Tillmann Rendel) Date: Tue, 20 May 2014 19:37:17 +0200 Subject: [Haskell-cafe] extending Do notation In-Reply-To: <537B8C69.3040206@gmail.com> References: <537B5189.9040108@gmail.com> <537B5B21.2000004@gmail.com> <537B8B51.4080902@informatik.uni-marburg.de> <537B8C69.3040206@gmail.com> Message-ID: <537B92CD.2060105@informatik.uni-marburg.de> Hi, silvio wrote: > I'm not en expert in formality but it should work something like this > > stmtpart1 { exp } stmtpart2 > > should desugar to > > x <- exp > stmtpart1 x stmtpart2 > > but as I said I don't insist on this working in the let case. Oh, I think this would work fine with let, if you do it as follows: let x = stmtpart1 { exp } stmtpart2 more stuff x other things desugars to let x = do temp <- exp stmtpart1 temp stmtpart2 more stuff x other things This is just your desugaring from above, but inside the body of the let. But what about lambdas: stmtpart1 (\x -> {exp}) stmtpart2 And what about nested braces: stmtpart1 { something { more } whatever } stmtpart2 There are lots of other cases to consider :) silvio wrote about idiom brackets: > Yes I know I looked it up and it was very complicated. I didn't > understand everything. Is your proposal more or less complicated? It seems less complicated at first, but if you fill in all the details and work out all the different cases, maybe it ends up being more complicated. Tillmann From miguelimo38 at yandex.ru Tue May 20 17:45:04 2014 From: miguelimo38 at yandex.ru (Miguel Mitrofanov) Date: Tue, 20 May 2014 21:45:04 +0400 Subject: [Haskell-cafe] Fwd: extending Do notation In-Reply-To: <946101400595996@web27h.yandex.ru> Message-ID: <5259091400607904@web7g.yandex.ru> Forgot to reply the list -------- ???????????? ????????? -------- 20.05.2014, 18:26, "Miguel Mitrofanov" : 20.05.2014, 18:14, "Kim-Ee Yeoh" : >> ?2) you can't use >>= in an if condition > ?Could you give an example of the if condition you want an >>= in? Actually, something like do ... ????if <- checkCondition ??????then doReportSuccess ??????else doReportFailure as well as do ... ????case <- generateResult of ??????Nothing -> ... ??????Just r -> ... instead of do ... ????b <- checkCondition ????if b ... and do ... ????r <- generateResult ????case r of ... would be very nice. -------- ?????????? ????????????? ????????? -------- From silvio.frischi at gmail.com Tue May 20 17:50:11 2014 From: silvio.frischi at gmail.com (silvio) Date: Tue, 20 May 2014 19:50:11 +0200 Subject: [Haskell-cafe] extending Do notation In-Reply-To: <537B92CD.2060105@informatik.uni-marburg.de> References: <537B5189.9040108@gmail.com> <537B5B21.2000004@gmail.com> <537B8B51.4080902@informatik.uni-marburg.de> <537B8C69.3040206@gmail.com> <537B92CD.2060105@informatik.uni-marburg.de> Message-ID: <537B95D3.6000303@gmail.com> > let x = stmtpart1 { exp } stmtpart2 > more stuff x other things that doesn't make sense stmts can only occure in a do not in a let stmt -> exp ; | pat <- exp ; | let decls ; | ; > But what about lambdas: > > stmtpart1 (\x -> {exp}) stmtpart2 > > > And what about nested braces: > > stmtpart1 { something { more } whatever } stmtpart2 > > > There are lots of other cases to consider :) Ok now we have finally come to implementation. I don't know a lot of compiler internals but it could work something along those lines. make "{ exp }" an expression. if you are parsing a statement there needs to be some context so an an expression can make use of the fact that it's in a do block. the expression "{ exp }" tells the statement to do "newvarname <- exp" and returns newvarname. Of course the order in which these "newvarname <- exp" will get executed is the order in which the expression results are returned, in other of the closing brackets. This should cover the lambda question and the nested question. silvio From silvio.frischi at gmail.com Tue May 20 18:01:31 2014 From: silvio.frischi at gmail.com (silvio) Date: Tue, 20 May 2014 20:01:31 +0200 Subject: [Haskell-cafe] Fwd: extending Do notation In-Reply-To: <5259091400607904@web7g.yandex.ru> References: <5259091400607904@web7g.yandex.ru> Message-ID: <537B987B.3070406@gmail.com> > do ... > if <- checkCondition > then doReportSuccess > else doReportFailure > > as well as > > do ... > case <- generateResult of > Nothing -> ... > Just r -> ... > > instead of > > do ... > b <- checkCondition > if b ... > > and > > do ... > r <- generateResult > case r of ... We could call it (<- exp) instead of ({ exp }) if that makes everyone feel more confortable but I don't see a reason to restrict it to if and case. It can could go into any expression. silvio From ky3 at atamo.com Tue May 20 18:34:28 2014 From: ky3 at atamo.com (Kim-Ee Yeoh) Date: Wed, 21 May 2014 01:34:28 +0700 Subject: [Haskell-cafe] Fwd: extending Do notation In-Reply-To: <5259091400607904@web7g.yandex.ru> References: <946101400595996@web27h.yandex.ru> <5259091400607904@web7g.yandex.ru> Message-ID: On Wed, May 21, 2014 at 12:45 AM, Miguel Mitrofanov wrote: > Actually, something like > > do ... > if <- checkCondition > then doReportSuccess > else doReportFailure > > as well as > > do ... > case <- generateResult of > Nothing -> ... > Just r -> ... > Yes, this looks like nice syntax sugar to me. And I gather that the recent (to me, anyway) lambda-case and lambda-if have abated the incromulence: https://ghc.haskell.org/trac/ghc/ticket/4359 Quote: "The motivating examples seem to be of the form getArgs >>= case of [] -> error "No args" fs -> doit fs " So do ... case <- generateResult of Nothing -> ... Just r -> ... becomes do generateResult >>= \case Nothing -> ... Just r -> ... Nevertheless, upward and onward to an even finer imperative language! -- Kim-Ee -------------- next part -------------- An HTML attachment was scrubbed... URL: From qdunkan at gmail.com Tue May 20 18:38:51 2014 From: qdunkan at gmail.com (Evan Laforge) Date: Tue, 20 May 2014 11:38:51 -0700 Subject: [Haskell-cafe] Fwd: extending Do notation In-Reply-To: <537B987B.3070406@gmail.com> References: <5259091400607904@web7g.yandex.ru> <537B987B.3070406@gmail.com> Message-ID: On Tue, May 20, 2014 at 11:01 AM, silvio wrote: > We could call it (<- exp) instead of ({ exp }) if that makes everyone > feel more confortable but I don't see a reason to restrict it to if and > case. It can could go into any expression. This extension has been proposed a number of times. Also there are haskell-like languages that implement it, e.g. using !expr. Looks like at least Idris does, maybe also elm or habit or whatever else. I can't find the write up on the haskell wiki for (<- expr), but I think the sticking point was how the desugaring should happen in nested expressions, and ambiguity about which level the (>>=) should happen at. That said, Idris apparently wasn't bothered by this. So perhaps the way forward is to find the old proposal (or make a new one, if it's gone), and see if Idris's solution applies to haskell. From rendel at informatik.uni-marburg.de Tue May 20 18:44:18 2014 From: rendel at informatik.uni-marburg.de (Tillmann Rendel) Date: Tue, 20 May 2014 20:44:18 +0200 Subject: [Haskell-cafe] extending Do notation In-Reply-To: <537B95D3.6000303@gmail.com> References: <537B5189.9040108@gmail.com> <537B5B21.2000004@gmail.com> <537B8B51.4080902@informatik.uni-marburg.de> <537B8C69.3040206@gmail.com> <537B92CD.2060105@informatik.uni-marburg.de> <537B95D3.6000303@gmail.com> Message-ID: <537BA282.7090503@informatik.uni-marburg.de> Hi, silvio wrote: > [...] This should cover the lambda > question and the nested question. No, I don't understand how this covers the lambda case. For example, how is the following desugared: do print (map (\name -> {readFile name}) ["foo", "bar"]) It would be convenient if this would mean something like: do contents <- mapM (\name -> readFile name) ["foo", "bar"] print contents But I don't understand how the implementation you propose can figure this out. Tillmann From dagitj at gmail.com Tue May 20 18:46:10 2014 From: dagitj at gmail.com (Jason Dagit) Date: Tue, 20 May 2014 11:46:10 -0700 Subject: [Haskell-cafe] OpenGL performance issue on OSX In-Reply-To: References: Message-ID: On Tue, May 20, 2014 at 8:36 AM, Michael Baker wrote: > > On Mon, May 19, 2014 at 11:43 PM, Anthony Cowley wrote: > >> >> > On May 20, 2014, at 12:20 AM, Michael Baker >> wrote: >> > >> > I'm using OpenGLRaw and I'm getting 3 frames per second trying to draw >> 8000 triangles. When I profile the application, I see that almost all of >> the time is taken by a call to CGLFlushDrawable, which is apparently OSX's >> function for swapping the back buffer to the front buffer. >> >> Can you put the code somewhere so we can take a look? OpenGL offers 8000 >> ways to draw 8000 triangles. >> >> Anthony >> >> >> > >> > Has anyone else run into a problem like this? I seem to recall a thread >> a while ago about a Haskell specific OpenGL performance issue, but I can't >> find it now. >> > _______________________________________________ >> > Haskell-Cafe mailing list >> > Haskell-Cafe at haskell.org >> > http://www.haskell.org/mailman/listinfo/haskell-cafe >> > > Here's the code https://gist.github.com/MichaelBaker/4429c93f2aca04bc79bb. > I think I have everything important in there. Line 53 is the one that > causes the slow down. I guess some things to note are that "Triangle" is > Storable and the vector I'm creating on line 14 and writing to on line 47 > is a mutable storable vector. > I think I know what is causing the slow down you're seeing. I want to point out some ways that you can get better help in the future. Perhaps you already know these things and you were in a hurry or something like that. In that case, I still want to point out these tips anyway for the benefit of others :) First: Thank you for posting the code, but please understand that I can't find withBasicWindow on hoogle or google and there isn't a single import in that code. How does it work? What is triangles? It's hard for me to help people if I don't have the complete code or know which libraries they're using. I'm sure others are in a similar situation. Second: OpenGL is a library/api for specifying the lighting, transformations, geometry, colors, raster effects, shaders and that sort of thing. OpenGL doesn't mention anything about making a window, putting pixels in the window, nor interfacing with the OS. On the other hand, performance problems don't discriminate and can happen at any level. In other words, you'll get much better help if you provide runnable examples. Yes that means more work for you, but I promise that being in the habit of making minimal/reproducible test cases will hugely improve your (or anyone's) skills as a software engineer. Furthermore, because I'm not testing with your code, anything I suggest should considered speculation. Third: In terms of graphics performance most people are accustomed to talking about FPS, but FPS is hard to work with. Think about this, if you can render one effect and get 60 FPS and you add another effect that renders at 30 FPS, what should be the resulting FPS? Instead, set a budget for rendering time by taking 1/(desired FPS), 60 FPS = 16.67 ms, and focus on how long each operation takes to render. At least then you can simply add the costs and figure out how much time you have left. Additionally, when you measure the FPS of rendering something there is usually a frame rate limit, say 60 FPS, so you might think your effect takes 16.7 ms but it really takes 2 ms. With that out of the way, I see that your `tris` list is 80 elements. If you're rendering 8000 triangles then are you saying you call that 100 times per frame? glDrawArray is slow per-call and is designed to work with a lot of data per-call. I haven't tried criterion with opengl before, but that's what I would do next. I'd use it to figure out the time per-call of your glDrawArray. Then you can get a sense of how many glDrawArray you can use as-per your rendering budget. I'd also look up the tricks that people use to reduce the number of individual calls to glDrawArray. Look up 'texture atlas'. I've never actually used it so don't trust my explanation :) Roughly, I think you are restricted to one texture per glDrawArray call so you 'cheat' by copying all your textures into one big texture and note the boundary points of each texture and provide those as the texture coordinates for your triangles as appropriate. You could probably make this nicer to work with by using Data.Map to map between your original texture id and the coordinates in the atlas. I hope that helps, Jason -------------- next part -------------- An HTML attachment was scrubbed... URL: From trebla at vex.net Tue May 20 18:59:56 2014 From: trebla at vex.net (Albert Y. C. Lai) Date: Tue, 20 May 2014 14:59:56 -0400 Subject: [Haskell-cafe] extending the notion of notation (was: extending Do notation) In-Reply-To: <537B5189.9040108@gmail.com> References: <537B5189.9040108@gmail.com> Message-ID: <537BA62C.20709@vex.net> On 14-05-20 08:58 AM, silvio wrote: > Only because we can't just execute an IO action and fill in the result. > And this list doesn't even include examples where the programmer had to > resort to making a pointless temp variable just to avoid using too many > complicated functions. I agree that requiring extra variable names to express data propagation is a problem. I disagree that any notation that goes like third_effect {first_effect} {second_effect} is a solution. I have written it to highlight the problem: the order of the effects is neither entirely left-to-right nor entirely right-to-left, but rather a haphazard "start somewhere in the middle, go right for a while, now suddenly jump back to the left". This is also my second biggest gripe with Lisp, Scheme, SML, Caml, every impure functional language. One thing the do-notation gets right is that I/O effect order is the simple top-to-bottom. The solution is to liberate programming from the plain text file. Draw a dataflow-like diagram. Arrange effect boxes in one order to indicate effect order. Draw lines or curves between them to indicate data propagation and/or parameter passing. Can programming be liberated from the plain text file? From ky3 at atamo.com Tue May 20 19:03:33 2014 From: ky3 at atamo.com (Kim-Ee Yeoh) Date: Wed, 21 May 2014 02:03:33 +0700 Subject: [Haskell-cafe] extending Do notation In-Reply-To: <537B8968.40301@gmail.com> References: <537B5189.9040108@gmail.com> <537B5B21.2000004@gmail.com> <537B6639.4060703@gmail.com> <537B8968.40301@gmail.com> Message-ID: On Tue, May 20, 2014 at 11:57 PM, silvio wrote: > stmtpart1 { exp } stmtpart2 > > should desugar to > > x <- exp > stmtpart1 x stmtpart2 > Ok, your proposal looks a lot clearer now. And in fact I've been mulling over the same problem. Let's kick it up a notch: Suppose what we really want to write is just: stmtpart1 exp stmtpart2 so that we do away with brackets, braces, and all other carpal-tunnelling punctuation-that-looks-like-line-noise? How would that work? -- Kim-Ee -------------- next part -------------- An HTML attachment was scrubbed... URL: From ky3 at atamo.com Tue May 20 19:09:35 2014 From: ky3 at atamo.com (Kim-Ee Yeoh) Date: Wed, 21 May 2014 02:09:35 +0700 Subject: [Haskell-cafe] Fwd: extending Do notation In-Reply-To: References: <5259091400607904@web7g.yandex.ru> <537B987B.3070406@gmail.com> Message-ID: On Wed, May 21, 2014 at 1:38 AM, Evan Laforge wrote: > So perhaps the way forward is to find the old proposal (or make a new > one, if it's gone), and see if Idris's solution applies to haskell. > Is Idris's solution written up anywhere? Mind sharing the link? -- Kim-Ee -------------- next part -------------- An HTML attachment was scrubbed... URL: From chrisdone at gmail.com Tue May 20 19:10:45 2014 From: chrisdone at gmail.com (Christopher Done) Date: Tue, 20 May 2014 21:10:45 +0200 Subject: [Haskell-cafe] Imports at bottom, why not? In-Reply-To: References: Message-ID: On 20 May 2014 20:41, Jochen Keil wrote: > > > The first technical problem I see is that a compiler can't easily > > generate a dependency graph without first parsing the whole module. > > Pardon my ignorance, but couldn't you just ignore every line that > doesn't start with 'import'? > I see two problems: 1) Standard Haskell has semi-colons for declaration separation, not just lines. So you could write x = do { putStrLn "Quoth I; sup?"; print "X" }; import Data.List; y = "oopie" You would have to parse this (to some depth) to figure out where x starts and the Data.List import begins. 2) With Template-Haskell enabled, you'd need to run the TH to ignore quasi-quotes that just happen to contain "import X", and if imports could appear anywhere, then TH would probably allow it, too, which would mean you'd have to run the TH in a module to find out what else it imports. With the restrictions imposed on imports being directly after module headers right now, a compiler can trivially scan through everything before even starting to parse (and quickly point out import cycles, or missing modules). -------------- next part -------------- An HTML attachment was scrubbed... URL: From donn at avvanta.com Tue May 20 19:17:52 2014 From: donn at avvanta.com (Donn Cave) Date: Tue, 20 May 2014 12:17:52 -0700 (PDT) Subject: [Haskell-cafe] Fwd: extending Do notation In-Reply-To: References: Message-ID: <20140520191752.972E1F3936@mail.avvanta.com> > ... And I gather that the recent > (to me, anyway) lambda-case and lambda-if have abated the incromulence: > > https://ghc.haskell.org/trac/ghc/ticket/4359 I thought so too, even though I have no idea what incromulence means, but I can't find anything about lambda-if in the 7.6.3 documentation, and the discussion seems to discount it. It's true (I think) that the use cases are relatively few. The multi-way-if that appears in the trac discussion is apparently, supported but it's a mystery to me if this has anything to do with lambda-if. Donn From qdunkan at gmail.com Tue May 20 19:20:34 2014 From: qdunkan at gmail.com (Evan Laforge) Date: Tue, 20 May 2014 12:20:34 -0700 Subject: [Haskell-cafe] Fwd: extending Do notation In-Reply-To: References: <5259091400607904@web7g.yandex.ru> <537B987B.3070406@gmail.com> Message-ID: On Tue, May 20, 2014 at 12:09 PM, Kim-Ee Yeoh wrote: > > On Wed, May 21, 2014 at 1:38 AM, Evan Laforge wrote: >> >> So perhaps the way forward is to find the old proposal (or make a new >> one, if it's gone), and see if Idris's solution applies to haskell. > > > Is Idris's solution written up anywhere? Mind sharing the link? It's briefly documented in the tutorial, see do notation: http://eb.host.cs.st-andrews.ac.uk/writings/idris-tutorial.pdf Looks like the key bit is "will lift expr as high as possible within the current scope". From spam at scientician.net Tue May 20 19:25:49 2014 From: spam at scientician.net (Bardur Arantsson) Date: Tue, 20 May 2014 21:25:49 +0200 Subject: [Haskell-cafe] extending the notion of notation In-Reply-To: <537BA62C.20709@vex.net> References: <537B5189.9040108@gmail.com> <537BA62C.20709@vex.net> Message-ID: On 2014-05-20 20:59, Albert Y. C. Lai wrote: > > Can programming be liberated from the plain text file? No. I hate to be downer, but every single time I've seen a proposal for this it has failed to account for how, *exactly*, it is actually different in any meaningful way from the failed attempts at addressing this issue. I've often been quite tempted to draw up a checklist ? la the infamous spam-fighting checklist for why $YOUR_IDEA_FOR_NON-TEXT-BASED_PROGRAMMING won't work -- at the very least it'd serve as a time-saver whenever this comes up :). We can all dream, but unless and until someone comes up with something *radically* different from previous attempts, it just ain't going to happen. Regards, From acowley at seas.upenn.edu Tue May 20 19:26:44 2014 From: acowley at seas.upenn.edu (Anthony Cowley) Date: Tue, 20 May 2014 15:26:44 -0400 Subject: [Haskell-cafe] OpenGL performance issue on OSX In-Reply-To: References: Message-ID: > On May 20, 2014, at 11:36 AM, Michael Baker wrote: > > >> On Mon, May 19, 2014 at 11:43 PM, Anthony Cowley wrote: >> >> > On May 20, 2014, at 12:20 AM, Michael Baker wrote: >> > >> > I'm using OpenGLRaw and I'm getting 3 frames per second trying to draw 8000 triangles. When I profile the application, I see that almost all of the time is taken by a call to CGLFlushDrawable, which is apparently OSX's function for swapping the back buffer to the front buffer. >> >> Can you put the code somewhere so we can take a look? OpenGL offers 8000 ways to draw 8000 triangles. >> >> Anthony >> >> >> > >> > Has anyone else run into a problem like this? I seem to recall a thread a while ago about a Haskell specific OpenGL performance issue, but I can't find it now. >> > _______________________________________________ >> > Haskell-Cafe mailing list >> > Haskell-Cafe at haskell.org >> > http://www.haskell.org/mailman/listinfo/haskell-cafe > > Here's the code https://gist.github.com/MichaelBaker/4429c93f2aca04bc79bb. I think I have everything important in there. Line 53 is the one that causes the slow down. I guess some things to note are that "Triangle" is Storable and the vector I'm creating on line 14 and writing to on line 47 is a mutable storable vector. I would avoid setting the buffer data every frame like this. You should create your VBO once, then map it, update the data, and unmap it every frame if all your geometry really does change every frame. Don't use a list for your geometry if you can avoid it. Consider using VAOs to keep track of enabled attributes, etc. Unsurprisingly, I'd recommend taking a look at the vinyl-gl tutorial for most of those considerations, though I don't think I say anything about mapping buffers there. Anthony > > Also, thanks Alp, I'll look into this when I get home. Although I don't think my computer has more than one graphics card (it's a Macbook Air). -------------- next part -------------- An HTML attachment was scrubbed... URL: From spam at scientician.net Tue May 20 19:29:10 2014 From: spam at scientician.net (Bardur Arantsson) Date: Tue, 20 May 2014 21:29:10 +0200 Subject: [Haskell-cafe] Fwd: extending Do notation In-Reply-To: <20140520191752.972E1F3936@mail.avvanta.com> References: <20140520191752.972E1F3936@mail.avvanta.com> Message-ID: On 2014-05-20 21:17, Donn Cave wrote: > I have no idea what incromulence means, I believe it's the opposite of cromulence[0]. [0] https://en.wiktionary.org/wiki/cromulent Regards, From msherman77 at yahoo.com Tue May 20 19:40:26 2014 From: msherman77 at yahoo.com (Michael S) Date: Tue, 20 May 2014 12:40:26 -0700 (PDT) Subject: [Haskell-cafe] haskell on OpenBSD 5.5 Message-ID: <1400614826.99466.YahooMailNeo@web163103.mail.bf1.yahoo.com> Good day all, I installed OpenBSD 5.5 in order to learn haskell. There are a few glitches however. I installed the haskell-platform meta-package and the issues I noticed are: - hs-vector wouldn't install - ghci wouldn't start, the message: unable to load package `integer-gmp' Has anyone experienced the same issue? Is this happening on OpenBSD 5.4? Is this OpenBSD specific? Thanks in advance. -------------- next part -------------- An HTML attachment was scrubbed... URL: From silvio.frischi at gmail.com Tue May 20 19:47:47 2014 From: silvio.frischi at gmail.com (silvio) Date: Tue, 20 May 2014 21:47:47 +0200 Subject: [Haskell-cafe] extending Do notation In-Reply-To: <537BA282.7090503@informatik.uni-marburg.de> References: <537B5189.9040108@gmail.com> <537B5B21.2000004@gmail.com> <537B8B51.4080902@informatik.uni-marburg.de> <537B8C69.3040206@gmail.com> <537B92CD.2060105@informatik.uni-marburg.de> <537B95D3.6000303@gmail.com> <537BA282.7090503@informatik.uni-marburg.de> Message-ID: <537BB163.8060200@gmail.com> On 05/20/2014 08:44 PM, Tillmann Rendel wrote: > Hi, > > silvio wrote: >> [...] This should cover the lambda >> question and the nested question. > > No, I don't understand how this covers the lambda case. For example, how > is the following desugared: > > do print (map (\name -> {readFile name}) ["foo", "bar"]) > > It would be convenient if this would mean something like: > > do contents <- mapM (\name -> readFile name) ["foo", "bar"] > print contents I see sorry I didn't consider that there would be new variables. syntax changed from {exp} to (<-exp) An other thing to consider is functions. This seems really awesome syntax. Unfortunately, this might cause some troubles because functions can be monads. do print map (<-readFile) ["foo","bar"] silvio From miguelimo38 at yandex.ru Tue May 20 19:51:32 2014 From: miguelimo38 at yandex.ru (MigMit) Date: Tue, 20 May 2014 23:51:32 +0400 Subject: [Haskell-cafe] extending the notion of notation (was: extending Do notation) In-Reply-To: <537BA62C.20709@vex.net> References: <537B5189.9040108@gmail.com> <537BA62C.20709@vex.net> Message-ID: > The solution is to liberate programming from the plain text file. Sounds a lot like "liberating literature from text". Sure, there are some kinds of media that are very non-textual... but they aren't literature anymore. And no, whatever Lispers want to believe in, program is not AST. Program is TEXT. Even if it's a Lisp program. From alois.cochard at gmail.com Tue May 20 20:03:02 2014 From: alois.cochard at gmail.com (Alois Cochard) Date: Tue, 20 May 2014 21:03:02 +0100 Subject: [Haskell-cafe] Fwd: extending Do notation In-Reply-To: References: <5259091400607904@web7g.yandex.ru> <537B987B.3070406@gmail.com> Message-ID: I heard Idris' author saying during a talk saying that he had once a branch which work even without the `!`. That never got in because it scare users (according to Edwin for no rational reason). I don't know enough the details, but I think dependent typing (and the Eff system) have probably a big role to play here... I mean Idris can go as far as "inferring implementation" so the type system allow the compiler to "understand" more and probably workaround ambiguity that Haskell might not be able to solve now (or even never). That's just a very naive view of the problem, which might be as well erroneous so please correct me if I'm wrong. On 20 May 2014 20:20, Evan Laforge wrote: > On Tue, May 20, 2014 at 12:09 PM, Kim-Ee Yeoh wrote: > > > > On Wed, May 21, 2014 at 1:38 AM, Evan Laforge wrote: > >> > >> So perhaps the way forward is to find the old proposal (or make a new > >> one, if it's gone), and see if Idris's solution applies to haskell. > > > > > > Is Idris's solution written up anywhere? Mind sharing the link? > > It's briefly documented in the tutorial, see do notation: > > http://eb.host.cs.st-andrews.ac.uk/writings/idris-tutorial.pdf > > Looks like the key bit is "will lift expr as high as possible within > the current scope". > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -- *A\ois* http://twitter.com/aloiscochard http://github.com/aloiscochard -------------- next part -------------- An HTML attachment was scrubbed... URL: From ky3 at atamo.com Tue May 20 20:02:45 2014 From: ky3 at atamo.com (Kim-Ee Yeoh) Date: Wed, 21 May 2014 03:02:45 +0700 Subject: [Haskell-cafe] extending Do notation In-Reply-To: <537BB163.8060200@gmail.com> References: <537B5189.9040108@gmail.com> <537B5B21.2000004@gmail.com> <537B8B51.4080902@informatik.uni-marburg.de> <537B8C69.3040206@gmail.com> <537B92CD.2060105@informatik.uni-marburg.de> <537B95D3.6000303@gmail.com> <537BA282.7090503@informatik.uni-marburg.de> <537BB163.8060200@gmail.com> Message-ID: On Wed, May 21, 2014 at 2:47 AM, silvio wrote: > do print map (<-readFile) ["foo","bar"] The closest current Haskell can come to this is print =<< mapM readFile ["foo","bar"] And I agree that the manual effect typing, the requisite =<< and the mapM for map, can be a pain. -- Kim-Ee -------------- next part -------------- An HTML attachment was scrubbed... URL: From jwlato at gmail.com Tue May 20 20:06:34 2014 From: jwlato at gmail.com (John Lato) Date: Tue, 20 May 2014 13:06:34 -0700 Subject: [Haskell-cafe] extending the notion of notation (was: extending Do notation) In-Reply-To: <537BA62C.20709@vex.net> References: <537B5189.9040108@gmail.com> <537BA62C.20709@vex.net> Message-ID: On May 20, 2014 12:00 PM, "Albert Y. C. Lai" wrote: > > On 14-05-20 08:58 AM, silvio wrote: >> >> Only because we can't just execute an IO action and fill in the result. >> And this list doesn't even include examples where the programmer had to >> resort to making a pointless temp variable just to avoid using too many >> complicated functions. > > > I agree that requiring extra variable names to express data propagation is a problem. I disagree that any notation that goes like > > third_effect {first_effect} {second_effect} > > is a solution. I have written it to highlight the problem: the order of the effects is neither entirely left-to-right nor entirely right-to-left, but rather a haphazard "start somewhere in the middle, go right for a while, now suddenly jump back to the left". This is also my second biggest gripe with Lisp, Scheme, SML, Caml, every impure functional language. > > One thing the do-notation gets right is that I/O effect order is the simple top-to-bottom. > > The solution is to liberate programming from the plain text file. > > Draw a dataflow-like diagram. Arrange effect boxes in one order to indicate effect order. Draw lines or curves between them to indicate data propagation and/or parameter passing. > > Can programming be liberated from the plain text file? Having done a number of projects in Max/MSP and PD, I have to say this is a horribly inefficient programming interface. It seems attractive in small doses, but it doesn't scale well. Additionally it's not at all clear how to design an editor that allows for decent automation, which can slow down many workflows. If you're interested in this interface, I'd suggest that you try PD for a while. -------------- next part -------------- An HTML attachment was scrubbed... URL: From silvio.frischi at gmail.com Tue May 20 20:07:43 2014 From: silvio.frischi at gmail.com (silvio) Date: Tue, 20 May 2014 22:07:43 +0200 Subject: [Haskell-cafe] extending Do notation In-Reply-To: References: <537B5189.9040108@gmail.com> <537B5B21.2000004@gmail.com> <537B8B51.4080902@informatik.uni-marburg.de> <537B8C69.3040206@gmail.com> <537B92CD.2060105@informatik.uni-marburg.de> <537B95D3.6000303@gmail.com> <537BA282.7090503@informatik.uni-marburg.de> <537BB163.8060200@gmail.com> Message-ID: <537BB60F.8010003@gmail.com> A simple solution would be to say that (<- exp) can only contain variables bound by do and leave the lambda out for now. This should make the execution order more or less clear and should cover most cases. If the need arose, it could still be extended to incorporate more things later. silvio From ky3 at atamo.com Tue May 20 20:10:46 2014 From: ky3 at atamo.com (Kim-Ee Yeoh) Date: Wed, 21 May 2014 03:10:46 +0700 Subject: [Haskell-cafe] Fwd: extending Do notation In-Reply-To: References: <5259091400607904@web7g.yandex.ru> <537B987B.3070406@gmail.com> Message-ID: On Wed, May 21, 2014 at 2:20 AM, Evan Laforge wrote: > On Tue, May 20, 2014 at 12:09 PM, Kim-Ee Yeoh wrote: > > It's briefly documented in the tutorial, see do notation: > > http://eb.host.cs.st-andrews.ac.uk/writings/idris-tutorial.pdf > > Looks like the key bit is "will lift expr as high as possible within > the current scope". Thanks! The section on bang-notation or !-notation is very interesting! And how did haskell-cafe ever miss doing an in-depth on this ...? -- Kim-Ee -------------- next part -------------- An HTML attachment was scrubbed... URL: From qdunkan at gmail.com Tue May 20 20:22:08 2014 From: qdunkan at gmail.com (Evan Laforge) Date: Tue, 20 May 2014 13:22:08 -0700 Subject: [Haskell-cafe] extending Do notation In-Reply-To: References: <537B5189.9040108@gmail.com> <537B5B21.2000004@gmail.com> <537B8B51.4080902@informatik.uni-marburg.de> <537B8C69.3040206@gmail.com> <537B92CD.2060105@informatik.uni-marburg.de> <537B95D3.6000303@gmail.com> <537BA282.7090503@informatik.uni-marburg.de> <537BB163.8060200@gmail.com> Message-ID: On Tue, May 20, 2014 at 1:02 PM, Kim-Ee Yeoh wrote: > > On Wed, May 21, 2014 at 2:47 AM, silvio wrote: >> >> do print map (<-readFile) ["foo","bar"] > > > The closest current Haskell can come to this is > > print =<< mapM readFile ["foo","bar"] > > And I agree that the manual effect typing, the requisite =<< and the mapM > for map, can be a pain. For an example that's harder to convert, I occasionally have something like this: f x | a && (b > 1 || (c && d)) && e = ... Now if 'c' becomes monadic you have to rewrite the whole expression in an entirely different (and much noisier) style. Not just all the lifting, but you can't use infix operators anymore. It really does feel like there are two languages (or dialects), with different idioms and syntax. You can translate between them without much complicated effort, but it's still a manual translation. From mwm at mired.org Tue May 20 20:27:09 2014 From: mwm at mired.org (Mike Meyer) Date: Tue, 20 May 2014 15:27:09 -0500 Subject: [Haskell-cafe] haskell on OpenBSD 5.5 In-Reply-To: <1400614826.99466.YahooMailNeo@web163103.mail.bf1.yahoo.com> References: <1400614826.99466.YahooMailNeo@web163103.mail.bf1.yahoo.com> Message-ID: The integer-gmp problems is that you don't have all the bits of the gmp library installed. This happens when the package system doesn't correctly pick them up, or when I install HP from outside the package system. The usual fix (on Linux, anyway) is to install the appropriate dev package to go with gmp. If OpenBSD hasn't yet succumbed to the idiocy of dev packages, it's possible the gmp library itself is missing. I suspect similar issues with hs-vector: there's some dependency missing in the package system description. On Tue, May 20, 2014 at 2:40 PM, Michael S wrote: > > Good day all, > > I installed OpenBSD 5.5 in order to learn haskell. > There are a few glitches however. I installed the haskell-platform meta-package and the issues I noticed are: > - hs-vector wouldn't install > - ghci wouldn't start, the message: unable to load package `integer-gmp' > > Has anyone experienced the same issue? Is this happening on OpenBSD 5.4? > > Is this OpenBSD specific? > > Thanks in advance. > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mwm at mired.org Tue May 20 20:32:38 2014 From: mwm at mired.org (Mike Meyer) Date: Tue, 20 May 2014 15:32:38 -0500 Subject: [Haskell-cafe] extending the notion of notation (was: extending Do notation) In-Reply-To: References: <537B5189.9040108@gmail.com> <537BA62C.20709@vex.net> Message-ID: On Tue, May 20, 2014 at 2:51 PM, MigMit wrote: > And no, whatever Lispers want to believe in, program is not AST. Program > is TEXT. No, a program is a bunch of bits the computer can execute. It can be represented as TEXT, or an AST, or even a diagram in some graphical programming tool somewhere - all of which we also confusingly call a "program". As noted by others, attempts to get away from TEXT have been going on for decades. So far every attempt has failed - for reasons also noted by others. -------------- next part -------------- An HTML attachment was scrubbed... URL: From silvio.frischi at gmail.com Tue May 20 20:42:00 2014 From: silvio.frischi at gmail.com (silvio) Date: Tue, 20 May 2014 22:42:00 +0200 Subject: [Haskell-cafe] extending Do notation In-Reply-To: References: <537B5189.9040108@gmail.com> <537B5B21.2000004@gmail.com> <537B8B51.4080902@informatik.uni-marburg.de> <537B8C69.3040206@gmail.com> <537B92CD.2060105@informatik.uni-marburg.de> <537B95D3.6000303@gmail.com> <537BA282.7090503@informatik.uni-marburg.de> <537BB163.8060200@gmail.com> Message-ID: <537BBE18.8090208@gmail.com> > f x > | a && (b > 1 || (c && d)) && e = ... > > Now if 'c' becomes monadic you have to rewrite the whole expression in > an entirely different (and much noisier) style. Not just all the > lifting, but you can't use infix operators anymore. It really does > feel like there are two languages (or dialects), with different idioms > and syntax. You can translate between them without much complicated > effort, but it's still a manual translation. > Good example, but i don't think you can have monads in a guard. Also I'd go for the temporary variable instead of lifting. From miguelimo38 at yandex.ru Tue May 20 20:44:46 2014 From: miguelimo38 at yandex.ru (MigMit) Date: Wed, 21 May 2014 00:44:46 +0400 Subject: [Haskell-cafe] extending the notion of notation (was: extending Do notation) In-Reply-To: References: <537B5189.9040108@gmail.com> <537BA62C.20709@vex.net> Message-ID: <6F2160E5-29E0-497A-AE71-63E3E0637334@yandex.ru> On 21 May 2014, at 00:32, Mike Meyer wrote: > On Tue, May 20, 2014 at 2:51 PM, MigMit wrote: > And no, whatever Lispers want to believe in, program is not AST. Program is TEXT. > > No, a program is a bunch of bits the computer can execute. It can be represented as TEXT, or an AST, or even a diagram in some graphical programming tool somewhere - all of which we also confusingly call a "program". Incorrect. There are programs in pseudocode, programs for MIX, programs for machines they don't make anymore. Ada Lovelace created some programs for Babbidge's machine. Program can be buggy, or unfinished. Neither of these types of programs can be executed, but they are still programs. I'd say that what makes program a program is not how it's executed, it's how it is read. By humans. And, as for now, there are no adequate alternatives to text representation. They all lose coding style, at least. From miguelimo38 at yandex.ru Tue May 20 20:46:37 2014 From: miguelimo38 at yandex.ru (MigMit) Date: Wed, 21 May 2014 00:46:37 +0400 Subject: [Haskell-cafe] extending the notion of notation (was: extending Do notation) In-Reply-To: <6F2160E5-29E0-497A-AE71-63E3E0637334@yandex.ru> References: <537B5189.9040108@gmail.com> <537BA62C.20709@vex.net> <6F2160E5-29E0-497A-AE71-63E3E0637334@yandex.ru> Message-ID: <338949D4-948D-4FBB-95BD-56885DF0F993@yandex.ru> > Babbidge's machine. Babbage, of course. Sorry for misspelling. From msherman77 at yahoo.com Tue May 20 20:46:27 2014 From: msherman77 at yahoo.com (Michael S) Date: Tue, 20 May 2014 13:46:27 -0700 (PDT) Subject: [Haskell-cafe] haskell on OpenBSD 5.5 In-Reply-To: References: <1400614826.99466.YahooMailNeo@web163103.mail.bf1.yahoo.com> Message-ID: <1400618787.94328.YahooMailNeo@web163105.mail.bf1.yahoo.com> Thanks! I will try installing the lib. Michael ? On Tuesday, May 20, 2014 4:27:11 PM, Mike Meyer wrote: The integer-gmp problems is that you don't have all the bits of the gmp library installed. This happens when the package system doesn't correctly pick them up, or when I install HP from outside the package system. The usual fix (on Linux, anyway) is to install the appropriate dev package to go with gmp. If OpenBSD hasn't yet succumbed to the idiocy of dev packages, it's possible the gmp library itself is missing. I suspect similar issues with hs-vector: there's some dependency missing in the package system description. On Tue, May 20, 2014 at 2:40 PM, Michael S wrote: > >Good day all, I installed OpenBSD 5.5 in order to learn haskell. There are a few glitches however. I installed the haskell-platform meta-package and the issues I noticed are: - hs-vector wouldn't install - ghci wouldn't start, the message: unable to load package `integer-gmp' Has anyone experienced the same issue? Is this happening on OpenBSD 5.4? Is this OpenBSD specific? Thanks in advance. >_______________________________________________ >Haskell-Cafe mailing list >Haskell-Cafe at haskell.org >http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From silvio.frischi at gmail.com Tue May 20 21:06:38 2014 From: silvio.frischi at gmail.com (silvio) Date: Tue, 20 May 2014 23:06:38 +0200 Subject: [Haskell-cafe] Fwd: extending Do notation In-Reply-To: References: <5259091400607904@web7g.yandex.ru> <537B987B.3070406@gmail.com> Message-ID: <537BC3DE.1030803@gmail.com> I just noticed that the (<-exp) notation would collide with pattern guards. So maybe the Bang ! would be a better notation. From mwm at mired.org Tue May 20 21:08:31 2014 From: mwm at mired.org (Mike Meyer) Date: Tue, 20 May 2014 16:08:31 -0500 Subject: [Haskell-cafe] extending the notion of notation (was: extending Do notation) In-Reply-To: <6F2160E5-29E0-497A-AE71-63E3E0637334@yandex.ru> References: <537B5189.9040108@gmail.com> <537BA62C.20709@vex.net> <6F2160E5-29E0-497A-AE71-63E3E0637334@yandex.ru> Message-ID: On Tue, May 20, 2014 at 3:44 PM, MigMit wrote: > > On 21 May 2014, at 00:32, Mike Meyer wrote: > > > On Tue, May 20, 2014 at 2:51 PM, MigMit wrote: > > And no, whatever Lispers want to believe in, program is not AST. Program > is TEXT. > > > > No, a program is a bunch of bits the computer can execute. It can be > represented as TEXT, or an AST, or even a diagram in some graphical > programming tool somewhere - all of which we also confusingly call a > "program". > > Incorrect. There are programs in pseudocode, programs for MIX, programs > for machines they don't make anymore. Ada Lovelace created some programs > for Babbidge's machine. Program can be buggy, or unfinished. Neither of > these types of programs can be executed, but they are still programs. Incorrect. Those are all representations of programs. Whether they can or can't be executed is immaterial to that status. As I said, it's common to call a representation of a program a program as well, because the context lets the reader sort it out. But in this context, it matters, because we're talking about alternative representations for programs. Turning your Haskell representation of a program into an actual program generally requires it to be translated through multiple different representations: core, C, assembler and finally you get a program. There may be some ASTs in there as well. Hopefully, they all preserve the intent of the programmer (otherwise, one or more of the steps in your tool chain is buggy). > I'd say that what makes program a program is not how it's executed, it's > how it is read. By humans. > I'd say that's what makes a text (or whatever) a representation of a program: how it's read by humans. Whether or not it can be turned into an actual, honest to goddesses executable program is another issue entirely. > And, as for now, there are no adequate alternatives to text > representation. Now you got it! To add the proper emphasis: there are no adequate alternatives to text *representation*. Exactly right! The text is a representation of a program, not a program. -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Tue May 20 21:19:46 2014 From: allbery.b at gmail.com (Brandon Allbery) Date: Tue, 20 May 2014 17:19:46 -0400 Subject: [Haskell-cafe] Fwd: extending Do notation In-Reply-To: <537BC3DE.1030803@gmail.com> References: <5259091400607904@web7g.yandex.ru> <537B987B.3070406@gmail.com> <537BC3DE.1030803@gmail.com> Message-ID: On Tue, May 20, 2014 at 5:06 PM, silvio wrote: > I just noticed that the (<-exp) notation would collide with pattern > guards. So maybe the Bang ! would be a better notation. I have to admit, I thought that was deliberate; that is, that the proposal was a generalization of pattern guards. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From alex.solla at gmail.com Tue May 20 21:30:41 2014 From: alex.solla at gmail.com (Alexander Solla) Date: Tue, 20 May 2014 14:30:41 -0700 Subject: [Haskell-cafe] Hackage Down? Message-ID: I can get to the Hackage website, but I'm having problems doing things with cabal. I have plenty of disk space. I deleted my package cache, since it was complaining about a truncated tar archive for a specific package. Now I'm trying: $ cabal update Downloading the latest package list from hackage.haskell.org cabal: truncated tar archive -------------- next part -------------- An HTML attachment was scrubbed... URL: From silvio.frischi at gmail.com Tue May 20 21:57:31 2014 From: silvio.frischi at gmail.com (silvio) Date: Tue, 20 May 2014 23:57:31 +0200 Subject: [Haskell-cafe] Fwd: extending Do notation In-Reply-To: References: <5259091400607904@web7g.yandex.ru> <537B987B.3070406@gmail.com> <537BC3DE.1030803@gmail.com> Message-ID: <537BCFCB.3020609@gmail.com> On 05/20/2014 11:19 PM, Brandon Allbery wrote: > I have to admit, I thought that was deliberate; that is, that the > proposal was a generalization of pattern guards. The idea was to extend the "do" notation. So you will never be able to use it for a toplevel declaration, and I originally used a different notation. Hmm the new notation is also ambiguous in a statement. What's supposed to be the difference between. exp <- exp === exp === stmt and pat <- exp === stmt I guess the "<-" in patten guards is a bit miss leading too, as it has nothing to do with monads. It should be a "=" (doesn't work of course) or a "~". I guess the problem is that <- does two things which can be useful individually 1. (>>=) i.e. extract value from monad (what the new <- or ! should do) 2. Assign/Pattern match it. same as("=" in let, "<-" in Pattern guards) too much chaos! silvio From dedgrant at gmail.com Tue May 20 22:12:43 2014 From: dedgrant at gmail.com (Darren Grant) Date: Wed, 21 May 2014 00:12:43 +0200 Subject: [Haskell-cafe] extending the notion of notation In-Reply-To: References: <537B5189.9040108@gmail.com> <537BA62C.20709@vex.net> Message-ID: There are plenty of counterexamples. Variations on visual function blocks abound in engineering circles. A better question might be whether the HMI bandwidth can be increased beyond what's possible with a keyboard. Cheers, Darren On May 20, 2014 12:26 PM, "Bardur Arantsson" wrote: > On 2014-05-20 20:59, Albert Y. C. Lai wrote: > > > > Can programming be liberated from the plain text file? > > No. > > I hate to be downer, but every single time I've seen a proposal for this > it has failed to account for how, *exactly*, it is actually different in > any meaningful way from the failed attempts at addressing this issue. > I've often been quite tempted to draw up a checklist ? la the infamous > spam-fighting checklist for why > $YOUR_IDEA_FOR_NON-TEXT-BASED_PROGRAMMING won't work -- at the very > least it'd serve as a time-saver whenever this comes up :). > > We can all dream, but unless and until someone comes up with something > *radically* different from previous attempts, it just ain't going to > happen. > > Regards, > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From msherman77 at yahoo.com Tue May 20 23:42:14 2014 From: msherman77 at yahoo.com (Michael S) Date: Tue, 20 May 2014 16:42:14 -0700 (PDT) Subject: [Haskell-cafe] haskell on OpenBSD 5.5 In-Reply-To: References: <1400614826.99466.YahooMailNeo@web163103.mail.bf1.yahoo.com> Message-ID: <1400629334.31473.YahooMailNeo@web163103.mail.bf1.yahoo.com> Unfortunately? installing the lib did not fix the issue: pkg_info | grep gmp gmp-5.0.2p2???????? library for arbitrary precision arithmetic ghci GHCi, version 7.6.3: http://www.haskell.org/ghc/? :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... ghc: /usr/local/lib/ghc/integer-gmp-0.5.0.0/HSinteger-gmp-0.5.0.0.o: unhandled ELF relocation(Rel) type 10 One way to rectify the issue is apparently to installed OpenBSD for x64, which I will do if I don't find fix soon. On Tuesday, May 20, 2014 4:27:11 PM, Mike Meyer wrote: The integer-gmp problems is that you don't have all the bits of the gmp library installed. This happens when the package system doesn't correctly pick them up, or when I install HP from outside the package system. The usual fix (on Linux, anyway) is to install the appropriate dev package to go with gmp. If OpenBSD hasn't yet succumbed to the idiocy of dev packages, it's possible the gmp library itself is missing. I suspect similar issues with hs-vector: there's some dependency missing in the package system description. On Tue, May 20, 2014 at 2:40 PM, Michael S wrote: > >Good day all, I installed OpenBSD 5.5 in order to learn haskell. There are a few glitches however. I installed the haskell-platform meta-package and the issues I noticed are: - hs-vector wouldn't install - ghci wouldn't start, the message: unable to load package `integer-gmp' Has anyone experienced the same issue? Is this happening on OpenBSD 5.4? Is this OpenBSD specific? Thanks in advance. >_______________________________________________ >Haskell-Cafe mailing list >Haskell-Cafe at haskell.org >http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mantkiew at gsd.uwaterloo.ca Tue May 20 23:49:56 2014 From: mantkiew at gsd.uwaterloo.ca (mantkiew at gsd.uwaterloo.ca) Date: Tue, 20 May 2014 19:49:56 -0400 Subject: [Haskell-cafe] extending the notion of notation In-Reply-To: References: <537B5189.9040108@gmail.com> <537BA62C.20709@vex.net> Message-ID: <20140520234956.6013077.17566.7518@gsd.uwaterloo.ca> An HTML attachment was scrubbed... URL: -------------- next part -------------- _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe at haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe From abela at chalmers.se Wed May 21 01:19:23 2014 From: abela at chalmers.se (Andreas Abel) Date: Wed, 21 May 2014 03:19:23 +0200 Subject: [Haskell-cafe] ghc-mod version 4.1.0 In-Reply-To: <20140502.211700.2031943760727962773.kazu@iij.ad.jp> References: <20140501.115809.1417729316609112864.kazu@iij.ad.jp> <20140502.211700.2031943760727962773.kazu@iij.ad.jp> Message-ID: <537BFF1B.3000908@chalmers.se> Oh, yes, tried M-x ghc-check-syntax on a 3 line program, and ghc-modi took 700m of resident memory. On 02.05.2014 14:17, Kazu Yamamoto (????) wrote: > Elliot, > >> One slight concern I've been running into recently is the memory usage of >> ghc-modi. I've been on a rampage over the last few days trying to keep the >> Chart library from OOMing on my laptop, and this generally involves killing >> one or more ghc-modi instances with 1GB+ of resident memory. If anyone else >> can confirm this is an issue (and it isn't already a known issue/necessary >> evil), I'd be happy to file an issue on Github and do some preliminary work >> as to why this is happening. > > Please record this space leak to a github issue. You are the second > person who are taking about this. Though I have not experienced such a > space leak, it must exit in some cases. Let's try to fix it. > > --Kazu > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -- Andreas Abel <>< Du bist der geliebte Mensch. Department of Computer Science and Engineering Chalmers and Gothenburg University, Sweden andreas.abel at gu.se http://www2.tcs.ifi.lmu.de/~abel/ From elliot.robinson at argiopetech.com Wed May 21 01:30:44 2014 From: elliot.robinson at argiopetech.com (Elliot Robinson) Date: Tue, 20 May 2014 21:30:44 -0400 Subject: [Haskell-cafe] ghc-mod version 4.1.0 In-Reply-To: <537BFF1B.3000908@chalmers.se> References: <20140501.115809.1417729316609112864.kazu@iij.ad.jp> <20140502.211700.2031943760727962773.kazu@iij.ad.jp> <537BFF1B.3000908@chalmers.se> Message-ID: Please see https://github.com/kazu-yamamoto/ghc-mod/issues/243 for the current status of this issue. --- Elliot Robinson Phone: (321) 252-9660 Site: www.argiopetech.com Email: elliot.robinson at argiopetech.com PGP Fingerprint: 0xD1E72E6A9D0610FFBBF838A6FFB5205A9FEDE59A On Tue, May 20, 2014 at 9:19 PM, Andreas Abel wrote: > Oh, yes, tried M-x ghc-check-syntax on a 3 line program, and ghc-modi took > 700m of resident memory. > > On 02.05.2014 14:17, Kazu Yamamoto (????) wrote: > >> Elliot, >> >> One slight concern I've been running into recently is the memory usage of >>> ghc-modi. I've been on a rampage over the last few days trying to keep >>> the >>> Chart library from OOMing on my laptop, and this generally involves >>> killing >>> one or more ghc-modi instances with 1GB+ of resident memory. If anyone >>> else >>> can confirm this is an issue (and it isn't already a known >>> issue/necessary >>> evil), I'd be happy to file an issue on Github and do some preliminary >>> work >>> as to why this is happening. >>> >> >> Please record this space leak to a github issue. You are the second >> person who are taking about this. Though I have not experienced such a >> space leak, it must exit in some cases. Let's try to fix it. >> >> --Kazu >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> >> > > -- > Andreas Abel <>< Du bist der geliebte Mensch. > > Department of Computer Science and Engineering > Chalmers and Gothenburg University, Sweden > > andreas.abel at gu.se > http://www2.tcs.ifi.lmu.de/~abel/ > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From capn.freako at gmail.com Wed May 21 01:34:30 2014 From: capn.freako at gmail.com (David Banas) Date: Tue, 20 May 2014 18:34:30 -0700 Subject: [Haskell-cafe] Default implementation of type class member function not working as expected. Message-ID: <1799C993-E04F-4C96-AA32-F2685E038E88@gmail.com> Hi all, I have a typeclass, which defines the following two member functions: (t is a Rose Tree.) getCompNodes :: t -> [CompNode a] getAllCompNodes :: t -> [CompNode a] getAllCompNodes t = getCompNodes t ++ (concatMap getAllCompNodes (subForest t)) The first one must be defined uniquely by each instance, but the second never needs a unique definition. So, I provided its implementation in the typeclass definition, as shown. However, I don?t get the expected behavior! If I copy and paste the code, above, for getAllCompNodes into my instance definition, then I get the expected results. Does anyone know why this is happening? Thanks, -db -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Wed May 21 01:54:09 2014 From: allbery.b at gmail.com (Brandon Allbery) Date: Tue, 20 May 2014 21:54:09 -0400 Subject: [Haskell-cafe] Default implementation of type class member function not working as expected. In-Reply-To: <1799C993-E04F-4C96-AA32-F2685E038E88@gmail.com> References: <1799C993-E04F-4C96-AA32-F2685E038E88@gmail.com> Message-ID: On Tue, May 20, 2014 at 9:34 PM, David Banas wrote: > The first one must be defined uniquely by each instance, but the second > never needs a unique definition. > So, I provided its implementation in the typeclass definition, as shown. > This makes no sense; if there's only one definition, then define it *outside* the typeclass. A definition *inside* the class is there to be overridden by specific instances that need to do so. That said, you haven't said what you are getting that is not expected, and there isn't enough information here to really say what might or might not be going on. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From ky3 at atamo.com Wed May 21 03:33:18 2014 From: ky3 at atamo.com (Kim-Ee Yeoh) Date: Wed, 21 May 2014 10:33:18 +0700 Subject: [Haskell-cafe] extending the notion of notation In-Reply-To: References: <537B5189.9040108@gmail.com> <537BA62C.20709@vex.net> Message-ID: On Wed, May 21, 2014 at 5:12 AM, Darren Grant wrote: > There are plenty of counterexamples. Variations on visual function blocks > abound in engineering circles. Let's not forget The World's Most Popular Functional Language: Spreadsheets [1]. They don't call themselves programmers but that doesn't mean the work they do all day long hacking cells and formulas and the occasional launch-the-missiles excel macro isn't programming. [1] http://research.microsoft.com/en-us/um/people/simonpj/Papers/excel/ -- Kim-Ee -------------- next part -------------- An HTML attachment was scrubbed... URL: From ky3 at atamo.com Wed May 21 04:02:35 2014 From: ky3 at atamo.com (Kim-Ee Yeoh) Date: Wed, 21 May 2014 11:02:35 +0700 Subject: [Haskell-cafe] Fwd: extending Do notation In-Reply-To: <20140520191752.972E1F3936@mail.avvanta.com> References: <20140520191752.972E1F3936@mail.avvanta.com> Message-ID: On Wed, May 21, 2014 at 2:17 AM, Donn Cave wrote: > The multi-way-if that appears in the trac discussion is apparently, > supported but it's a mystery to me if this has anything to do with > lambda-if. > Good catch: there's no lambda-if, only multiway-if. Which isn't the same. Lambda-if might look something like this: do ... checkCondition >>= \if then doReportSuccess else doReportFailure Compare to the originally proposed: do ... if <- checkCondition then doReportSuccess else doReportFailure -- Kim-Ee -------------- next part -------------- An HTML attachment was scrubbed... URL: From miguelimo38 at yandex.ru Wed May 21 04:41:06 2014 From: miguelimo38 at yandex.ru (MigMit) Date: Wed, 21 May 2014 08:41:06 +0400 Subject: [Haskell-cafe] extending the notion of notation (was: extending Do notation) In-Reply-To: References: <537B5189.9040108@gmail.com> <537BA62C.20709@vex.net> <6F2160E5-29E0-497A-AE71-63E3E0637334@yandex.ru> Message-ID: <563128A3-CA3D-4BB9-B75E-C00425550869@yandex.ru> > > Incorrect. There are programs in pseudocode, programs for MIX, programs for machines they don't make anymore. Ada Lovelace created some programs for Babbidge's machine. Program can be buggy, or unfinished. Neither of these types of programs can be executed, but they are still programs. > > Incorrect. Those are all representations of programs. Of what programs? > Whether they can or can't be executed is immaterial to that status. As I said, it's common to call a representation of a program a program as well, because the context lets the reader sort it out. But in this context, it matters, because we're talking about alternative representations for programs. No, it doesn't, because there are no alternative representations and, most of the time, nothing to represent. I'll elaborate on both points. Let's start with the second part. The executable, compiled from source (even if compilation IS possible) depends on overwhelming amount of variables. Compiler. It's version. Operating system. Optimization flags. Libraries' versions (not to mention that libraries, as binaries, also depend on a lot of things). Linker. Hardware platform. Etc. There is NOTHING common to all possible binaries produced by compiling the same source. Therefore, there is nothing to represent. Now, about there being no alternative representations. It's true that small changes of syntax usually don't really change the program. In the same way as changing "Philosopher's stone" to "Sorcerer's stone" in US didn't really change the first Harry Potter book. That doesn't mean syntax is irrelevant. Program conveys some meaning, and syntax plays it's part. Joining the chapters of the book together, for instance, will make it less readable. The simplest programming example probably is quicksort (x:xs) = [y | y <- xs, y < x] ++ x ++ [y | y <- xs, y >= x] This can be written in one line, and AST would be the same. But the layout here emphasizes the symmetry of algorithm, helping the author to express the meaning of what he is doing. Now, that's a very simple example, of course, but things like that are everywhere. No other represenation can capture such details, and they matter. So, there are no alternative representations. There could be some other views of the program ? like graphical class hierarchies ? but they aren't "representations", as the chart presented by company's top managers to shareholders is not the representation of all the company's documentation. Of course, you can actually start from some other "representation" ? for example, graphical. That would be like writing a novel by drawing pictures. From oleg.durandin at gmail.com Wed May 21 07:14:20 2014 From: oleg.durandin at gmail.com (Oleg Durandin) Date: Wed, 21 May 2014 11:14:20 +0400 Subject: [Haskell-cafe] Manually control linker options in Cabal build system In-Reply-To: <537B2A9D.2010103@gmail.com> References: <537B2A9D.2010103@gmail.com> Message-ID: <537C524C.2040405@gmail.com> Hi all! Not long ago, I faced with problem building library with Cabal. I'm trying to build simple Haskell project as a shared library for use in MS Visual Studio (yes, I use FFI for this). And I created simple test project: / {-# LANGUAGE ForeignFunctionInterface #-} module GrepWrap where import Foreign import Foreign.C.String import Data.Char printCString :: CString -> IO () printCString s = do ss <- peekCString s putStrLn ss getCStringFromKey :: IO CString getCStringFromKey = do guess <- getLine newCString guess hello :: IO() hello = do putStrLn "Hi there!" foreign export stdcall ? ? ? ? hello :: IO () foreign export stdcall? ? printCString :: CString -> IO () foreign export stdcall? ? getCStringFromKey :: IO CString/ Also, I created file for safe initialization with wrappers for hs_init() and hs_exit() calls: /// StartEnd.c #include extern void __stginit_GrepWrap(void); void HsStart() { int argc = 1; char* argv[] = {"ghcDll", NULL}; // argv must end with NULL // Initialize Haskell runtime char** args = argv; hs_init(&argc, &args); } void HsEnd() { hs_exit(); }/ I compile these files with the next commands: /*> ghc -c GrepWrap.c*//* *//*> ghc -c StartEnd.c*//* *//*> ghc -shared -o grepWrap.dll grepWrap.hs StartEnd.o*/ /Linking grepWrap.dll ...// //Creating library file: grepWrap.dll.a// /// After it, I've got grepWrap.dll and grepWrap.dll.a files. I successfully linked that library with my simple C++ test app, that uses these functions. And I was able to use my Haskell functions in my simple C++ app. Further, I'd like to use Cabal build system for building the same Haskell library filles. My cabal file looks like this: /*name: GrepWrap version: 1.0 synopsis: example shared library for C use build-type: Simple cabal-version: >=1.10 library default-language: Haskell2010 exposed-modules: GrepWrap extra-libraries: HSbase-4.6.0.1, wsock32, user32, shell32, HSinteger-gmp-0.5.0.0, HSghc-prim-0.3.0.0, HSrts, gdi32, winmm c-sources: StartEnd.c extensions: ForeignFunctionInterface build-depends: base >= 4 --ghc-options: "-v"*/ After build, in directory dist/build I got a set of files and among them there are: _/libHSGrepWrap-1.0-ghc7.6.3.dll/_ , ___/libHSGrepWrap-1.0-ghc7.6.3.dll.a/_ and /_GrepWrap_stub.h_/ . I use these files in the same Visual Studio project (of course, I changed names of dependent libraries in dependencies configuration in Visual Studio). Application successfully builds, but after run this app, I've got the next exception: Unhandled exception at 0x6D7905FB (libHSrts-ghc7.6.3.dll) in GrepWrapCabalUseDll.exe: 0xC0000005: Access violation reading location 0x00000000 It occurs, when I call functions from library (but when HsStart() already called). When I use "-v" flag with compilation (using ghc) I saw such linker message log: /*** Linker:// //"C:\Program Files (x86)\Haskell Platform\2013.2.0.0\lib/../mingw/bin/gcc.exe" "-fno-stack-protector" "-Wl,--hash-size=31" "-Wl,--reduce-memory-overheads" "-o" "grepWrap.dll" "-shared" "-Wl,--out-implib=grepWrap.dll.a" "grepWrap.o" "-Wl,--enable-auto-import" "StartEnd.o" "-LC:\Program Files (x86)\Haskell Platform\2013.2.0.0\lib\base-4.6.0.1" "-LC:\Program Files (x86)\Haskell Platform\2013.2.0.0\lib\integer-gmp-0.5.0.0" "-LC:\Program Files (x86)\Haskell Platform\2013.2.0.0\lib\ghc-prim-0.3.0.0" "-LC:\Program Files (x86)\Haskell Platform\2013.2.0.0\lib" "-lHSbase-4.6.0.1" "-lwsock32" "-luser32" "-lshell32" "-lHSinteger-gmp-0.5.0.0" "-lHSghc-prim-0.3.0.0" "-lHSrts" "-lm" "-lwsock32" "-lgdi32" "-lwinmm" "-u" "_ghczmprim_GHCziTypes_Izh_static_info" "-u" "_ghczmprim_GHCziTypes_Czh_static_info" "-u" "_ghczmprim_GHCziTypes_Fzh_static_info" "-u" "_ghczmprim_GHCziTypes_Dzh_static_info" "-u" "_base_GHCziPtr_Ptr_static_info" "-u" "_ghczmprim_GHCziTypes_Wzh_static_info" "-u" "_base_GHCziInt_I8zh_static_info" "-u" "_base_GHCziInt_I16zh_static_info" "-u" "_base_GHCziInt_I32zh_static_info" "-u" "_base_GHCziInt_I64zh_static_info" "-u" "_base_GHCziWord_W8zh_static_info" "-u" "_base_GHCziWord_W16zh_static_info" "-u" "_base_GHCziWord_W32zh_static_info" "-u" "_base_GHCziWord_W64zh_static_info" "-u" "_base_GHCziStable_StablePtr_static_info" "-u" "_ghczmprim_GHCziTypes_Izh_con_info" "-u" "_ghczmprim_GHCziTypes_Czh_con_info" "-u" "_ghczmprim_GHCziTypes_Fzh_con_info" "-u" "_ghczmprim_GHCziTypes_Dzh_con_info" "-u" "_base_GHCziPtr_Ptr_con_info" "-u" "_base_GHCziPtr_FunPtr_con_info" "-u" "_base_GHCziStable_StablePtr_con_info" "-u" "_ghczmprim_GHCziTypes_False_closure" "-u" "_ghczmprim_GHCziTypes_True_closure" "-u" "_base_GHCziPack_unpackCString_closure" "-u" "_base_GHCziIOziException_stackOverflow_closure" "-u" "_base_GHCziIOziException_heapOverflow_closure" "-u" "_base_ControlziExceptionziBase_nonTermination_closure" "-u" "_base_GHCziIOziException_blockedIndefinitelyOnMVar_closure" "-u" "_base_GHCziIOziException_blockedIndefinitelyOnSTM_closure" "-u" "_base_ControlziExceptionziBase_nestedAtomically_closure" "-u" "_base_GHCziWeak_runFinalizzerBatch_closure" "-u" "_base_GHCziTopHandler_flushStdHandles_closure" "-u" "_base_GHCziTopHandler_runIO_closure" "-u" "_base_GHCziTopHandler_runNonIO_closure" "-u" "_base_GHCziConcziIO_ensureIOManagerIsRunning_closure" "-u" "_base_GHCziConcziSync_runSparks_closure" "-u" "_base_GHCziConcziSignal_runHandlers_closure"// //Creating library file: grepWrap.dll.a// //link: done/ But, when I call cabal build with "-v2" option to get build log, I get the following: /> cabal build -v2 I've got the next log: creating dist\build creating dist\build\autogen Building GrepWrap-1.0... Preprocessing library GrepWrap-1.0... Building library... creating dist\build C:\Program Files (x86)\Haskell Platform\2013.2.0.0\bin\ghc.exe --make -fbuilding-cabal-package -O -odir dist\build -hidir dist\build -stubdir dist\build -i -idist\build -i. -idist\build\autogen -Idist\build\autogen -Idist\build -optP-include -optPdist\build\autogen\cabal_macros.h -package-name GrepWrap-1.0 -hide-all-packages -package-db dist\package.conf.inplace -package-id base-4.6.0.1-f0c2cc6dcf0e12bf75312a2e7f354095 -XHaskell2010 -XForeignFunctionInterface GrepWrap [1 of 1] Compiling GrepWrap ( GrepWrap.hs, dist\build\GrepWrap.o ) C:\Program Files (x86)\Haskell Platform\2013.2.0.0\bin\ghc.exe --make -fbuilding-cabal-package -O -prof -osuf p_o -hisuf p_hi -odir dist\build -hidir dist\build -stubdir dist\build -i -idist\build -i. -idist\build\autogen -Idist\build\autogen -Idist\build -optP-include -optPdist\build\autogen\cabal_macros.h -package-name GrepWrap-1.0 -hide-all-packages -package-db dist\package.conf.inplace -package-id base-4.6.0.1-f0c2cc6dcf0e12bf75312a2e7f354095 -XHaskell2010 -XForeignFunctionInterface GrepWrap [1 of 1] Compiling GrepWrap ( GrepWrap.hs, dist\build\GrepWrap.p_o ) C:\Program Files (x86)\Haskell Platform\2013.2.0.0\bin\ghc.exe --make -fbuilding-cabal-package -O -dynamic -fPIC -osuf dyn_o -hisuf dyn_hi -odir dist\build -hidir dist\build -stubdir dist\build -i -idist\build -i. -idist\build\autogen -Idist\build\autogen -Idist\build -optP-include -optPdist\build\autogen\cabal_macros.h -package-name GrepWrap-1.0 -hide-all-packages -package-db dist\package.conf.inplace -package-id base-4.6.0.1-f0c2cc6dcf0e12bf75312a2e7f354095 -XHaskell2010 -XForeignFunctionInterface GrepWrap [1 of 1] Compiling GrepWrap ( GrepWrap.hs, dist\build\GrepWrap.dyn_o ) Building C Sources... creating dist\build C:\Program Files (x86)\Haskell Platform\2013.2.0.0\bin\ghc.exe -c -prof -odir dist\build -Idist\build -optc-O2 -package-db dist\package.conf.inplace -package-id base-4.6.0.1-f0c2cc6dcf0e12bf75312a2e7f354095 StartEnd.c C:\Program Files (x86)\Haskell Platform\2013.2.0.0\bin\ghc.exe -c -prof -dynamic -fPIC -osuf dyn_o -odir dist\build -Idist\build -optc-O2 -package-db dist\package.conf.inplace -package-id base-4.6.0.1-f0c2cc6dcf0e12bf75312a2e7f354095 StartEnd.c Linking... C:\Program Files (x86)\Haskell Platform\2013.2.0.0\mingw\bin\ar.exe -r dist\build\libHSGrepWrap-1.0.a dist\build\GrepWrap.o dist\build\StartEnd.o C:\Program Files (x86)\Haskell Platform\2013.2.0.0\mingw\bin\ar.exe: creating dist\build\libHSGrepWrap-1.0.a C:\Program Files (x86)\Haskell Platform\2013.2.0.0\mingw\bin\ar.exe -r dist\build\libHSGrepWrap-1.0_p.a dist\build\GrepWrap.p_o dist\build\StartEnd.o C:\Program Files (x86)\Haskell Platform\2013.2.0.0\mingw\bin\ar.exe: creating dist\build\libHSGrepWrap-1.0_p.a C:\Program Files (x86)\Haskell Platform\2013.2.0.0\mingw\bin\ld.exe -x --hash-size=31 --reduce-memory-overheads -r -o dist\build\HSGrepWrap-1.0.o dist\build\GrepWrap.o dist\build\StartEnd.o C:\Program Files (x86)\Haskell Platform\2013.2.0.0\bin\ghc.exe -shared -dynamic -lHSbase-4.6.0.1 -lwsock32 -luser32 -lshell32 -lHSinteger-gmp-0.5.0.0 -lHSghc-prim-0.3.0.0 -lHSrts -lgdi32 -lwinmm -package-name GrepWrap-1.0 -no-auto-link-packages -package-db dist\package.conf.inplace -package-id base-4.6.0.1-f0c2cc6dcf0e12bf75312a2e7f354095 dist\build\GrepWrap.dyn_o dist\build\StartEnd.dyn_o -o dist\build\libHSGrepWrap-1.0-ghc7.6.3.dll Creating library file: dist\build\libHSGrepWrap-1.0-ghc7.6.3.dll.a In-place registering GrepWrap-1.0... C:\Program Files (x86)\Haskell Platform\2013.2.0.0\bin\ghc-pkg.exe update - --global --user --package-db=dist\package.conf.inplace/ I'm confused.. Cabal uses a batch of options, it adds multiple options that I can't control. I'd like to control this options. How can I build my Haskell library with Cabal build system as same as building it with simple ghc? I can call ghc manually, but it will be a hard task, when I'll compile library for multiple files. Best regards, Oleg Durandin -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- name: GrepWrap version: 1.0 synopsis: example shared library for C use build-type: Simple cabal-version: >=1.10 library default-language: Haskell2010 exposed-modules: GrepWrap extra-libraries: HSbase-4.6.0.1, wsock32, user32, shell32, HSinteger-gmp-0.5.0.0, HSghc-prim-0.3.0.0, HSrts, gdi32, winmm c-sources: StartEnd.c extensions: ForeignFunctionInterface build-depends: base >= 4 --ghc-options: "-v" -------------- next part -------------- {-# LANGUAGE ForeignFunctionInterface #-} module GrepWrap where import Foreign import Foreign.C.String import Data.Char printCString :: CString -> IO () printCString s = do ss <- peekCString s putStrLn ss getCStringFromKey :: IO CString getCStringFromKey = do guess <- getLine newCString guess hello :: IO() hello = do putStrLn "Hi there!" foreign export stdcall hello :: IO () foreign export stdcall printCString :: CString -> IO () foreign export stdcall getCStringFromKey :: IO CString -------------- next part -------------- // StartEnd.c #include extern void __stginit_GrepWrap(void); void HsStart() { int argc = 1; char* argv[] = {"ghcDll", NULL}; // argv must end with NULL // Initialize Haskell runtime char** args = argv; hs_init(&argc, &args); // Tell Haskell about all root modules //hs_add_root(__stginit_Adder); } void HsEnd() { hs_exit(); } From carlo at carlo-hamalainen.net Wed May 21 07:56:07 2014 From: carlo at carlo-hamalainen.net (Carlo Hamalainen) Date: Wed, 21 May 2014 07:56:07 +0000 Subject: [Haskell-cafe] ghc-mod version 4.1.0 In-Reply-To: References: <20140501.115809.1417729316609112864.kazu@iij.ad.jp> Message-ID: <000001461dc7bd2f-fff2b1a9-7bef-43dd-9bc6-82335369e014-000000@email.amazonses.com> On 17/05/14 20:18, Bardur Arantsson wrote: > I've been trying this thing out (including the Emacs integration) and > it's working pretty well so far, but I've run into a limitation that's a > bit frustrating. > > I have a multi-project setup sort of like the following: > > project/ > A/ > B/ (depends on A) > C/ (depends on A) > D/ (depends on B + C) > > (where D is an executable "example" project) > > To compile everything I've created a sandbox for the D project in > project/D/ and run all my cabal commands from there. I've added A, B, > and C via the "add-source" sandbox feature. Does it work if you create a sandbox in each of the directories A, B, C, and D? My thinking is that if you are adding the directories A, B, and C using "cabal sandbox add-source" then they should be able to be built independently. And of course you'd have to run cabal sandbox add-source /path/to/project/A # in directory B cabal sandbox add-source /path/to/project/A # in directory C cabal sandbox add-source /path/to/project/B # in directory D cabal sandbox add-source /path/to/project/C # in directory D to get the dependencies. I've tried this out with a test project and it seems to work ok. Also "cabal repl" works in each of the subdirectories. -- Carlo Hamalainen http://carlo-hamalainen.net From mdorman at ironicdesign.com Wed May 21 11:37:37 2014 From: mdorman at ironicdesign.com (Michael Alan Dorman) Date: Wed, 21 May 2014 07:37:37 -0400 Subject: [Haskell-cafe] TemplateHaskell forces manual declaration ordering? In-Reply-To: (edwards.benj@gmail.com's message of "Tue, 20 May 2014 14:25:48 +0000") References: <87wqdgpw73.fsf@ironicdesign.com> Message-ID: <87oayrpdku.fsf@ironicdesign.com> "edwardsbenj at gmail.com" writes: > I was making the naive assumption that if OP didn't know about it then > it wasn't prominent. That perhaps was a little hasty. There is a > discussion of this very thing in the official user guide. First > section, 7.16.1. Syntax. I'm assuming you're referring to the subsection that begins: * The type environment seen by reify includes all the top-level declaration up to the end of the immediately preceding declaration group, but no more. So I'll just note that the text you refer to---which does, as you note, lay out those limitations---is new with 7.8, and I was using the docs for the compiler version I'm using, 7.6.3. http://www.haskell.org/ghc/docs/7.6.3/html/users_guide/template-haskell.html Perhaps it would have made sense to consult the latest docs, but then it also refers to typed TH expression and other things that don't exist in 7.6.3. :) Mike. From edwards.benj at gmail.com Wed May 21 11:38:54 2014 From: edwards.benj at gmail.com (Benjamin Edwards) Date: Wed, 21 May 2014 11:38:54 +0000 Subject: [Haskell-cafe] TemplateHaskell forces manual declaration ordering? References: <87wqdgpw73.fsf@ironicdesign.com> <87oayrpdku.fsf@ironicdesign.com> Message-ID: Good catch! Hurray for improving docs. Ben On Wednesday, 21 May 2014 12:37:42, Michael Alan Dorman < mdorman at ironicdesign.com> wrote: > "edwardsbenj at gmail.com" writes: > > > I was making the naive assumption that if OP didn't know about it then > > it wasn't prominent. That perhaps was a little hasty. There is a > > discussion of this very thing in the official user guide. First > > section, 7.16.1. Syntax. > > I'm assuming you're referring to the subsection that begins: > > * The type environment seen by reify includes all the top-level > declaration up to the end of the immediately preceding declaration > group, but no more. > > So I'll just note that the text you refer to---which does, as you note, > lay out those limitations---is new with 7.8, and I was using the docs > for the compiler version I'm using, 7.6.3. > > http://www.haskell.org/ghc/docs/7.6.3/html/users_guide/ > template-haskell.html > > Perhaps it would have made sense to consult the latest docs, but then it > also refers to typed TH expression and other things that don't exist in > 7.6.3. :) > > Mike. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From komendantskaya at gmail.com Wed May 21 12:03:18 2014 From: komendantskaya at gmail.com (Ekaterina Komendantskaya) Date: Wed, 21 May 2014 13:03:18 +0100 Subject: [Haskell-cafe] One PhD position is available at the University of Dundee, Scotland Message-ID: One PhD position is available at the University of Dundee, Scotland. Contact ??????????? Katya Komendantskaya - katya at computing.dundee.ac.uk Profile ??????????? The subject of the studentship is programming language semantics and implementation. The specific topic for the studentship will depend on the interests and expertise of the potential candidate. Possible topics are: computational logic, interactive or automated theorem proving, verification, type systems, type inference, logics and applications, program analysis tools. Conditions ??????????? The studentship covers 3 years with a standard stipend of about ?13-14k a year plus some eligible travel and consumables. Requirements ??????????? The ideal candidate must show a solid Mathematical or Computer Science background and interest in theoretical and/or practical aspects of declarative programming languages. Previous experience in one or more of the areas described in the profile will be considered a plus. How to apply ??????????? The position is available immediately. Candidates please contact Katya Komendantskaya - katya at computing.dundee.ac.uk Dundee and the university ??????????? Dundee is the fourth-largest city in Scotland and it is well connected with Edinburgh, Glasgow and Aberdeen. Dundee is promoted as 'One City, Many Discoveries' in honor of Dundee's history of scientific activities and of the RRS Discovery exploration vessel, which is berthed in the city harbor. Biomedical, technological and video game industries have been important for the development of the city in the last 20 years. The University of Dundee counts about 18.000 students and is situated in the city center. The university is ranked in the World's Top 250 Universities and has been voted one of the best universities in the UK for student experience. http://en.wikipedia.org/wiki/Dundee http://www.dundee.ac.uk The Theory of Computation group ??????????? The Theory of Computation group focuses on research into different areas covering functional programming, program analysis, computational logic, theorem proving, machine learning, constraint programming, graph theory, algorithms and applications like privacy, security, complexity, optimisation, and artificial intelligence. ************************ Ekaterina Komendantskaya Senior Lecturer, Head of PhD Studies Room 1.04, Queen Mother Building School of Computing, University of Dundee Scotland, DD14HN Tel: (+44) 01382384820 -------------- next part -------------- An HTML attachment was scrubbed... URL: From capn.freako at gmail.com Wed May 21 13:12:52 2014 From: capn.freako at gmail.com (David Banas) Date: Wed, 21 May 2014 06:12:52 -0700 Subject: [Haskell-cafe] Default implementation of type class member function not working as expected. In-Reply-To: References: Message-ID: That worked, Brandon; thanks! Gurus, I?d still love to understand exactly what I broke, trying to do it the other way. Any thoughts? Thanks, -db On May 21, 2014, at 12:14 AM, haskell-cafe-request at haskell.org wrote: > if there's only one definition, then define it > *outside* the typeclass. > >> I have a typeclass, which defines the following two member functions: >> (t is a Rose Tree.) >> >> getCompNodes :: t -> [CompNode a] >> >> getAllCompNodes :: t -> [CompNode a] >> getAllCompNodes t = getCompNodes t >> ++ (concatMap getAllCompNodes (subForest t)) >> The first one must be defined uniquely by each instance, but the second >> never needs a unique definition. >> So, I provided its implementation in the typeclass definition, as shown. >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From ky3 at atamo.com Wed May 21 13:34:07 2014 From: ky3 at atamo.com (Kim-Ee Yeoh) Date: Wed, 21 May 2014 20:34:07 +0700 Subject: [Haskell-cafe] Default implementation of type class member function not working as expected. In-Reply-To: References: Message-ID: On Wed, May 21, 2014 at 8:12 PM, David Banas wrote: > Gurus, I?d still love to understand exactly what I broke, trying to do it > the other way. Any thoughts? Provide more information. If you re-read what you sent to the list, you'll find there's nothing to go by. Things you need to provide: * actual error messages * the client code using the type classes * best of all, minimized but fully compilable code exhibiting the problem -- Kim-Ee -------------- next part -------------- An HTML attachment was scrubbed... URL: From spam at scientician.net Wed May 21 16:58:07 2014 From: spam at scientician.net (Bardur Arantsson) Date: Wed, 21 May 2014 18:58:07 +0200 Subject: [Haskell-cafe] ghc-mod version 4.1.0 In-Reply-To: References: <20140501.115809.1417729316609112864.kazu@iij.ad.jp> Message-ID: On 2014-05-19 19:33, Michal Antkiewicz wrote: > Hi Bardur, > > in such situations I use a shared sandbox instead of the "add-source". > > execute > > `cabal sandbox init --sandbox=../.shared-cabal-sandbox > > in each project and build A, B, C, D. > > Does it help with ghc-mod? Thanks, I did end up using a variation of this which seems to work OK. I created a shared sandbox as you suggested and then used "cabal add-source ../A ../B ..." in the "example" project D which uses all the others. I'm fine with just always building in the "D" project, so that works OK for my purposes, and ghc-mod now seems to be able to handle editing in e.g. B/ just fine now. Thanks to both of you for the ideas! Regards, From hsyl20 at gmail.com Wed May 21 18:04:34 2014 From: hsyl20 at gmail.com (Sylvain Henry) Date: Wed, 21 May 2014 20:04:34 +0200 Subject: [Haskell-cafe] Default implementation of type class member function not working as expected. In-Reply-To: References: Message-ID: Are you trying to do something like that? data Rose a = Rose a [Rose a] class TreeLike t where getNodes :: t a -> [t a] getAllNodes :: t a -> [t a] getAllNodes t = getNodes t ++ (concatMap getAllNodes (getNodes t)) instance TreeLike Rose where getNodes (Rose _ xs) = xs -Sylvain 2014-05-21 15:12 GMT+02:00 David Banas : > That worked, Brandon; thanks! > > Gurus, I?d still love to understand exactly what I broke, trying to do it > the other way. Any thoughts? > > Thanks, > -db > > On May 21, 2014, at 12:14 AM, haskell-cafe-request at haskell.org wrote: > > if there's only one definition, then define it > *outside* the typeclass. > > > > I have a typeclass, which defines the following two member functions: > (t is a Rose Tree.) > > getCompNodes :: t -> [CompNode a] > > getAllCompNodes :: t -> [CompNode a] > getAllCompNodes t = getCompNodes t > ++ (concatMap getAllCompNodes (subForest t)) > > > The first one must be defined uniquely by each instance, but the second > never needs a unique definition. > So, I provided its implementation in the typeclass definition, as shown. > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From r.wobben at home.nl Wed May 21 18:51:56 2014 From: r.wobben at home.nl (Roelof Wobben) Date: Wed, 21 May 2014 20:51:56 +0200 Subject: [Haskell-cafe] porting Haskell to Mageia Message-ID: <537CF5CC.6060107@home.nl> Hello, I like to port Haskell to mageia linux. Now I found out that someone has already made a bootstrap package. Now my question is how can I use that one so I can make the full package like fedora has. So a lot of small packages instead of one big package. Roelof From john at repetae.net Wed May 21 21:37:26 2014 From: john at repetae.net (John Meacham) Date: Wed, 21 May 2014 14:37:26 -0700 Subject: [Haskell-cafe] extending the notion of notation In-Reply-To: References: <537B5189.9040108@gmail.com> <537BA62C.20709@vex.net> Message-ID: On Tue, May 20, 2014 at 8:33 PM, Kim-Ee Yeoh wrote: > Let's not forget The World's Most Popular Functional Language: Spreadsheets > [1]. I dunno, I think makefiles might give them a run for the money when it comes to declarative functional languages out there. and they are monadic too! John -- John Meacham - http://notanumber.net/ From john at repetae.net Wed May 21 21:46:04 2014 From: john at repetae.net (John Meacham) Date: Wed, 21 May 2014 14:46:04 -0700 Subject: [Haskell-cafe] instance Alternative (Either [a]) In-Reply-To: References: Message-ID: On Mon, May 19, 2014 at 8:31 AM, Corentin Dupont wrote: > However the instance in Control.Monad.Trans.Error.Error gets in the way... > I cannot use this one, it works only with Strings. > My use case is that the Either handle in the Right a final value, or else in > the Left a list of things "left to do" to compute the value. > How can I do? You want to use a newtype to wrap your Either. It sounds like you would want to do this independently of the String instance because you are not using left as shortcutting failure anyway, rather you want to collect together the failure actions. newtype NotDoneYet b a = NotDoneYet (Either [b] a) instance Applicative (NotDoneYet b) where Left xs <*> Left ys = Left (xs ++ ys) ... -- John Meacham - http://notanumber.net/ From mike at izbicki.me Wed May 21 22:50:54 2014 From: mike at izbicki.me (Mike Izbicki) Date: Wed, 21 May 2014 15:50:54 -0700 Subject: [Haskell-cafe] llvm is generating invalid instructions (problem with autovectorization?) Message-ID: I have some code* that is causing llvm to throw a fit. In particular, I get (compiling with GHC 7.8 and llvm 3.4): /tmp/ghc1685_0/ghc1685_5.bc:150324:0: Error: no such instruction: `sarxq %rax,%rbx,%r14' Similar errors get repeated several thousand times, and it's always a sarxq instruction. Now, my code doesn't use any of the simd primops, so the sarxq must be coming from llvm's autovectorization. Is it possible that somehow GHC's output bytecode could be responsible, or is the problem more likely with llvm proper? Is there any way I can force GHC to pass flags to llvm so I can experiment with different settings? Another clue that the cause might be in llvm's autovectorization is that when I compile with llvm 3.0 (which does not support autovectorization), there are no error messages. * I suspect my code is far too complicated for it to shed any light on this question, but it's available at: https://github.com/mikeizbicki/HLearn/tree/dev-7.8/src/examples/hlearn-allknn If need be, I can create a minimal sample of code that causes the error, but I don't want to go through the trouble if it's not needed. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mihai.maruseac at gmail.com Wed May 21 23:19:09 2014 From: mihai.maruseac at gmail.com (Mihai Maruseac) Date: Wed, 21 May 2014 19:19:09 -0400 Subject: [Haskell-cafe] [Haskell] ANNOUNCE: Haskell Communities and Activities Report (26th ed., May 2014) Message-ID: On behalf of all the contributors, we are pleased to announce that the Haskell Communities and Activities Report (26th edition, May 2014) is now available, in PDF and HTML formats: http://www.haskell.org/communities/05-2014/report.pdf http://www.haskell.org/communities/05-2014/html/report.html Many thanks go to all the people that contributed to this report, both directly, by sending in descriptions, and indirectly, by doing all the interesting things that are reported. We hope you will find it as interesting a read as we did. If you have not encountered the Haskell Communities and Activities Reports before, you may like to know that the first of these reports was published in November 2001. Their goal is to improve the communication between the increasingly diverse groups, projects, and individuals working on, with, or inspired by Haskell. The idea behind these reports is simple: Every six months, a call goes out to all of you enjoying Haskell to contribute brief summaries of your own area of work. Many of you respond (eagerly, unprompted, and sometimes in time for the actual deadline) to the call. The editors collect all the contributions into a single report and feed that back to the community. When we try for the next update, six months from now, you might want to report on your own work, project, research area or group as well. So, please put the following into your diaries now: ======================================== End of October 2014: target deadline for contributions to the November 2014 edition of the HC&A Report ======================================== Unfortunately, many Haskellers working on interesting projects are so busy with their work that they seem to have lost the time to follow the Haskell related mailing lists and newsgroups, and have trouble even finding time to report on their work. If you are a member, user or friend of a project so burdened, please find someone willing to make time to report and ask them to "register" with the editors for a simple e-mail reminder in October (you could point us to them as well, and we can then politely ask if they want to contribute, but it might work better if you do the initial asking). Of course, they will still have to find the ten to fifteen minutes to draw up their report, but maybe we can increase our coverage of all that is going on in the community. Feel free to circulate this announcement further in order to reach people who might otherwise not see it. Enjoy! Mihai Maruseac and Alejandro Serrano Mena -- Mihai Maruseac (MM) "If you don't know, the thing to do is not to get scared, but to learn." -- Atlas Shrugged. From tmorris at tmorris.net Wed May 21 23:58:35 2014 From: tmorris at tmorris.net (Tony Morris) Date: Thu, 22 May 2014 09:58:35 +1000 Subject: [Haskell-cafe] instance Alternative (Either [a]) In-Reply-To: References: Message-ID: http://hackage.haskell.org/package/validation-0.3.4/docs/Data-Validation.html On Thu, May 22, 2014 at 7:46 AM, John Meacham wrote: > On Mon, May 19, 2014 at 8:31 AM, Corentin Dupont > wrote: > > However the instance in Control.Monad.Trans.Error.Error gets in the > way... > > I cannot use this one, it works only with Strings. > > My use case is that the Either handle in the Right a final value, or > else in > > the Left a list of things "left to do" to compute the value. > > How can I do? > > You want to use a newtype to wrap your Either. It sounds like you would > want > to do this independently of the String instance because you are not using > left as shortcutting failure anyway, rather you want to collect together > the failure actions. > > newtype NotDoneYet b a = NotDoneYet (Either [b] a) > > instance Applicative (NotDoneYet b) where > Left xs <*> Left ys = Left (xs ++ ys) > ... > > > -- > John Meacham - http://notanumber.net/ > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mainland at apeiron.net Thu May 22 01:05:49 2014 From: mainland at apeiron.net (Geoffrey Mainland) Date: Wed, 21 May 2014 21:05:49 -0400 Subject: [Haskell-cafe] llvm is generating invalid instructions (problem with autovectorization?) In-Reply-To: References: Message-ID: <537D4D6D.8020901@apeiron.net> Perhaps your installed version of binutils does not support the sarxq instruction? You can ask GHC to pass flags to llc and friends: http://www.haskell.org/ghc/docs/7.8.2/html/users_guide/options-phases.html#forcing-options-through Best, Geoff On 05/21/2014 06:50 PM, Mike Izbicki wrote: > I have some code* that is causing llvm to throw a fit. In particular, > I get (compiling with GHC 7.8 and llvm 3.4): > > /tmp/ghc1685_0/ghc1685_5.bc:150324:0: > Error: no such instruction: `sarxq %rax,%rbx,%r14' > > Similar errors get repeated several thousand times, and it's always a > sarxq instruction. Now, my code doesn't use any of the simd primops, > so the sarxq must be coming from llvm's autovectorization. Is it > possible that somehow GHC's output bytecode could be responsible, or > is the problem more likely with llvm proper? Is there any way I can > force GHC to pass flags to llvm so I can experiment with different > settings? > > Another clue that the cause might be in llvm's autovectorization is > that when I compile with llvm 3.0 (which does not support > autovectorization), there are no error messages. > > * I suspect my code is far too complicated for it to shed any light on > this question, but it's available at: > https://github.com/mikeizbicki/HLearn/tree/dev-7.8/src/examples/hlearn-allknn > If need be, I can create a minimal sample of code that causes the > error, but I don't want to go through the trouble if it's not needed. > > From michaeltbaker at gmail.com Thu May 22 01:53:11 2014 From: michaeltbaker at gmail.com (Michael Baker) Date: Wed, 21 May 2014 20:53:11 -0500 Subject: [Haskell-cafe] OpenGL performance issue on OSX In-Reply-To: References: Message-ID: I've added a VAO and reduced the inner loop to only a call to glDrawArrays which renders 8000 triangles (24000 vertices). The gameFrame function now benchmarks at ~86ms on my machine. I would expect it to be ~16ms because of vsync. I've pared down the entire project into this buildable cabal project of three files, most of which is OpenGL boilerplate: https://github.com/MichaelBaker/haskell-opengl. Running it benchmarks the problem area. For what it's worth, I also tried using glBufferSubData to update the vertex data, but that had no effect. As a side note, vinyl-gl looks like a nice library. I'll definitely look into using it if I can ever get this basic example working. -------------- next part -------------- An HTML attachment was scrubbed... URL: From carter.schonwald at gmail.com Thu May 22 01:57:47 2014 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Wed, 21 May 2014 21:57:47 -0400 Subject: [Haskell-cafe] llvm is generating invalid instructions (problem with autovectorization?) In-Reply-To: <537D4D6D.8020901@apeiron.net> References: <537D4D6D.8020901@apeiron.net> Message-ID: Is this on a Mac that is using gcc4.2? The older GCC assembler stuff doesn't understand simd. On Wednesday, May 21, 2014, Geoffrey Mainland wrote: > Perhaps your installed version of binutils does not support the sarxq > instruction? > > You can ask GHC to pass flags to llc and friends: > > > http://www.haskell.org/ghc/docs/7.8.2/html/users_guide/options-phases.html#forcing-options-through > > Best, > Geoff > > On 05/21/2014 06:50 PM, Mike Izbicki wrote: > > I have some code* that is causing llvm to throw a fit. In particular, > > I get (compiling with GHC 7.8 and llvm 3.4): > > > > /tmp/ghc1685_0/ghc1685_5.bc:150324:0: > > Error: no such instruction: `sarxq %rax,%rbx,%r14' > > > > Similar errors get repeated several thousand times, and it's always a > > sarxq instruction. Now, my code doesn't use any of the simd primops, > > so the sarxq must be coming from llvm's autovectorization. Is it > > possible that somehow GHC's output bytecode could be responsible, or > > is the problem more likely with llvm proper? Is there any way I can > > force GHC to pass flags to llvm so I can experiment with different > > settings? > > > > Another clue that the cause might be in llvm's autovectorization is > > that when I compile with llvm 3.0 (which does not support > > autovectorization), there are no error messages. > > > > * I suspect my code is far too complicated for it to shed any light on > > this question, but it's available at: > > > https://github.com/mikeizbicki/HLearn/tree/dev-7.8/src/examples/hlearn-allknn > > If need be, I can create a minimal sample of code that causes the > > error, but I don't want to go through the trouble if it's not needed. > > > > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mike at izbicki.me Thu May 22 02:06:48 2014 From: mike at izbicki.me (Mike Izbicki) Date: Wed, 21 May 2014 19:06:48 -0700 Subject: [Haskell-cafe] llvm is generating invalid instructions (problem with autovectorization?) In-Reply-To: References: <537D4D6D.8020901@apeiron.net> Message-ID: Geoffrey: After a quick google of binutils, it's not obvious to me what role it plays in the compilation process or how I would find out if it supports sarxq? Carter: It's on linux (centos); gcc version is 4.4.7. Why is gcc even getting involved in this process? I didn't think ghc used it at all anymore. On Wed, May 21, 2014 at 6:57 PM, Carter Schonwald < carter.schonwald at gmail.com> wrote: > Is this on a Mac that is using gcc4.2? The older GCC assembler stuff > doesn't understand simd. > > > On Wednesday, May 21, 2014, Geoffrey Mainland > wrote: > >> Perhaps your installed version of binutils does not support the sarxq >> instruction? >> >> You can ask GHC to pass flags to llc and friends: >> >> >> http://www.haskell.org/ghc/docs/7.8.2/html/users_guide/options-phases.html#forcing-options-through >> >> Best, >> Geoff >> >> On 05/21/2014 06:50 PM, Mike Izbicki wrote: >> > I have some code* that is causing llvm to throw a fit. In particular, >> > I get (compiling with GHC 7.8 and llvm 3.4): >> > >> > /tmp/ghc1685_0/ghc1685_5.bc:150324:0: >> > Error: no such instruction: `sarxq %rax,%rbx,%r14' >> > >> > Similar errors get repeated several thousand times, and it's always a >> > sarxq instruction. Now, my code doesn't use any of the simd primops, >> > so the sarxq must be coming from llvm's autovectorization. Is it >> > possible that somehow GHC's output bytecode could be responsible, or >> > is the problem more likely with llvm proper? Is there any way I can >> > force GHC to pass flags to llvm so I can experiment with different >> > settings? >> > >> > Another clue that the cause might be in llvm's autovectorization is >> > that when I compile with llvm 3.0 (which does not support >> > autovectorization), there are no error messages. >> > >> > * I suspect my code is far too complicated for it to shed any light on >> > this question, but it's available at: >> > >> https://github.com/mikeizbicki/HLearn/tree/dev-7.8/src/examples/hlearn-allknn >> > If need be, I can create a minimal sample of code that causes the >> > error, but I don't want to go through the trouble if it's not needed. >> > >> > >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Thu May 22 02:30:07 2014 From: allbery.b at gmail.com (Brandon Allbery) Date: Wed, 21 May 2014 22:30:07 -0400 Subject: [Haskell-cafe] llvm is generating invalid instructions (problem with autovectorization?) In-Reply-To: References: <537D4D6D.8020901@apeiron.net> Message-ID: On Wed, May 21, 2014 at 10:06 PM, Mike Izbicki wrote: > Geoffrey: After a quick google of binutils, it's not obvious to me what > role it plays in the compilation process or how I would find out if it > supports sarxq? > The assembler comes from binutils on Linux. Carter: It's on linux (centos); gcc version is 4.4.7. Why is gcc even > getting involved in this process? I didn't think ghc used it at all > anymore. > I think that was slightly confused; on OS X, the assembler is provided by Apple in the same package (Xcode command line tools) as gcc, although it's not part of gcc as such. (Apple doesn't use binutils, as its Mach-O object support tends to be out of date or broken.) I don't *think* gcc is involved with building stuff with -llvm. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Thu May 22 02:30:07 2014 From: allbery.b at gmail.com (Brandon Allbery) Date: Wed, 21 May 2014 22:30:07 -0400 Subject: [Haskell-cafe] llvm is generating invalid instructions (problem with autovectorization?) In-Reply-To: References: <537D4D6D.8020901@apeiron.net> Message-ID: On Wed, May 21, 2014 at 10:06 PM, Mike Izbicki wrote: > Geoffrey: After a quick google of binutils, it's not obvious to me what > role it plays in the compilation process or how I would find out if it > supports sarxq? > The assembler comes from binutils on Linux. Carter: It's on linux (centos); gcc version is 4.4.7. Why is gcc even > getting involved in this process? I didn't think ghc used it at all > anymore. > I think that was slightly confused; on OS X, the assembler is provided by Apple in the same package (Xcode command line tools) as gcc, although it's not part of gcc as such. (Apple doesn't use binutils, as its Mach-O object support tends to be out of date or broken.) I don't *think* gcc is involved with building stuff with -llvm. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From ky3 at atamo.com Thu May 22 04:18:49 2014 From: ky3 at atamo.com (Kim-Ee Yeoh) Date: Thu, 22 May 2014 11:18:49 +0700 Subject: [Haskell-cafe] instance Alternative (Either [a]) In-Reply-To: References: Message-ID: On Thu, May 22, 2014 at 6:58 AM, Tony Morris wrote: > > http://hackage.haskell.org/package/validation-0.3.4/docs/Data-Validation.html I don't understand how to use this package. Is it because Either is an ugly name for the data type and Validation is preferable? And AccValidation is to be used over Validation, like in Hungarian notation, to indicate (the possibility of?) a Semigroup instance on Left / Failure? -- Kim-Ee -------------- next part -------------- An HTML attachment was scrubbed... URL: From john at repetae.net Thu May 22 04:28:15 2014 From: john at repetae.net (John Meacham) Date: Wed, 21 May 2014 21:28:15 -0700 Subject: [Haskell-cafe] instance Alternative (Either [a]) In-Reply-To: References: Message-ID: I use a similar idiom newtype P b a = P ([b],Maybe a) Note that the [b] is _outside_ the maybe (or either), this means that the accumulated value can be propagated through failure. Notably, <*> and `ap` have very different meanings for this which is not true for other monads. <*> will collect [b] from both sides while `ap` will only do the left. John John On Wed, May 21, 2014 at 9:18 PM, Kim-Ee Yeoh wrote: > > On Thu, May 22, 2014 at 6:58 AM, Tony Morris wrote: >> >> >> http://hackage.haskell.org/package/validation-0.3.4/docs/Data-Validation.html > > > I don't understand how to use this package. > > Is it because Either is an ugly name for the data type and Validation is > preferable? > > And AccValidation is to be used over Validation, like in Hungarian notation, > to indicate (the possibility of?) a Semigroup instance on Left / Failure? > > > -- Kim-Ee -- John Meacham - http://notanumber.net/ From ky3 at atamo.com Thu May 22 04:48:00 2014 From: ky3 at atamo.com (Kim-Ee Yeoh) Date: Thu, 22 May 2014 11:48:00 +0700 Subject: [Haskell-cafe] extending the notion of notation In-Reply-To: References: <537B5189.9040108@gmail.com> <537BA62C.20709@vex.net> Message-ID: On Thu, May 22, 2014 at 4:37 AM, John Meacham wrote: > I dunno, I think makefiles might give them a run for the money when it > comes to declarative functional languages out there. and they are > monadic too! > Yes. Makefile programming is declarative programming indeed. Makefiles are textfiles though. So to return to the theme of "Can programming be liberated from textfiles?", I posited spreadsheets as a form of programming with no textfiles in sight. -- Kim-Ee -------------- next part -------------- An HTML attachment was scrubbed... URL: From dagitj at gmail.com Thu May 22 04:59:22 2014 From: dagitj at gmail.com (Jason Dagit) Date: Wed, 21 May 2014 21:59:22 -0700 Subject: [Haskell-cafe] OpenGL performance issue on OSX In-Reply-To: References: Message-ID: On Wed, May 21, 2014 at 6:53 PM, Michael Baker wrote: > I've added a VAO and reduced the inner loop to only a call to glDrawArrays > which renders 8000 triangles (24000 vertices). The gameFrame function now > benchmarks at ~86ms on my machine. I would expect it to be ~16ms because of > vsync. I've pared down the entire project into this buildable cabal project > of three files, most of which is OpenGL boilerplate: > https://github.com/MichaelBaker/haskell-opengl. > Awesome. Thanks! I'm taking a look now. I'll let you know if I figure out anything. Jason -------------- next part -------------- An HTML attachment was scrubbed... URL: From mike at izbicki.me Thu May 22 05:20:11 2014 From: mike at izbicki.me (Mike Izbicki) Date: Wed, 21 May 2014 22:20:11 -0700 Subject: [Haskell-cafe] llvm is generating invalid instructions (problem with autovectorization?) In-Reply-To: References: <537D4D6D.8020901@apeiron.net> Message-ID: Thanks everyone. Installing the latest version of binutils fixed the problem. On Wed, May 21, 2014 at 7:30 PM, Brandon Allbery wrote: > On Wed, May 21, 2014 at 10:06 PM, Mike Izbicki wrote: > >> Geoffrey: After a quick google of binutils, it's not obvious to me what >> role it plays in the compilation process or how I would find out if it >> supports sarxq? >> > > The assembler comes from binutils on Linux. > > Carter: It's on linux (centos); gcc version is 4.4.7. Why is gcc even >> getting involved in this process? I didn't think ghc used it at all >> anymore. >> > > I think that was slightly confused; on OS X, the assembler is provided by > Apple in the same package (Xcode command line tools) as gcc, although it's > not part of gcc as such. (Apple doesn't use binutils, as its Mach-O object > support tends to be out of date or broken.) I don't *think* gcc is involved > with building stuff with -llvm. > > -- > brandon s allbery kf8nh sine nomine > associates > allbery.b at gmail.com > ballbery at sinenomine.net > unix, openafs, kerberos, infrastructure, xmonad > http://sinenomine.net > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dagitj at gmail.com Thu May 22 05:35:30 2014 From: dagitj at gmail.com (Jason Dagit) Date: Wed, 21 May 2014 22:35:30 -0700 Subject: [Haskell-cafe] OpenGL performance issue on OSX In-Reply-To: References: Message-ID: On Wed, May 21, 2014 at 9:59 PM, Jason Dagit wrote: > > > > On Wed, May 21, 2014 at 6:53 PM, Michael Baker wrote: > >> I've added a VAO and reduced the inner loop to only a call to >> glDrawArrays which renders 8000 triangles (24000 vertices). The gameFrame >> function now benchmarks at ~86ms on my machine. I would expect it to be >> ~16ms because of vsync. I've pared down the entire project into this >> buildable cabal project of three files, most of which is OpenGL >> boilerplate: https://github.com/MichaelBaker/haskell-opengl. >> > > Awesome. Thanks! I'm taking a look now. I'll let you know if I figure out > anything. > I only have access to windows at the moment and I'm getting a weird linker error in bindings-GLFW when trying to build GLFW-b: Loading package bindings-GLFW-3.0.3.2 ... linking ... ghc.exe: unable to load package `bindings-GLFW-3.0.3.2' ghc.exe: warning: _vsnprintf from msvcrt is linked instead of __imp__vsnprintf ghc.exe: C:\Users\dagit\Documents\Repos\haskell-opengl\.cabal-sandbox\x86_64-windows-ghc-7.8.2\bindings-GLFW-3.0.3.2\HSbindings-GLFW-3.0.3.2.o: unknown symbol `strdup' Failed to install GLFW-b-1.4.6 I'll try on osx tomorrow. -------------- next part -------------- An HTML attachment was scrubbed... URL: From loupgaroublond at gmail.com Thu May 22 06:06:43 2014 From: loupgaroublond at gmail.com (Yaakov M Nemoy) Date: Wed, 21 May 2014 23:06:43 -0700 Subject: [Haskell-cafe] porting Haskell to Mageia In-Reply-To: <537CF5CC.6060107@home.nl> References: <537CF5CC.6060107@home.nl> Message-ID: <98CECB95-587A-48F8-A293-6813D3333E60@gmail.com> Hi Roelof, I don?t know a lot about Mageia packaging so i can?t help you with specifics there, but i can tell you a bit about how packaging is (or was) done in Fedora when i helped put together the packaging guidelines. In RPM packages there is a mapping between source code to a main package and zero or more subpackages. Usually there is just one source tarball and sometimes a few patches. You write a single SPEC file for the whole thing that runs all the step to build the code into binaries. This, of course, needs the build dependencies to be installed. For GHC, you want to install the monolithic bootstrapper so you can use it to build a new GHC package. Then the SPEC file has steps to configure the package int he build environment, build and compile the code, and finally install the code to a temporary build directory managed by RPM. If you stop here, you will have a new monolithic package, just like the bootstrapper. The magic happens in the %files section. For each sub package you want, you declare a separate %files section and then list the files that belong in that package. If you want to split each library into a separate package, you need to know which files fall under which library. For Haskell libraries in Fedora, we used split each package into code, documentation and profiling code. Nowadays, it is split into two parts, code and development headers for dynamic linked libraries. We also built macros for RPM to help automated this process. I imagine there is a similar packaging process for Mageia Linux. You can learn more about the Fedora side starting with this link below. I no longer maintain packages in Fedora, but I believe some of the current maintainers are on this list (hi!) and will correct my mistakes. If you would like further clarification, please don?t hesitate to ask. http://fedoraproject.org/wiki/Packaging:Haskell Kind regards, Yaakov M Nemoy On May 21, 2014, at 11.51, Roelof Wobben wrote: > Hello, > > I like to port Haskell to mageia linux. > > Now I found out that someone has already made a bootstrap package. > > Now my question is how can I use that one so I can make the full package like fedora has. > So a lot of small packages instead of one big package. > > > Roelof > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From ivan.miljenovic at gmail.com Thu May 22 06:38:50 2014 From: ivan.miljenovic at gmail.com (Ivan Lazar Miljenovic) Date: Thu, 22 May 2014 16:38:50 +1000 Subject: [Haskell-cafe] extending the notion of notation In-Reply-To: References: <537B5189.9040108@gmail.com> <537BA62C.20709@vex.net> Message-ID: On 22 May 2014 14:48, Kim-Ee Yeoh wrote: > > On Thu, May 22, 2014 at 4:37 AM, John Meacham wrote: >> >> I dunno, I think makefiles might give them a run for the money when it >> comes to declarative functional languages out there. and they are >> monadic too! > > > Yes. Makefile programming is declarative programming indeed. Makefiles are > textfiles though. > > So to return to the theme of "Can programming be liberated from textfiles?", > I posited spreadsheets as a form of programming with no textfiles in sight. CSVs? -- Ivan Lazar Miljenovic Ivan.Miljenovic at gmail.com http://IvanMiljenovic.wordpress.com From r.wobben at home.nl Thu May 22 06:40:33 2014 From: r.wobben at home.nl (Roelof Wobben) Date: Thu, 22 May 2014 08:40:33 +0200 Subject: [Haskell-cafe] porting Haskell to Mageia In-Reply-To: <98CECB95-587A-48F8-A293-6813D3333E60@gmail.com> References: <537CF5CC.6060107@home.nl> <98CECB95-587A-48F8-A293-6813D3333E60@gmail.com> Message-ID: <537D9BE1.8020804@home.nl> Yaakov M Nemoy schreef op 22-5-2014 8:06: > Hi Roelof, > > I don?t know a lot about Mageia packaging so i can?t help you with specifics there, but i can tell you a bit about how packaging is (or was) done in Fedora when i helped put together the packaging guidelines. > > In RPM packages there is a mapping between source code to a main package and zero or more subpackages. Usually there is just one source tarball and sometimes a few patches. You write a single SPEC file for the whole thing that runs all the step to build the code into binaries. This, of course, needs the build dependencies to be installed. For GHC, you want to install the monolithic bootstrapper so you can use it to build a new GHC package. Then the SPEC file has steps to configure the package int he build environment, build and compile the code, and finally install the code to a temporary build directory managed by RPM. If you stop here, you will have a new monolithic package, just like the bootstrapper. > > The magic happens in the %files section. For each sub package you want, you declare a separate %files section and then list the files that belong in that package. If you want to split each library into a separate package, you need to know which files fall under which library. For Haskell libraries in Fedora, we used split each package into code, documentation and profiling code. Nowadays, it is split into two parts, code and development headers for dynamic linked libraries. We also built macros for RPM to help automated this process. > > I imagine there is a similar packaging process for Mageia Linux. You can learn more about the Fedora side starting with this link below. I no longer maintain packages in Fedora, but I believe some of the current maintainers are on this list (hi!) and will correct my mistakes. If you would like further clarification, please don?t hesitate to ask. > > http://fedoraproject.org/wiki/Packaging:Haskell > > > Kind regards, > > Yaakov M Nemoy > > > > > > > > > > On May 21, 2014, at 11.51, Roelof Wobben wrote: > >> Hello, >> >> I like to port Haskell to mageia linux. >> >> Now I found out that someone has already made a bootstrap package. >> >> Now my question is how can I use that one so I can make the full package like fedora has. >> So a lot of small packages instead of one big package. >> >> >> Roelof >> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe > Thanks, That's is what I thought. 1) Make the subpackages and using the monolotic bootstrap package. 2) Make GHC and use the subpackages made on 2) Roelof From tmorris at tmorris.net Thu May 22 07:10:24 2014 From: tmorris at tmorris.net (Tony Morris) Date: Thu, 22 May 2014 17:10:24 +1000 Subject: [Haskell-cafe] instance Alternative (Either [a]) In-Reply-To: References: Message-ID: AccValidation has an Applicative instance that accumulates on "Left" (Failure) as per the previous email. Therefore, it has no Monad. Validation has a Monad and Applicative the same as Either. On Thu, May 22, 2014 at 2:18 PM, Kim-Ee Yeoh wrote: > > On Thu, May 22, 2014 at 6:58 AM, Tony Morris wrote: > >> >> http://hackage.haskell.org/package/validation-0.3.4/docs/Data-Validation.html > > > I don't understand how to use this package. > > Is it because Either is an ugly name for the data type and Validation is > preferable? > > And AccValidation is to be used over Validation, like in Hungarian > notation, to indicate (the possibility of?) a Semigroup instance on Left / > Failure? > > > -- Kim-Ee > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tonymorris at gmail.com Thu May 22 07:21:39 2014 From: tonymorris at gmail.com (Tony Morris) Date: Thu, 22 May 2014 17:21:39 +1000 Subject: [Haskell-cafe] instance Alternative (Either [a]) In-Reply-To: References: Message-ID: <537DA583.9000800@gmail.com> On 22/05/14 14:28, John Meacham wrote: > Notably, <*> and `ap` have very different meanings for this which is > not true for other monads. Please don't do this. Kittens die and all that. -- Tony Morris http://tmorris.net/ From R.Paterson at city.ac.uk Thu May 22 07:37:52 2014 From: R.Paterson at city.ac.uk (Ross Paterson) Date: Thu, 22 May 2014 08:37:52 +0100 Subject: [Haskell-cafe] instance Alternative (Either [a]) In-Reply-To: References: Message-ID: <20140522073752.GA4519@city.ac.uk> On Thu, May 22, 2014 at 05:10:24PM +1000, Tony Morris wrote: > AccValidation has an Applicative instance that accumulates on "Left" (Failure) > as per the previous email. Therefore, it has no Monad. This applicative is called Errors in the transformers package (in Control.Applicative.Lift, of which it's a special case). From jv at informatik.uni-bonn.de Thu May 22 08:29:42 2014 From: jv at informatik.uni-bonn.de (Janis Voigtlaender) Date: Thu, 22 May 2014 10:29:42 +0200 Subject: [Haskell-cafe] [Haskell] ANNOUNCE: Haskell Communities and Activities Report (26th ed., May 2014) In-Reply-To: References: Message-ID: <537DB576.7090900@informatik.uni-bonn.de> Nicely done. Thanks, Mihai and Alejandro! Am 22.05.2014 01:19, schrieb Mihai Maruseac: > On behalf of all the contributors, we are pleased to announce that the > > Haskell Communities and Activities Report > (26th edition, May 2014) > > is now available, in PDF and HTML formats: > > http://www.haskell.org/communities/05-2014/report.pdf > http://www.haskell.org/communities/05-2014/html/report.html > > ... From carlo at carlo-hamalainen.net Thu May 22 08:42:15 2014 From: carlo at carlo-hamalainen.net (Carlo Hamalainen) Date: Thu, 22 May 2014 08:42:15 +0000 Subject: [Haskell-cafe] Announce: ghc-imported-from-0.2.0.4 Message-ID: <0000014623185320-4dd55495-9bd2-4788-bdd2-1948e62729c6-000000@email.amazonses.com> Hi, I have released v0.2.0.4 of my utility ghc-imported-from. It lets you quickly jump to the Haddock documentation for a symbol in a Haskell source file. This version has a few bug fixes, is significantly faster, and has better support for cabal sandboxes. Short screencast showing the vim plugin: https://www.youtube.com/watch?v=7yO_VGCWMu8 (make sure it plays in 720p HD) Hackage page: http://hackage.haskell.org/package/ghc-imported-from-0.2.0.4 Vim plugin: https://github.com/carlohamalainen/ghcimportedfrom-vim Cheers, -- Carlo Hamalainen http://carlo-hamalainen.net From john at repetae.net Thu May 22 09:35:21 2014 From: john at repetae.net (John Meacham) Date: Thu, 22 May 2014 02:35:21 -0700 Subject: [Haskell-cafe] instance Alternative (Either [a]) In-Reply-To: <537DA583.9000800@gmail.com> References: <537DA583.9000800@gmail.com> Message-ID: On Thu, May 22, 2014 at 12:21 AM, Tony Morris wrote: > On 22/05/14 14:28, John Meacham wrote: >> Notably, <*> and `ap` have very different meanings for this which is >> not true for other monads. > Please don't do this. Kittens die and all that. In my particular case I did this, it is actually collecting a non-deterministic set of values so the difference between the two does not matter for correctness, but is practically useful to have a greater set of errors to choose from. The difference is hidden behind an abstract interface so it actually is externally a monad. Manual imprecise exceptions. I just prefer to think of `ap` as buggy and unrelated to <*> sometimes... John -- John Meacham - http://notanumber.net/ From john at repetae.net Thu May 22 09:38:22 2014 From: john at repetae.net (John Meacham) Date: Thu, 22 May 2014 02:38:22 -0700 Subject: [Haskell-cafe] extending the notion of notation In-Reply-To: References: <537B5189.9040108@gmail.com> <537BA62C.20709@vex.net> Message-ID: On Wed, May 21, 2014 at 9:48 PM, Kim-Ee Yeoh wrote: > So to return to the theme of "Can programming be liberated from textfiles?", > I posited spreadsheets as a form of programming with no textfiles in sight. 'go' is a little in this direction in that there is a standard syntax aware formatter that is part of the language. So although there are text files, they have been normalized and spit through an AST. John -- John Meacham - http://notanumber.net/ From ky3 at atamo.com Thu May 22 10:33:29 2014 From: ky3 at atamo.com (Kim-Ee Yeoh) Date: Thu, 22 May 2014 17:33:29 +0700 Subject: [Haskell-cafe] instance Alternative (Either [a]) In-Reply-To: References: Message-ID: On Thu, May 22, 2014 at 2:10 PM, Tony Morris wrote: > AccValidation has an Applicative instance that accumulates on "Left" > (Failure) as per the previous email. Therefore, it has no Monad. > > Validation has a Monad and Applicative the same as Either. Thanks for clarifying. So my takeaway is that 1) Validation instead of Either is not so much bikeshedding on the name as aligning with the use-case of AccValidation, and 2) AccValidation vs Either is like the ZippyList applicative vs List monad conflation. -- Kim-Ee -------------- next part -------------- An HTML attachment was scrubbed... URL: From acowley at seas.upenn.edu Thu May 22 14:31:04 2014 From: acowley at seas.upenn.edu (Anthony Cowley) Date: Thu, 22 May 2014 10:31:04 -0400 Subject: [Haskell-cafe] OpenGL performance issue on OSX In-Reply-To: References: Message-ID: <8C015405-C067-4848-937D-03D2C6843F4A@seas.upenn.edu> > On May 21, 2014, at 9:53 PM, Michael Baker wrote: > > I've added a VAO and reduced the inner loop to only a call to glDrawArrays which renders 8000 triangles (24000 vertices). The gameFrame function now benchmarks at ~86ms on my machine. I would expect it to be ~16ms because of vsync. I've pared down the entire project into this buildable cabal project of three files, most of which is OpenGL boilerplate: https://github.com/MichaelBaker/haskell-opengl. Running it benchmarks the problem area. For what it's worth, I also tried using glBufferSubData to update the vertex data, but that had no effect. > > As a side note, vinyl-gl looks like a nice library. I'll definitely look into using it if I can ever get this basic example working. That's some pretty serious antialiasing you're asking for, there (16x). Is that intentional? Anthony -------------- next part -------------- An HTML attachment was scrubbed... URL: From michaeltbaker at gmail.com Thu May 22 15:57:05 2014 From: michaeltbaker at gmail.com (Michael Baker) Date: Thu, 22 May 2014 10:57:05 -0500 Subject: [Haskell-cafe] OpenGL performance issue on OSX In-Reply-To: <8C015405-C067-4848-937D-03D2C6843F4A@seas.upenn.edu> References: <8C015405-C067-4848-937D-03D2C6843F4A@seas.upenn.edu> Message-ID: > > That's some pretty serious antialiasing you're asking for, there (16x). Is > that intentional? > > Anthony > Ah, that might be part of the problem. Lowering (or removing) that definitely helps, but I'm still getting ~79ms per frame on a Macbook Pro Retina with an Intel HD Graphics 4000 video card. -------------- next part -------------- An HTML attachment was scrubbed... URL: From sapristi at gmail.com Thu May 22 17:26:29 2014 From: sapristi at gmail.com (Albert Cardona) Date: Thu, 22 May 2014 13:26:29 -0400 Subject: [Haskell-cafe] using withAnnotations from Graphics.Rendering.Plot.Figure Message-ID: Hi all, given two Vector and a list of strings, I generate a plot of one vector as a function of the other [1]. At each x,y point, I am trying to place the corresponding string. For the purpose, I zip3 all three sequences, define an annotation function, and invoke it with mapM_ in the context of withAnnotations [2]: withPlot (1, 1) $ do ... let annotation (x, y, label) = text (x + 2, y) (setText label) in withAnnotations $ do mapM_ annotation $ zip3 (toList vx) (toList vy) labels The code above compiles and runs, the plot shows, but no text annotations appear at all. I understand that I am not using the Annote monad correctly: the mapM_ drops every returned value, so the state is not altered. What is the correct way to invoke withAnnotations over a list of (x, y, String) ? Needless to say, I am a beginner in Haskell. Apologies if the above is too trivial. Thanks very much in advance. Albert [1] https://github.com/acardona/haskell-lib/blob/master/CATMAID/Analysis/Graph/Plot.hs [2] http://hackage.haskell.org/package/plot-0.2.3/docs/Graphics-Rendering-Plot-Figure.html#v:withAnnotations -- http://albert.rierol.net http://www.ini.uzh.ch/~acardona/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From felipe.lessa at gmail.com Thu May 22 18:46:56 2014 From: felipe.lessa at gmail.com (Felipe Lessa) Date: Thu, 22 May 2014 15:46:56 -0300 Subject: [Haskell-cafe] OpenGL performance issue on OSX In-Reply-To: References: Message-ID: <537E4620.60902@gmail.com> Em 21-05-2014 22:53, Michael Baker escreveu: > I've added a VAO and reduced the inner loop to only a call to > glDrawArrays which renders 8000 triangles (24000 vertices). The > gameFrame function now benchmarks at ~86ms on my machine. I would expect > it to be ~16ms because of vsync. I've pared down the entire project into > this buildable cabal project of three files, most of which is OpenGL > boilerplate: https://github.com/MichaelBaker/haskell-opengl. Running it > benchmarks the problem area. For what it's worth, I also tried using > glBufferSubData to update the vertex data, but that had no effect. Your program is segfaulting for me on Linux: $ cabal clean $ cabal configure --disable-executable-stripping --ghc-option=-debug [...] $ cabal build [...] $ LC_ALL=C valgrind ./dist/build/opengl/opengl ==21335== Memcheck, a memory error detector ==21335== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. ==21335== Using Valgrind-3.9.0 and LibVEX; rerun with -h for copyright info ==21335== Command: ./dist/build/opengl/opengl ==21335== warming up estimating clock resolution... mean is 38.15961 us (20001 iterations) found 583 outliers among 19999 samples (2.9%) 328 (1.6%) high mild 254 (1.3%) high severe estimating cost of a clock call... mean is 1.177577 us (66 iterations) found 3 outliers among 66 samples (4.5%) 2 (3.0%) high mild 1 (1.5%) high severe benchmarking gameFrame ==21335== Invalid read of size 8 ==21335== at 0x4C2CB30: memcpy at GLIBC_2.2.5 (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==21335== by 0x5C1E1A4: ??? (in /usr/lib/nvidia/libGL.so.337.19) ==21335== by 0x5DC2: ??? ==21335== by 0xFF2FFFFFFFF: ??? ==21335== by 0xFEF: ??? ==21335== by 0xFEF: ??? ==21335== by 0xAC4285F: ??? ==21335== by 0x5EF4BB5: _XSend (in /usr/lib/libX11.so.6.3.0) ==21335== by 0xAE456DF: ??? ==21335== by 0xAE460A7: ??? ==21335== by 0x5DC2F: ??? ==21335== by 0xAE455EF: ??? ==21335== Address 0xfe8 is not stack'd, malloc'd or (recently) free'd ==21335== ==21335== ==21335== Process terminating with default action of signal 11 (SIGSEGV) ==21335== Access not within mapped region at address 0xFE8 ==21335== at 0x4C2CB30: memcpy at GLIBC_2.2.5 (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==21335== by 0x5C1E1A4: ??? (in /usr/lib/nvidia/libGL.so.337.19) ==21335== by 0x5DC2: ??? ==21335== by 0xFF2FFFFFFFF: ??? ==21335== by 0xFEF: ??? ==21335== by 0xFEF: ??? ==21335== by 0xAC4285F: ??? ==21335== by 0x5EF4BB5: _XSend (in /usr/lib/libX11.so.6.3.0) ==21335== by 0xAE456DF: ??? ==21335== by 0xAE460A7: ??? ==21335== by 0x5DC2F: ??? ==21335== by 0xAE455EF: ??? ==21335== If you believe this happened as a result of a stack ==21335== overflow in your program's main thread (unlikely but ==21335== possible), you can try to increase the size of the ==21335== main thread stack using the --main-stacksize= flag. ==21335== The main thread stack size used in this run was 8388608. ==21335== ==21335== HEAP SUMMARY: ==21335== in use at exit: 1,222,944 bytes in 665 blocks ==21335== total heap usage: 5,445 allocs, 4,780 frees, 78,290,922 bytes allocated ==21335== ==21335== LEAK SUMMARY: ==21335== definitely lost: 10,752 bytes in 12 blocks ==21335== indirectly lost: 0 bytes in 0 blocks ==21335== possibly lost: 519,934 bytes in 2 blocks ==21335== still reachable: 692,258 bytes in 651 blocks ==21335== suppressed: 0 bytes in 0 blocks ==21335== Rerun with --leak-check=full to see details of leaked memory ==21335== ==21335== For counts of detected and suppressed errors, rerun with: -v ==21335== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 3 from 2) Falha de segmenta??o (imagem do n?cleo gravada) $ gdb ./dist/build/opengl/opengl GNU gdb (GDB) 7.7.1 [...] Reading symbols from ./dist/build/opengl/opengl...(no debugging symbols found)...done. (gdb) run Starting program: /tmp/haskell-opengl/dist/build/opengl/opengl warning: Could not load shared library symbols for linux-vdso.so.1. Do you need "set solib-search-path" or "set sysroot"? [Thread debugging using libthread_db enabled] Using host libthread_db library "/usr/lib/libthread_db.so.1". warming up estimating clock resolution... mean is 1.346329 us (640001 iterations) found 4071 outliers among 639999 samples (0.6%) 3860 (0.6%) high severe estimating cost of a clock call... mean is 81.51352 ns (10 iterations) found 1 outliers among 10 samples (10.0%) 1 (10.0%) high mild benchmarking gameFrame Program received signal SIGSEGV, Segmentation fault. 0x00007ffff5c5ece0 in _wordcopy_fwd_aligned () from /usr/lib/libc.so.6 (gdb) bt #0 0x00007ffff5c5ece0 in _wordcopy_fwd_aligned () from /usr/lib/libc.so.6 #1 0x00007ffff5c595f5 in __memmove_sse2 () from /usr/lib/libc.so.6 #2 0x00007ffff6dff1a5 in ?? () from /usr/lib/libGL.so.1 #3 0x00007ffff6e01ada in ?? () from /usr/lib/libGL.so.1 #4 0x0000000000407b91 in ceGc_info () #5 0x0000000000000000 in ?? () Cheers, -- Felipe. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 901 bytes Desc: OpenPGP digital signature URL: From smills at systems-dev.com Thu May 22 19:07:41 2014 From: smills at systems-dev.com (Stuart Mills) Date: Thu, 22 May 2014 12:07:41 -0700 Subject: [Haskell-cafe] Haskell-cafe] Yesod can't build on 64 bit 7.8.2 Windows Message-ID: <537E4AFD.2040404@systems-dev.com> Apparently in going to Mingw 64 the packages "system-fileio" and "unix-compat" no longer compiled because some Windows routines were not available in their expected "names". I reported the issues and John Milikin quickly patched "system-fileio" (thanks John, if you're listening). The unix-compat issue is still outstanding (not sure if it's still being maintained), but I was able to patch it by adding underscores to elements like "snprintf". ( _snprintf works, _stat instead of stat, etc.) These were the same types of changes that worked for system-fileio. Note that this approach may break Win32. The next issue is when linking with yaml (ghc.exe: panic!). This was reported as a GHC bug 2 weeks ago (#9080) by maun, who was trying to build GHCJS. I get the exact same error in building Yesod. Because of Yesod, I think #9080 should be promoted to high priority, and it would be great if someone could bring unix-compat up to date. Thanks Stuart From bertram.felgenhauer at googlemail.com Thu May 22 20:13:00 2014 From: bertram.felgenhauer at googlemail.com (Bertram Felgenhauer) Date: Thu, 22 May 2014 22:13:00 +0200 Subject: [Haskell-cafe] OpenGL performance issue on OSX In-Reply-To: References: Message-ID: <20140522201300.GA9238@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> Michael Baker wrote: > I've added a VAO and reduced the inner loop to only a call to glDrawArrays > which renders 8000 triangles (24000 vertices). The gameFrame function now > benchmarks at ~86ms on my machine. I would expect it to be ~16ms because of > vsync. You're expecting too much from your graphics hardware. The total area of the triangles that you are drawing covers approximately 80 million pixels (they overlap a lot). If one uses non-overlapping triangles (with a total area close to 60k pixels) floats = concat $ [[0, 0, 0, cos ((x+1) / triangles), sin ((x+1) / triangles), 0, cos (x / triangles), sin (x / triangles), 0] | x <- [0..triangles]] :: [GLfloat] the program becomes a lot faster. Code: let area [] = 0; area (x1:y1:_:x2:y2:_:x3:y3:_:xs) = ((x3-x1)*(y2-y1) - (x2-x1)*(y3-y1))/2*400*300 + area xs in area floats Cheers, Bertram From michaeltbaker at gmail.com Thu May 22 20:29:20 2014 From: michaeltbaker at gmail.com (Michael Baker) Date: Thu, 22 May 2014 15:29:20 -0500 Subject: [Haskell-cafe] OpenGL performance issue on OSX In-Reply-To: <20140522201300.GA9238@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> References: <20140522201300.GA9238@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> Message-ID: > > You're expecting too much from your graphics hardware. The total area of > the triangles that you are drawing covers approximately 80 million pixels > (they overlap a lot). If one uses non-overlapping triangles (with a total > area close to 60k pixels) Ah, ok. So the problem is that I'm trying to render too many fragments, rather than too many triangles. So if I had a lot of small triangles, or a few big ones, I would be fine. However, I've got a lot of big ones, which is slow. I'll try reducing the total area of the triangles I'm rendering. Is there some benchmark or tool I could have used to figure that out? Something that would show me the time spent filling fragments vs the time spent processing triangles vs time spent uploading data to the graphics card? -------------- next part -------------- An HTML attachment was scrubbed... URL: From dagitj at gmail.com Thu May 22 20:39:11 2014 From: dagitj at gmail.com (Jason Dagit) Date: Thu, 22 May 2014 13:39:11 -0700 Subject: [Haskell-cafe] OpenGL performance issue on OSX In-Reply-To: References: <20140522201300.GA9238@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> Message-ID: On Thu, May 22, 2014 at 1:29 PM, Michael Baker wrote: > You're expecting too much from your graphics hardware. The total area of >> the triangles that you are drawing covers approximately 80 million pixels >> (they overlap a lot). If one uses non-overlapping triangles (with a total >> area close to 60k pixels) > > > Ah, ok. So the problem is that I'm trying to render too many fragments, > rather than too many triangles. So if I had a lot of small triangles, or a > few big ones, I would be fine. However, I've got a lot of big ones, which > is slow. I'll try reducing the total area of the triangles I'm rendering. > Is there some benchmark or tool I could have used to figure that out? > Something that would show me the time spent filling fragments vs the time > spent processing triangles vs time spent uploading data to the graphics > card? > This looks like a decent list of options: http://www.opengl.org/wiki/Debugging_Tools This SO question looks promising: http://stackoverflow.com/questions/12640841/did-someone-succeed-in-using-opengl-profiler-on-mountain-lion In particular, I think you can attach the OSX opengl profiler to a process: https://developer.apple.com/library/mac/documentation/GraphicsImaging/Conceptual/OpenGLProfilerUserGuide/GettedStarted/GettingStarted.html -------------- next part -------------- An HTML attachment was scrubbed... URL: From michaeltbaker at gmail.com Fri May 23 01:03:03 2014 From: michaeltbaker at gmail.com (Michael Baker) Date: Thu, 22 May 2014 20:03:03 -0500 Subject: [Haskell-cafe] OpenGL performance issue on OSX In-Reply-To: References: <20140522201300.GA9238@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> Message-ID: For the sake of posterity I want to let everyone know that decreasing the anti-aliasing samples and decreasing the total visible area being rendered solved the problem. Thank you everyone for your help! -------------- next part -------------- An HTML attachment was scrubbed... URL: From svenpanne at gmail.com Fri May 23 07:20:04 2014 From: svenpanne at gmail.com (Sven Panne) Date: Fri, 23 May 2014 09:20:04 +0200 Subject: [Haskell-cafe] OpenGL performance issue on OSX In-Reply-To: References: <20140522201300.GA9238@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> Message-ID: 2014-05-22 22:29 GMT+02:00 Michael Baker : > [...] Is there some benchmark or tool I could have used to figure that out? Something > that would show me the time spent filling fragments vs the time spent > processing triangles vs time spent uploading data to the graphics card? I don't think there are general cross-platform tools for this, but e.g. if you have NVIDIA hardware, your platform is supported and you go through the initial pain of installing/learning the tool, NVIDIA Nsight or PerfKit can quickly answer such questions. No idea if something similar exists for AMD or Intel GPUs, but it's likely. Apart from that, there are few rules of thumb and techniques to determine the bottleneck in your rendering pipeline: Vary the size of the window you're drawing to and see if performance changes. If yes, you are probably limited by the fill rate of your GPU. Another test: Keep the window size, but vary the complexity of the geometry. If performance changes, it could be the calculation of the geometry on the CPU or the transformation of the geometry on the GPU (depending on how you do things). You could even calculate and vary the geometry, but don't actually send it for rendering to see the effect of your CPU, you could play some OpenGL tricks to measure/visualize the amount of overdraw etc. etc. From edskodevries at gmail.com Fri May 23 14:51:01 2014 From: edskodevries at gmail.com (Edsko de Vries) Date: Fri, 23 May 2014 15:51:01 +0100 Subject: [Haskell-cafe] hasktags and sublime? Message-ID: Hey, has anyone has much luck with hasktags and sublime (3, OSX)? If I create the tags file with hasktags -c it complains that it cannot find any relevant tags file, and when I create it with hasktags -e that warning disappears but I can't jump to any definition (it always says that the tag is not found). -E -------------- next part -------------- An HTML attachment was scrubbed... URL: From dawedawe at gmx.de Fri May 23 17:32:02 2014 From: dawedawe at gmx.de (Dawe) Date: Fri, 23 May 2014 19:32:02 +0200 Subject: [Haskell-cafe] haskell on OpenBSD 5.5 In-Reply-To: <1400614826.99466.YahooMailNeo@web163103.mail.bf1.yahoo.com> References: <1400614826.99466.YahooMailNeo@web163103.mail.bf1.yahoo.com> Message-ID: <20140523173130.GA17846@padtree> On May 20, 2014 12:40, Michael S wrote: > > > Good day all, I installed OpenBSD 5.5 in order to learn haskell. > There are a few glitches however. I installed the haskell-platform meta-package and the issues I noticed are: > - hs-vector wouldn't install > - ghci wouldn't start, the message: unable to load package `integer-gmp' Has anyone experienced the same issue? Is this happening on OpenBSD 5.4? Is this OpenBSD specific? Thanks in advance. Known problem with ghci on OpenBSD 5.5 i386. If you can, try amd64. You should be fine there. If you can't, 5.4 i386 was ok, iirc. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 834 bytes Desc: not available URL: From bob at redivi.com Fri May 23 18:42:13 2014 From: bob at redivi.com (Bob Ippolito) Date: Fri, 23 May 2014 11:42:13 -0700 Subject: [Haskell-cafe] Self-contained GHC for Mac Message-ID: After seeing some demand for packaged Haskell for Mac for the IHaskell project and by word of mouth at BayHac I decided to take a stab at it. Here you go: http://ghcformacosx.github.io/ (currently GHC 7.8.2 and cabal-install 1.20.0.1) Why? It can be a bit cumbersome to use the GHC builds from haskell.org on Mac, because they don't come "fully baked", you have to ./configure --prefix=/some/path to get them installed and the installation is not relocatable, if you move it the scripts will break and the package.conf.d files will go stale. It also doesn't ship with cabal-install, which is cumbersome as well, especially for new users. How does it work? In https://github.com/ghcformacosx/ghc-dot-app I have a Main.hs script which downloads/builds/etc. all of the prerequisites. Then it patches the shell scripts to use a path relative to themselves (after following symlinks) rather than hard-coding an installation location. It also patches the package.conf.d files to use ${pkgroot} relative paths. Separately, there's an Xcode project that includes all of the metadata to make it look like a real Mac app bundle (icons, Info.plist) and a small Cocoa application that has a button to open the docs and provides instructions for adding it to the PATH in .bashrc. Due to the heuristics in Mac OS X's man, this will automatically make man pages work as well. Using Xcode here also makes it produce a signed build (which I do, since I am already paying for the $99/year license). -bob -------------- next part -------------- An HTML attachment was scrubbed... URL: From msherman77 at yahoo.com Fri May 23 23:46:37 2014 From: msherman77 at yahoo.com (Michael S) Date: Fri, 23 May 2014 16:46:37 -0700 (PDT) Subject: [Haskell-cafe] haskell on OpenBSD 5.5 In-Reply-To: <20140523173130.GA17846@padtree> References: <1400614826.99466.YahooMailNeo@web163103.mail.bf1.yahoo.com> <20140523173130.GA17846@padtree> Message-ID: <1400888797.39200.YahooMailNeo@web163105.mail.bf1.yahoo.com> That was what I did.? ghci works? on the amd64? port. Thanks! Tha On Friday, May 23, 2014 1:32:02 PM, Dawe wrote: On May 20, 2014 12:40, Michael S wrote: > > > Good day all, I installed OpenBSD 5.5 in order to learn haskell. > There are a few glitches however. I installed the haskell-platform meta-package and the issues I noticed are: > - hs-vector wouldn't install > - ghci wouldn't start, the message: unable to load package `integer-gmp' Has anyone experienced the same issue? Is this happening on OpenBSD 5.4? Is this OpenBSD specific? Thanks in advance. Known problem with ghci on OpenBSD 5.5 i386. If you can, try amd64. You should be fine there. If you can't, 5.4 i386 was ok, iirc. -------------- next part -------------- An HTML attachment was scrubbed... URL: From adam at bergmark.nl Sat May 24 06:56:19 2014 From: adam at bergmark.nl (Adam Bergmark) Date: Sat, 24 May 2014 08:56:19 +0200 Subject: [Haskell-cafe] Self-contained GHC for Mac In-Reply-To: References: Message-ID: Nice, thanks for doing this! I'll make sure to try this next time i need to install GHC. - Adam On Fri, May 23, 2014 at 8:42 PM, Bob Ippolito wrote: > After seeing some demand for packaged Haskell for Mac for the IHaskell > project and by word of mouth at BayHac I decided to take a stab at it. Here > you go: > http://ghcformacosx.github.io/ (currently GHC 7.8.2 and cabal-install > 1.20.0.1) > > Why? > > It can be a bit cumbersome to use the GHC builds from haskell.org on Mac, > because they don't come "fully baked", you have to ./configure > --prefix=/some/path to get them installed and the installation is not > relocatable, if you move it the scripts will break and the package.conf.d > files will go stale. It also doesn't ship with cabal-install, which is > cumbersome as well, especially for new users. > > How does it work? > > In https://github.com/ghcformacosx/ghc-dot-app I have a Main.hs script > which downloads/builds/etc. all of the prerequisites. Then it patches the > shell scripts to use a path relative to themselves (after following > symlinks) rather than hard-coding an installation location. It also patches > the package.conf.d files to use ${pkgroot} relative paths. > > Separately, there's an Xcode project that includes all of the metadata to > make it look like a real Mac app bundle (icons, Info.plist) and a small > Cocoa application that has a button to open the docs and provides > instructions for adding it to the PATH in .bashrc. Due to the heuristics in > Mac OS X's man, this will automatically make man pages work as well. Using > Xcode here also makes it produce a signed build (which I do, since I am > already paying for the $99/year license). > > -bob > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From knardi at gmail.com Sat May 24 06:58:40 2014 From: knardi at gmail.com (Kevin Nardi) Date: Fri, 23 May 2014 23:58:40 -0700 Subject: [Haskell-cafe] Self-contained GHC for Mac In-Reply-To: References: Message-ID: <292A325B-D064-4583-917E-95000269B410@gmail.com> +1 This is really awesome, and definitely would have made my life easier the first time I installed GHC. -Kevin On May 23, 2014, at 11:56 PM, Adam Bergmark wrote: > Nice, thanks for doing this! > > I'll make sure to try this next time i need to install GHC. > > - Adam > > > > > On Fri, May 23, 2014 at 8:42 PM, Bob Ippolito wrote: > After seeing some demand for packaged Haskell for Mac for the IHaskell project and by word of mouth at BayHac I decided to take a stab at it. Here you go: > http://ghcformacosx.github.io/ (currently GHC 7.8.2 and cabal-install 1.20.0.1) > > Why? > > It can be a bit cumbersome to use the GHC builds from haskell.org on Mac, because they don't come "fully baked", you have to ./configure --prefix=/some/path to get them installed and the installation is not relocatable, if you move it the scripts will break and the package.conf.d files will go stale. It also doesn't ship with cabal-install, which is cumbersome as well, especially for new users. > > How does it work? > > In https://github.com/ghcformacosx/ghc-dot-app I have a Main.hs script which downloads/builds/etc. all of the prerequisites. Then it patches the shell scripts to use a path relative to themselves (after following symlinks) rather than hard-coding an installation location. It also patches the package.conf.d files to use ${pkgroot} relative paths. > > Separately, there's an Xcode project that includes all of the metadata to make it look like a real Mac app bundle (icons, Info.plist) and a small Cocoa application that has a button to open the docs and provides instructions for adding it to the PATH in .bashrc. Due to the heuristics in Mac OS X's man, this will automatically make man pages work as well. Using Xcode here also makes it produce a signed build (which I do, since I am already paying for the $99/year license). > > -bob > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe -------------- next part -------------- An HTML attachment was scrubbed... URL: From carter.schonwald at gmail.com Sat May 24 07:03:36 2014 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Sat, 24 May 2014 03:03:36 -0400 Subject: [Haskell-cafe] Self-contained GHC for Mac In-Reply-To: <292A325B-D064-4583-917E-95000269B410@gmail.com> References: <292A325B-D064-4583-917E-95000269B410@gmail.com> Message-ID: i'd totally support making this prominently visible on haskell.org On Sat, May 24, 2014 at 2:58 AM, Kevin Nardi wrote: > +1 > > This is really awesome, and definitely would have made my life easier the > first time I installed GHC. > > -Kevin > > On May 23, 2014, at 11:56 PM, Adam Bergmark wrote: > > Nice, thanks for doing this! > > I'll make sure to try this next time i need to install GHC. > > - Adam > > > > > On Fri, May 23, 2014 at 8:42 PM, Bob Ippolito wrote: > >> After seeing some demand for packaged Haskell for Mac for the IHaskell >> project and by word of mouth at BayHac I decided to take a stab at it. Here >> you go: >> http://ghcformacosx.github.io/ (currently GHC 7.8.2 and cabal-install >> 1.20.0.1) >> >> Why? >> >> It can be a bit cumbersome to use the GHC builds from haskell.org on >> Mac, because they don't come "fully baked", you have to ./configure >> --prefix=/some/path to get them installed and the installation is not >> relocatable, if you move it the scripts will break and the package.conf.d >> files will go stale. It also doesn't ship with cabal-install, which is >> cumbersome as well, especially for new users. >> >> How does it work? >> >> In https://github.com/ghcformacosx/ghc-dot-app I have a Main.hs script >> which downloads/builds/etc. all of the prerequisites. Then it patches the >> shell scripts to use a path relative to themselves (after following >> symlinks) rather than hard-coding an installation location. It also patches >> the package.conf.d files to use ${pkgroot} relative paths. >> >> Separately, there's an Xcode project that includes all of the metadata to >> make it look like a real Mac app bundle (icons, Info.plist) and a small >> Cocoa application that has a button to open the docs and provides >> instructions for adding it to the PATH in .bashrc. Due to the heuristics in >> Mac OS X's man, this will automatically make man pages work as well. Using >> Xcode here also makes it produce a signed build (which I do, since I am >> already paying for the $99/year license). >> >> -bob >> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> >> > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From KAction at gnu.org Sat May 24 14:53:52 2014 From: KAction at gnu.org (Dmitry Bogatov) Date: Sat, 24 May 2014 18:53:52 +0400 Subject: [Haskell-cafe] Typeclasses -- if does not satisfy Message-ID: <20140524145352.GA2607@localhost.lan> Hello! I am working on package to generalize common `runSomeThing` and `runSomethingT` functions. It is very easy to generalize runStateT and runReaderT like class Runnable a where type RunResult a run :: a -> RunResult a instance Runnable (StateT s m a) where --- Why ScopedTypeVariables do not work here? type RunResult (StateT s m a) = s -> m (a, s) run = runStateT --- ReaderT absolutely the same But problem is that `State s a` is in fact `StateT s Identity a` and I get type family conflicts. In fact, it boils down to following: type family TestIdentity (m :: * -> *) type instance TestIdentity Identity = Int type instance TestIdentity m = () -- Anything but Identity. In general, with all this TypeClass magic, I have a lot of ways that something belong to some class, and no (aside OverlappingInstances) to tell that it does NOT belong. I belive, there is reason to, but I do not see it. Also, seems even TH does not helps here. PS. Please, keep me in To: -- Best regards, Dmitry Bogatov , Free Software supporter, esperantisto and netiquette guardian. git://kaction.name/rc-files.git GPG: 54B7F00D From vogt.adam at gmail.com Sat May 24 16:27:18 2014 From: vogt.adam at gmail.com (adam vogt) Date: Sat, 24 May 2014 12:27:18 -0400 Subject: [Haskell-cafe] Typeclasses -- if does not satisfy In-Reply-To: <20140524145352.GA2607@localhost.lan> References: <20140524145352.GA2607@localhost.lan> Message-ID: Hi Dmitry, It's pretty straightforward to use OverlappingInstances: class Runnable a b where run :: a -> b instance (r ~ (s -> (m (a,s)))) => Runnable (StateT s m a) r where run m = runStateT m instance (r ~ (s -> (a,s))) => Runnable (StateT s Identity a) r where run m = runState m Involving a type family doesn't simplify things, since you still need two class instances to choose between runStateT and runState. With TH you could avoid overlapping instances by looking at the names in (reify ''Monad) to replace the type variable `m' with a particular instance of Monad. In other words, with TH you can generate many many instances that look like: instance (r ~ (s -> (IO (a,s)))) => Runnable (StateT s IO a) r where run m = runStateT m instance (r ~ (s -> (ReaderT t (a,s)))) => Runnable (StateT s (ReaderT t) a) r where run m = runStateT m And then users that define their own instances of Monad would have run the same TH for Runnable to work. Is that the unpleasant scenario you mean by "even TH does not helps here"? Regards, Adam On Sat, May 24, 2014 at 10:53 AM, Dmitry Bogatov wrote: > Hello! I am working on package to generalize > common `runSomeThing` and `runSomethingT` functions. > > It is very easy to generalize runStateT and runReaderT > like > > class Runnable a where > type RunResult a > run :: a -> RunResult a > instance Runnable (StateT s m a) where > --- Why ScopedTypeVariables do not work here? > type RunResult (StateT s m a) = s -> m (a, s) > run = runStateT > --- ReaderT absolutely the same > > But problem is that `State s a` is in fact `StateT s Identity a` and > I get type family conflicts. > > In fact, it boils down to following: > > type family TestIdentity (m :: * -> *) > type instance TestIdentity Identity = Int > type instance TestIdentity m = () -- Anything but Identity. > > In general, with all this TypeClass magic, I have a lot of ways that > something belong to some class, and no (aside OverlappingInstances) > to tell that it does NOT belong. I belive, there is reason to, but I do > not see it. Also, seems even TH does not helps here. > > PS. Please, keep me in To: > > -- > Best regards, Dmitry Bogatov , > Free Software supporter, esperantisto and netiquette guardian. > git://kaction.name/rc-files.git > GPG: 54B7F00D > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From KAction at gnu.org Sat May 24 17:08:01 2014 From: KAction at gnu.org (Dmitry Bogatov) Date: Sat, 24 May 2014 21:08:01 +0400 Subject: [Haskell-cafe] Typeclasses -- if does not satisfy In-Reply-To: References: <20140524145352.GA2607@localhost.lan> Message-ID: <20140524170801.GA14945@localhost.lan> * adam vogt [2014-05-24 12:27:18-0400] > Hi Dmitry, > > It's pretty straightforward to use OverlappingInstances: > > class Runnable a b where > run :: a -> b > > instance (r ~ (s -> (m (a,s)))) => Runnable (StateT s m a) r where > run m = runStateT m > > instance (r ~ (s -> (a,s))) => Runnable (StateT s Identity a) r where > run m = runState m > > Involving a type family doesn't simplify things, since you still need > two class instances to choose between runStateT and runState. So simple and so good. Thank you. -- Best regards, Dmitry Bogatov , Free Software supporter, esperantisto and netiquette guardian. git://kaction.name/rc-files.git GPG: 54B7F00D From bertram.felgenhauer at googlemail.com Sat May 24 20:54:25 2014 From: bertram.felgenhauer at googlemail.com (Bertram Felgenhauer) Date: Sat, 24 May 2014 22:54:25 +0200 Subject: [Haskell-cafe] wanted: Function to break circular data dependencies In-Reply-To: References: Message-ID: <20140524205425.GI9238@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> Job Vranish wrote: > Is a function like the following possible?: > > avoidCircularDataDependency :: a -> a -> a > avoidCircularDataDependency a b = ? For one, it breaks purity. If we have let x = avoidCircularDataDependency y True y = avoidCircularDataDependency x False then whether x and y are True or False depends on which of them is evaluated first. Note that x and y might be evaluated in parallel by different threads. Secondly, an implementation of avoidCircularDataDependencies in a threaded runtime system requires cycle detection on the heap, because running into a black hole does not reliably indicate a data dependency cycle. GHC currently only does this when things have already gone wrong; cycles are detected during garbage collection and the threads involved receive NonTermination exceptions as a result. To make avoidCircularDataDependencies useful, you'd need a more efficient way of detecting cycles, which looks like a hard problem to me. > I've often found myself wanting a function like this. It would make certain > kinds of knot-tying/cycle detection _much_ easier. Actually I'd be interested in seeing an example for this. Cheers, Bertram From magnus at therning.org Sat May 24 23:41:29 2014 From: magnus at therning.org (Magnus Therning) Date: Sun, 25 May 2014 01:41:29 +0200 Subject: [Haskell-cafe] Cabal, tar and uploading to Hackage Message-ID: <20140524234129.GA26703@tatooine.lan> Lately my attempts at creating tar-balls for uploading to Hackage have been failing. I use the standard `./Setup.hs sdist` method to generate tar-balls, but apparently that uses `/usr/bin/tar` (GNU tar), which defaults to the 'gnu' format, while Hackage requires the 'ustar' format. Is there some way to pass arguments to `tar` when using `./Setup.hs sdist`? /M -- Magnus Therning OpenPGP: 0xAB4DFBA4 email: magnus at therning.org jabber: magnus at therning.org twitter: magthe http://therning.org/magnus Heuristic is an algorithm in a clown suit. It?s less predictable, it?s more fun, and it comes without a 30-day, money-back guarantee. -- Steve McConnell, Code Complete -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From maydwell at gmail.com Sat May 24 23:44:00 2014 From: maydwell at gmail.com (Lyndon Maydwell) Date: Sun, 25 May 2014 09:44:00 +1000 Subject: [Haskell-cafe] Self-contained GHC for Mac In-Reply-To: References: <292A325B-D064-4583-917E-95000269B410@gmail.com> Message-ID: That's really cool. Is there some way that a CI task could be set up to automatically publish new versions? On Sat, May 24, 2014 at 5:03 PM, Carter Schonwald wrote: > i'd totally support making this prominently visible on haskell.org > > > > On Sat, May 24, 2014 at 2:58 AM, Kevin Nardi wrote: >> >> +1 >> >> This is really awesome, and definitely would have made my life easier the >> first time I installed GHC. >> >> -Kevin >> >> On May 23, 2014, at 11:56 PM, Adam Bergmark wrote: >> >> Nice, thanks for doing this! >> >> I'll make sure to try this next time i need to install GHC. >> >> - Adam >> >> >> >> >> On Fri, May 23, 2014 at 8:42 PM, Bob Ippolito wrote: >>> >>> After seeing some demand for packaged Haskell for Mac for the IHaskell >>> project and by word of mouth at BayHac I decided to take a stab at it. Here >>> you go: >>> http://ghcformacosx.github.io/ (currently GHC 7.8.2 and cabal-install >>> 1.20.0.1) >>> >>> Why? >>> >>> It can be a bit cumbersome to use the GHC builds from haskell.org on Mac, >>> because they don't come "fully baked", you have to ./configure >>> --prefix=/some/path to get them installed and the installation is not >>> relocatable, if you move it the scripts will break and the package.conf.d >>> files will go stale. It also doesn't ship with cabal-install, which is >>> cumbersome as well, especially for new users. >>> >>> How does it work? >>> >>> In https://github.com/ghcformacosx/ghc-dot-app I have a Main.hs script >>> which downloads/builds/etc. all of the prerequisites. Then it patches the >>> shell scripts to use a path relative to themselves (after following >>> symlinks) rather than hard-coding an installation location. It also patches >>> the package.conf.d files to use ${pkgroot} relative paths. >>> >>> Separately, there's an Xcode project that includes all of the metadata to >>> make it look like a real Mac app bundle (icons, Info.plist) and a small >>> Cocoa application that has a button to open the docs and provides >>> instructions for adding it to the PATH in .bashrc. Due to the heuristics in >>> Mac OS X's man, this will automatically make man pages work as well. Using >>> Xcode here also makes it produce a signed build (which I do, since I am >>> already paying for the $99/year license). >>> >>> -bob >>> >>> >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://www.haskell.org/mailman/listinfo/haskell-cafe >>> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> >> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > From bob at redivi.com Sun May 25 00:00:54 2014 From: bob at redivi.com (Bob Ippolito) Date: Sat, 24 May 2014 17:00:54 -0700 Subject: [Haskell-cafe] Self-contained GHC for Mac In-Reply-To: References: <292A325B-D064-4583-917E-95000269B410@gmail.com> Message-ID: That's certainly technically possible On Saturday, May 24, 2014, Lyndon Maydwell wrote: > That's really cool. Is there some way that a CI task could be set up > to automatically publish new versions? > > On Sat, May 24, 2014 at 5:03 PM, Carter Schonwald > wrote: > > i'd totally support making this prominently visible on haskell.org > > > > > > > > On Sat, May 24, 2014 at 2:58 AM, Kevin Nardi wrote: > >> > >> +1 > >> > >> This is really awesome, and definitely would have made my life easier > the > >> first time I installed GHC. > >> > >> -Kevin > >> > >> On May 23, 2014, at 11:56 PM, Adam Bergmark wrote: > >> > >> Nice, thanks for doing this! > >> > >> I'll make sure to try this next time i need to install GHC. > >> > >> - Adam > >> > >> > >> > >> > >> On Fri, May 23, 2014 at 8:42 PM, Bob Ippolito wrote: > >>> > >>> After seeing some demand for packaged Haskell for Mac for the IHaskell > >>> project and by word of mouth at BayHac I decided to take a stab at it. > Here > >>> you go: > >>> http://ghcformacosx.github.io/ (currently GHC 7.8.2 and cabal-install > >>> 1.20.0.1) > >>> > >>> Why? > >>> > >>> It can be a bit cumbersome to use the GHC builds from haskell.org on > Mac, > >>> because they don't come "fully baked", you have to ./configure > >>> --prefix=/some/path to get them installed and the installation is not > >>> relocatable, if you move it the scripts will break and the > package.conf.d > >>> files will go stale. It also doesn't ship with cabal-install, which is > >>> cumbersome as well, especially for new users. > >>> > >>> How does it work? > >>> > >>> In https://github.com/ghcformacosx/ghc-dot-app I have a Main.hs script > >>> which downloads/builds/etc. all of the prerequisites. Then it patches > the > >>> shell scripts to use a path relative to themselves (after following > >>> symlinks) rather than hard-coding an installation location. It also > patches > >>> the package.conf.d files to use ${pkgroot} relative paths. > >>> > >>> Separately, there's an Xcode project that includes all of the metadata > to > >>> make it look like a real Mac app bundle (icons, Info.plist) and a small > >>> Cocoa application that has a button to open the docs and provides > >>> instructions for adding it to the PATH in .bashrc. Due to the > heuristics in > >>> Mac OS X's man, this will automatically make man pages work as well. > Using > >>> Xcode here also makes it produce a signed build (which I do, since I am > >>> already paying for the $99/year license). > >>> > >>> -bob > >>> > >>> > >>> _______________________________________________ > >>> Haskell-Cafe mailing list > >>> Haskell-Cafe at haskell.org > >>> http://www.haskell.org/mailman/listinfo/haskell-cafe > >>> > >> > >> _______________________________________________ > >> Haskell-Cafe mailing list > >> Haskell-Cafe at haskell.org > >> http://www.haskell.org/mailman/listinfo/haskell-cafe > >> > >> > >> > >> _______________________________________________ > >> Haskell-Cafe mailing list > >> Haskell-Cafe at haskell.org > >> http://www.haskell.org/mailman/listinfo/haskell-cafe > >> > > > > > > _______________________________________________ > > Haskell-Cafe mailing list > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From me at thoradam.com Sun May 25 12:27:32 2014 From: me at thoradam.com (Thor Adam) Date: Sun, 25 May 2014 12:27:32 +0000 Subject: [Haskell-cafe] Cabal, tar and uploading to Hackage In-Reply-To: <20140524234129.GA26703@tatooine.lan> References: <20140524234129.GA26703@tatooine.lan> Message-ID: You could try setting the TAR_OPTIONS environment variable before running Setup: TAR_OPTIONS="--format=ustar" runhaskell Setup.hs sdist On Sat, May 24, 2014 at 11:41 PM, Magnus Therning wrote: > Lately my attempts at creating tar-balls for uploading to Hackage have > been failing. I use the standard `./Setup.hs sdist` method to > generate tar-balls, but apparently that uses `/usr/bin/tar` (GNU tar), > which defaults to the 'gnu' format, while Hackage requires the > 'ustar' format. > > Is there some way to pass arguments to `tar` when using `./Setup.hs > sdist`? > > /M > > -- > Magnus Therning OpenPGP: 0xAB4DFBA4 > email: magnus at therning.org jabber: magnus at therning.org > twitter: magthe http://therning.org/magnus > > Heuristic is an algorithm in a clown suit. It?s less predictable, it?s more > fun, and it comes without a 30-day, money-back guarantee. > -- Steve McConnell, Code Complete > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > On Sat, May 24, 2014 at 11:41 PM, Magnus Therning wrote: > Lately my attempts at creating tar-balls for uploading to Hackage have > been failing. I use the standard `./Setup.hs sdist` method to > generate tar-balls, but apparently that uses `/usr/bin/tar` (GNU tar), > which defaults to the 'gnu' format, while Hackage requires the > 'ustar' format. > > Is there some way to pass arguments to `tar` when using `./Setup.hs > sdist`? > > /M > > -- > Magnus Therning OpenPGP: 0xAB4DFBA4 > email: magnus at therning.org jabber: magnus at therning.org > twitter: magthe http://therning.org/magnus > > Heuristic is an algorithm in a clown suit. It?s less predictable, it?s more > fun, and it comes without a 30-day, money-back guarantee. > -- Steve McConnell, Code Complete > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From christian at ponies.io Mon May 26 03:14:29 2014 From: christian at ponies.io (Christian Marie) Date: Mon, 26 May 2014 13:14:29 +1000 Subject: [Haskell-cafe] Job opening: Anchor Hosting, Sydney - Linux Haskell Developers Message-ID: <20140526031429.GA17712@cucumber.bridge.anchor.net.au> Anchor hosting is hiring Haskell developers! ============================================ Anchor hosting has job opportunities for two entry-to mid-level developers. We will be building an open source cloud hosting platform built upon Ceph and OpenStack in Haskell. This will involve experience across diverse fields, such as: Linux systems development, distributed systems, metric storage, data analysis, monitoring, tool development, REST API design and development, to name a few. We have two positions available; if you can't make your mind up, feel free to ask about them. Linux Systems Developer / Wizard ================================ You will work alongside sysadmins and developers on the Systems Team. This developer will be cutting a lot of Linux systems automation code, and will probably build a distributed system by the time you're done. A proven track record with Haskell and Linux is a must. Knowledge of type theory and language design would be a bonus. A working knowledge of C and basic algorithms is expected. You'll get to work on a Cloud hosting framework with interesting technologies, doing some cool things that nobody has done before. Data engineer ============= Part of our Analytics team, this role is fundamentally about helping our engineers make evidence-based decisions. You would be writing code to take numbers (such as the CPU usage of a set of machines) and convert them into more useful numbers (such as the probability of those servers catching fire in the next week, or the usage we should be billing the customer for). In addition to a working knowledge of Haskell and UNIX programming, experience working with large datasets, computational stats or machine learning would be a big plus. Applicants ========== Please send a resume along with a link to your Github account to pingu at anchor.com.au. Perks ===== Why Anchor should be your home away from home: * Our kick-ass office is on Hyde park, with Town Hall station just minutes away. * Well-stocked drinks fridge. * Catered lunch every Friday. * Pizza and board games every Tuesday night. * Transparent, no-nonsense and trusting environment ? if we hire you we know you?ll do the right thing. * Company account with a great coffee shop across the road means your daily caffeination is free of charge! -- Christian Marie - Sparkly Code Princess -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: not available URL: From bulat.ziganshin at gmail.com Mon May 26 09:01:13 2014 From: bulat.ziganshin at gmail.com (Bulat Ziganshin) Date: Mon, 26 May 2014 13:01:13 +0400 Subject: [Haskell-cafe] Chan with priorities Message-ID: <1016646931.20140526130113@gmail.com> Hello Haskell-cafe, can you please point me to any OSS implementation of IO Channels with priorities - i.e. data pushed to the Chan using high priority should be read prior to the data pushed with lower priority: pushChan ch 1 'x' pushChan ch 2 'y' readChan ch >>= print -- prints 'y' i've found only STM implementations - i don't know STM enough, may be i just need to convert STM to IO operations? i don't expect strong guarantees, my algorithm will remain correct anyway. and i don't have lot of objects, it's just a few dozens -- Best regards, Bulat mailto:Bulat.Ziganshin at gmail.com From 0slemi0 at gmail.com Mon May 26 09:10:27 2014 From: 0slemi0 at gmail.com (Andras Slemmer) Date: Mon, 26 May 2014 11:10:27 +0200 Subject: [Haskell-cafe] Chan with priorities In-Reply-To: <1016646931.20140526130113@gmail.com> References: <1016646931.20140526130113@gmail.com> Message-ID: STM is very simple to use, you create transactions in the STM monad (actions that should be executed as an atomic unit) then execute them with atomically :: STM a -> IO a. Under the hood the STM monad creates a dependency graph of the used STM primitives (TVars) in order to know when to undo/redo transactions. But from what I understand you'll pretty much only need to use (atomically . readTChan c)/(atomically . writeTChan c) which are in the IO monad On 26 May 2014 11:01, Bulat Ziganshin wrote: > Hello Haskell-cafe, > > can you please point me to any OSS implementation of IO Channels with > priorities - i.e. data pushed to the Chan using high priority should > be read prior to the data pushed with lower priority: > > pushChan ch 1 'x' > pushChan ch 2 'y' > readChan ch >>= print -- prints 'y' > > i've found only STM implementations - i don't know STM enough, may be > i just need to convert STM to IO operations? > > i don't expect strong guarantees, my algorithm will remain correct > anyway. and i don't have lot of objects, it's just a few dozens > > > > -- > Best regards, > Bulat mailto:Bulat.Ziganshin at gmail.com > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bulat.ziganshin at gmail.com Mon May 26 09:51:30 2014 From: bulat.ziganshin at gmail.com (Bulat Ziganshin) Date: Mon, 26 May 2014 13:51:30 +0400 Subject: [Haskell-cafe] Chan with priorities In-Reply-To: References: <1016646931.20140526130113@gmail.com> Message-ID: <6309377.20140526135130@gmail.com> An HTML attachment was scrubbed... URL: From hutch-lists at recursive.ca Mon May 26 12:23:22 2014 From: hutch-lists at recursive.ca (Bob Hutchison) Date: Mon, 26 May 2014 08:23:22 -0400 Subject: [Haskell-cafe] Self-contained GHC for Mac In-Reply-To: References: Message-ID: <6DA71A20-108B-4A54-8592-0DA3E1F635C5@recursive.ca> On May 23, 2014, at 2:42 PM, Bob Ippolito wrote: > After seeing some demand for packaged Haskell for Mac for the IHaskell project and by word of mouth at BayHac I decided to take a stab at it. Here you go: > http://ghcformacosx.github.io/ (currently GHC 7.8.2 and cabal-install 1.20.0.1) > Thank you! Wonderful! I think this is the way to go for anyone setting up Haskell for the first time on a Mac. I agree that this should be a very prominently displayed installation option on haskell.org So, Bob, have you thought about how you?ll avoid having to maintain this forever? Cheers, Bob -------------- next part -------------- An HTML attachment was scrubbed... URL: From cobbe at ccs.neu.edu Mon May 26 13:08:12 2014 From: cobbe at ccs.neu.edu (Richard Cobbe) Date: Mon, 26 May 2014 09:08:12 -0400 Subject: [Haskell-cafe] Self-contained GHC for Mac In-Reply-To: <6DA71A20-108B-4A54-8592-0DA3E1F635C5@recursive.ca> References: <6DA71A20-108B-4A54-8592-0DA3E1F635C5@recursive.ca> Message-ID: <20140526130812.GB291@ridcully.home> On Mon, May 26, 2014 at 08:23:22AM -0400, Bob Hutchison wrote: > > On May 23, 2014, at 2:42 PM, Bob Ippolito wrote: > > > After seeing some demand for packaged Haskell for Mac for the IHaskell project and by word of mouth at BayHac I decided to take a stab at it. Here you go: > > http://ghcformacosx.github.io/ (currently GHC 7.8.2 and cabal-install 1.20.0.1) > > > > Thank you! Wonderful! > > I think this is the way to go for anyone setting up Haskell for the first time on a Mac. I agree that this should be a very prominently displayed installation option on haskell.org Asking purely out of curiosity: what's the advantage to doing this over using the Haskell Platform installer? (Other than the fact that the latter hasn't seen a release in a year, I mean.) Richard From gale at sefer.org Mon May 26 13:51:39 2014 From: gale at sefer.org (Yitzchak Gale) Date: Mon, 26 May 2014 16:51:39 +0300 Subject: [Haskell-cafe] Chan with priorities In-Reply-To: <1016646931.20140526130113@gmail.com> References: <1016646931.20140526130113@gmail.com> Message-ID: Bulat! It's great to see you here. We haven't seen you in quite a while. Regards, Yitz On Mon, May 26, 2014 at 12:01 PM, Bulat Ziganshin wrote: > Hello Haskell-cafe, > > can you please point me to any OSS implementation of IO Channels with > priorities - i.e. data pushed to the Chan using high priority should > be read prior to the data pushed with lower priority: > > pushChan ch 1 'x' > pushChan ch 2 'y' > readChan ch >>= print -- prints 'y' > > i've found only STM implementations - i don't know STM enough, may be > i just need to convert STM to IO operations? > > i don't expect strong guarantees, my algorithm will remain correct > anyway. and i don't have lot of objects, it's just a few dozens > > > > -- > Best regards, > Bulat mailto:Bulat.Ziganshin at gmail.com > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From felipe.lessa at gmail.com Mon May 26 14:38:50 2014 From: felipe.lessa at gmail.com (Felipe Lessa) Date: Mon, 26 May 2014 11:38:50 -0300 Subject: [Haskell-cafe] Chan with priorities In-Reply-To: References: <1016646931.20140526130113@gmail.com> Message-ID: <538351FA.8090707@gmail.com> Em 26-05-2014 10:51, Yitzchak Gale escreveu: > Bulat! > It's great to see you here. > We haven't seen you in quite a while. Same thought I had, but I dismissed it thinking that I must have just missed his e-mails :). Cheers, -- Felipe. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 901 bytes Desc: OpenPGP digital signature URL: From hutch-lists at recursive.ca Mon May 26 15:12:31 2014 From: hutch-lists at recursive.ca (Bob Hutchison) Date: Mon, 26 May 2014 11:12:31 -0400 Subject: [Haskell-cafe] Self-contained GHC for Mac In-Reply-To: <20140526130812.GB291@ridcully.home> References: <6DA71A20-108B-4A54-8592-0DA3E1F635C5@recursive.ca> <20140526130812.GB291@ridcully.home> Message-ID: On May 26, 2014, at 9:08 AM, Richard Cobbe wrote: > On Mon, May 26, 2014 at 08:23:22AM -0400, Bob Hutchison wrote: >> >> On May 23, 2014, at 2:42 PM, Bob Ippolito wrote: >> >>> After seeing some demand for packaged Haskell for Mac for the IHaskell project and by word of mouth at BayHac I decided to take a stab at it. Here you go: >>> http://ghcformacosx.github.io/ (currently GHC 7.8.2 and cabal-install 1.20.0.1) >>> >> >> Thank you! Wonderful! >> >> I think this is the way to go for anyone setting up Haskell for the first time on a Mac. I agree that this should be a very prominently displayed installation option on haskell.org > > Asking purely out of curiosity: what's the advantage to doing this over > using the Haskell Platform installer? (Other than the fact that the latter > hasn't seen a release in a year, I mean.) That?s a pretty good reason :-) Have a look at this thread ?Minimal Haskell Platform? https://groups.google.com/forum/#!topic/haskell-cafe/-MrmFsyq-FM for a lot of discussion. There have been other threads in various mailing lists touching on this recently. Cheers, Bob > > Richard > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From mail at nh2.me Mon May 26 15:21:21 2014 From: mail at nh2.me (=?ISO-8859-1?Q?Niklas_Hamb=FCchen?=) Date: Mon, 26 May 2014 16:21:21 +0100 Subject: [Haskell-cafe] How to write fast for loops In-Reply-To: References: <535C27E2.6010808@nh2.me> <535C5A56.7060704@nh2.me> <535D6418.5040304@nh2.me> <535D86A0.3010200@nh2.me> <535D9771.4060201@nh2.me> <535DBBBA.7010703@nh2.me> Message-ID: <53835BF1.7050509@nh2.me> There has just been a fix for vector that improves on the bad performance of Word32 as compared to Int (https://github.com/haskell/vector/issues/21#issuecomment-44154305). The new benchmarks (https://rawgit.com/nh2/loop/master/results/bench-vector-bbd726d.html) now show Vector+Word32 on par, but functions in base, especially forM_, are still horrendously slow on Word32. On 28/04/14 05:24, John Lato wrote: > Ahh, you made me look at the core again. I think this is related to > your observation about V.enumFromTo being the same as V.fromList. With > Word32 the generated core shows that this goes via a list representation > instead of a nice loop. Which makes me suspect there's some RULE that > applies to Stream.enumFromTo that is firing in the first case but not > the second. And if I build both versions with -ddump-rule-firings, > indeed I see that the Int version has > > Rule fired: enumFromTo [Stream] > > With nothing comparable for the Word32 version. I'd imagine if you grep > for that in the Vector sources, you'd find something interesting. > > The EnumFromN version does not seem to suffer from this (but again it's > necessary to evaluate the argument). From bob at redivi.com Mon May 26 15:36:47 2014 From: bob at redivi.com (Bob Ippolito) Date: Mon, 26 May 2014 08:36:47 -0700 Subject: [Haskell-cafe] Self-contained GHC for Mac In-Reply-To: References: <6DA71A20-108B-4A54-8592-0DA3E1F635C5@recursive.ca> <20140526130812.GB291@ridcully.home> Message-ID: On Monday, May 26, 2014, Bob Hutchison wrote: > > On May 26, 2014, at 9:08 AM, Richard Cobbe > > wrote: > > > On Mon, May 26, 2014 at 08:23:22AM -0400, Bob Hutchison wrote: > >> > >> On May 23, 2014, at 2:42 PM, Bob Ippolito > > wrote: > >> > >>> After seeing some demand for packaged Haskell for Mac for the IHaskell > project and by word of mouth at BayHac I decided to take a stab at it. Here > you go: > >>> http://ghcformacosx.github.io/ (currently GHC 7.8.2 and cabal-install > 1.20.0.1) > >>> > >> > >> Thank you! Wonderful! > >> > >> I think this is the way to go for anyone setting up Haskell for the > first time on a Mac. I agree that this should be a very prominently > displayed installation option on haskell.org > > > > Asking purely out of curiosity: what's the advantage to doing this over > > using the Haskell Platform installer? (Other than the fact that the > latter > > hasn't seen a release in a year, I mean.) > > That?s a pretty good reason :-) > > Have a look at this thread ?Minimal Haskell Platform? > https://groups.google.com/forum/#!topic/haskell-cafe/-MrmFsyq-FM for a > lot of discussion. There have been other threads in various mailing lists > touching on this recently. > In addition to that, you can only have one Haskell Platform install and you need admin to install it. With this, you don't need admin and can have as many "installs" as you want (although it won't save you from .ghc or .cabal hell). -------------- next part -------------- An HTML attachment was scrubbed... URL: From hesselink at gmail.com Mon May 26 15:38:46 2014 From: hesselink at gmail.com (Erik Hesselink) Date: Mon, 26 May 2014 17:38:46 +0200 Subject: [Haskell-cafe] Self-contained GHC for Mac In-Reply-To: References: <6DA71A20-108B-4A54-8592-0DA3E1F635C5@recursive.ca> <20140526130812.GB291@ridcully.home> Message-ID: On Mon, May 26, 2014 at 5:36 PM, Bob Ippolito wrote: > > On Monday, May 26, 2014, Bob Hutchison wrote: >> >> On May 26, 2014, at 9:08 AM, Richard Cobbe wrote: >> >> > On Mon, May 26, 2014 at 08:23:22AM -0400, Bob Hutchison wrote: >> >> >> >> On May 23, 2014, at 2:42 PM, Bob Ippolito wrote: >> >> >> >>> After seeing some demand for packaged Haskell for Mac for the IHaskell >> >>> project and by word of mouth at BayHac I decided to take a stab at it. Here >> >>> you go: >> >>> http://ghcformacosx.github.io/ (currently GHC 7.8.2 and cabal-install >> >>> 1.20.0.1) >> >>> >> >> >> >> Thank you! Wonderful! >> >> >> >> I think this is the way to go for anyone setting up Haskell for the >> >> first time on a Mac. I agree that this should be a very prominently >> >> displayed installation option on haskell.org >> > >> > Asking purely out of curiosity: what's the advantage to doing this over >> > using the Haskell Platform installer? (Other than the fact that the >> > latter >> > hasn't seen a release in a year, I mean.) >> >> That?s a pretty good reason :-) >> >> Have a look at this thread ?Minimal Haskell Platform? >> https://groups.google.com/forum/#!topic/haskell-cafe/-MrmFsyq-FM for a lot >> of discussion. There have been other threads in various mailing lists >> touching on this recently. > > > In addition to that, you can only have one Haskell Platform install and you > need admin to install it. With this, you don't need admin and can have as > many "installs" as you want (although it won't save you from .ghc or .cabal > hell). I have three platforms installed. As long as they have different GHC versions, there's no problem, I think. Should I be aware of something? Erik From bob at redivi.com Mon May 26 15:39:13 2014 From: bob at redivi.com (Bob Ippolito) Date: Mon, 26 May 2014 08:39:13 -0700 Subject: [Haskell-cafe] Self-contained GHC for Mac In-Reply-To: <6DA71A20-108B-4A54-8592-0DA3E1F635C5@recursive.ca> References: <6DA71A20-108B-4A54-8592-0DA3E1F635C5@recursive.ca> Message-ID: On Monday, May 26, 2014, Bob Hutchison wrote: > > On May 23, 2014, at 2:42 PM, Bob Ippolito > > wrote: > > After seeing some demand for packaged Haskell for Mac for the IHaskell > project and by word of mouth at BayHac I decided to take a stab at it. Here > you go: > http://ghcformacosx.github.io/ (currently GHC 7.8.2 and cabal-install > 1.20.0.1) > > > Thank you! Wonderful! > > I think this is the way to go for anyone setting up Haskell for the first > time on a Mac. I agree that this should be a very prominently displayed > installation option on haskell.org > Might be worth waiting a little while to shake out any issues, but I'm ok with that. > So, Bob, have you thought about how you?ll avoid having to maintain this > forever? > I wrote up instructions for how to build it. Could be done by a CI builder, although it needs someone's signing key to build one suitable for distro. Happy to take it on myself for now as I'm already paying for the Mac developer subscription so might as well use it. -bob -------------- next part -------------- An HTML attachment was scrubbed... URL: From gale at sefer.org Mon May 26 15:52:30 2014 From: gale at sefer.org (Yitzchak Gale) Date: Mon, 26 May 2014 18:52:30 +0300 Subject: [Haskell-cafe] Cabal, tar and uploading to Hackage In-Reply-To: <20140524234129.GA26703@tatooine.lan> References: <20140524234129.GA26703@tatooine.lan> Message-ID: Magnus Therning wrote: > Lately my attempts at creating tar-balls for uploading to Hackage have > been failing. I use the standard `./Setup.hs sdist` method to > generate tar-balls, but apparently that uses `/usr/bin/tar` (GNU tar), > which defaults to the 'gnu' format, while Hackage requires the > 'ustar' format. Is there some special reason why you use Setup.hs for this? I'm not sure why you say that is the "standard". From what I understand, the standard way has been cabal dist for quite some time. Are you using a custom Setup.hs (which often results in problems and should be avoided unless absolutely necessary), and have you checked that cabal dist doesn't do the right thing? Regards, Yitz From sean at functionaljobs.com Mon May 26 16:00:01 2014 From: sean at functionaljobs.com (Functional Jobs) Date: Mon, 26 May 2014 12:00:01 -0400 Subject: [Haskell-cafe] New Functional Programming Job Opportunities Message-ID: <5383650489960@functionaljobs.com> Here are some functional programming job opportunities that were posted recently: Haskell Developer at skedge.me http://functionaljobs.com/jobs/8712-haskell-developer-at-skedgeme Cheers, Sean Murphy FunctionalJobs.com From gale at sefer.org Mon May 26 16:03:08 2014 From: gale at sefer.org (Yitzchak Gale) Date: Mon, 26 May 2014 19:03:08 +0300 Subject: [Haskell-cafe] How to write fast for loops In-Reply-To: References: <535C27E2.6010808@nh2.me> <535C5A56.7060704@nh2.me> <535D6418.5040304@nh2.me> <535D86A0.3010200@nh2.me> <535D9771.4060201@nh2.me> <535DBBBA.7010703@nh2.me> Message-ID: John Lato wrote: > For Int, toEnum/fromEnum is a noop, but on Word32 it's not. Actually, GHC has type-specialized rewrite rules for toEnum/fromEnum on types from Data.Word. So it's a noop on a 32-bit platform and nearly a noop on 64-bit. Regards, Yitz From sean.leather at gmail.com Mon May 26 16:05:57 2014 From: sean.leather at gmail.com (Sean Leather) Date: Mon, 26 May 2014 18:05:57 +0200 Subject: [Haskell-cafe] Self-contained GHC for Mac In-Reply-To: References: <6DA71A20-108B-4A54-8592-0DA3E1F635C5@recursive.ca> <20140526130812.GB291@ridcully.home> Message-ID: On Mon, May 26, 2014 at 5:38 PM, Erik Hesselink wrote: > On Mon, May 26, 2014 at 5:36 PM, Bob Ippolito wrote: > > In addition to that, you can only have one Haskell Platform install and > you > > need admin to install it. With this, you don't need admin and can have as > > many "installs" as you want (although it won't save you from .ghc or > .cabal > > hell). > > I have three platforms installed. As long as they have different GHC > versions, there's no problem, I think. Should I be aware of something? > And I wrote a script to make it easy to switch between GHC versions: https://github.com/spl/ghc-ver I haven't used it in a long time, but I expect it should still work. Regards, Sean -------------- next part -------------- An HTML attachment was scrubbed... URL: From gale at sefer.org Mon May 26 16:32:38 2014 From: gale at sefer.org (Yitzchak Gale) Date: Mon, 26 May 2014 19:32:38 +0300 Subject: [Haskell-cafe] Self-contained GHC for Mac In-Reply-To: References: <6DA71A20-108B-4A54-8592-0DA3E1F635C5@recursive.ca> <20140526130812.GB291@ridcully.home> Message-ID: Richard Cobbe wrote: >>>> Asking purely out of curiosity: what's the advantage to doing this over >>>> using the Haskell Platform installer? (Other than the fact that the latter >>>> hasn't seen a release in a year, I mean.) Bob Hutchison wrote: >>> That?s a pretty good reason :-) There has indeed been an usual delay in the current HP release. Despite Mark Lentzner's hard work it has gone way past due. Not a small part of the reason for that delay was the Mac platform, with all of the problems introduced by Xcode 5. It looks like the next HP is finally nearing release though. It will be based on GHC 7.8.2. Bob Ippolito wrote: >> In addition to that, you can only have one Haskell Platform install Erik Hesselink wrote: > I have three platforms installed. As long as they have different GHC > versions, there's no problem, I think. And no two HP's have every had the same GHC version. So that should never be an issue. That said, I think I might prefer having just one HP and then this new method for other versions of GHC. What I like most about this is that since it doesn't need to be bundled with the HP libraries, this installer will be much easier to update promptly when new versions of GHC are released. So I can get the best of both worlds - the standard set of HP packages and versions, plus other versions of GHC that aren't part of an HP release. Regards, Yitz From magnus at therning.org Mon May 26 17:25:42 2014 From: magnus at therning.org (Magnus Therning) Date: Mon, 26 May 2014 19:25:42 +0200 Subject: [Haskell-cafe] Cabal, tar and uploading to Hackage In-Reply-To: References: <20140524234129.GA26703@tatooine.lan> Message-ID: <20140526172542.GA4191@tatooine.lan> On Mon, May 26, 2014 at 06:52:30PM +0300, Yitzchak Gale wrote: > Magnus Therning wrote: >> Lately my attempts at creating tar-balls for uploading to Hackage >> have been failing. I use the standard `./Setup.hs sdist` method to >> generate tar-balls, but apparently that uses `/usr/bin/tar` (GNU >> tar), which defaults to the 'gnu' format, while Hackage requires >> the 'ustar' format. > > Is there some special reason why you use Setup.hs for this? Because using tar directly is a bit too much work. > I'm not sure why you say that is the "standard". From what I > understand, the standard way has been cabal dist for quite some > time. Maybe it's not 'the' standard any longer, but it surely is 'a' standard, since it's what tools like `cabal` has to fall back on when a package has a non-trivial Setup.hs. > Are you using a custom Setup.hs (which often results in problems and > should be avoided unless absolutely necessary), and have you checked > that cabal dist doesn't do the right thing? No, I'm not using a non-standard Setup.hs, but I have so far not had any use for `cabal` since I'm on a platform with a real package manager. /M -- Magnus Therning OpenPGP: 0xAB4DFBA4 email: magnus at therning.org jabber: magnus at therning.org twitter: magthe http://therning.org/magnus I invented the term Object-Oriented, and I can tell you I did not have C++ in mind. -- Alan Kay -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From duncan.coutts at googlemail.com Mon May 26 17:36:23 2014 From: duncan.coutts at googlemail.com (Duncan Coutts) Date: Mon, 26 May 2014 18:36:23 +0100 Subject: [Haskell-cafe] Cabal, tar and uploading to Hackage In-Reply-To: <20140526172542.GA4191@tatooine.lan> References: <20140524234129.GA26703@tatooine.lan> <20140526172542.GA4191@tatooine.lan> Message-ID: On 26 May 2014 18:25, Magnus Therning wrote: > On Mon, May 26, 2014 at 06:52:30PM +0300, Yitzchak Gale wrote: >> Magnus Therning wrote: >>> Lately my attempts at creating tar-balls for uploading to Hackage >>> have been failing. I use the standard `./Setup.hs sdist` method to >>> generate tar-balls, but apparently that uses `/usr/bin/tar` (GNU >>> tar), which defaults to the 'gnu' format, while Hackage requires >>> the 'ustar' format. File a Cabal bug report. The Setup.hs really ought to call gnu tar in such a way that it always produces ustar format. Duncan From travis.cardwell at extellisys.com Mon May 26 22:55:45 2014 From: travis.cardwell at extellisys.com (Travis Cardwell) Date: Tue, 27 May 2014 07:55:45 +0900 Subject: [Haskell-cafe] Self-contained GHC for Mac In-Reply-To: References: <6DA71A20-108B-4A54-8592-0DA3E1F635C5@recursive.ca> <20140526130812.GB291@ridcully.home> Message-ID: <5383C671.3080702@extellisys.com> On 2014?05?27? 00:36, Bob Ippolito wrote: > In addition to that, you can only have one Haskell Platform install and you > need admin to install it. With this, you don't need admin and can have as > many "installs" as you want (although it won't save you from .ghc or .cabal > hell). I wrote an article explaining how I install multiple versions and avoid ~/.cabal hell (on Debian Wheezy): http://www.extellisys.com/articles/haskell-on-debian-wheezy TLDR: Do not install *anything* into ~/.cabal; essentially just use it to store the package list and archives, installing the most recent version of cabal-install into --global and everything else into sandboxes. Cheers, Travis From jv at informatik.uni-bonn.de Tue May 27 05:14:22 2014 From: jv at informatik.uni-bonn.de (Janis Voigtlaender) Date: Tue, 27 May 2014 07:14:22 +0200 Subject: [Haskell-cafe] Second Workshop on Haskell And Rewriting Techniques (HART 2014, co-located with ICFP 2014) Message-ID: <53841F2E.20508@informatik.uni-bonn.de> CALL FOR PAPERS Second Workshop on Haskell And Rewriting Techniques (HART 2014) http://www.program-transformation.org/HART14/ To be held on September 5, co-located with ICFP, the Haskell Symposium, etc., in Gothenburg. Haskell is an advanced purely-functional programming language. Pure functional programming is programming with equations, often defined by pattern-matching. Rewriting is the science of replacing equals by equals and thus a very powerful method for dealing with equations, often constructor-based. There are strong connections between Haskell (or generally, pure functional) programming and rewriting. The purpose of the HART workshop is to foster those connections. In addition to an invited talk by Oleg Kiselyov, we plan a half day of discussions, in an informal setting, on how Haskell (and related languages) and rewriting techniques and theories can cross-fertilize each other. Topics of interest are, for example: ==================================== - equational reasoning and other rewriting techniques for program verification and analysis; - lambda calculi and type systems for functional programs and higher-order rewrite systems; - rewriting of type expressions in the type checker; - rewriting of programs by refactoring tools, optimizers, code generators; - execution of programs as a form of graph rewriting (terms with sharing); - Template Haskell, generally introducing a rewriting-like macro language into the compilation process. This list of topics is non-exclusive. If you have a contribution that connects Haskell and rewriting, then submit. Also, the workshop is deliberately open for discussion of rewriting-related aspects of languages like Agda, Clean, ... When in doubt, please contact a member of the PC (see below). Dates: ====== July 2: deadline for submissions July 21: notification of acceptance September 5: workshop Submission and proceedings: =========================== We solicit two types of submissions: - Extended abstracts. Presenting original research, and also preliminary reports of work in progress. Will be included in the proceedings. - Presentation-only papers. Describing work recently published or submitted. Only abstract will be included in the proceedings. Papers should be at most 5 pages in length, and should use the easychair.cls style. Submission is electronically at https://www.easychair.org/conferences/?conf=hart2014 In line with the informal style of the workshop, the reviewing of submissions will be light. Proceedings will be made available electronically. Program committee: ================== Bertram Felgenhauer Carsten Fuhs Andy Gill Makoto Hamana Bastiaan Heeren Femke van Raamsdonk Tiark Rompf Kristoffer Rose (co-chair) Christian Sternagel Janis Voigtl?nder (co-chair) Johannes Waldmann From gale at sefer.org Tue May 27 10:03:30 2014 From: gale at sefer.org (Yitzchak Gale) Date: Tue, 27 May 2014 13:03:30 +0300 Subject: [Haskell-cafe] Self-contained GHC for Mac In-Reply-To: <5383C671.3080702@extellisys.com> References: <6DA71A20-108B-4A54-8592-0DA3E1F635C5@recursive.ca> <20140526130812.GB291@ridcully.home> <5383C671.3080702@extellisys.com> Message-ID: Travis Cardwell wrote: > I wrote an article explaining how I install multiple versions and avoid > ~/.cabal hell (on Debian Wheezy): Thanks for this detailed write up! I have two comments: 1. When you switch to a different version of GHC using the PATH, you also need to take into account the cabal command. Normally you will want to be using the most recent cabal command, but your procedure will switch you over to whatever version of the cabal command was shipped with that version of GHC, because that GHC bin directory now comes first in the PATH. 2. You don't need to have cabal-install installed globally. All you need is the executable. To fix these, add the following to your procedure: 1. Create the directory /usr/local/opt/cabal/bin 2. Create a new empty dir, cd into it, and run: cabal sandbox init; cabal install cabal-install Copy .cabal-sandbox/bin/cabal to /usr/local/opt/cabal/bin [Note: if the cabal bundled with your initial GHC version is too old to support sandboxes, then instead do cabal install cabal-dev; cabal-dev install cabal-install and then copy cabal-dev/bin/cabal to /usr/local/opt/cabal/bin ] 3. Add /usr/local/opt/cabal/bin to your PATH, or install /usr/local/opt/cabal using stow. 4. When you switch to a different version of GHC by setting the PATH, do this instead of what you wrote: export PATH=/usr/local/opt/cabal/bin:/usr/local/opt/ghc-7.6.3-2013.2.0.0/bin:$PATH Regards, Yitz From hoerdegen at funktional.info Tue May 27 14:33:06 2014 From: hoerdegen at funktional.info (=?ISO-8859-15?Q?Heinrich_H=F6rdegen?=) Date: Tue, 27 May 2014 16:33:06 +0200 Subject: [Haskell-cafe] Munich Haskell Meeting Message-ID: <5384A222.8010700@funktional.info> Dear all, our next Haskell meeting in Munich is scheduled for the 29th of May, 19h30 at Cafe Puck. If you plan to join, please go to http://www.haskell-munich.de/dates and klick the button. With hope to see many of you, Heinrich From jmacristovao at gmail.com Tue May 27 16:40:15 2014 From: jmacristovao at gmail.com (=?UTF-8?B?Sm/Do28gQ3Jpc3TDs3bDo28=?=) Date: Tue, 27 May 2014 17:40:15 +0100 Subject: [Haskell-cafe] Local .ghci_history Message-ID: Hello, I raised this on trac ( https://ghc.haskell.org/trac/ghc/ticket/9089 ), but it seems it did not get much attention, but surelly I'm not the only one who finds this useful. With this little change, if there is a .ghci_history in the folder where you launch ghci it will use it instead of the global ~/.ghc/ghci_history. So, if you keep jumping from one project folder to the other, you can have a project specific history on each one (if you want). If you do not create a local .ghci_history file on that folder, the behaviour is exactly the same as it was before. Thus, this is somewhat identical to the local .ghci file. This, coupled with finally discovering the well hidden possibility of increasing the history size: http://trac.haskell.org/haskeline/wiki/UserPrefs Has vastly improved my ghci workflow. What do you think? Jo?o From mail at nh2.me Tue May 27 18:48:33 2014 From: mail at nh2.me (=?UTF-8?B?TmlrbGFzIEhhbWLDvGNoZW4=?=) Date: Tue, 27 May 2014 19:48:33 +0100 Subject: [Haskell-cafe] Local .ghci_history In-Reply-To: References: Message-ID: <5384DE01.2040601@nh2.me> I really need this. On Tue 27 May 2014 17:40:15 BST, Jo?o Crist?v?o wrote: > Hello, > > I raised this on trac ( https://ghc.haskell.org/trac/ghc/ticket/9089 > ), but it seems it did not get much attention, but surelly I'm not the > only one who finds this useful. > > With this little change, if there is a .ghci_history in the folder > where you launch ghci it will use it instead of the global > ~/.ghc/ghci_history. So, if you keep jumping from one project folder > to the other, you can have a project specific history on each one (if > you want). > > If you do not create a local .ghci_history file on that folder, the > behaviour is exactly the same as it was before. Thus, this is somewhat > identical to the local .ghci file. > > This, coupled with finally discovering the well hidden possibility of > increasing the history size: > > http://trac.haskell.org/haskeline/wiki/UserPrefs > > Has vastly improved my ghci workflow. > > > What do you think? > > Jo?o > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe From travis.cardwell at extellisys.com Wed May 28 00:20:26 2014 From: travis.cardwell at extellisys.com (Travis Cardwell) Date: Wed, 28 May 2014 09:20:26 +0900 Subject: [Haskell-cafe] Self-contained GHC for Mac In-Reply-To: References: <6DA71A20-108B-4A54-8592-0DA3E1F635C5@recursive.ca> <20140526130812.GB291@ridcully.home> <5383C671.3080702@extellisys.com> Message-ID: <53852BCA.4090604@extellisys.com> On 2014?05?27? 19:03, Yitzchak Gale wrote: > Travis Cardwell wrote: >> I wrote an article explaining how I install multiple versions and avoid >> ~/.cabal hell (on Debian Wheezy): > > Thanks for this detailed write up! Thank you very much for the feedback! > 1. When you switch to a different version of GHC using the PATH, > you also need to take into account the cabal command. Normally > you will want to be using the most recent cabal command, but > your procedure will switch you over to whatever version of the > cabal command was shipped with that version of GHC, because > that GHC bin directory now comes first in the PATH. By always installing the latest version of cabal-install globally, the most recent cabal command is in the GHC bin directory. There is no need to prepend another path onto PATH just for cabal. Since cabal is an integral part of the GHC toolchain, I prefer this over having a separate path just for cabal, making PATH (IMHO unnecessarily) longer. (Would there ever be a case where GHC/bin is needed while cabal/bin is not?) > 2. You don't need to have cabal-install installed globally. > All you need is the executable. I have been wondering about this, but I install --global cabal-install because I was not sure that the corresponding cabal [library] version might not be expected in some case. As there are no other dependencies, I did not worry about it. I just did a quick test and found that the cabal [library] is not installed with Haskell Platform; just the cabal-install executable is, as you suggest. Thank you for pointing that out to me! I will update the article soon. Cheers, Travis From omari at smileystation.com Wed May 28 01:55:59 2014 From: omari at smileystation.com (Omari Norman) Date: Tue, 27 May 2014 21:55:59 -0400 Subject: [Haskell-cafe] [ANN] cartel - specify Cabal files using Haskell Message-ID: The Cabal file format works very well for small projects. However, in big projects with a library, many executables, and test suites, some irritations emerge. You need to specify dependencies in multiple places, leading to redundancy. You also have to manually add in new modules, make sure you list all modules (a real pain with executables, as problems may arise only after you build a distribution tarball), and update your module lists when you refactor. Specifying your Cabal files in Haskell rather than in a plain-text file format helps deal with a lot of these problems. You have the full power of Haskell to make definitions in one place and then reuse them. You can also dynamically read a tree of modules and use the result, thus avoiding the need to manually update your module lists. A disadvantage to Cartel is that it can be a bit more verbose than a vanilla Cabal file. In addition, you also have to remember to generate the new Cabal file whenever you change the script that generates your Cabal file. Cabal already has an AST that it uses. Cartel could, perhaps, have re-used these structures. Cartel does not do this for three reasons. First, the Cabal API is a bit untidy, partially because it has to do things that Cartel doesn't have to worry about, but also because the comments in the Cabal modules themselves indicate that the whole thing could use a refactoring. Second, the Cabal developers make no commitment to keep that API stable. Third, the Cartel API tries only to replicate format of the plain-text Cabal file, which will be much more stable than the Cabal API. Hackage: http://hackage.haskell.org/package/cartel Github: https://github.com/massysett/cartel -------------- next part -------------- An HTML attachment was scrubbed... URL: From daniel.trstenjak at gmail.com Wed May 28 06:20:32 2014 From: daniel.trstenjak at gmail.com (Daniel Trstenjak) Date: Wed, 28 May 2014 08:20:32 +0200 Subject: [Haskell-cafe] [ANN] cartel - specify Cabal files using Haskell In-Reply-To: References: Message-ID: <20140528062032.GA1984@machine> Hi Omari, On Tue, May 27, 2014 at 09:55:59PM -0400, Omari Norman wrote: > The Cabal file format works very well for small projects. However, in big > projects with a library, many executables, and test suites, some irritations > emerge. You need to specify dependencies in multiple places, leading to > redundancy. That's not quite true, you can share the dependencies and specify the modules once, but you have to use a different sub directory for each section (library, executable, test-suite, benchmark) in the cabal file. See: https://github.com/dan-t/hsimport/blob/master/hsimport.cabal Greetings, Daniel From ivan.perez at keera.co.uk Wed May 28 07:20:19 2014 From: ivan.perez at keera.co.uk (Ivan Perez) Date: Wed, 28 May 2014 09:20:19 +0200 Subject: [Haskell-cafe] ANN: hcwiid-0.0.5 (wiimote, gaming) Message-ID: Hi cafe! We are happy to announce the release of Hcwiid 0.0.5, the Haskell bindings for cwiid, which provide a user-space driver for Nintendo's Wiimotes. The following new features have been made available recently: *- Infrared support*. This is essential if you want to use the sensor bar to detect what the wiimote is pointing at. *- Accelerometer support*. * - Improved API*. Access to all the key features, new auxiliary functions not present in cwiid, and a higher-level interface via the type system. *- Documentation*. An effort is being made to provide not only haddock documentation, but also several tests that demonstrate the features of this library. More information (including "What is a wiimote and how can I use it?" and "what can we expect next") can be found here: http://keera.co.uk/blog/2014/05/27/interacting-haskell-games-using-wiimote/ Hackage: https://hackage.haskell.org/package/hcwiid Github: https://github.com/ivanperez-keera/hcwiid I hope you all enjoy spicing up your applications a little bit with this library. All the best Ivan facebook: https://www.facebook.com/keerastudios twitter: @KeeraStudios -------------- next part -------------- An HTML attachment was scrubbed... URL: From kiwamu at debian.or.jp Wed May 28 07:30:49 2014 From: kiwamu at debian.or.jp (Kiwamu Okabe) Date: Wed, 28 May 2014 16:30:49 +0900 Subject: [Haskell-cafe] ANN: hcwiid-0.0.5 (wiimote, gaming) In-Reply-To: References: Message-ID: So great, Ivan! On Wed, May 28, 2014 at 4:20 PM, Ivan Perez wrote: > We are happy to announce the release of Hcwiid 0.0.5, the Haskell bindings > for cwiid, which provide a user-space driver for Nintendo's Wiimotes. Sometime, you may like also Carettah http://carettah.masterq.net/. It's a presentation tool that is able to be controlled with Wiimotes. Thank's, -- Kiwamu Okabe at METASEPI DESIGN From miroslav.karpis at gmail.com Wed May 28 08:55:56 2014 From: miroslav.karpis at gmail.com (Miro Karpis) Date: Wed, 28 May 2014 10:55:56 +0200 Subject: [Haskell-cafe] Interfacing BTCe Message-ID: Hi cafe, I'm trying to interface BTCe and get my account info. I have found following peace of code, which I would like to build on top: http://pastebin.com/AfDt8jcs I have added to the request a POST method, but I'm still getting error from BTCe: "{\"success\":0,\"error\":\"*invalid nonce parameter; on key:0*, you sent:\"}" The API is documented here: https://btc-e.com/api/documentation In short: Authorization is performed by sending the following HTTP Headers: *Key* ? API key *Sign* ? POST data (?param=val¶m1=val1) signed by a secret key according to HMAC-SHA512 method; Sent on *https://btc-e.com/tapi * . All requests must also include a special *nonce* POST parameter with increment integer. (>0) The method name is sent via POST parameter method. All the method parameters are sent via POST. {-# LANGUAGE OverloadedStrings #-} import Network.HTTP.Conduit import Network.HTTP.Types.Header import Data.Word import Data.ByteString.Lazy(pack) import qualified Data.ByteString.Char8 as B import Data.Digest.Pure.SHA import Data.Time.Clock.POSIX ------------------------------------------------------------------------------- toWord8 :: String -> [Word8] toWord8 = Prelude.map (fromIntegral . fromEnum) ------------------------------------------------------------------------------- key :: B.ByteString key = "key" secret :: String secret = "secret" url :: String url = "https://btc-e.com/tapi" ------------------------------------------------------------------------------- querystring :: Int -> String querystring nonce = "?method=getInfo&nonce=" ++ show nonce sign :: Int -> B.ByteString sign nonce = B.pack $ show $ hmacSha512 (pack $ toWord8 secret) (pack $ toWord8 $ querystring nonce) main :: IO () main = do nonce <- fmap floor getPOSIXTime putStrLn $ url ++ (querystring nonce) ticker <- parseUrl $ url ++ (querystring nonce) let request = ticker { secure = True , method = "POST" , requestHeaders = (requestHeaders ticker) ++ [ ("Content-Type", "application/x-www-form-urlencoded") , ("Host", "btc-e.com") , ("User-Agent", "Haskell Trading Robot") , ("Key", key) , ("Sign", sign nonce)]} putStrLn $ show request response <- withManager $ httpLbs request print $ responseBody response any ideas more than welcome cheers, miro -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan.perez at keera.co.uk Wed May 28 08:58:26 2014 From: ivan.perez at keera.co.uk (Ivan Perez) Date: Wed, 28 May 2014 10:58:26 +0200 Subject: [Haskell-cafe] ANN: hcwiid-0.0.5 (wiimote, gaming) In-Reply-To: References: Message-ID: <5385A532.8010309@keera.co.uk> On 28/05/14 09:30, Kiwamu Okabe wrote: > > Sometime, you may like also Carettah http://carettah.masterq.net/. > It's a presentation tool that is able to be controlled with Wiimotes. I have to give a presentation in a few weeks. I'll give it a try :) Thanks. One important fact is that there are some changes to the API that make hcwiid 0.0.5 not backwards compatible. The adaptations you'll have to make to your code are minimal, but you'll have to apply them by hand. Also, you might want to check the documentation on the github page. It explains the source of the nasty Nothing that cwiid_open used to return and how to run programs compiled with the latest version of ghc (it's a RTS flag, but non-intuitive). Ivan -- Facebook: https://www.facebook.com/keerastudios Twitter: https://twitter.com/KeeraStudios Web: http://www.keera.co.uk From kiwamu at debian.or.jp Wed May 28 09:04:59 2014 From: kiwamu at debian.or.jp (Kiwamu Okabe) Date: Wed, 28 May 2014 18:04:59 +0900 Subject: [Haskell-cafe] ANN: hcwiid-0.0.5 (wiimote, gaming) In-Reply-To: <5385A532.8010309@keera.co.uk> References: <5385A532.8010309@keera.co.uk> Message-ID: Hi Ivan, thank's for your effort. On Wed, May 28, 2014 at 5:58 PM, Ivan Perez wrote: > One important fact is that there are some changes to the API that make > hcwiid 0.0.5 not backwards compatible. The adaptations you'll have to make > to your code are minimal, but you'll have to apply them by hand. Ah. OK, I should create time to fix it on carettah side. Also I should update Debian packages of hcwiid and carettah.. > Also, you might want to check the documentation on the github page. It > explains the source of the nasty Nothing that cwiid_open used to return and > how to run programs compiled with the latest version of ghc (it's a RTS > flag, but non-intuitive). Sorry,,,, I think no time for it... I believe hcwiid is yours. Then it's good to remove my name from Author Property. Thank's. -- Kiwamu Okabe at METASEPI DESIGN From ivan.perez at keera.co.uk Wed May 28 09:20:34 2014 From: ivan.perez at keera.co.uk (Ivan Perez) Date: Wed, 28 May 2014 11:20:34 +0200 Subject: [Haskell-cafe] ANN: hcwiid-0.0.5 (wiimote, gaming) In-Reply-To: References: <5385A532.8010309@keera.co.uk> Message-ID: <5385AA62.5030901@keera.co.uk> On 28/05/14 11:04, Kiwamu Okabe wrote: >> Also, you might want to check the documentation on the github page. It >> explains the source of the nasty Nothing that cwiid_open used to return and >> how to run programs compiled with the latest version of ghc (it's a RTS >> flag, but non-intuitive). > Sorry,,,, I think no time for it... > I believe hcwiid is yours. Then it's good to remove my name from > Author Property. :))) What I mean is that, if carettah is using hcwiid and if it is your program (is it?), then you probably cannot run carettah with the latest ghc unless you compile with -rtsopts and run with +RTS -V0. -- Facebook: https://www.facebook.com/keerastudios Twitter: https://twitter.com/KeeraStudios Web: http://www.keera.co.uk From kiwamu at debian.or.jp Wed May 28 09:50:27 2014 From: kiwamu at debian.or.jp (Kiwamu Okabe) Date: Wed, 28 May 2014 18:50:27 +0900 Subject: [Haskell-cafe] ANN: hcwiid-0.0.5 (wiimote, gaming) In-Reply-To: <5385AA62.5030901@keera.co.uk> References: <5385A532.8010309@keera.co.uk> <5385AA62.5030901@keera.co.uk> Message-ID: Hi Ivan, On Wed, May 28, 2014 at 6:20 PM, Ivan Perez wrote: > :))) What I mean is that, if carettah is using hcwiid and if it is your > program (is it?), then you probably cannot run carettah with the latest ghc > unless you compile with -rtsopts and run with +RTS -V0. Ah, thank's. I was confused. GHC version on Debian is 7.6.3. https://packages.debian.org/en/sid/ghc Is it good setting "compile with -rtsopts and run with +RTS -V0" on both GHC 7.6 and 7.8? Thank's, -- Kiwamu Okabe at METASEPI DESIGN From omari at smileystation.com Wed May 28 10:25:14 2014 From: omari at smileystation.com (Omari Norman) Date: Wed, 28 May 2014 06:25:14 -0400 Subject: [Haskell-cafe] [ANN] cartel - specify Cabal files using Haskell In-Reply-To: <20140528062032.GA1984@machine> References: <20140528062032.GA1984@machine> Message-ID: On Wed, May 28, 2014 at 2:20 AM, Daniel Trstenjak < daniel.trstenjak at gmail.com> wrote: > > Hi Omari, > > On Tue, May 27, 2014 at 09:55:59PM -0400, Omari Norman wrote: > > The Cabal file format works very well for small projects. However, in big > > projects with a library, many executables, and test suites, some > irritations > > emerge. You need to specify dependencies in multiple places, leading to > > redundancy. > > That's not quite true, you can share the dependencies and specify the > modules once, but you have to use a different sub directory for each > section (library, executable, test-suite, benchmark) in the cabal file. > > See: https://github.com/dan-t/hsimport/blob/master/hsimport.cabal This is a solution only where you have shared code that can be pushed into the library. This may not be practical. Non-trivial tests, for instance, are going to have dependencies of their own. See http://hackage.haskell.org/package/penny-0.32.0.10/penny.cabal where three separate components must specify dependencies on text, time, and transformers. This was even after I moved a lot of code to the library for the sole reason of removing Cabal file redundancy. I could have the library re-export modules from those packages but that is a kludge. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan.perez at keera.co.uk Wed May 28 10:40:35 2014 From: ivan.perez at keera.co.uk (Ivan Perez) Date: Wed, 28 May 2014 12:40:35 +0200 Subject: [Haskell-cafe] ANN: hcwiid-0.0.5 (wiimote, gaming) In-Reply-To: References: <5385A532.8010309@keera.co.uk> <5385AA62.5030901@keera.co.uk> Message-ID: <5385BD23.8080603@keera.co.uk> On 28/05/14 11:50, Kiwamu Okabe wrote: > GHC version on Debian is 7.6.3. https://packages.debian.org/en/sid/ghc > Is it good setting "compile with -rtsopts and run with +RTS -V0" on > both GHC 7.6 and 7.8? I have not tried 7.8. The latest version available in Ubuntu is 7.6.3. Could someone with a wiimote check whether the Test.hs program in the latest hcwiid version works with ghc 7.8? From mail at nh2.me Wed May 28 11:53:38 2014 From: mail at nh2.me (=?UTF-8?B?TmlrbGFzIEhhbWLDvGNoZW4=?=) Date: Wed, 28 May 2014 12:53:38 +0100 Subject: [Haskell-cafe] [ANN] cartel - specify Cabal files using Haskell In-Reply-To: References: <20140528062032.GA1984@machine> Message-ID: <5385CE42.6080201@nh2.me> An example of how some project's cabal file looks in cartel would be nice. From omari at smileystation.com Wed May 28 13:35:38 2014 From: omari at smileystation.com (Omari Norman) Date: Wed, 28 May 2014 09:35:38 -0400 Subject: [Haskell-cafe] [ANN] cartel - specify Cabal files using Haskell In-Reply-To: <5385CE42.6080201@nh2.me> References: <20140528062032.GA1984@machine> <5385CE42.6080201@nh2.me> Message-ID: On Wed, May 28, 2014 at 7:53 AM, Niklas Hamb?chen wrote: > An example of how some project's cabal file looks in cartel would be > nice. > > Cartel's own cabal file is generated from Cartel. https://github.com/massysett/cartel/blob/master/genCabal.hs -------------- next part -------------- An HTML attachment was scrubbed... URL: From kiwamu at debian.or.jp Wed May 28 14:02:24 2014 From: kiwamu at debian.or.jp (Kiwamu Okabe) Date: Wed, 28 May 2014 23:02:24 +0900 Subject: [Haskell-cafe] ANN: hcwiid-0.0.5 (wiimote, gaming) In-Reply-To: References: <5385A532.8010309@keera.co.uk> <5385AA62.5030901@keera.co.uk> Message-ID: Hi Ivan, On Wed, May 28, 2014 at 6:50 PM, Kiwamu Okabe wrote: >> :))) What I mean is that, if carettah is using hcwiid and if it is your >> program (is it?), then you probably cannot run carettah with the latest ghc >> unless you compile with -rtsopts and run with +RTS -V0. > > Ah, thank's. I was confused. Now supported your hcwiid by carettah-0.3.0. http://hackage.haskell.org/package/carettah Thank's, -- Kiwamu Okabe at METASEPI DESIGN From john at repetae.net Thu May 29 02:17:43 2014 From: john at repetae.net (John Meacham) Date: Wed, 28 May 2014 19:17:43 -0700 Subject: [Haskell-cafe] [ANN] cartel - specify Cabal files using Haskell In-Reply-To: References: <20140528062032.GA1984@machine> <5385CE42.6080201@nh2.me> Message-ID: you might also be interested in franchise, an attempt by david roundy to create a decent haskell package manager before retiring from the community http://hackage.haskell.org/package/franchise may have some ideas to reuse. I use autoconf to generate cabal files when needed, working on a better solution all around somwhat more similar to but distinct from cartel and not haskell specific. John On Wed, May 28, 2014 at 6:35 AM, Omari Norman wrote: > > On Wed, May 28, 2014 at 7:53 AM, Niklas Hamb?chen wrote: >> >> An example of how some project's cabal file looks in cartel would be >> nice. >> > > Cartel's own cabal file is generated from Cartel. > > https://github.com/massysett/cartel/blob/master/genCabal.hs > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -- John Meacham - http://notanumber.net/ From dstcruz at gmail.com Thu May 29 03:14:59 2014 From: dstcruz at gmail.com (Daniel Santa Cruz) Date: Wed, 28 May 2014 23:14:59 -0400 Subject: [Haskell-cafe] Haskell Weekly News: Issue 295 Message-ID: Welcome to issue 294 of the HWN, an issue covering crowd-sourced bits of information about Haskell from around the web. This issue covers from May 4 to 24, 2014 Quotes of the Week * dalaing: going from doing a fair bit of haskell recently to doing javascript today... sigh... it feels like the difference between typing at a keyboard and typing with a pair of those sporting-event-foam-hands-with-a-pointing-finger on * monochrom: to be blunt, I believe that "I do X for a living" means nothing. politicians do politics for a living too, what is the result? * Cale: Java seems like it was designed especially to be a strawman for people who hate static type systems * ReinH: Every so often edwardk goes up to the mountain of CT and brings us some new tablets edwardk: hear that dolio? we're going to start calling you the mountain. Top Reddit Stories * #haskell is welcoming and troll resistent (just found this by accident) Domain: gist.github.com, Score: 172, Comments: 19 Original: [1] http://goo.gl/TCiMW On Reddit: [2] http://goo.gl/JZNY3M * $7.5m DoD grant to develop Homotopy Type Theory Domain: cmu.edu, Score: 117, Comments: 70 Original: [3] http://goo.gl/EmSlbE On Reddit: [4] http://goo.gl/sKjGIl * Understanding the Stack Domain: well-typed.com, Score: 102, Comments: 13 Original: [5] http://goo.gl/qo9m5O On Reddit: [6] http://goo.gl/MVvaQn * Elm 0.12.3 - efficient 3D rendering with WebGL Domain: elm-lang.org, Score: 82, Comments: 19 Original: [7] http://goo.gl/iATfSi On Reddit: [8] http://goo.gl/QJ5ttp * An example of a Real World Haskell Application Architecture Domain: self.haskell, Score: 68, Comments: 36 Original: [9] http://goo.gl/ZTcr1x On Reddit: [10] http://goo.gl/ZTcr1x * ezyang: ?try a <|> b? considered harmful Domain: blog.ezyang.com, Score: 67, Comments: 29 Original: [11] http://goo.gl/BEkC6W On Reddit: [12] http://goo.gl/3oql5l * 9m URL Shortener (Written in Haskell) Domain: 9m.no, Score: 67, Comments: 27 Original: [13] http://goo.gl/E0NoYv On Reddit: [14] http://goo.gl/n4cyN5 * Announce: JHC 0.8.1 IS OUT Domain: notanumber.net, Score: 66, Comments: 14 Original: [15] http://goo.gl/n6qAcf On Reddit: [16] http://goo.gl/wSMrva * Haskell for Mac OS X, self-contained relocatable GHC builds Domain: ghcformacosx.github.io, Score: 64, Comments: 35 Original: [17] http://goo.gl/CvsYC7 On Reddit: [18] http://goo.gl/WcIBw5 * Binary serialisation: better, stronger, faster (PDF, Duncan Coutts, March 2014) Domain: code.haskell.org, Score: 63, Comments: 39 Original: [19] http://goo.gl/r4xShZ On Reddit: [20] http://goo.gl/xhJRbg * CS240h lecture notes Domain: scs.stanford.edu, Score: 61, Comments: 8 Original: [21] http://goo.gl/F39zHe On Reddit: [22] http://goo.gl/AQqrUj * Haskell-mode documentation Domain: chrisdone.com, Score: 58, Comments: 28 Original: [23] http://goo.gl/XzKMCk On Reddit: [24] http://goo.gl/DZBQtO * PSA: you can now visit status.haskell.org Domain: status.haskell.org, Score: 58, Comments: 19 Original: [25] http://goo.gl/oRHfsn On Reddit: [26] http://goo.gl/Ye9YU2 * Once more into the teach, dear friends Domain: serpentine.com, Score: 57, Comments: 11 Original: [27] http://goo.gl/L8Csnm On Reddit: [28] http://goo.gl/AyF2Fs * What Features Would You Like to Find in a Haskell IDE? Domain: self.haskell, Score: 57, Comments: 90 Original: [29] http://goo.gl/Pvo32I On Reddit: [30] http://goo.gl/Pvo32I * Adventure with Types in Haskell - Simon Peyton Jones [1:33:36] Domain: youtu.be, Score: 57, Comments: 10 Original: [31] http://goo.gl/L9wGWe On Reddit: [32] http://goo.gl/sL3u8i * Ars Technica has Haskell as one of three potential heirs to Fortran's scientific computing throne Domain: arstechnica.com, Score: 56, Comments: 78 Original: [33] http://goo.gl/lxWcdK On Reddit: [34] http://goo.gl/kCxUS9 Top StackOverflow Questions * Why does Haskell's ?do nothing? function, id, consume tons of memory? votes: 72, answers: 1 Read on SO: [35] http://goo.gl/8awkSk * Are Ana-/Catamorphisms just slower? votes: 29, answers: 2 Read on SO: [36] http://goo.gl/wcmkQw * Code becomes slower as more boxed arrays are allocated votes: 22, answers: 2 Read on SO: [37] http://goo.gl/qfKo2a * Which part of Real World Haskell is now obsolete or considered bad practise? votes: 22, answers: 1 Read on SO: [38] http://goo.gl/EtT51x Until next time, [39]+Daniel Santa Cruz References 1. https://gist.github.com/quchen/5280339 2. http://www.reddit.com/r/haskell/comments/2516e4/haskell_is_welcoming_and_troll_resistent_just/ 3. http://www.cmu.edu/news/stories/archives/2014/april/april28_awodeygrant.html 4. http://www.reddit.com/r/haskell/comments/24rs73/75m_dod_grant_to_develop_homotopy_type_theory/ 5. http://www.well-typed.com/blog/94/ 6. http://www.reddit.com/r/haskell/comments/2641x0/understanding_the_stack/ 7. http://elm-lang.org/blog/announce/0.12.3.elm 8. http://www.reddit.com/r/haskell/comments/261abs/elm_0123_efficient_3d_rendering_with_webgl/ 9. http://www.reddit.com/r/haskell/comments/24y6ls/an_example_of_a_real_world_haskell_application/ 10. http://www.reddit.com/r/haskell/comments/24y6ls/an_example_of_a_real_world_haskell_application/ 11. http://blog.ezyang.com/2014/05/parsec-try-a-or-b-considered-harmful/ 12. http://www.reddit.com/r/haskell/comments/25ulsv/ezyang_try_a_b_considered_harmful/ 13. http://9m.no/ 14. http://www.reddit.com/r/haskell/comments/267evu/9m_url_shortener_written_in_haskell/ 15. http://notanumber.net/archives/178/jhc-haskell-0-8-1-released 16. http://www.reddit.com/r/haskell/comments/25o33n/announce_jhc_081_is_out/ 17. http://ghcformacosx.github.io/ 18. http://www.reddit.com/r/haskell/comments/26bx5n/haskell_for_mac_os_x_selfcontained_relocatable/ 19. http://code.haskell.org/~duncan/binary-experiment/binary.pdf 20. http://www.reddit.com/r/haskell/comments/25ch8v/binary_serialisation_better_stronger_faster_pdf/ 21. http://www.scs.stanford.edu/14sp-cs240h/slides/ 22. http://www.reddit.com/r/haskell/comments/25i99i/cs240h_lecture_notes/ 23. http://chrisdone.com/posts/haskell-mode-docs 24. http://www.reddit.com/r/haskell/comments/2583sm/haskellmode_documentation/ 25. http://status.haskell.org/ 26. http://www.reddit.com/r/haskell/comments/2653kp/psa_you_can_now_visit_statushaskellorg/ 27. http://www.serpentine.com/blog/2014/05/13/once-more-into-the-teach-dear-friends/ 28. http://www.reddit.com/r/haskell/comments/25iqk7/once_more_into_the_teach_dear_friends/ 29. http://www.reddit.com/r/haskell/comments/25sqvk/what_features_would_you_like_to_find_in_a_haskell/ 30. http://www.reddit.com/r/haskell/comments/25sqvk/what_features_would_you_like_to_find_in_a_haskell/ 31. http://youtu.be/6COvD8oynmI 32. http://www.reddit.com/r/haskell/comments/25vj62/adventure_with_types_in_haskell_simon_peyton/ 33. http://arstechnica.com/science/2014/05/scientific-computings-future-can-any-coding-language-top-a-1950s-behemoth/ 34. http://www.reddit.com/r/haskell/comments/250558/ars_technica_has_haskell_as_one_of_three/ 35. http://stackoverflow.com/questions/23746852/why-does-haskells-do-nothing-function-id-consume-tons-of-memory 36. http://stackoverflow.com/questions/23664197/are-ana-catamorphisms-just-slower 37. http://stackoverflow.com/questions/23462004/code-becomes-slower-as-more-boxed-arrays-are-allocated 38. http://stackoverflow.com/questions/23727768/which-part-of-real-world-haskell-is-now-obsolete-or-considered-bad-practise 39. https://plus.google.com/105107667630152149014/about -------------- next part -------------- An HTML attachment was scrubbed... URL: From chriswarbo at googlemail.com Thu May 29 08:32:18 2014 From: chriswarbo at googlemail.com (Chris Warburton) Date: Thu, 29 May 2014 09:32:18 +0100 Subject: [Haskell-cafe] Haskell in Org Mode Babel Message-ID: <86r43dm1d9.fsf@gmail.com> Hello, I'm wondering if anyone's had success using Haskell in "Babel", the literate programming system in Emacs's Org Mode? I'm trying it with a blog post, but am getting mixed results. For those who don't know, Org Mode is an Emacs mode for editing text files, which has a bunch of features controlled by markup in the file. Babel is a feature which allows source code in various languages to be included in-line and executed. For example, I can write some Haskell like this: #+begin_src haskell [1..10] #+end_src Cheers, Chris From chriswarbo at googlemail.com Thu May 29 08:45:59 2014 From: chriswarbo at googlemail.com (Chris Warburton) Date: Thu, 29 May 2014 09:45:59 +0100 Subject: [Haskell-cafe] Haskell in Org Mode Babel In-Reply-To: <86r43dm1d9.fsf@gmail.com> (Chris Warburton's message of "Thu, 29 May 2014 09:32:18 +0100") References: <86r43dm1d9.fsf@gmail.com> Message-ID: <86k395m0qg.fsf@gmail.com> Apologies for the incomplete email, the Gnus "send mail" keybinding is the same as Org mode's "evaluate code"! I was wondering if anyone has had success with using Haskell in Org mode. I'm writing a blog post, where I can include a code block like the following and Org mode will print the result underneath: #+begin_src haskell [1..10] #+end_src #+RESULTS: | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | By default, "haskell" code blocks will be sent to GHCi, which means I can't do top-level definitions: #+begin_src haskell :results value true x y = x false x y = y if_ c t e = c t e #+end_src #+RESULTS: : :187:11: parse error on input `=' This can be worked around, but it's a little ugly and the "inferior Haskell" comint mode doesn't strip the intermediate prompts properly: #+begin_src haskell :prologue ":set +m" :results value both let {true x y = x; false x y = y; if_ c t e = c t e} in if_ true "then" "else" #+end_src #+RESULTS: : *Main| *Main| "then" I've tried saving code to a separate file, which Org mode calls "tangling": #+begin_src haskell :tangle yes true x y = x false x y = y if_ c t e = c t e #+end_src Then loading the code from the GHCi prompt: #+begin_src haskell :results value both :load test.hs if_ true "then" "else" #+end_src However it seems to be a bit hit-and-miss whether this will load the code. How do others do this, if at all? Cheers, Chris From jmacristovao at gmail.com Thu May 29 13:03:40 2014 From: jmacristovao at gmail.com (=?UTF-8?B?Sm/Do28gQ3Jpc3TDs3bDo28=?=) Date: Thu, 29 May 2014 14:03:40 +0100 Subject: [Haskell-cafe] Local .ghci_history In-Reply-To: <5384DE01.2040601@nh2.me> References: <5384DE01.2040601@nh2.me> Message-ID: If you're confortable enough with compiling ghc on your own, the patch (over 7.8.2) I submitted seems to work just fine. Cheers 2014-05-27 19:48 GMT+01:00 Niklas Hamb?chen : > I really need this. > > On Tue 27 May 2014 17:40:15 BST, Jo?o Crist?v?o wrote: >> Hello, >> >> I raised this on trac ( https://ghc.haskell.org/trac/ghc/ticket/9089 >> ), but it seems it did not get much attention, but surelly I'm not the >> only one who finds this useful. >> >> With this little change, if there is a .ghci_history in the folder >> where you launch ghci it will use it instead of the global >> ~/.ghc/ghci_history. So, if you keep jumping from one project folder >> to the other, you can have a project specific history on each one (if >> you want). >> >> If you do not create a local .ghci_history file on that folder, the >> behaviour is exactly the same as it was before. Thus, this is somewhat >> identical to the local .ghci file. >> >> This, coupled with finally discovering the well hidden possibility of >> increasing the history size: >> >> http://trac.haskell.org/haskeline/wiki/UserPrefs >> >> Has vastly improved my ghci workflow. >> >> >> What do you think? >> >> Jo?o >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe From alexey.muranov at gmail.com Fri May 30 12:36:17 2014 From: alexey.muranov at gmail.com (Alexey Muranov) Date: Fri, 30 May 2014 05:36:17 -0700 (PDT) Subject: [Haskell-cafe] Self-contained GHC for Mac In-Reply-To: <6DA71A20-108B-4A54-8592-0DA3E1F635C5@recursive.ca> References: <6DA71A20-108B-4A54-8592-0DA3E1F635C5@recursive.ca> Message-ID: <40c81c8a-8cda-41e2-8487-5f98fb55dca6@googlegroups.com> On Monday, May 26, 2014 2:23:34 PM UTC+2, Bob Hutchison wrote: > > > I think this is the way to go for anyone setting up Haskell for the first > time on a Mac. I agree that this should be a very prominently displayed > installation option on haskell.org > Are there any drawbacks in installing Haskell with Homebrew? Alexey. -------------- next part -------------- An HTML attachment was scrubbed... URL: From adam at bergmark.nl Fri May 30 18:07:15 2014 From: adam at bergmark.nl (Adam Bergmark) Date: Fri, 30 May 2014 20:07:15 +0200 Subject: [Haskell-cafe] Self-contained GHC for Mac In-Reply-To: <40c81c8a-8cda-41e2-8487-5f98fb55dca6@googlegroups.com> References: <6DA71A20-108B-4A54-8592-0DA3E1F635C5@recursive.ca> <40c81c8a-8cda-41e2-8487-5f98fb55dca6@googlegroups.com> Message-ID: I didn't have any problems using HP from homebrew but it installs packages globally which seems to be frowned upon. On Fri, May 30, 2014 at 2:36 PM, Alexey Muranov wrote: > > > On Monday, May 26, 2014 2:23:34 PM UTC+2, Bob Hutchison wrote: >> >> >> I think this is the way to go for anyone setting up Haskell for the first >> time on a Mac. I agree that this should be a very prominently displayed >> installation option on haskell.org >> > > Are there any drawbacks in installing Haskell with Homebrew? > > Alexey. > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cma at bitemyapp.com Fri May 30 18:20:52 2014 From: cma at bitemyapp.com (Christopher Allen) Date: Fri, 30 May 2014 13:20:52 -0500 Subject: [Haskell-cafe] Self-contained GHC for Mac In-Reply-To: References: <6DA71A20-108B-4A54-8592-0DA3E1F635C5@recursive.ca> <40c81c8a-8cda-41e2-8487-5f98fb55dca6@googlegroups.com> Message-ID: The global package installation is the part I take objection to and it's what causes problems for new people. It's why I was excited about this idea. On Fri, May 30, 2014 at 1:07 PM, Adam Bergmark wrote: > I didn't have any problems using HP from homebrew but it installs packages > globally which seems to be frowned upon. > > > > On Fri, May 30, 2014 at 2:36 PM, Alexey Muranov > wrote: > >> >> >> On Monday, May 26, 2014 2:23:34 PM UTC+2, Bob Hutchison wrote: >>> >>> >>> I think this is the way to go for anyone setting up Haskell for the >>> first time on a Mac. I agree that this should be a very prominently >>> displayed installation option on haskell.org >>> >> >> Are there any drawbacks in installing Haskell with Homebrew? >> >> Alexey. >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> >> > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bob at redivi.com Fri May 30 18:24:55 2014 From: bob at redivi.com (Bob Ippolito) Date: Fri, 30 May 2014 11:24:55 -0700 Subject: [Haskell-cafe] Self-contained GHC for Mac In-Reply-To: <40c81c8a-8cda-41e2-8487-5f98fb55dca6@googlegroups.com> References: <6DA71A20-108B-4A54-8592-0DA3E1F635C5@recursive.ca> <40c81c8a-8cda-41e2-8487-5f98fb55dca6@googlegroups.com> Message-ID: On Fri, May 30, 2014 at 5:36 AM, Alexey Muranov wrote: > > > On Monday, May 26, 2014 2:23:34 PM UTC+2, Bob Hutchison wrote: >> >> >> I think this is the way to go for anyone setting up Haskell for the first >> time on a Mac. I agree that this should be a very prominently displayed >> installation option on haskell.org >> > > Are there any drawbacks in installing Haskell with Homebrew? > Homebrew mostly works fine, but this self-contained version doesn't have any dependencies outside of Xcode and thus you can get it up and running much more quickly. Not everyone uses homebrew. -bob -------------- next part -------------- An HTML attachment was scrubbed... URL: From cma at bitemyapp.com Fri May 30 18:26:28 2014 From: cma at bitemyapp.com (Christopher Allen) Date: Fri, 30 May 2014 13:26:28 -0500 Subject: [Haskell-cafe] Self-contained GHC for Mac In-Reply-To: References: <6DA71A20-108B-4A54-8592-0DA3E1F635C5@recursive.ca> <40c81c8a-8cda-41e2-8487-5f98fb55dca6@googlegroups.com> Message-ID: Compilation time is a pain and using homebrew's GHC package could break other homebrew recipes, particularly Ruby ones that rely on native compilation. On Fri, May 30, 2014 at 1:24 PM, Bob Ippolito wrote: > On Fri, May 30, 2014 at 5:36 AM, Alexey Muranov > wrote: > >> >> >> On Monday, May 26, 2014 2:23:34 PM UTC+2, Bob Hutchison wrote: >>> >>> >>> I think this is the way to go for anyone setting up Haskell for the >>> first time on a Mac. I agree that this should be a very prominently >>> displayed installation option on haskell.org >>> >> >> Are there any drawbacks in installing Haskell with Homebrew? >> > > Homebrew mostly works fine, but this self-contained version doesn't have > any dependencies outside of Xcode and thus you can get it up and running > much more quickly. Not everyone uses homebrew. > > -bob > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From carter.schonwald at gmail.com Fri May 30 19:07:39 2014 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Fri, 30 May 2014 15:07:39 -0400 Subject: [Haskell-cafe] Self-contained GHC for Mac In-Reply-To: References: <6DA71A20-108B-4A54-8592-0DA3E1F635C5@recursive.ca> <40c81c8a-8cda-41e2-8487-5f98fb55dca6@googlegroups.com> Message-ID: And more importantly: no one familiar with ghc is actively making sure the ghc formula on brew stays kosher. On Friday, May 30, 2014, Christopher Allen wrote: > Compilation time is a pain and using homebrew's GHC package could break > other homebrew recipes, particularly Ruby ones that rely on native > compilation. > > > On Fri, May 30, 2014 at 1:24 PM, Bob Ippolito > wrote: > >> On Fri, May 30, 2014 at 5:36 AM, Alexey Muranov > > wrote: >> >>> >>> >>> On Monday, May 26, 2014 2:23:34 PM UTC+2, Bob Hutchison wrote: >>>> >>>> >>>> I think this is the way to go for anyone setting up Haskell for the >>>> first time on a Mac. I agree that this should be a very prominently >>>> displayed installation option on haskell.org >>>> >>> >>> Are there any drawbacks in installing Haskell with Homebrew? >>> >> >> Homebrew mostly works fine, but this self-contained version doesn't have >> any dependencies outside of Xcode and thus you can get it up and running >> much more quickly. Not everyone uses homebrew. >> >> -bob >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ian at skybluetrades.net Sat May 31 10:44:02 2014 From: ian at skybluetrades.net (Ian Ross) Date: Sat, 31 May 2014 12:44:02 +0200 Subject: [Haskell-cafe] MacOS testing? Message-ID: Hi all, Does anyone know of a good solution for MacOS testing that doesn't cost much? (Ideally, that costs nothing...) I've been getting a lot of MacOS-specific issues on the C2HS that I maintain and, since I don't have a Mac myself, testing and fixing these things is a bit of a problem. There is no equivalent of Amazon's EC2 for MacOS. There are some hosting services out there, but they're not all that practical, since they cost, they're set up for continuous hosting rather than intermittent use for bug-fixing, and you can't save a machine image snapshot once you've installed all the software you need (as you can on AWS) so you either need to keep your instance running or reinstall everything every time you want to test something. Any ideas? The only thought I've had so far was to try to do something horrible using Travis (Kiwamu Okabe has some slides about building and testing Haskell code on Travis: http://www.slideshare.net/master_q/20131109-kof2013-travisciosx). That's not a good solution for debugging though. Thanks for any thoughts you might have, Ian. -- Ian Ross Tel: +43(0)6804451378 ian at skybluetrades.net www.skybluetrades.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From bob at redivi.com Sat May 31 15:16:21 2014 From: bob at redivi.com (Bob Ippolito) Date: Sat, 31 May 2014 08:16:21 -0700 Subject: [Haskell-cafe] MacOS testing? In-Reply-To: References: Message-ID: Travis is the only free option I'm aware of. As for renting time on a Mac by the hour here's what I could find: http://www.macincloud.com On Saturday, May 31, 2014, Ian Ross wrote: > Hi all, > > Does anyone know of a good solution for MacOS testing that doesn't cost > much? (Ideally, that costs nothing...) I've been getting a lot of > MacOS-specific issues on the C2HS that I maintain and, since I don't have a > Mac myself, testing and fixing these things is a bit of a problem. There > is no equivalent of Amazon's EC2 for MacOS. There are some hosting > services out there, but they're not all that practical, since they cost, > they're set up for continuous hosting rather than intermittent use for > bug-fixing, and you can't save a machine image snapshot once you've > installed all the software you need (as you can on AWS) so you either need > to keep your instance running or reinstall everything every time you want > to test something. > > Any ideas? The only thought I've had so far was to try to do something > horrible using Travis (Kiwamu Okabe has some slides about building and > testing Haskell code on Travis: > http://www.slideshare.net/master_q/20131109-kof2013-travisciosx). That's > not a good solution for debugging though. > > Thanks for any thoughts you might have, > > Ian. > > -- > Ian Ross Tel: +43(0)6804451378 ian at skybluetrades.net > > www.skybluetrades.net > -------------- next part -------------- An HTML attachment was scrubbed... URL: From petr.mvd at gmail.com Sat May 31 18:58:40 2014 From: petr.mvd at gmail.com (=?UTF-8?B?UGV0ciBQdWRsw6Fr?=) Date: Sat, 31 May 2014 20:58:40 +0200 Subject: [Haskell-cafe] MonadRandom and traversing infinite streams Message-ID: Hi Brent and Wouter, looking at SO questions http://stackoverflow.com/q/14494648/1333025 http://codereview.stackexchange.com/q/52149/15600 threre are monads and applicative functors that support ``` sequenceInf :: S.Stream (f a) -> f (S.Stream a) ``` that is, allow lazy traversals of streams (infinite lists). Namely those that don't produce any additional output. And instances of MonadRandom seem to have valid implementations of `sequenceInf`, which would allow to produce lazy infinite randomized lists (basically a generalization of `getRandoms`). My proposal is to add ``` class Applicative f => LazyApplicative f where sequenceInf :: S.Stream (f a) -> f (S.Stream a) sequenceInf = traverseInf id traverseInf :: (a -> f b) -> S.Stream a -> f (S.Stream b) traverseInf f = sequenceInf . S.map f ``` to a module in Stream package (for example `Control.Applicative.Lazy`), and add its instances into `MonadRandom`. What do you think? I'd be willing to send patches. Best regards, Petr -------------- next part -------------- An HTML attachment was scrubbed... URL: From byorgey at seas.upenn.edu Sat May 31 19:35:50 2014 From: byorgey at seas.upenn.edu (Brent Yorgey) Date: Sat, 31 May 2014 15:35:50 -0400 Subject: [Haskell-cafe] MonadRandom and traversing infinite streams In-Reply-To: References: Message-ID: <20140531193550.GA30864@seas.upenn.edu> On Sat, May 31, 2014 at 08:58:40PM +0200, Petr Pudl?k wrote: > Hi Brent and Wouter, > > looking at SO questions > > http://stackoverflow.com/q/14494648/1333025 > http://codereview.stackexchange.com/q/52149/15600 > > threre are monads and applicative functors that support > > ``` > sequenceInf :: S.Stream (f a) -> f (S.Stream a) > ``` Hi Petr, Perhaps what you are looking for is distributive functors: http://hackage.haskell.org/package/distributive-0.4/docs/Data-Distributive.html#t:Distributive Distributive functors g support distribute :: Functor f => f (g a) -> g (f a) for all Functors f. Also, a functor is distributive if and only if it is representable, that is, if it is isomorphic to (r -> a) for some type r. Another way to think about this is that in order to be able to lazily zip an infinite number of copies of g, it must be that g is composed of only products; you can think of (r -> a) as an r-indexed product of a values. If g contains any sums (e.g. Maybe and [] both have two constructors, i.e. are a sum of two types) then you need to examine the entire list before you can decide the structure of the output. As for instances of MonadRandom supporting sequenceInf or distribute or whatever, are you talking about e.g. Rand? Now that I think about it, perhaps Distributive is not exactly what you are looking for: Rand is not distributive, because (State s) is not. Intuitively the reason State is not distributive is that the order matters, so in order to do f (State s a) -> State s (f a), f must be Traversable. But this is just 'sequenceA' from the Traversable instance for f; the only thing required of State s is that it is Applicative. So I guess I am not sure whether you really need anything extra beyond what is already provided (there is an Applicative instance for Rand). This works for me: > rs <- evalRandIO . T.sequenceA . repeat . getRandomR $ (0,1 :: Double) > take 3 rs [0.2873830633564285,0.7737439541152851,0.5740433935180629] If you have something different in mind I'd love to hear it explained in more detail. Brent From petr.mvd at gmail.com Sat May 31 19:59:58 2014 From: petr.mvd at gmail.com (=?UTF-8?B?UGV0ciBQdWRsw6Fr?=) Date: Sat, 31 May 2014 21:59:58 +0200 Subject: [Haskell-cafe] MonadRandom and traversing infinite streams In-Reply-To: <20140531193550.GA30864@seas.upenn.edu> References: <20140531193550.GA30864@seas.upenn.edu> Message-ID: Hi Brent, thanks for pointing me to the distributive functors, I'll have a look at them. Indeed, `sequenceInf` is almost `sequenceA`. The difference is that `sequenceA` doesn't work for infinite lists for most monads, including `State` and `Rand`, as in this example: main = do let infSeq = sequence $ repeat getRandom (xs, y) <- evalRandIO ((,) <$> infSeq <*> getRandom) :: IO ([Int], Int) print (take 5 xs) print y Here `y` will always diverge. Your example worked only because the generator was never used for anything after producing a lazy infinite list. But it can be implemented for `Rand` in a different way (as `sequenceInf`), because it can split the generator, return one part as the output, and use the other part to lazily generate an infinite randomized list. Petr 2014-05-31 21:35 GMT+02:00 Brent Yorgey : > On Sat, May 31, 2014 at 08:58:40PM +0200, Petr Pudl?k wrote: > > Hi Brent and Wouter, > > > > looking at SO questions > > > > http://stackoverflow.com/q/14494648/1333025 > > http://codereview.stackexchange.com/q/52149/15600 > > > > threre are monads and applicative functors that support > > > > ``` > > sequenceInf :: S.Stream (f a) -> f (S.Stream a) > > ``` > > Hi Petr, > > Perhaps what you are looking for is distributive functors: > > > http://hackage.haskell.org/package/distributive-0.4/docs/Data-Distributive.html#t:Distributive > > Distributive functors g support > > distribute :: Functor f => f (g a) -> g (f a) > > for all Functors f. Also, a functor is distributive if and only if it > is representable, that is, if it is isomorphic to (r -> a) for some > type r. Another way to think about this is that in order to be able > to lazily zip an infinite number of copies of g, it must be that g is > composed of only products; you can think of (r -> a) as an r-indexed > product of a values. If g contains any sums (e.g. Maybe and [] both > have two constructors, i.e. are a sum of two types) then you need to > examine the entire list before you can decide the structure of the > output. > > As for instances of MonadRandom supporting sequenceInf or distribute > or whatever, are you talking about e.g. Rand? Now that I think about > it, perhaps Distributive is not exactly what you are looking for: Rand > is not distributive, because (State s) is not. Intuitively the reason > State is not distributive is that the order matters, so in order to do > f (State s a) -> State s (f a), f must be Traversable. But this is > just 'sequenceA' from the Traversable instance for f; the only thing > required of State s is that it is Applicative. So I guess I am not > sure whether you really need anything extra beyond what is already > provided (there is an Applicative instance for Rand). This works for me: > > > rs <- evalRandIO . T.sequenceA . repeat . getRandomR $ (0,1 :: Double) > > take 3 rs > [0.2873830633564285,0.7737439541152851,0.5740433935180629] > > If you have something different in mind I'd love to hear it explained > in more detail. > > Brent > > -------------- next part -------------- An HTML attachment was scrubbed... URL: