From ok at cs.otago.ac.nz Tue Nov 1 00:37:58 2016 From: ok at cs.otago.ac.nz (Richard A. O'Keefe) Date: Tue, 1 Nov 2016 13:37:58 +1300 Subject: [Haskell-cafe] Haskell-Cafe Digest, Vol 158, Issue 29 In-Reply-To: <8f85862d-d14a-342b-b489-ad394afe92cb@durchholz.org> References: <36384d09-9d23-265c-5f4e-e379cb6a0bb7@cs.otago.ac.nz> <706f4620-d604-f87e-dffc-b939317b76cd@cs.otago.ac.nz> <8f85862d-d14a-342b-b489-ad394afe92cb@durchholz.org> Message-ID: <5bd71407-0a1d-c2fc-5a60-bcb56e26aebc@cs.otago.ac.nz> On 1/11/16 9:54 AM, Joachim Durchholz wrote: > > And you need to control memory coherence, i.e. you need to define what > data goes together with what processes. At this point I'm puzzled. Languages like Occam, ZPL, and Co-Array Fortran basically say NO! to memory coherence. Of course you say which data goes with what process. If the data need to be available in some other process, there is some sort of fairly explicit communication. > In an ideal world, the compiler would be smart enough to do that for you. > I have been reading fantasies that FPLs with their immutable data > structures are better suited for this kind of automation; Memory coherence exists as an issue when data are replicated and one of the copies gets mutated, so that the copies are now inconsistent. With immutable data this cannot be a problem. For what it's worth, the "Clean" programming language used to be called "Concurrent Clean" because it was set up to run on a cluster of Macintoshes. > Without that, you'd code explicit multithreading, which means that > communication does not look like memory access at all. I believe my argument was that it *shouldn't* look like memory access. From icfp.publicity at googlemail.com Tue Nov 1 01:59:32 2016 From: icfp.publicity at googlemail.com (Lindsey Kuper) Date: Mon, 31 Oct 2016 18:59:32 -0700 Subject: [Haskell-cafe] Call for Workshop Proposals: ICFP 2017 Message-ID: <5817f70490a52_54a3fd6a9465be4679d@landin.local.mail> CALL FOR WORKSHOP AND CO-LOCATED EVENT PROPOSALS ICFP 2017 22nd ACM SIGPLAN International Conference on Functional Programming September 3-9, 2017 Oxford, United Kingdom http://conf.researchr.org/home/icfp-2017 The 22nd ACM SIGPLAN International Conference on Functional Programming will be held in Oxford, United Kingdom on September 3-9, 2017. ICFP provides a forum for researchers and developers to hear about the latest work on the design, implementations, principles, and uses of functional programming. Proposals are invited for workshops (and other co-located events, such as tutorials) to be affiliated with ICFP 2017 and sponsored by SIGPLAN. These events should be less formal and more focused than ICFP itself, include sessions that enable interaction among the attendees, and foster the exchange of new ideas. The preference is for one-day events, but other schedules can also be considered. The workshops are scheduled to occur on September 3 (the day before ICFP) and September 7-9 (the three days after ICFP). ---------------------------------------------------------------------- Submission details Deadline for submission: November 19, 2016 Notification of acceptance: December 18, 2016 Prospective organizers of workshops or other co-located events are invited to submit a completed workshop proposal form in plain text format to the ICFP 2017 workshop co-chairs (David Christiansen and Andres Loeh), via email to icfp2017-workshops at googlegroups.com by November 19, 2016. (For proposals of co-located events other than workshops, please fill in the workshop proposal form and just leave blank any sections that do not apply.) Please note that this is a firm deadline. Organizers will be notified if their event proposal is accepted by December 18, 2016, and if successful, depending on the event, they will be asked to produce a final report after the event has taken place that is suitable for publication in SIGPLAN Notices. The proposal form is available at: http://www.icfpconference.org/icfp2017-files/icfp17-workshops-form.txt Further information about SIGPLAN sponsorship is available at: http://www.sigplan.org/Resources/Proposals/Sponsored/ ---------------------------------------------------------------------- Selection committee The proposals will be evaluated by a committee comprising the following members of the ICFP 2017 organizing committee, together with the members of the SIGPLAN executive committee. Workshop Co-Chair: David Christiansen (Indiana University) Workshop Co-Chair: Andres Loeh (Well-Typed LLP) General Chair: Jeremy Gibbons (University of Oxford) Program Chair: Mark Jones (Portland State University) ---------------------------------------------------------------------- Further information Any queries should be addressed to the workshop co-chairs (David Christiansen and Andres Loeh), via email to icfp2017-workshops at googlegroups.com From djohnson.m at gmail.com Tue Nov 1 02:27:02 2016 From: djohnson.m at gmail.com (David Johnson) Date: Mon, 31 Oct 2016 21:27:02 -0500 Subject: [Haskell-cafe] GHCJS Bad first impression In-Reply-To: <612AF2B8-4175-4244-95C7-15D096BC7628@gmail.com> References: <612AF2B8-4175-4244-95C7-15D096BC7628@gmail.com> Message-ID: Zachary, The ghcjs-dom package on nixpkgs is pretty badly broken. This is because cabal2nix doesn't generate nix expressions that are sensitive to ghcjs. Therefore, you have to override derivations before you even begin. To do this create the directory ~/.nixpkgs with file config.nix (~/.nixpkgs/config.nix). Then paste the contents of this config.nix [1] into your local file system, then try the previous script again: > nix-shell -p "haskell.packages.ghcjs.ghcWithPackages (pkgs: with pkgs; [ghcjs-base ghcjs-dom])” [1] https://gist.github.com/dmjio/380f8d8729f7f81be48ffdddb3fb1de0 Regards, Dave On Mon, Oct 31, 2016 at 6:59 AM, Aycan İrican wrote: > > > On 30 Oct 2016, at 21:42, David Johnson wrote: > > > > Zachary, > > > > I highly recommend using the nix package manager for GHCJS projects. > > > > Nix is very easy to install and uninstall (rm -rf /nix). > > > > To install: curl https://nixos.org/nix/install > > | sh > > > > > > To be put into a shell where ghcjs exists along with a few dependencies, > run, > > nix-shell -p "haskell.packages.ghcjs.ghcWithPackages (pkgs: with pkgs; > [ghcjs-base ghcjs-dom])” > > > > Unfortunately it is failing with: > > ``` > building path(s) ‘/nix/store/bcdkyjdrvx1jmqzkh031h1zz0x3sd4 > q6-entropy-0.3.7’ > setupCompilerEnvironmentPhase > Build with /nix/store/nxnnsdk5njk6913z017h0hf6v5f3waah-ghcjs-0.2.0. > unpacking sources > unpacking source archive /nix/store/86ny46814x0qw0srcgywwgzsz1myhp > nn-entropy-0.3.7.tar.gz > source root is entropy-0.3.7 > setting SOURCE_DATE_EPOCH to timestamp 1434401149 of file > entropy-0.3.7/System/EntropyXen.hs > patching sources > compileBuildDriverPhase > setupCompileFlags: -package-db=/tmp/nix-build-entropy-0.3.7.drv-2/package.conf.d > -j1 > [1 of 1] Compiling Main ( Setup.hs, > /tmp/nix-build-entropy-0.3.7.drv-2/Main.o ) > Linking Setup ... > configuring > configureFlags: --verbose --prefix=/nix/store/ > bcdkyjdrvx1jmqzkh031h1zz0x3sd4q6-entropy-0.3.7 > --libdir=$prefix/lib/$compiler --libsubdir=$pkgid --with-gcc=gcc > --package-db=/tmp/nix-build-entropy-0.3.7.drv-2/package.conf.d > --ghc-option=-opt > l=-Wl,-rpath=/nix/store/bcdkyjdrvx1jmqzkh031h1zz0x3sd4 > q6-entropy-0.3.7/lib/ghcjs-0.2.0/entropy-0.3.7 --enable-split-objs > --disable-library-profiling --disable-executable-profiling --enable-shared > --enable-library-vanilla --enable-executab > le-dynamic --disable-tests --with-hsc2hs=/nix/store/ > mcfx2csfnjsqk83h64jw0w1a4df48rwp-ghc-7.10.3/bin/hsc2hs --ghcjs > Configuring entropy-0.3.7... > Flags chosen: halvm=False > Dependency base >=4.3 && <5: using base-4.8.0.0 > Dependency bytestring -any: using bytestring-0.10.6.0 > Dependency unix -any: using unix-2.7.1.0 > Using Cabal-1.22.5.0 compiled by ghc-7.10 > Using compiler: ghcjs-0.2.0 > Using install prefix: > /nix/store/bcdkyjdrvx1jmqzkh031h1zz0x3sd4q6-entropy-0.3.7 > Binaries installed in: > /nix/store/bcdkyjdrvx1jmqzkh031h1zz0x3sd4q6-entropy-0.3.7/bin > Libraries installed in: > /nix/store/bcdkyjdrvx1jmqzkh031h1zz0x3sd4q6-entropy-0.3.7/lib/ghcjs-0. > 2.0/entropy-0.3.7 > Private binaries installed in: > /nix/store/bcdkyjdrvx1jmqzkh031h1zz0x3sd4q6-entropy-0.3.7/libexec > Data files installed in: > /nix/store/bcdkyjdrvx1jmqzkh031h1zz0x3sd4q6-entropy-0.3.7/share/x86_64- > linux-ghcjs-0.2.0-ghc7_10_3/entropy-0.3.7 > Documentation installed in: > /nix/store/bcdkyjdrvx1jmqzkh031h1zz0x3sd4q6-entropy-0.3.7/share/doc/ > x86_64-linux-ghcjs-0.2.0-ghc7_10_3/entropy-0.3.7 > Configuration files installed in: > /nix/store/bcdkyjdrvx1jmqzkh031h1zz0x3sd4q6-entropy-0.3.7/etc > No alex found > Using ar found on system at: > /nix/store/d61gfhj50bfrrlvp4jzdxmsap3izsvyc-binutils-2.27/bin/ar > No c2hs found > No cpphs found > Using gcc version 5.4.0 given by user at: > /nix/store/wckiwf1m333akbm3d7pyrj57g3i39367-gcc-wrapper-5.4.0/bin/gcc > No ghc found > No ghc-pkg found > Using ghcjs version 0.2.0 found on system at: > /nix/store/nxnnsdk5njk6913z017h0hf6v5f3waah-ghcjs-0.2.0/bin/ghcjs > Using ghcjs-pkg version 7.10.3 found on system at: > /nix/store/nxnnsdk5njk6913z017h0hf6v5f3waah-ghcjs-0.2.0/bin/ghcjs-pkg > No greencard found > Using haddock version 2.16.1 found on system at: > /nix/store/nxnnsdk5njk6913z017h0hf6v5f3waah-ghcjs-0.2.0/bin/haddock-ghcjs > No happy found > Using haskell-suite found on system at: haskell-suite-dummy-location > Using haskell-suite-pkg found on system at: haskell-suite-pkg-dummy- > location > No hmake found > No hpc found > Using hsc2hs version 0.67 given by user at: > /nix/store/mcfx2csfnjsqk83h64jw0w1a4df48rwp-ghc-7.10.3/bin/hsc2hs > No hscolour found > No jhc found > Using ld found on system at: > /nix/store/wckiwf1m333akbm3d7pyrj57g3i39367-gcc-wrapper-5.4.0/bin/ld > No lhc found > No lhc-pkg found > No pkg-config found > Using strip version 2.27 found on system at: > /nix/store/d61gfhj50bfrrlvp4jzdxmsap3izsvyc-binutils-2.27/bin/strip > Using tar found on system at: > /nix/store/p6jsf52izfpgb758xvdcw19byj644iak-gnutar-1.29/bin/tar > No uhc found > building > Setup: Could not determine C compiler > builder for ‘/nix/store/8ig44jskrggpnsqmiwjr3y7kz8aib9jj-entropy-0.3.7.drv’ > failed with exit code 1 > cannot build derivation ‘/nix/store/658g4wwinrpiy4qc23r9rzf0abab6q13-ghcjs-0.2.0.drv’: > 1 dependencies couldn't be built > error: build of ‘/nix/store/658g4wwinrpiy4qc23r9rzf0abab6q13-ghcjs-0.2.0.drv’ > failed > /run/current-system/sw/bin/nix-shell: failed to build all dependencies > ``` > > I also tried it with 16.09 which also failed. > > — > aycan > > -- Cell: 1.630.740.8204 -------------- next part -------------- An HTML attachment was scrubbed... URL: From simons at nospf.cryp.to Tue Nov 1 07:43:11 2016 From: simons at nospf.cryp.to (Peter Simons) Date: Tue, 01 Nov 2016 08:43:11 +0100 Subject: [Haskell-cafe] GHCJS Bad first impression References: <612AF2B8-4175-4244-95C7-15D096BC7628@gmail.com> Message-ID: <87shrb1w8g.fsf@write-only.cryp.to> Hi David, > cabal2nix doesn't generate nix expressions that are sensitive to ghcjs. the expressions in Nixpkgs target GHC 8.0.x, not GHCJS. If you want cabal2nix to generate expressions for GHCJS instead, then you'll just have to run it with the flag "--compiler=ghcjs". Builds generated by the Nix function haskell.packages.ghcjs.callHackage do this automatically. Best regards, Peter From rik at dcs.bbk.ac.uk Tue Nov 1 09:41:51 2016 From: rik at dcs.bbk.ac.uk (Rik Howard) Date: Tue, 1 Nov 2016 09:41:51 +0000 Subject: [Haskell-cafe] Haskell-Cafe Digest, Vol 158, Issue 29 In-Reply-To: <706f4620-d604-f87e-dffc-b939317b76cd@cs.otago.ac.nz> References: <36384d09-9d23-265c-5f4e-e379cb6a0bb7@cs.otago.ac.nz> <706f4620-d604-f87e-dffc-b939317b76cd@cs.otago.ac.nz> Message-ID: As usual, you give me much to ponder. For some reason it pleases that the world is not too concerned with what we happen to like. But it's not true to what is *there*, and if you program for that model, > you're going to get terrible performance. I heard recently of a type system that captures the complexity of functions in their signatures. With that information available to the machine, perhaps the machine could be equipped with a way to plan an execution such that performance is optimised. Your day with the HPC system sounds fascinating. Do you think that an Ada/Occam-like approach to partitioned distribution could tame the sort address space that you encountered on the day? > Any programming model that relies on large flat shared address spaces is > out; message passing that copies stuff is going to be much easier to manage > than passing a pointer to memory that might be powered off when you need it But there'll still be some call for shared memory? Or maybe only for persistence stores? One of the presenters was working with a million lines of Fortran, almost > all of it written by other people. How do we make that safe? Ultimately only proof can verify safety. (I'm trying to address something like that in my rewrite, which given the high quality of feedback from this list, I hope to post soon.) On 31 October 2016 at 04:07, Richard A. O'Keefe wrote: > > > On 31/10/16 5:44 AM, Rik Howard wrote: > >> thanks for the reply. Conceptually I like the idea of a single address >> space, it can then be a matter of configuration as to whether what >> you're addressing is another local process, processor or something more >> remote. >> > > The world doesn't care what you or I happen to like. > I completely agree in *liking* a single address space. > But it's not true to what is *there*, and if you program for that > model, you're going to get terrible performance. > > I've just been attending a 1-day introduction to our national HPC > system. There are two clusters. One has about 3,300 cores and > the other over 6,000. One is POWER+AIX, the other Intel+Linux. > One has Xeon Phis (amongst other things), the other does not. > Hint: neither of them has a single address space, and while we > know about software distributed memory (indeed, one of the people > here has published innovative research in that area), it is *not* > like a single address space and is not notably easy to use. > > It's possible to "tame" single address space. When you start to > learn Ada, you *think* you're dealing with a single address space > language, until you learn about partitioning programs for > distributed execution. For that matter, Occam has the same > property (which is one of the reasons why Occam didn't have > pointers, so that it would be *logically* a matter of indifference > whether two concurrent processors were on the same chip or not). > > But even when communication is disguised as memory accessing, > it's still communication, it still *costs* like communication, > and if you want high performance, you had better *measure* it > as communication. > > One of the presenters was working with a million lines of Fortran, > almost all of it written by other people. How do we make that safe? > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From alexander.kjeldaas at gmail.com Tue Nov 1 10:51:22 2016 From: alexander.kjeldaas at gmail.com (Alexander Kjeldaas) Date: Tue, 1 Nov 2016 11:51:22 +0100 Subject: [Haskell-cafe] GHCJS Bad first impression In-Reply-To: References: Message-ID: The culprit is that GHCJS isn't released. This again means that the stack project doesn't want to support it (yet). This is unfortunate, but the way things are. (In addition to GHCJS not being released, I'm guessing that there is no FP Complete customer using ghcjs yet) I wouldn't recommend using nix for this, as when you work with ghcjs, you'll likely need to be on the bleeding edge anyways. I don't see what issue nix solves in this, but it does add an extra level of complexity. If you want to use stackage nightly (as lts is a bit stuck at the moment), I can recommend the following which works for me: resolver: nightly-2016-10-25 compiler: ghcjs-0.2.1.820161025_ghc-8.0.1 compiler-check: match-exact setup-info: ghcjs: source: ghcjs-0.2.1.820161025_ghc-8.0.1: url: http://tolysz.org/ghcjs/untested/ghc-8.0-2016-10-25-nightly-2016-10-25-820161025.tar.gz sha1: ca05f23ab6af89803a9fa8ce7241ebdd2eee7dae Alexander On Sun, Oct 30, 2016 at 10:01 AM, Zachary Kessin wrote: > I am starting a project that might use ghcjs and it seems to me that if > someone's first impression of it is tying stack install and having it take > several hours to build everything that is not a very welcoming way to get > people to use ghcjs. Why not precompiled binaries? > > Also while It has been compiling i have seen a lot of warnings? > > Zach > > -- > Zach Kessin > SquareTarget > Twitter: @zkessin > Skype: zachkessin > ᐧ > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zkessin at gmail.com Tue Nov 1 12:41:51 2016 From: zkessin at gmail.com (Zachary Kessin) Date: Tue, 1 Nov 2016 14:41:51 +0200 Subject: [Haskell-cafe] Suggestion: A catalog of Language extensions Message-ID: I have noticed that almost every haskell source file I have looked at has 4-8 language extensions. It would be very nice if there was a page somewhere that listed them all and gave a short (1 paragraph) description of what that extension does and what it is normally used for. That is not a detailed description of the API but a short description of *WHY* you might want to use it. Followed by a link to the API -- Zach Kessin SquareTarget Twitter: @zkessin Skype: zachkessin ᐧ -------------- next part -------------- An HTML attachment was scrubbed... URL: From max.voit+mlhc at with-eyes.net Tue Nov 1 12:51:42 2016 From: max.voit+mlhc at with-eyes.net (Max Voit) Date: Tue, 1 Nov 2016 13:51:42 +0100 Subject: [Haskell-cafe] Suggestion: A catalog of Language extensions In-Reply-To: References: Message-ID: <20161101135142.2d6853e0@veeloqu.lan> On Tue, 1 Nov 2016 14:41:51 +0200 Zachary Kessin wrote: > I have noticed that almost every haskell source file I have looked at > has 4-8 language extensions. It would be very nice if there was a page > somewhere that listed them all and gave a short (1 paragraph) > description of what that extension does and what it is normally used > for. That is not a detailed description of the API but a short > description of *WHY* you might want to use it. Followed by a link to > the API There is https://downloads.haskell.org/~ghc/8.0.1/docs/html/users_guide/lang.html and the more compact https://downloads.haskell.org/~ghc/8.0.1/docs/html/libraries/Cabal-1.24.0.0/Language-Haskell-Extension.html Best, Max From imantc at gmail.com Tue Nov 1 12:54:34 2016 From: imantc at gmail.com (Imants Cekusins) Date: Tue, 1 Nov 2016 13:54:34 +0100 Subject: [Haskell-cafe] Suggestion: A catalog of Language extensions In-Reply-To: References: Message-ID: > There is one more: http://ghc.readthedocs.io/en/8.0.1/glasgow_exts.html ​ -------------- next part -------------- An HTML attachment was scrubbed... URL: From toad3k at gmail.com Tue Nov 1 13:13:43 2016 From: toad3k at gmail.com (David McBride) Date: Tue, 1 Nov 2016 09:13:43 -0400 Subject: [Haskell-cafe] Suggestion: A catalog of Language extensions In-Reply-To: References: Message-ID: In addition to what others have said, there was a 24 days of ghc extensions last year which highlighted some of the more interesting extensions and more importantly, why you might use them. https://ocharles.org.uk/blog/pages/2014-12-01-24-days-of-ghc-extensions.html On Tue, Nov 1, 2016 at 8:41 AM, Zachary Kessin wrote: > I have noticed that almost every haskell source file I have looked at has > 4-8 language extensions. It would be very nice if there was a page > somewhere that listed them all and gave a short (1 paragraph) description > of what that extension does and what it is normally used for. That is not a > detailed description of the API but a short description of *WHY* you might > want to use it. Followed by a link to the API > > -- > Zach Kessin > SquareTarget > Twitter: @zkessin > Skype: zachkessin > ᐧ > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From abela at chalmers.se Tue Nov 1 18:45:16 2016 From: abela at chalmers.se (Andreas Abel) Date: Tue, 1 Nov 2016 19:45:16 +0100 Subject: [Haskell-cafe] Cfa TTT 2017 (Type Theory Based Tools) Message-ID: CALL FOR ABSTRACTS TTT : Type Theory Based Tools ============================= Satellite workshop of POPL 2017, Paris France, January 15th [We have funding possibilities for students and young researchers, see below. Note the early deadline!] Overview ======== The aim of this workshop is to showcase modern tools based on type theory, whether designed for programming or for verification, whether academic projects or used in an industrial setting. It will provide a forum to highlight and discuss their common and their distinctive features, and the future directions of development of the tools. The program will consist of invited and contributed talks, and will encourage informal discussion. Abstracts will be displayed on the website of the workshop but there will be no proceedings. We solicit abstract submissions proposing demos, case studies, describing the impact of a theoretical result on practice, or any other aspect of the development and use of tools based on type theory. In particular, we welcome submissions about prototype implementations and promising work in progress, as soon as they have the potential of raising interesting discussions. This workshop is funded by the EUTypes COST project (https://eutypes.cs.ru.nl/). The program will include a plenary discussion on the role of the EUTypes project in the community and planning of activities for 2017. Invited Speakers ================ Robbert Krebbers, Delft University of Technology, Netherlands Aaron Tomb, Galois, US More speakers to be confirmed Registration ============ Registration information will be soon available at the main POPL 2017 website: http://conf.researchr.org/home/POPL-2017 Participant funding =================== The EUTypes COST project (https://eutypes.cs.ru.nl/) can fund students and young researchers from countries participating in the project to attend the workshop – check http://www.cost.eu/COST_Actions/ca/CA15123?parties to see if your country is listed. The application should include the following information: * Your name * Your institution * The name of your supervisor(s) * The url of your webpage if you have one * Your research topics or interests in 1 paragraph and should be sent to ttt2017 at easychair.org as soon as possible and no later than November 20th. Contact ======= For any query about this workshop, please contact us at ttt2017 at easychair.org Call for abstracts ================== Submissions for talks and demonstrations should be described in an extended abstract, between 1 and 2 pages in length. We suggest formatting the text using the two-column SIGPLAN LaTeX style (9pt font). Submission page: https://easychair.org/conferences/?conf=ttt2017 Important dates =============== Submission deadline: 30 November 2016 Notification: 15 December 2016 Workshop: 15 January 2017 Program Committee ================= Andreas Abel, Gothenburg University, Sweden Andrej Bauer, University of Ljubljana, Slovenia Assia Mahboubi, Inria Université Paris-Saclay, France Keiko Nakata, Germany -- 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 list at mroth.net Tue Nov 1 16:07:47 2016 From: list at mroth.net (Michael Roth) Date: Tue, 1 Nov 2016 17:07:47 +0100 Subject: [Haskell-cafe] Suggestion for Data Structure regarding Timetabling and Time Intervals Message-ID: I would like to experiment with timetabling algorithms and resource scheduling in a special use case: I have time intervals like A, B and C and they are put sequentially on a time line. However, between the major time intervals like A, B etc. their are always "minor" time intervals which separates the major ones. For example: a, A, ab, B, bc, C, c Upper case letters denotes "major" time intervals and lower case letters denotes the minor intervals which always separates the major ones. The minor time intervals only have a duration, their exact occurrence in time doesn't matter, only the fact that they occur between the major time intervals are important. The major time intervals start and stop a specific time; they don't overlap and maybe there is free time between major and/or minor time intervals. The minor time intervals "a" and "b" at the beginning and ending of the complete time line I'm not interested in and can be omitted completely. Say, to insert a time interval X after B, assuming there is enough free time between B and C, the resulting structure is: a, A, ab, B, bx, X, xc, C, c The minor time interval "bc" is discarded and two new minor time intervals "bx" and "xc" are inserted. I'm a little bit stuck what a good data structure would be for this problem. Additionally I would like to use an infinite data structure, because a priori I don't know how many time intervals have to be created and inserted into the time line. The time intervals are not generated in an ascending order. An algorithm will search for possible places to insert the new created major time intervals and creates the corresponding minor time intervals. There is the concept of a "present time" in this process. The algorithm can only manipulate the future. I thought to push all time intervals in the past respective to this "present time" to a MonadWriter to get my infinite list of time intervals. The "present time" is moved forward at specific events. What do you experts think about the approach with the MonadWriter? What would be a good data structure to ensure that all major time intervals are separated by minor time intervals? Thank you in advance for your ideas and comments, Michael Roth From jo at durchholz.org Tue Nov 1 21:28:51 2016 From: jo at durchholz.org (Joachim Durchholz) Date: Tue, 1 Nov 2016 22:28:51 +0100 Subject: [Haskell-cafe] Haskell-Cafe Digest, Vol 158, Issue 29 In-Reply-To: <5bd71407-0a1d-c2fc-5a60-bcb56e26aebc@cs.otago.ac.nz> References: <36384d09-9d23-265c-5f4e-e379cb6a0bb7@cs.otago.ac.nz> <706f4620-d604-f87e-dffc-b939317b76cd@cs.otago.ac.nz> <8f85862d-d14a-342b-b489-ad394afe92cb@durchholz.org> <5bd71407-0a1d-c2fc-5a60-bcb56e26aebc@cs.otago.ac.nz> Message-ID: <5f58df52-d6cc-7c13-cc4f-95c35e720293@durchholz.org> Am 01.11.2016 um 01:37 schrieb Richard A. O'Keefe: > > > On 1/11/16 9:54 AM, Joachim Durchholz wrote: >> >> And you need to control memory coherence, i.e. you need to define what >> data goes together with what processes. > > At this point I'm puzzled. Languages like Occam, ZPL, and Co-Array > Fortran basically say NO! to memory coherence. Sure, but unrelated. > Of course you say > which data goes with what process. The hope with FPLs was that you do not need to explicitly specify it anymore, because the compiler can manage that. Or maybe the considerably weaker scenario: that the programmer still explicitly defines what computation with what data forms a unit, but that it is easy to move boundaries. > If the data need to be available > in some other process, there is some sort of fairly explicit > communication. Which means that you do not have a simple function call anymore, but an extra API layer. >> In an ideal world, the compiler would be smart enough to do that for you. >> I have been reading fantasies that FPLs with their immutable data >> structures are better suited for this kind of automation; > > Memory coherence exists as an issue when data are replicated and > one of the copies gets mutated, so that the copies are now inconsistent. > With immutable data this cannot be a problem. This still does not tell you where to draw the boundaries inside your system. If anything, it is getting harder with non-strict languages because it is harder to predict what computation will be run at what time. > For what it's worth, the "Clean" programming language used to be > called "Concurrent Clean" because it was set up to run on a cluster > of Macintoshes. Clean is strict ;-) >> Without that, you'd code explicit multithreading, which means that >> communication does not look like memory access at all. > > I believe my argument was that it *shouldn't* look like memory access. It's something that some people want(ed). Yours Truly being one of them, actually. It's just that I have become sceptical about the trade-offs. Plus, the more I read about various forms of partitioning computations (not just NUMA but also IPC and networking), the more it seems that hardware moves towards making the barriers higher, not lower (the reason being that this helps making computations within the barrier more efficient). If that's a general trend, that's bad news for network, IPC, or NUMA transparency. Which is going to make programming for these harder, not easier :-( From itstheimp at gmail.com Tue Nov 1 23:29:38 2016 From: itstheimp at gmail.com (=?UTF-8?Q?Ole_Kr=C3=BCger?=) Date: Tue, 01 Nov 2016 23:29:38 +0000 Subject: [Haskell-cafe] DefaultSignature versus overlapping instance Message-ID: Ahoy, I have the following type class. -- | An entity whose underlying information spans zero or more columns class ResultEntity a where -- | Build an instance of @a at . parseEntity :: RowParser a default parseEntity :: (EligibleDataType meta cons a) => RowParser a parseEntity = parseGeneric The EligibleDataType constraint allows me to construct a RowParser with the help of generics. It is so minimal that I am considering to transform the hole thing into this. -- | An entity whose underlying information spans zero or more columns class ResultEntity a where -- | Build an instance of @a at . parseEntity :: RowParser a instance {-# OVERLAPPABLE #-} (EligibleDataType meta cons a) => ResultEntity a where parseEntity = parseGeneric This makes defining new instances of ResultEntity obsolete for types that already satisfy the EligibleDataType constraint (basically everything that has a Generic instance). It is still possible to provide a hand-rolled instance. Undecidable and overlapping instances seem like a big no-no. Even after reading up on them, I can't get rid of the feeling that this might be dangerous. *Is it dangerous? *I am targeting GHC 8.0.1 with this. - Ole -------------- next part -------------- An HTML attachment was scrubbed... URL: From djohnson.m at gmail.com Tue Nov 1 23:47:03 2016 From: djohnson.m at gmail.com (David Johnson) Date: Tue, 1 Nov 2016 18:47:03 -0500 Subject: [Haskell-cafe] GHCJS Bad first impression In-Reply-To: <87shrb1w8g.fsf@write-only.cryp.to> References: <612AF2B8-4175-4244-95C7-15D096BC7628@gmail.com> <87shrb1w8g.fsf@write-only.cryp.to> Message-ID: Hi Peti, Thanks for chiming in on this, was not aware cabal2nix's ghcjs functionality. This is great. There are some packages in haskellPackages (ghcjs-dom-jsffi) that are really only meant to be used with ghcjs. In this case would it be appropriate to somehow detect this, and use the "--compiler-ghcjs" flag during generation? Or is it better for us to resort to overriding all ghcjs specific packages on hackage in "pkgs/development/haskell-modules/configuration-ghcjs.nix" ? The derivation below is pretty much useless for anyone using GHC (not a library nor executable, 0 deps specified). I imagine as GHCJS continues to grow, and hackage contains more 'ghcjs-only' packages, it will become onerous to continally override in configuration-ghcjs.nix (ghcjs-dom is also a good example of needing to do this). ``` "ghcjs-dom-jsffi" = callPackage ({ mkDerivation }: mkDerivation { pname = "ghcjs-dom-jsffi"; version = "0.5.0.2"; sha256 = "... some hash ..."; isLibrary = false; isExecutable = false; description = "DOM library using JSFFI and GHCJS"; license = stdenv.lib.licenses.mit; hydraPlatforms = stdenv.lib.platforms.none; }) {}; ``` Peti, is there a way we could generate two derivations (w/ and w/o the --ghcjs flag) and conditionally select the one we want based on the compiler (meaning ghcjs vs. latest ghc)? Regards, David On Tue, Nov 1, 2016 at 2:43 AM, Peter Simons wrote: > Hi David, > > > cabal2nix doesn't generate nix expressions that are sensitive to ghcjs. > > the expressions in Nixpkgs target GHC 8.0.x, not GHCJS. If you want > cabal2nix to generate expressions for GHCJS instead, then you'll just > have to run it with the flag "--compiler=ghcjs". Builds generated by the > Nix function haskell.packages.ghcjs.callHackage do this automatically. > > Best regards, > Peter > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > -- Cell: 1.630.740.8204 -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok at cs.otago.ac.nz Wed Nov 2 00:24:53 2016 From: ok at cs.otago.ac.nz (Richard A. O'Keefe) Date: Wed, 2 Nov 2016 13:24:53 +1300 Subject: [Haskell-cafe] Haskell-Cafe Digest, Vol 158, Issue 29 In-Reply-To: <5f58df52-d6cc-7c13-cc4f-95c35e720293@durchholz.org> References: <36384d09-9d23-265c-5f4e-e379cb6a0bb7@cs.otago.ac.nz> <706f4620-d604-f87e-dffc-b939317b76cd@cs.otago.ac.nz> <8f85862d-d14a-342b-b489-ad394afe92cb@durchholz.org> <5bd71407-0a1d-c2fc-5a60-bcb56e26aebc@cs.otago.ac.nz> <5f58df52-d6cc-7c13-cc4f-95c35e720293@durchholz.org> Message-ID: <7c2ec8cc-6631-479a-09d4-41e3a23473d0@cs.otago.ac.nz> On 2/11/16 10:28 AM, Joachim Durchholz wrote: We're still not really communicating, so it may be time to draw this thread to a close soon. > Am 01.11.2016 um 01:37 schrieb Richard A. O'Keefe: >> >> >> On 1/11/16 9:54 AM, Joachim Durchholz wrote: >>> >>> And you need to control memory coherence, i.e. you need to define what >>> data goes together with what processes. >> >> At this point I'm puzzled. Languages like Occam, ZPL, and Co-Array >> Fortran basically say NO! to memory coherence. > > Sure, but unrelated. How is it unrelated? If you don't need, don't want, and don't have "memory coherence", then you don't have to control it. > The hope with FPLs was that you do not need to explicitly specify it > anymore, because the compiler can manage that. The Alan Perlis quote applies: When someone says: "I want a programming language in which I need only say what I wish done", give him a lollipop. In declarative languages, you give up explicit control over some things in order to make other things easier to express. A compiler has three ways to decide which are the "important" things: - by analysis - by being told (there's the famous anecdote about the original Fortran FREQUENCY statement being implemented backwards and nobody noticing) - by measuring (standard technology in C compilers for years now) Nearly 20 years ago I was using a C compiler that would shuffle functions around in your executable in order to reduce page faults. That's the "measurement" approach. >> If the data need to be available >> in some other process, there is some sort of fairly explicit >> communication. > > Which means that you do not have a simple function call anymore, but an > extra API layer. Here you have left me behind. WHAT was "a simple function call"? WHAT is "an extra API layer", as opposed to annotations like the distribution annotations in ZPL and HPFortran? >> For what it's worth, the "Clean" programming language used to be >> called "Concurrent Clean" because it was set up to run on a cluster >> of Macintoshes. > > Clean is strict ;-) That one line provoked this reply. Clean isn't any stricter than Haskell. It does strictness inference, just like GHC. It allows strictness annotations, just like GHC (though not in Haskell 2010). Plus, the more I read about various > forms of partitioning computations (not just NUMA but also IPC and > networking), the more it seems that hardware moves towards making the > barriers higher, not lower (the reason being that this helps making > computations within the barrier more efficient). > > If that's a general trend, that's bad news for network, IPC, or NUMA > transparency. Which is going to make programming for these harder, not > easier :-( On the one hand, agreed. On the other hand, while programming in the 1960s still *is* getting harder, it's not clear that we cannot find an approach that will be easier. To my astonishment, quite a lot of the people using NZ's supercomputer facility are programming in Python (basically glue code hooking up existing applications), or Matlab (serious number-crunching, which they say they've benchmarked against C), or even R (yes, R; NOT one of the world's faster languages, BUT again we're mostly talking about glue code hooking together existing building-blocks). And this facility has people who will help researchers with their supercomputer programming for free. The Science Data Processor for the Square Kilometre Array will have a multi-level structure - compute elements contain multiple cores, probably GPUs, and probably FPGAs. These are roughly the equivalent of laptops. - compute nodes are tightly integrated clusters containing multiple compute elements + interconnects + extra storage - compute islands are looser clusters containing multiple compute nodes and management stuff - the SDP will contain multiple compute islands + massive interconnects (3TB/sec data coming in) - there will be two SDPs, each sharing a multimegawatt power station with a signal processing system that talks directly to the telescopes. Managing massive data flows and scheduling the computational tasks is going to be seriously hard work. One of the main tools for managing stuff like this is ISOLATION, and LIMITING communication as much as possible, which is the very opposite of the large flat shared memory model. From jo at durchholz.org Wed Nov 2 05:46:36 2016 From: jo at durchholz.org (Joachim Durchholz) Date: Wed, 2 Nov 2016 06:46:36 +0100 Subject: [Haskell-cafe] Haskell-Cafe Digest, Vol 158, Issue 29 In-Reply-To: <7c2ec8cc-6631-479a-09d4-41e3a23473d0@cs.otago.ac.nz> References: <36384d09-9d23-265c-5f4e-e379cb6a0bb7@cs.otago.ac.nz> <706f4620-d604-f87e-dffc-b939317b76cd@cs.otago.ac.nz> <8f85862d-d14a-342b-b489-ad394afe92cb@durchholz.org> <5bd71407-0a1d-c2fc-5a60-bcb56e26aebc@cs.otago.ac.nz> <5f58df52-d6cc-7c13-cc4f-95c35e720293@durchholz.org> <7c2ec8cc-6631-479a-09d4-41e3a23473d0@cs.otago.ac.nz> Message-ID: Am 02.11.2016 um 01:24 schrieb Richard A. O'Keefe: > >> The hope with FPLs was that you do not need to explicitly specify it >> anymore, because the compiler can manage that. > > The Alan Perlis quote applies: > When someone says: "I want a programming language in which > I need only say what I wish done", give him a lollipop. It does not really apply, the quote talks about how "say what one wishes one" turns into a programming language, albeit a higher-level one. We're talking about assigning memory to memory areas. That's a very different story, and one where other previously unthinkable features are applied by GHC today, such as efficient automatic memory reclamation, or elimination of intermediate data structures. >>> If the data need to be available >>> in some other process, there is some sort of fairly explicit >>> communication. >> >> Which means that you do not have a simple function call anymore, but an >> extra API layer. > > Here you have left me behind. WHAT was "a simple function call"? > WHAT is "an extra API layer", as opposed to annotations like the > distribution annotations in ZPL and HPFortran? I wasn't aware of these annotations, so I was talking from the perspective how you'd do it in one of today's vanilla languages. >> Plus, the more I read about various >> forms of partitioning computations (not just NUMA but also IPC and >> networking), the more it seems that hardware moves towards making the >> barriers higher, not lower (the reason being that this helps making >> computations within the barrier more efficient). >> >> If that's a general trend, that's bad news for network, IPC, or NUMA >> transparency. Which is going to make programming for these harder, not >> easier :-( > > On the one hand, agreed. On the other hand, while programming in the > 1960s still *is* getting harder, it's not clear that we cannot find an > approach that will be easier. Agreed. From ok at cs.otago.ac.nz Wed Nov 2 05:50:48 2016 From: ok at cs.otago.ac.nz (Richard A. O'Keefe) Date: Wed, 2 Nov 2016 18:50:48 +1300 Subject: [Haskell-cafe] Using unboxed integers Message-ID: I have x, y :: Int# I expect that x <=# y :: Bool but ghc 7.8 says Couldn't match expected type ‘Bool’ with actual type ‘Int#’ In the expression: x <=# y In an equation for ‘b’: b = x <=# y I have MagicHash and I've imported the right modules so that <=# is recognised as *something*, but at this point I'm baffled. I'm also not clear on how I can show an Int#. From rahulmutt at gmail.com Wed Nov 2 05:58:02 2016 From: rahulmutt at gmail.com (Rahul Muttineni) Date: Wed, 2 Nov 2016 11:28:02 +0530 Subject: [Haskell-cafe] Using unboxed integers In-Reply-To: References: Message-ID: Use the isTrue# function which is made visible by importing GHC.Base. isTrue# (x <=# y) :: Bool You can show an Int# by wrapping it up in an I# data constructor and applying show to it: x# :: Int# show (I# x#) ::String You can make the I# data constructor visible via GHC.Base like above. Hope that helps! Rahul On Wed, Nov 2, 2016 at 11:20 AM, Richard A. O'Keefe wrote: > I have x, y :: Int# > I expect that x <=# y :: Bool > but ghc 7.8 says > Couldn't match expected type ‘Bool’ with actual type ‘Int#’ > In the expression: x <=# y > In an equation for ‘b’: b = x <=# y > > I have MagicHash and I've imported the right modules so that > <=# is recognised as *something*, but at this point I'm baffled. > > I'm also not clear on how I can show an Int#. > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -- Rahul Muttineni -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok at cs.otago.ac.nz Wed Nov 2 06:15:12 2016 From: ok at cs.otago.ac.nz (Richard A. O'Keefe) Date: Wed, 2 Nov 2016 19:15:12 +1300 Subject: [Haskell-cafe] Using unboxed integers In-Reply-To: References: Message-ID: <896319b7-2689-55c5-bbba-c8ea2ed7fc0e@cs.otago.ac.nz> import GHC.Base isTrue# (comparison) show (I# x#) worked. Thank you very much. This made a barely measurable difference to my program, so I now that I know how to use unboxed integers, I can forget again. From simons at nospf.cryp.to Wed Nov 2 06:42:40 2016 From: simons at nospf.cryp.to (Peter Simons) Date: Wed, 02 Nov 2016 07:42:40 +0100 Subject: [Haskell-cafe] GHCJS Bad first impression References: <612AF2B8-4175-4244-95C7-15D096BC7628@gmail.com> <87shrb1w8g.fsf@write-only.cryp.to> Message-ID: <8760o6757j.fsf@write-only.cryp.to> Hi David, > There are some packages in haskellPackages (ghcjs-dom-jsffi) that are > really only meant to be used with ghcjs. In this case would it be > appropriate to somehow detect this, and use the "--compiler=ghcjs" > flag during generation? the tricky part is to somehow detect this. :-) If we'd know that a certain package targets ghcjs only, then we could generate the instructions specifically for that compiler. That would make our users lives much easier, because more builds would work out of the box. I'm just not sure how to detect this property. Also, this heuristic would not help with building packages that target both ghc and ghcjs, i.e. by using conditional logic in the Cabal file. > is there a way we could generate two derivations (w/ and w/o the > --ghcjs flag) and conditionally select the one we want based on the > compiler (meaning ghcjs vs. latest ghc)? Nix is powerful enough to make those distinctions, and for a while I considered extending the generator to generate expressions that capture all the conditional logic found in Cabal: https://github.com/NixOS/cabal2nix/blob/master/doc/03-map-cabal-files-to-nix-without-information-loss.md In the end, I didn't bother though because the callHackage function solves this problem by generating build expressions that fit the environment of the function, i.e. haskell.packages.ghc704.callHackage "hsdns" "1.6.1" {} gives you a build that targets GHC version 7.0.4 and haskell.packages.ghcjs.callHackage "hsdns" "1.6.1" {} gives you a build that targets GHCJS. callHackage accomplishes that by generating the Nix expressions during the time of evaluation and then importing the generated expression from the Nix store. Unfortunately, this import-from-derivation feature raises a several design issues for Nix that no-one has been able to answer satisfactorily yet: https://github.com/NixOS/nix/issues/954 Most importantly, it's unclear how to make that feature interact with Hydra, which runs Nix in its "restricted mode" that disables IFD. Best regards, Peter From corentin.dupont at gmail.com Wed Nov 2 08:57:44 2016 From: corentin.dupont at gmail.com (Corentin Dupont) Date: Wed, 2 Nov 2016 09:57:44 +0100 Subject: [Haskell-cafe] file name to module name Message-ID: Hi there, is there somewhere in the libraries a function to transform a file name into a module name? for exemple: "src/Data/List.hs" --> "Data.List" Thanks! Corentin -------------- next part -------------- An HTML attachment was scrubbed... URL: From itstheimp at gmail.com Wed Nov 2 14:45:40 2016 From: itstheimp at gmail.com (=?UTF-8?Q?Ole_Kr=C3=BCger?=) Date: Wed, 02 Nov 2016 14:45:40 +0000 Subject: [Haskell-cafe] DefaultSignature versus overlapping instance In-Reply-To: References: Message-ID: It seems the formatting got mutilated, so I am posting this in proper format, again. I apologize for the spam. Ahoy, I have the following type class. -- | An entity whose underlying information spans zero or more columns class ResultEntity a where -- | Build an instance of @a@ parseEntity :: RowParser a default parseEntity :: (EligibleDataType meta cons a) => RowParser a parseEntity = parseGeneric The EligibleDataType constraint allows me to construct a RowParser with the help of generics. It is so minimal that I am considering to transform the hole thing into this. -- | An entity whose underlying information spans zero or more columns class ResultEntity a where -- | Build an instance of @a at . parseEntity :: RowParser a instance {-# OVERLAPPABLE #-} (EligibleDataType meta cons a) => ResultEntity a where parseEntity = parseGeneric This makes defining new instances of ResultEntity obsolete for types that already satisfy the EligibleDataType constraint (basically everything that has a Generic instance). And it is still possible to provide a hand-rolled instance. Undecidable and overlapping instances seem like a big no-no. Even after reading up on them, I can't get rid of the feeling that this might be dangerous. Is it dangerous? I am targeting GHC 8.0.1 with this. - Ole -------------- next part -------------- An HTML attachment was scrubbed... URL: From harendra.kumar at gmail.com Wed Nov 2 16:05:09 2016 From: harendra.kumar at gmail.com (Harendra Kumar) Date: Wed, 2 Nov 2016 21:35:09 +0530 Subject: [Haskell-cafe] Package metadata format - notes from discussion Message-ID: For reference, I have organized the major points of the discussion that happened earlier on haskell-cafe regarding package metadata format (cabal vs yaml, vs toml, vs hs). Take a look at this: https://github.com/harendra-kumar/package-metadata In my opinion, in the short term it might help if the cabal format is improved, the parser is modularized and detached from the cabal tool itself so that it can be used independently by any other tools wishing to do so. For long term possibility of change of format, I do not intend to pursue or investigate it further at this point of time but others who are interested are free to do so. -harendra -------------- next part -------------- An HTML attachment was scrubbed... URL: From simons at nospf.cryp.to Wed Nov 2 16:16:04 2016 From: simons at nospf.cryp.to (Peter Simons) Date: Wed, 02 Nov 2016 17:16:04 +0100 Subject: [Haskell-cafe] Package metadata format - notes from discussion References: Message-ID: <87shr9503f.fsf@write-only.cryp.to> Hi Harendra, > It might help if the [Cabal] parser is modularized and detached from > the cabal tool itself so that it can be used independently by any > other tools wishing to do so. I'm not quite sure how to interpret that statement. The parser for the Cabal format is quite modular and re-usable already and has been available in the Cabal library for years: http://hackage.haskell.org/package/Cabal-1.24.0.0/docs/Distribution-PackageDescription-Parse.html Am I missing something? Best regards, Peter From harendra.kumar at gmail.com Wed Nov 2 17:05:33 2016 From: harendra.kumar at gmail.com (Harendra Kumar) Date: Wed, 2 Nov 2016 22:35:33 +0530 Subject: [Haskell-cafe] Package metadata format - notes from discussion In-Reply-To: <87shr9503f.fsf@write-only.cryp.to> References: <87shr9503f.fsf@write-only.cryp.to> Message-ID: Peter, My point was to make it easier for any new tool writers to choose the same format over something entirely new, there are some examples in the notes. I have not investigated it in detail but there must be some reason why the cabal format is not being adopted or is not likely to be adopted by new tools describing package metadata; I was thinking the format being seen as tightly attached to cabal and not usable in general might be one reason. Is it likely to be seen as an independent format if it has a spec describing it and an independent parsing library? Or is it some entirely different reason altogether? Or maybe its not worth caring about whether all tools use the same language for metadata, I might be the only one? -harendra On 2 November 2016 at 21:46, Peter Simons wrote: > Hi Harendra, > > > It might help if the [Cabal] parser is modularized and detached from > > the cabal tool itself so that it can be used independently by any > > other tools wishing to do so. > > I'm not quite sure how to interpret that statement. The parser for the > Cabal format is quite modular and re-usable already and has been available > in the Cabal library for years: > > http://hackage.haskell.org/package/Cabal-1.24.0.0/docs/Distribution- > PackageDescription-Parse.html > > Am I missing something? > > Best regards, > Peter > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From olf at aatal-apotheke.de Wed Nov 2 20:26:32 2016 From: olf at aatal-apotheke.de (Olaf Klinke) Date: Wed, 2 Nov 2016 21:26:32 +0100 Subject: [Haskell-cafe] Suggestion for Data Structure regarding Timetabling and Time Intervals Message-ID: <63753058-716B-4D2B-8D8F-4B0F77732C2A@aatal-apotheke.de> Dear Michael, if you can be sure your intervals will never overlap, why not use a binary search tree, such as Data.Set from containers? You could make a data structure distinguishing major and minor intervals such as: type Time = -- your favourite totally ordered time type data Major = Major { fromTime :: Time, untilTime :: Time} deriving (Eq) data Minor = Minor { after :: Time before :: Time} deriving (Eq) type TimeInterval = Either Minor Major instance Ord (Either Minor Major) where Left a <= Left b = before a <= after b Right a <= Right b = untilTime a <= fromTime b Left a <= Right b = before a <= fromTime b Right a <= Left b = untilTime a <= after b If I understood your intentions correctly, inserting a minor interval between a :: Major and b :: Major where a < b would mean to insert Minor {after = untilTime a, before = fromTime b} It might also be handy to define a new type (isomorphic to the product (a,b)) Anno a b = Anno a b whose Ord instance uses the Ord instance of b only, so that Anno "Some annotation" (Major t0 t1) is an interval bearing some annotation that can be ordered just like the Major type. If your intervals _do_ overlap, then two intervals can be in six different configurations (instead of LT, GT and EQ), and several tree structures exist that support some operations more or less efficiently. Bioinformatics and geometry has developed good data structures and algorithms to deal with efficient overlap searches. Olaf From olf at aatal-apotheke.de Wed Nov 2 20:26:36 2016 From: olf at aatal-apotheke.de (Olaf Klinke) Date: Wed, 2 Nov 2016 21:26:36 +0100 Subject: [Haskell-cafe] Suggestion: A catalog of Language (broken links) Message-ID: <7DDD8E72-EC2A-4F5F-898B-CB2FE1FD29DB@aatal-apotheke.de> The documentation https://downloads.haskell.org/~ghc/8.0.1/docs/html/libraries/Cabal-1.24.0.0/Language-Haskell-Extension.html was mentioned in a post on haskell-cafe, and I found that every link to a specific KnownExtension there is broken. Olaf From allbery.b at gmail.com Wed Nov 2 20:39:13 2016 From: allbery.b at gmail.com (Brandon Allbery) Date: Wed, 2 Nov 2016 16:39:13 -0400 Subject: [Haskell-cafe] Suggestion: A catalog of Language (broken links) In-Reply-To: <7DDD8E72-EC2A-4F5F-898B-CB2FE1FD29DB@aatal-apotheke.de> References: <7DDD8E72-EC2A-4F5F-898B-CB2FE1FD29DB@aatal-apotheke.de> Message-ID: On Wed, Nov 2, 2016 at 4:26 PM, Olaf Klinke wrote: > I found that every link to a specific KnownExtension there is broken. ghc8 redid the manual completely; the links would be correct for the 7.10.3 manual, but the haddock references /latest/ instead of a specific known-good version. (someone did not think too hard about that...) -- 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 danburton.email at gmail.com Wed Nov 2 22:08:16 2016 From: danburton.email at gmail.com (danburton.email at gmail.com) Date: Wed, 02 Nov 2016 22:08:16 +0000 Subject: [Haskell-cafe] Call for participation: BayHac 2017 survey Message-ID: <94eb2c039f6e93695b054058ada1@google.com> I've invited you to fill out the following form: BayHac 2017 participation survey To fill it out, visit: https://docs.google.com/forms/d/e/1FAIpQLSdaHON7_RFSwR-2aAHpR8bJ6IUvpQ7Usul--LiIyr6p-a-JXw/viewform?c=0&w=1&usp=mail_form_link BayHac is a Haskell hackathon weekend event for the San Francisco Bay Area and Silicon Valley. It will be a weekend of learning, hacking, and connecting with fellow Haskell enthusiasts. The proposed outline for 2017 is: Friday: Haskell in Production & getting started with Haskell Saturday: Get involved! Highlights of various open source Haskell projects. Sunday: Follow along: Abstract concepts taught via Haskell code snippets. As we solidify the location and date (tentatively March or April 2017), Haskellers of all varieties and skill levels are invited to participate to the degree that they are willing and able. If you are interested in attending BayHac 2017, kindly fill out this survey to help us calibrate and organize our preparations. Google Forms: Create and analyze surveys. -------------- next part -------------- An HTML attachment was scrubbed... URL: From code at funwithsoftware.org Thu Nov 3 02:20:44 2016 From: code at funwithsoftware.org (Patrick Pelletier) Date: Wed, 2 Nov 2016 19:20:44 -0700 Subject: [Haskell-cafe] Package metadata format - notes from discussion In-Reply-To: References: <87shr9503f.fsf@write-only.cryp.to> Message-ID: <437e10f4-cc16-aac2-7615-6fa5ded7e507@funwithsoftware.org> One impression I've gotten (although I have not looked into this closely) is that the API for cabal-the-library does not seem to be very stable. From looking at the version history of the standalone-haddock tool, it appears that it has to change frequently for new versions of cabal, and only supports one version of cabal at a time. (And it currently isn't up-to-date with the latest cabal.) This makes it difficult to use, because my cabal is probably too old or too new. --Patrick On 11/2/16 10:05 AM, Harendra Kumar wrote: > Peter, > > My point was to make it easier for any new tool writers to choose the > same format over something entirely new, there are some examples in > the notes. I have not investigated it in detail but there must be some > reason why the cabal format is not being adopted or is not likely to > be adopted by new tools describing package metadata; I was thinking > the format being seen as tightly attached to cabal and not usable in > general might be one reason. Is it likely to be seen as an independent > format if it has a spec describing it and an independent parsing > library? Or is it some entirely different reason altogether? Or maybe > its not worth caring about whether all tools use the same language for > metadata, I might be the only one? > > -harendra > > On 2 November 2016 at 21:46, Peter Simons > wrote: > > Hi Harendra, > > > It might help if the [Cabal] parser is modularized and detached > from > > the cabal tool itself so that it can be used independently by any > > other tools wishing to do so. > > I'm not quite sure how to interpret that statement. The parser for the > Cabal format is quite modular and re-usable already and has been > available > in the Cabal library for years: > > http://hackage.haskell.org/package/Cabal-1.24.0.0/docs/Distribution-PackageDescription-Parse.html > > > Am I missing something? > > Best regards, > Peter > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > Only members subscribed via the mailman list are allowed to post. > > > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan.miljenovic at gmail.com Thu Nov 3 03:44:30 2016 From: ivan.miljenovic at gmail.com (Ivan Lazar Miljenovic) Date: Thu, 3 Nov 2016 14:44:30 +1100 Subject: [Haskell-cafe] Package metadata format - notes from discussion In-Reply-To: <437e10f4-cc16-aac2-7615-6fa5ded7e507@funwithsoftware.org> References: <87shr9503f.fsf@write-only.cryp.to> <437e10f4-cc16-aac2-7615-6fa5ded7e507@funwithsoftware.org> Message-ID: On 3 November 2016 at 13:20, Patrick Pelletier wrote: > One impression I've gotten (although I have not looked into this closely) is > that the API for cabal-the-library does not seem to be very stable. From > looking at the version history of the standalone-haddock tool, it appears > that it has to change frequently for new versions of cabal, and only > supports one version of cabal at a time. (And it currently isn't up-to-date > with the latest cabal.) This makes it difficult to use, because my cabal is > probably too old or too new. I believe that any version of Cabal can parse files produced for any older versions of Cabal. The API hasn't changed that much that I'm familiar with (I've had to tweak some code that deals with it every time there's a new version, but it's usually not too bad, more that they keep changing where information about PackageDB is found). > > --Patrick > > > On 11/2/16 10:05 AM, Harendra Kumar wrote: > > Peter, > > My point was to make it easier for any new tool writers to choose the same > format over something entirely new, there are some examples in the notes. I > have not investigated it in detail but there must be some reason why the > cabal format is not being adopted or is not likely to be adopted by new > tools describing package metadata; I was thinking the format being seen as > tightly attached to cabal and not usable in general might be one reason. Is > it likely to be seen as an independent format if it has a spec describing it > and an independent parsing library? Or is it some entirely different reason > altogether? Or maybe its not worth caring about whether all tools use the > same language for metadata, I might be the only one? > > -harendra > > On 2 November 2016 at 21:46, Peter Simons wrote: >> >> Hi Harendra, >> >> > It might help if the [Cabal] parser is modularized and detached from >> > the cabal tool itself so that it can be used independently by any >> > other tools wishing to do so. >> >> I'm not quite sure how to interpret that statement. The parser for the >> Cabal format is quite modular and re-usable already and has been available >> in the Cabal library for years: >> >> >> http://hackage.haskell.org/package/Cabal-1.24.0.0/docs/Distribution-PackageDescription-Parse.html >> >> Am I missing something? >> >> Best regards, >> Peter >> >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view archives go to: >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> Only members subscribed via the mailman list are allowed to post. > > > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -- Ivan Lazar Miljenovic Ivan.Miljenovic at gmail.com http://IvanMiljenovic.wordpress.com From nicholls.mark at vimn.com Thu Nov 3 08:47:40 2016 From: nicholls.mark at vimn.com (Nicholls, Mark) Date: Thu, 3 Nov 2016 08:47:40 +0000 Subject: [Haskell-cafe] programming style...and type classes... In-Reply-To: <836817a9-52f6-fdf6-50db-420c12f91efe@cs.otago.ac.nz> References: <50a704b8-14b7-ca49-7093-143dbe9bbd86@durchholz.org> , <836817a9-52f6-fdf6-50db-420c12f91efe@cs.otago.ac.nz> Message-ID: <1FF462D6-9DDB-4227-BDB7-AC5BE67089ED@vimn.com> im writing a msc project which touches on typeclasses (i am a relative noob at haskell, im using it in comparison to other techniques) i believe there is advice to avoid typeclasses stylistically? (see haskell wiki on style, allegedly because it leads to creeping haskell extensions...overlapping instances etc)...which lead you into the "wild" (allegedly SPJ) is there some sort of potted pros vs cons? its such a general question its actually hard to find something specific. or is it simply that? some cases overlap and some cases are undecidable, throw in functional dependency and type families and you're in a world of complexity you may not need? vs extensibility ? CONFIDENTIALITY NOTICE This e-mail (and any attached files) is confidential and protected by copyright (and other intellectual property rights). If you are not the intended recipient please e-mail the sender and then delete the email and any attached files immediately. Any further use or dissemination is prohibited. While MTV Networks Europe has taken steps to ensure that this email and any attachments are virus free, it is your responsibility to ensure that this message and any attachments are virus free and do not affect your systems / data. Communicating by email is not 100% secure and carries risks such as delay, data corruption, non-delivery, wrongful interception and unauthorised amendment. If you communicate with us by e-mail, you acknowledge and assume these risks, and you agree to take appropriate measures to minimise these risks when e-mailing us. MTV Networks International, MTV Networks UK & Ireland, Greenhouse, Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions International, Be Viacom, Viacom International Media Networks and VIMN and Comedy Central are all trading names of MTV Networks Europe. MTV Networks Europe is a partnership between MTV Networks Europe Inc. and Viacom Networks Europe Inc. Address for service in Great Britain is 17-29 Hawley Crescent, London, NW1 8TT. From tdammers at gmail.com Thu Nov 3 09:47:48 2016 From: tdammers at gmail.com (Tobias Dammers) Date: Thu, 3 Nov 2016 10:47:48 +0100 Subject: [Haskell-cafe] better error messages for YAML Message-ID: <20161103094747.GA12930@nibbler> Hello cafe, I have a bit of a conundrum here. The situation is such that I'm using the YAML package to parse YAML configuration files; some of the values in the file format require further parsing (using my own ginger library), and all that works fine. One problem though; since this is aimed at end users, I want to preset error messages that pinpoint the exact error location in case the ginger parse fails. However, the ginger parser doesn't get to see the entire YAML source, because it runs on just an individual string value inside the YAML, and the YAML parser itself doesn't report source positions either. The unfortunate result is that while I get "technically correct" parser errors from Ginger, the source positions they report are relative to the string value, i.e., all errors are reported as being on line 1 of an unnamed source file. The relevant code is here: https://github.com/tdammers/sprinkles/blob/master/src/Web/Sprinkles/Replacement.hs#L40 The only solution I can think of right now involves writing my own YAML parser, and probably also an Aeson drop-in replacement; I don't really want to do that though. Is there any other way to get what I want? -- Tobias Dammers - tdammers at gmail.com From michael at snoyman.com Thu Nov 3 09:55:01 2016 From: michael at snoyman.com (Michael Snoyman) Date: Thu, 3 Nov 2016 11:55:01 +0200 Subject: [Haskell-cafe] better error messages for YAML In-Reply-To: <20161103094747.GA12930@nibbler> References: <20161103094747.GA12930@nibbler> Message-ID: The Text.Libyaml[1] module provides a streaming interface, which allows more flexibility and doesn't jump through the aeson Value type at all. Currently, it doesn't include location information, but I _think_ the underlying libyaml C library makes that information available. I'd certainly be open to a PR to add something like: decodeWithPosition :: ByteString -> Producer m (Event, Position) And that way you don't have to rewrite a parser or the FFI bindings. [1] https://www.stackage.org/haddock/lts-7.7/yaml-0.8.20/Text-Libyaml.html On Thu, Nov 3, 2016 at 11:47 AM, Tobias Dammers wrote: > Hello cafe, > > I have a bit of a conundrum here. > > The situation is such that I'm using the YAML package to parse YAML > configuration files; some of the values in the file format require > further parsing (using my own ginger library), and all that works fine. > > One problem though; since this is aimed at end users, I want to preset > error messages that pinpoint the exact error location in case the ginger > parse fails. However, the ginger parser doesn't get to see the entire > YAML source, because it runs on just an individual string value inside > the YAML, and the YAML parser itself doesn't report source positions > either. The unfortunate result is that while I get "technically correct" > parser errors from Ginger, the source positions they report are relative > to the string value, i.e., all errors are reported as being on line 1 of > an unnamed source file. > > The relevant code is here: > > https://github.com/tdammers/sprinkles/blob/master/src/Web/ > Sprinkles/Replacement.hs#L40 > > The only solution I can think of right now involves writing my own YAML > parser, and probably also an Aeson drop-in replacement; I don't really > want to do that though. > > Is there any other way to get what I want? > > -- > Tobias Dammers - tdammers at gmail.com > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From damian.nadales at gmail.com Thu Nov 3 10:12:16 2016 From: damian.nadales at gmail.com (Damian Nadales) Date: Thu, 3 Nov 2016 11:12:16 +0100 Subject: [Haskell-cafe] Any students for master project in The Netherlands? (near Eindhoven) Message-ID: Hi, In my current team, we're looking for Master students to work in a project about checking RAML specifications automatically. We would like to develop this in the functional paradigm, but all the students we got so far have no FP exposure whatsoever. So if you know of somebody that might be looking for a master project and want to know more details please do let me know (maybe Alejandro and Jurriën have some ideas ;)). Best, Damian. From zemyla at gmail.com Thu Nov 3 10:17:24 2016 From: zemyla at gmail.com (Zemyla) Date: Thu, 3 Nov 2016 05:17:24 -0500 Subject: [Haskell-cafe] Using unboxed integers In-Reply-To: <896319b7-2689-55c5-bbba-c8ea2ed7fc0e@cs.otago.ac.nz> References: <896319b7-2689-55c5-bbba-c8ea2ed7fc0e@cs.otago.ac.nz> Message-ID: If you look at the Core GHC produces (with -ddump-simpl), you'll probably see that the Ints have been unboxed for as many operations as possible, so manual unboxing won't make that much difference. On Nov 2, 2016 1:15 AM, "Richard A. O'Keefe" wrote: > import GHC.Base > isTrue# (comparison) > show (I# x#) > worked. Thank you very much. > > This made a barely measurable difference to my program, so I now that > I know how to use unboxed integers, I can forget again. > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From dominic at steinitz.org Thu Nov 3 12:37:49 2016 From: dominic at steinitz.org (dominic at steinitz.org) Date: Thu, 3 Nov 2016 12:37:49 +0000 Subject: [Haskell-cafe] Suggestion for Data Structure regarding Timetabling and Time Intervals In-Reply-To: References: Message-ID: <145371A1-33FE-43EF-8777-B80FBDC2C89E@steinitz.org> I don’t know if this is relevant but for manipulating time intervals, I have found the intervals package very useful. > Message: 5 > Date: Wed, 2 Nov 2016 21:26:32 +0100 > From: Olaf Klinke > To: list at mroth.net > Cc: haskell-cafe at haskell.org > Subject: Re: [Haskell-cafe] Suggestion for Data Structure regarding > Timetabling and Time Intervals > Message-ID: <63753058-716B-4D2B-8D8F-4B0F77732C2A at aatal-apotheke.de> > Content-Type: text/plain; charset=us-ascii > > Dear Michael, > > if you can be sure your intervals will never overlap, why not use a binary search tree, such as Data.Set from containers? You could make a data structure distinguishing major and minor intervals such as: > > type Time = -- your favourite totally ordered time type > data Major = Major { > fromTime :: Time, > untilTime :: Time} deriving (Eq) > data Minor = Minor { > after :: Time > before :: Time} deriving (Eq) > type TimeInterval = Either Minor Major > > instance Ord (Either Minor Major) where > Left a <= Left b = before a <= after b > Right a <= Right b = untilTime a <= fromTime b > Left a <= Right b = before a <= fromTime b > Right a <= Left b = untilTime a <= after b > > If I understood your intentions correctly, inserting a minor interval between a :: Major and b :: Major where a < b would mean to insert > > Minor {after = untilTime a, before = fromTime b} > > It might also be handy to define a new type (isomorphic to the product (a,b)) > > Anno a b = Anno a b > > whose Ord instance uses the Ord instance of b only, so that > > Anno "Some annotation" (Major t0 t1) > > is an interval bearing some annotation that can be ordered just like the Major type. > > If your intervals _do_ overlap, then two intervals can be in six different configurations (instead of LT, GT and EQ), and several tree structures exist that support some operations more or less efficiently. Bioinformatics and geometry has developed good data structures and algorithms to deal with efficient overlap searches. > > Olaf > > Dominic Steinitz dominic at steinitz.org http://idontgetoutmuch.wordpress.com From zkessin at gmail.com Thu Nov 3 13:11:09 2016 From: zkessin at gmail.com (Zachary Kessin) Date: Thu, 3 Nov 2016 15:11:09 +0200 Subject: [Haskell-cafe] Creating string resources Message-ID: I have an app with a UX in GHCJS and I want to have way for a non developer to edit the text, but then have it compiled into our code base. One obvious way would be just to have haskell modules that just has the strings in it as constants. But I thought to ask has anyone else come up with a solution to this? -- Zach Kessin SquareTarget Twitter: @zkessin Skype: zachkessin ᐧ -------------- next part -------------- An HTML attachment was scrubbed... URL: From imantc at gmail.com Thu Nov 3 13:19:34 2016 From: imantc at gmail.com (Imants Cekusins) Date: Thu, 3 Nov 2016 14:19:34 +0100 Subject: [Haskell-cafe] Creating string resources In-Reply-To: References: Message-ID: > haskell modules that just has the strings in it as constants text-only (simple syntax or a common text-friendly format) config files which can be parsed on app start? ​ -------------- next part -------------- An HTML attachment was scrubbed... URL: From alexander.kjeldaas at gmail.com Thu Nov 3 14:14:26 2016 From: alexander.kjeldaas at gmail.com (Alexander Kjeldaas) Date: Thu, 3 Nov 2016 15:14:26 +0100 Subject: [Haskell-cafe] Package metadata format - notes from discussion In-Reply-To: References: Message-ID: I didn't see much in the form of problem statement in those threads. Let me suggest one: A new format should support the megarepo setup. Today 95% of the text in a .cabal file that exists in a megarepo is fluff. It should be possible to specify a .cabal file in 1-3 lines in a typical megarepo setup. - repeating copyright, repo location, ghc options, most of the dependencies, description, url, author, even version. All should be inherited. Listing modules seems unnecessary if there are known strategies for that. How about making the cabal file a Monoid so it can be composed? I heard that's a Haskell thing. Alexander On Wed, Nov 2, 2016 at 5:05 PM, Harendra Kumar wrote: > For reference, I have organized the major points of the discussion that > happened earlier on haskell-cafe regarding package metadata format (cabal > vs yaml, vs toml, vs hs). Take a look at this: > > https://github.com/harendra-kumar/package-metadata > > In my opinion, in the short term it might help if the cabal format is > improved, the parser is modularized and detached from the cabal tool itself > so that it can be used independently by any other tools wishing to do so. > For long term possibility of change of format, I do not intend to pursue or > investigate it further at this point of time but others who are interested > are free to do so. > > -harendra > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at snoyman.com Thu Nov 3 14:37:30 2016 From: michael at snoyman.com (Michael Snoyman) Date: Thu, 3 Nov 2016 16:37:30 +0200 Subject: [Haskell-cafe] Creating string resources In-Reply-To: References: Message-ID: I think you're looking for file-embed[1]. In the Yesod scaffolding, we even use it to read in a yaml file and parse it at compile time to make available to the app. [1] https://www.stackage.org/package/file-embed On Thu, Nov 3, 2016 at 3:11 PM, Zachary Kessin wrote: > I have an app with a UX in GHCJS and I want to have way for a non > developer to edit the text, but then have it compiled into our code base. > > One obvious way would be just to have haskell modules that just has the > strings in it as constants. But I thought to ask has anyone else come up > with a solution to this? > > -- > Zach Kessin > SquareTarget > Twitter: @zkessin > Skype: zachkessin > ᐧ > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From adam at bergmark.nl Thu Nov 3 17:59:05 2016 From: adam at bergmark.nl (Adam Bergmark) Date: Thu, 03 Nov 2016 17:59:05 +0000 Subject: [Haskell-cafe] better error messages for YAML In-Reply-To: References: <20161103094747.GA12930@nibbler> Message-ID: For aeson there is a combinator in an "internal" modue lfor adding custom error messages (https://github.com/bos/aeson/issues/475). There's definitely room for improving error messages though, I hope you'd consider helping out with that in aeson rather than rolling your own :) But what Michael says makes a lot of sense, going through aeson is not optimal. Especially since yaml is a superset (in terms of constructs) of json. - Adam On Thu, Nov 3, 2016 at 10:55 AM Michael Snoyman wrote: > The Text.Libyaml[1] module provides a streaming interface, which allows > more flexibility and doesn't jump through the aeson Value type at all. > Currently, it doesn't include location information, but I _think_ the > underlying libyaml C library makes that information available. I'd > certainly be open to a PR to add something like: > > decodeWithPosition :: ByteString -> Producer m (Event, Position) > > And that way you don't have to rewrite a parser or the FFI bindings. > > [1] https://www.stackage.org/haddock/lts-7.7/yaml-0.8.20/Text-Libyaml.html > > On Thu, Nov 3, 2016 at 11:47 AM, Tobias Dammers > wrote: > > Hello cafe, > > I have a bit of a conundrum here. > > The situation is such that I'm using the YAML package to parse YAML > configuration files; some of the values in the file format require > further parsing (using my own ginger library), and all that works fine. > > One problem though; since this is aimed at end users, I want to preset > error messages that pinpoint the exact error location in case the ginger > parse fails. However, the ginger parser doesn't get to see the entire > YAML source, because it runs on just an individual string value inside > the YAML, and the YAML parser itself doesn't report source positions > either. The unfortunate result is that while I get "technically correct" > parser errors from Ginger, the source positions they report are relative > to the string value, i.e., all errors are reported as being on line 1 of > an unnamed source file. > > The relevant code is here: > > > https://github.com/tdammers/sprinkles/blob/master/src/Web/Sprinkles/Replacement.hs#L40 > > The only solution I can think of right now involves writing my own YAML > parser, and probably also an Aeson drop-in replacement; I don't really > want to do that though. > > Is there any other way to get what I want? > > -- > Tobias Dammers - tdammers at gmail.com > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ezyang at mit.edu Thu Nov 3 19:57:42 2016 From: ezyang at mit.edu (Edward Z. Yang) Date: Thu, 03 Nov 2016 12:57:42 -0700 Subject: [Haskell-cafe] Package metadata format - notes from discussion In-Reply-To: References: Message-ID: <1478203046-sup-8365@sabre> Funnily enough, it is already, though not in the way you want ;) Excerpts from Alexander Kjeldaas's message of 2016-11-03 15:14:26 +0100: > I didn't see much in the form of problem statement in those threads. > > Let me suggest one: A new format should support the megarepo setup. Today > 95% of the text in a .cabal file that exists in a megarepo is fluff. It > should be possible to specify a .cabal file in 1-3 lines in a typical > megarepo setup. > > - repeating copyright, repo location, ghc options, most of the > dependencies, description, url, author, even version. All should be > inherited. Listing modules seems unnecessary if there are known strategies > for that. > > How about making the cabal file a Monoid so it can be composed? I heard > that's a Haskell thing. > > Alexander > > > On Wed, Nov 2, 2016 at 5:05 PM, Harendra Kumar > wrote: > > > For reference, I have organized the major points of the discussion that > > happened earlier on haskell-cafe regarding package metadata format (cabal > > vs yaml, vs toml, vs hs). Take a look at this: > > > > https://github.com/harendra-kumar/package-metadata > > > > In my opinion, in the short term it might help if the cabal format is > > improved, the parser is modularized and detached from the cabal tool itself > > so that it can be used independently by any other tools wishing to do so. > > For long term possibility of change of format, I do not intend to pursue or > > investigate it further at this point of time but others who are interested > > are free to do so. > > > > -harendra > > > > _______________________________________________ > > Haskell-Cafe mailing list > > To (un)subscribe, modify options or view archives go to: > > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > Only members subscribed via the mailman list are allowed to post. > > From olf at aatal-apotheke.de Thu Nov 3 20:08:45 2016 From: olf at aatal-apotheke.de (Olaf Klinke) Date: Thu, 3 Nov 2016 21:08:45 +0100 Subject: [Haskell-cafe] programming style...and type classes... Message-ID: <6C668759-8AF3-40F3-B928-2536E269830E@aatal-apotheke.de> Mark, Haskell typeclasses are a wonderful thing to have. I dare say that typeclasses are what makes haskell code modular and re-usable, because you can develop an algorithm "aginst the class interface" and users only need to supply a class instance for their own data type in order to use your algorithm. What the wiki warns about is misuse or over-use of typeclasses. Typeclasses express properties that different types have in common, and in that respect they are somewhat similar to OO-classes. However, there is no hierarchy of inheritance. It is true that typeclasses, particularly the more advanced ones with e.g. multiple parameters or functional dependencies, sometimes get into your way. One example is ambiguity arising from multi-parameter type classes: Suppose you have a two-parameter class {-# LANGUAGE MultiParamTypeClasses,FunctionalDependencies #-} class Foo a b where foo :: a -> b bar :: b -> (a,[Int]) Now you write a function using only bar: f :: (Foo a b) => b -> Int f = length.snd.bar The compiler will complain that it does not know which Foo instance to use, because while bar itself mentions both class parameters a and b, snd.bar has type b -> [Int] and hence lost the information about the first class parameter. Adding a functional dependency b -> a helps in this case. But the promise that for every b there is only one a such that Foo a b holds may not be what you want. So what went wrong? Observe that bar :: b -> (a,[Int]) is equivalent to two functions bar1 :: b -> a bar2 :: b -> [Int] and bar2 probably did not belong into the class Foo. We've been cramming to much into one typeclass and should therefore split Foo into two classes. Olaf From allbery.b at gmail.com Thu Nov 3 20:20:33 2016 From: allbery.b at gmail.com (Brandon Allbery) Date: Thu, 3 Nov 2016 16:20:33 -0400 Subject: [Haskell-cafe] programming style...and type classes... In-Reply-To: <1FF462D6-9DDB-4227-BDB7-AC5BE67089ED@vimn.com> References: <50a704b8-14b7-ca49-7093-143dbe9bbd86@durchholz.org> <836817a9-52f6-fdf6-50db-420c12f91efe@cs.otago.ac.nz> <1FF462D6-9DDB-4227-BDB7-AC5BE67089ED@vimn.com> Message-ID: On Thu, Nov 3, 2016 at 4:47 AM, Nicholls, Mark wrote: > i believe there is advice to avoid typeclasses stylistically? (see haskell > wiki on style, allegedly because it leads to creeping haskell > extensions...overlapping instances etc)...which lead you into the "wild" > (allegedly SPJ) > Typeclasses are great when used properly and for their intended purpose. There is a tendency for new Haskellers to overuse them, or to mistake them for OOP classes and try to use them as such (which won't work, but *will* cause the compiler to start suggesting increasingly-far-afield extensions as it tries to make sense of what the programmer was trying to do). -- 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 takenobu.hs at gmail.com Fri Nov 4 04:37:55 2016 From: takenobu.hs at gmail.com (Takenobu Tani) Date: Fri, 4 Nov 2016 13:37:55 +0900 Subject: [Haskell-cafe] simple diagrams about GHC development flow Message-ID: Hi cafe, For myself and new contributors, I drew overview diagrams about GHC development flow. GHC development flow http://takenobu-hs.github.io/downloads/ghc_development_flow.pdf https://github.com/takenobu-hs/ghc-development-flow Let's enjoy :) Regards, Takenobu -------------- next part -------------- An HTML attachment was scrubbed... URL: From nicholls.mark at vimn.com Fri Nov 4 08:31:55 2016 From: nicholls.mark at vimn.com (Nicholls, Mark) Date: Fri, 4 Nov 2016 08:31:55 +0000 Subject: [Haskell-cafe] programming style...and type classes... In-Reply-To: References: <50a704b8-14b7-ca49-7093-143dbe9bbd86@durchholz.org> <836817a9-52f6-fdf6-50db-420c12f91efe@cs.otago.ac.nz> <1FF462D6-9DDB-4227-BDB7-AC5BE67089ED@vimn.com>, Message-ID: <98D898C8-5A7A-4A4B-A822-C399C3AA1E7B@vimn.com> i like the example but you say yourself it just means that bar2 should be elsewhere.::? ie an oo'er would just say youve created the wrong abstraction, but not....dont create the abstraction....creating the abstraction is the mantra oo'ers are stylistically indoctonated in, in the name of extensibility (for good or evil) so...is the problem with type classes that this modelling process is quite subtle and advanced? and thus should be avoided until you know what you're doing? or something more? (maybe the cost of the modelling process outweighs the benefit? even when you do know what youre doing?) Excuse the spelling, sent from a phone with itty bitty keys, it like trying to sow a button on a shirt with a sausage. On 3 Nov 2016, at 20:20, Brandon Allbery > wrote: On Thu, Nov 3, 2016 at 4:47 AM, Nicholls, Mark > wrote: i believe there is advice to avoid typeclasses stylistically? (see haskell wiki on style, allegedly because it leads to creeping haskell extensions...overlapping instances etc)...which lead you into the "wild" (allegedly SPJ) Typeclasses are great when used properly and for their intended purpose. There is a tendency for new Haskellers to overuse them, or to mistake them for OOP classes and try to use them as such (which won't work, but *will* cause the compiler to start suggesting increasingly-far-afield extensions as it tries to make sense of what the programmer was trying to do). -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net CONFIDENTIALITY NOTICE This e-mail (and any attached files) is confidential and protected by copyright (and other intellectual property rights). If you are not the intended recipient please e-mail the sender and then delete the email and any attached files immediately. Any further use or dissemination is prohibited. While MTV Networks Europe has taken steps to ensure that this email and any attachments are virus free, it is your responsibility to ensure that this message and any attachments are virus free and do not affect your systems / data. Communicating by email is not 100% secure and carries risks such as delay, data corruption, non-delivery, wrongful interception and unauthorised amendment. If you communicate with us by e-mail, you acknowledge and assume these risks, and you agree to take appropriate measures to minimise these risks when e-mailing us. MTV Networks International, MTV Networks UK & Ireland, Greenhouse, Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions International, Be Viacom, Viacom International Media Networks and VIMN and Comedy Central are all trading names of MTV Networks Europe. MTV Networks Europe is a partnership between MTV Networks Europe Inc. and Viacom Networks Europe Inc. Address for service in Great Britain is 17-29 Hawley Crescent, London, NW1 8TT. -------------- next part -------------- An HTML attachment was scrubbed... URL: From nicholls.mark at vimn.com Fri Nov 4 09:57:31 2016 From: nicholls.mark at vimn.com (Nicholls, Mark) Date: Fri, 4 Nov 2016 09:57:31 +0000 Subject: [Haskell-cafe] programming style...and type classes... In-Reply-To: References: <50a704b8-14b7-ca49-7093-143dbe9bbd86@durchholz.org> <836817a9-52f6-fdf6-50db-420c12f91efe@cs.otago.ac.nz> <1FF462D6-9DDB-4227-BDB7-AC5BE67089ED@vimn.com> Message-ID: I’m nervous of the statement “used properly”…it’s a bit tautological, and the inference is often used the wrong way around…i.e. if it doesn’t work you didn’t use it properly….and if it did…then you did! i.e. the logic goes. Creating an open data abstraction is not a “proper” usage? But not knowing future extensions requirements is a reality? So having a language where data abstraction are open by default (unless you WANT to close them) is an attractive objective? Typeclasses provide this? Eureka! Becomes DISASTER? So is the objection is really empirical ?…i.e. typeclasses will cause you problems IF you work like this (and you don’t know what you’re doing)? Once you know where the problems are…best steer clear….once you know the pitfalls, you can use them “properly” (successfully)? (ironically the process of finding the problems IS not using them properly!...but that’s life I think). CONFIDENTIALITY NOTICE This e-mail (and any attached files) is confidential and protected by copyright (and other intellectual property rights). If you are not the intended recipient please e-mail the sender and then delete the email and any attached files immediately. Any further use or dissemination is prohibited. While MTV Networks Europe has taken steps to ensure that this email and any attachments are virus free, it is your responsibility to ensure that this message and any attachments are virus free and do not affect your systems / data. Communicating by email is not 100% secure and carries risks such as delay, data corruption, non-delivery, wrongful interception and unauthorised amendment. If you communicate with us by e-mail, you acknowledge and assume these risks, and you agree to take appropriate measures to minimise these risks when e-mailing us. MTV Networks International, MTV Networks UK & Ireland, Greenhouse, Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions International, Be Viacom, Viacom International Media Networks and VIMN and Comedy Central are all trading names of MTV Networks Europe. MTV Networks Europe is a partnership between MTV Networks Europe Inc. and Viacom Networks Europe Inc. Address for service in Great Britain is 17-29 Hawley Crescent, London, NW1 8TT. -------------- next part -------------- An HTML attachment was scrubbed... URL: From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Fri Nov 4 12:48:48 2016 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Fri, 4 Nov 2016 12:48:48 +0000 Subject: [Haskell-cafe] memory leak when using "forever" In-Reply-To: <20161004175648.GD15239@weber> References: <20161004171952.GB15239@weber> <20161004175648.GD15239@weber> Message-ID: <20161104124848.GA5391@weber> On Tue, Oct 04, 2016 at 06:56:48PM +0100, Tom Ellis wrote: > On Tue, Oct 04, 2016 at 06:19:52PM +0100, Tom Ellis wrote: > > My results below. Looks like there's something wrong with *> for ReaderT > > and StateT. > > This seems to be how it executes > > let loop = return () *> loop in loop > in runReaderT loop () [...] I'm adding an evaluation trace of 'forever' in terms of '>>' to this discussion because the issue has arisen in https://www.reddit.com/r/haskell/comments/5axh2j/two_methods_of_using_statet_with_pipes_one_of/ let loop = return () >> loop in loop in runReaderT loop () -- Un-newtype let loop = return () >> loop in loop in loop () -- Un-newtype let loop = return () >> loop in loop in loop () -- Definition of >> let loop = return () >>= (\_ -> loop) in loop in loop () -- >>= for Reader in terms of >>= for m let loop = \r -> (return () r) >>= (\_ -> loop r) in loop in loop () let loop = \r -> (return () r) >>= (\_ -> loop r) in loop in (\r -> (return () r) >>= (\_ -> loop r)) () let loop = \r -> (return () r) >>= (\_ -> loop r) in loop in (return () ()) >>= (\_ -> loop ()) -- return () for ReaderT in terms of return () for m let loop = \r -> (return () r) >>= (\_ -> loop r) in loop in return () >>= (\_ -> loop ()) So for m = IO evaluation proceeds without a space leak. We evaluate 'return ()' and then proceed to evaluate 'loop ()' without creating any new thunk. 'forever' needs urgent fixing! Tom From tdammers at gmail.com Fri Nov 4 13:29:37 2016 From: tdammers at gmail.com (Tobias Dammers) Date: Fri, 4 Nov 2016 14:29:37 +0100 Subject: [Haskell-cafe] programming style...and type classes... In-Reply-To: References: <50a704b8-14b7-ca49-7093-143dbe9bbd86@durchholz.org> <836817a9-52f6-fdf6-50db-420c12f91efe@cs.otago.ac.nz> <1FF462D6-9DDB-4227-BDB7-AC5BE67089ED@vimn.com> Message-ID: <20161104132936.GB31501@nibbler> My rule of thumb is that if there is one obvious instance (or none) for every given type, then your abstraction is a good candidate for a typeclass; if multiple instances make sense, then it's a judgment call; and if many instances could arbitrarily make sense or not depending on the usage / circumstances, then it's probably not a good candidate for a typeclass. For example, Functor is a very good typeclass - every type can have exactly zero or one lawful Functor instance; if you think about it a little, this means that with Functor, you can never run into overlapping or undecidable instances, and the open universe is a fairly benign problem - even if you derive or implement an orphan instance, it will at least be functionally and logically equivalent to other possible instances. Most of the typeclasses in base are tougher calls, but overall, I would say they still make a lot of sense. I'd be hard pressed to come up with a type that has more than one sensible Monad instance, for example. Something like Aeson's ToJSON / FromJSON is kind of a judgment call - On the one hand, they shouldn't be typeclasses, because ideally you want to separate JSON format specifications from data types (i.e., the user code of a given type should decide on the serialization format, not the type itself), but on the other hand, more often than not one designs types specifically for the purpose of representing a certain JSON schema, and an extra translation step sits between these types and the actual domain types (at least that's how I often do it). On a side note; it's not like the open universe principle is a bad idea. There are lots of benefits to be had here. On Fri, Nov 04, 2016 at 09:57:31AM +0000, Nicholls, Mark wrote: > I’m nervous of the statement “used properly”…it’s a bit tautological, and the inference is often used the wrong way around…i.e. if it doesn’t work you didn’t use it properly….and if it did…then you did! > > i.e. the logic goes. > Creating an open data abstraction is not a “proper” usage? > But not knowing future extensions requirements is a reality? > So having a language where data abstraction are open by default (unless you WANT to close them) is an attractive objective? > Typeclasses provide this? > Eureka! > Becomes DISASTER? > > So is the objection is really empirical ?…i.e. typeclasses will cause you problems IF you work like this (and you don’t know what you’re doing)? > > Once you know where the problems are…best steer clear….once you know the pitfalls, you can use them “properly” (successfully)? > > (ironically the process of finding the problems IS not using them properly!...but that’s life I think). > > > > CONFIDENTIALITY NOTICE > > This e-mail (and any attached files) is confidential and protected by copyright (and other intellectual property rights). If you are not the intended recipient please e-mail the sender and then delete the email and any attached files immediately. Any further use or dissemination is prohibited. > > While MTV Networks Europe has taken steps to ensure that this email and any attachments are virus free, it is your responsibility to ensure that this message and any attachments are virus free and do not affect your systems / data. > > Communicating by email is not 100% secure and carries risks such as delay, data corruption, non-delivery, wrongful interception and unauthorised amendment. If you communicate with us by e-mail, you acknowledge and assume these risks, and you agree to take appropriate measures to minimise these risks when e-mailing us. > > MTV Networks International, MTV Networks UK & Ireland, Greenhouse, Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions International, Be Viacom, Viacom International Media Networks and VIMN and Comedy Central are all trading names of MTV Networks Europe. MTV Networks Europe is a partnership between MTV Networks Europe Inc. and Viacom Networks Europe Inc. Address for service in Great Britain is 17-29 Hawley Crescent, London, NW1 8TT. > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -- Tobias Dammers - tdammers at gmail.com From migmit at gmail.com Fri Nov 4 13:46:28 2016 From: migmit at gmail.com (Miguel) Date: Fri, 4 Nov 2016 14:46:28 +0100 Subject: [Haskell-cafe] programming style...and type classes... In-Reply-To: <20161104132936.GB31501@nibbler> References: <50a704b8-14b7-ca49-7093-143dbe9bbd86@durchholz.org> <836817a9-52f6-fdf6-50db-420c12f91efe@cs.otago.ac.nz> <1FF462D6-9DDB-4227-BDB7-AC5BE67089ED@vimn.com> <20161104132936.GB31501@nibbler> Message-ID: More that one Monad instance is actually pretty easy: type String -> (String, a) has different monad instances if you treat it as a State monad, or as a combination of Reader and Writer. Thanks to Denis Moskvin for inspiration. On Fri, Nov 4, 2016 at 2:29 PM, Tobias Dammers wrote: > My rule of thumb is that if there is one obvious instance (or none) for > every given type, then your abstraction is a good candidate for a > typeclass; if multiple instances make sense, then it's a judgment call; > and if many instances could arbitrarily make sense or not depending on > the usage / circumstances, then it's probably not a good candidate for a > typeclass. > > For example, Functor is a very good typeclass - every type can have > exactly zero or one lawful Functor instance; if you think about it a > little, this means that with Functor, you can never run into overlapping > or undecidable instances, and the open universe is a fairly benign > problem - even if you derive or implement an orphan instance, it will at > least be functionally and logically equivalent to other possible > instances. > > Most of the typeclasses in base are tougher calls, but overall, I would > say they still make a lot of sense. I'd be hard pressed to come up with > a type that has more than one sensible Monad instance, for example. > > Something like Aeson's ToJSON / FromJSON is kind of a judgment call - > On the one hand, they shouldn't be typeclasses, because ideally you want to > separate JSON format specifications from data types (i.e., the user code > of a given type should decide on the serialization format, not the type > itself), but on the other hand, more often than not one designs types > specifically for the purpose of representing a certain JSON schema, and > an extra translation step sits between these types and the actual domain > types (at least that's how I often do it). > > On a side note; it's not like the open universe principle is a bad idea. > There are lots of benefits to be had here. > > On Fri, Nov 04, 2016 at 09:57:31AM +0000, Nicholls, Mark wrote: > > I’m nervous of the statement “used properly”…it’s a bit tautological, > and the inference is often used the wrong way around…i.e. if it doesn’t > work you didn’t use it properly….and if it did…then you did! > > > > i.e. the logic goes. > > Creating an open data abstraction is not a “proper” usage? > > But not knowing future extensions requirements is a reality? > > So having a language where data abstraction are open by default (unless > you WANT to close them) is an attractive objective? > > Typeclasses provide this? > > Eureka! > > Becomes DISASTER? > > > > So is the objection is really empirical ?…i.e. typeclasses will cause > you problems IF you work like this (and you don’t know what you’re doing)? > > > > Once you know where the problems are…best steer clear….once you know the > pitfalls, you can use them “properly” (successfully)? > > > > (ironically the process of finding the problems IS not using them > properly!...but that’s life I think). > > > > > > > > CONFIDENTIALITY NOTICE > > > > This e-mail (and any attached files) is confidential and protected by > copyright (and other intellectual property rights). If you are not the > intended recipient please e-mail the sender and then delete the email and > any attached files immediately. Any further use or dissemination is > prohibited. > > > > While MTV Networks Europe has taken steps to ensure that this email and > any attachments are virus free, it is your responsibility to ensure that > this message and any attachments are virus free and do not affect your > systems / data. > > > > Communicating by email is not 100% secure and carries risks such as > delay, data corruption, non-delivery, wrongful interception and > unauthorised amendment. If you communicate with us by e-mail, you > acknowledge and assume these risks, and you agree to take appropriate > measures to minimise these risks when e-mailing us. > > > > MTV Networks International, MTV Networks UK & Ireland, Greenhouse, > Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions > International, Be Viacom, Viacom International Media Networks and VIMN and > Comedy Central are all trading names of MTV Networks Europe. MTV Networks > Europe is a partnership between MTV Networks Europe Inc. and Viacom > Networks Europe Inc. Address for service in Great Britain is 17-29 Hawley > Crescent, London, NW1 8TT. > > > _______________________________________________ > > Haskell-Cafe mailing list > > To (un)subscribe, modify options or view archives go to: > > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > Only members subscribed via the mailman list are allowed to post. > > > -- > Tobias Dammers - tdammers at gmail.com > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From nicholls.mark at vimn.com Fri Nov 4 14:06:18 2016 From: nicholls.mark at vimn.com (Nicholls, Mark) Date: Fri, 4 Nov 2016 14:06:18 +0000 Subject: [Haskell-cafe] programming style...and type classes... In-Reply-To: <20161104132936.GB31501@nibbler> References: <50a704b8-14b7-ca49-7093-143dbe9bbd86@durchholz.org> <836817a9-52f6-fdf6-50db-420c12f91efe@cs.otago.ac.nz> <1FF462D6-9DDB-4227-BDB7-AC5BE67089ED@vimn.com> <20161104132936.GB31501@nibbler> Message-ID: >Subject: Re: [Haskell-cafe] programming style...and type classes... > >My rule of thumb is that if there is one obvious instance (or none) for every >given type, then your abstraction is a good candidate for a typeclass; if multiple >instances make sense, then it's a judgment call; and if many instances could >arbitrarily make sense or not depending on the usage / circumstances, then it's >probably not a good candidate for a typeclass. OK, that’s a bit more prescriptive...so if many instances make sense (Ord a) then what? Seems like Ord is a "bad" typeclass?...it should really be a dictionary data type? And then you simply define which order you want? There needs to be 1 (or 0) instances because this is all resolved compile time?....i.e. so we (the programmer/compiler) need a function from types, and function name into instances...if there 0 instance...then boom...not defined..so you need to do something, that’s fixable....if 2...then boom...you're in trouble? CONFIDENTIALITY NOTICE This e-mail (and any attached files) is confidential and protected by copyright (and other intellectual property rights). If you are not the intended recipient please e-mail the sender and then delete the email and any attached files immediately. Any further use or dissemination is prohibited. While MTV Networks Europe has taken steps to ensure that this email and any attachments are virus free, it is your responsibility to ensure that this message and any attachments are virus free and do not affect your systems / data. Communicating by email is not 100% secure and carries risks such as delay, data corruption, non-delivery, wrongful interception and unauthorised amendment. If you communicate with us by e-mail, you acknowledge and assume these risks, and you agree to take appropriate measures to minimise these risks when e-mailing us. MTV Networks International, MTV Networks UK & Ireland, Greenhouse, Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions International, Be Viacom, Viacom International Media Networks and VIMN and Comedy Central are all trading names of MTV Networks Europe. MTV Networks Europe is a partnership between MTV Networks Europe Inc. and Viacom Networks Europe Inc. Address for service in Great Britain is 17-29 Hawley Crescent, London, NW1 8TT. From fa-ml at ariis.it Fri Nov 4 14:21:28 2016 From: fa-ml at ariis.it (Francesco Ariis) Date: Fri, 4 Nov 2016 15:21:28 +0100 Subject: [Haskell-cafe] [ANN] Haskell ITA meetup in Bologna, Italy (2016-11-19) Message-ID: <20161104142128.GB4326@casa.casa> Hello -cafe, the Italian Haskell Community (http://haskell-ita.it/) is happy to announce its autumn Haskell meetup! The event is going to be hosted in Bologna, on November 19th. The meeting will be in italian; we are going to form small groups/projects, to see Haskell in action and to share knowledge and opinions on functional programming. Everyone, experienced or not, is welcome, just make sure to have a laptop and a working Haskell environment! For a more detailed description of the event and to register, check: https://www.metooo.io/e/haskell-day-bologna (further information in italian follows) ----- - Dove: Bologna, Giardini Margherita, nella struttura "La Gabbia del Leone" (http://leserre.kilowatt.bo.it/gabbia-del-leone/), presso "Le Serre dei Giardini". - Quando: Sabato 19 Novembre, dalle 10:00 alle 18:00. - Chi: chiunque sia interessato alla programmazione funzionale, indipendentemente dal suo livello di esperienza. - Cosa faremo: lavoreremo in gruppi (2-6 persone circa) su diversi progetti. Ogni persona può scegliere il progetto che vuole, saranno date delle indicazioni sul livelo di conoscienza richiesto per contribuire. Lo scopo è provare a utilizzare Haskell per un progetto concreto, "toccare con mano" il modo che hanno altri di lavorare e di condividere le esperienze nelle numerose pause di gruppo. Lo scopo è puramente didattico, quindi nessuna ansia. - Cosa portare: un computer portatile e un ambiente Haskell configurato. - Come arrivare: dalla Stazione Centrale dei Treni di Bologna, prendere l'autobus 33 (frequenza 15 minuti) e scendere alla fermata "Giardini Margherita" e/o "Porta Santo Stefano" (circa 20 minuti di viaggio). Entrare nei Giardini Margherita, dall'ingresso di Via Castiglione 136 o Via Polischi 9, e recarsi presso "Le Serre dei Giardini", alla struttura "La Gabbia del Leone" (http://leserre.kilowatt.bo.it/gabbia-del-leone/). - Grazie a chi: all'associazione [Kilowatt](http://kilowatt.bo.it/about) che ha messo a disposizione gratuitamente la sala. - Per iscriversi: https://www.metooo.io/e/haskell-day-bologna From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Fri Nov 4 14:44:00 2016 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Fri, 4 Nov 2016 14:44:00 +0000 Subject: [Haskell-cafe] Strange space leak Message-ID: <20161104144400.GA6044@weber> Can anyone explain why this leaks space: main :: IO () main = let loop () = return () *> loop () in loop () whilst this doesn't: main :: IO () main = let loop = return () *> loop in loop I'm stumped. From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Fri Nov 4 14:58:32 2016 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Fri, 4 Nov 2016 14:58:32 +0000 Subject: [Haskell-cafe] Strange space leak In-Reply-To: <20161104144400.GA6044@weber> References: <20161104144400.GA6044@weber> Message-ID: <20161104145832.GB6044@weber> On Fri, Nov 04, 2016 at 02:44:00PM +0000, Tom Ellis wrote: > Can anyone explain why this leaks space: > > main :: IO () > main = let loop () = return () *> loop () > in loop () > > whilst this doesn't: > > main :: IO () > main = let loop = return () *> loop > in loop More strangely, the space leak only appears in ghci (and runhaskell). When compiled there is no such space leak. Tom From tdammers at gmail.com Fri Nov 4 15:10:10 2016 From: tdammers at gmail.com (Tobias Dammers) Date: Fri, 4 Nov 2016 16:10:10 +0100 Subject: [Haskell-cafe] programming style...and type classes... In-Reply-To: References: <50a704b8-14b7-ca49-7093-143dbe9bbd86@durchholz.org> <836817a9-52f6-fdf6-50db-420c12f91efe@cs.otago.ac.nz> <1FF462D6-9DDB-4227-BDB7-AC5BE67089ED@vimn.com> <20161104132936.GB31501@nibbler> Message-ID: <20161104151009.GD31501@nibbler> On Fri, Nov 04, 2016 at 02:06:18PM +0000, Nicholls, Mark wrote: > >Subject: Re: [Haskell-cafe] programming style...and type classes... > > > >My rule of thumb is that if there is one obvious instance (or none) for every > >given type, then your abstraction is a good candidate for a typeclass; if multiple > >instances make sense, then it's a judgment call; and if many instances could > >arbitrarily make sense or not depending on the usage / circumstances, then it's > >probably not a good candidate for a typeclass. > > OK, that’s a bit more prescriptive...so if many instances make sense (Ord a) then what? > > Seems like Ord is a "bad" typeclass?...it should really be a dictionary data type? And then you simply define which order you want? Ord is a "bad" typeclass if you interpret it as "the ordering rules for this type"; but it is OK if you interpret it as "the default ordering rules for this type". Which, arguably, makes more sense for some types (Int) and less for others (Text). However, in the case of Ord, there is little harm in defining a default instance and using more specialized sorting functions that take an explicit ordering functions; this stuff is simple enough for these things to not be very intrusive at all, and giving arguable cases the benefit of the doubt, I guess, is considered pragmatic. > > There needs to be 1 (or 0) instances because this is all resolved > compile time?....i.e. so we (the programmer/compiler) need a function > from types, and function name into instances...if there 0 > instance...then boom...not defined..so you need to do something, > that’s fixable....if 2...then boom...you're in trouble? Sort of, yes. You can't have two instances of the same typeclass for the same type. However, because instances are always global, and can be defined separately from both the type and the typeclass, it is possible to write instances which, when imported, break the code that imports them by introducing conflicting instances. This is why the recommendation is to always define instances either in the module that defines the type, or the module that defines the typeclass. Instances that are defined separately from both are called "orphan instances", and people generally avoid them where possible, but occasionally practical concerns make them necessary. The most common reason for orphan instances is to avoid dependencies: suppose you write a library that defines an alternative string type; and someone else writes a library that defines useful typeclasses for string-like types. Ideally, you want your custom string type to have instances for those typeclasses, but you can't put them in the typeclass library (because you don't control it), and you don't want to put them in your own library, because then your own library has to depend on the typeclass library even though most people won't need that functionality. In such a situation, you'd bite the bullet and provide an extra library that contains just the instances, peppered with warnings about orphan instances. Another example is when you write a program that uses types from some third-party library, and wants to marshal them to and from JSON - for that to work, you need to implement ToJSON and FromJSON instances for those types, but since you control neither the type nor the JSON typeclasses, the only choice you have is to make orphan instances in your program. In that case, the damage is limited, because you won't expose the orphan instances to the outside world, so it's sort of acceptable usually. From nicholls.mark at vimn.com Fri Nov 4 15:31:22 2016 From: nicholls.mark at vimn.com (Nicholls, Mark) Date: Fri, 4 Nov 2016 15:31:22 +0000 Subject: [Haskell-cafe] programming style...and type classes... In-Reply-To: <20161104151009.GD31501@nibbler> References: <50a704b8-14b7-ca49-7093-143dbe9bbd86@durchholz.org> <836817a9-52f6-fdf6-50db-420c12f91efe@cs.otago.ac.nz> <1FF462D6-9DDB-4227-BDB7-AC5BE67089ED@vimn.com> <20161104132936.GB31501@nibbler> <20161104151009.GD31501@nibbler> Message-ID: >> >My rule of thumb is that if there is one obvious instance (or none) >> >for every given type, then your abstraction is a good candidate for a >> >typeclass; if multiple instances make sense, then it's a judgment >> >call; and if many instances could arbitrarily make sense or not >> >depending on the usage / circumstances, then it's probably not a good >candidate for a typeclass. >> >> OK, that’s a bit more prescriptive...so if many instances make sense (Ord a) >then what? >> >> Seems like Ord is a "bad" typeclass?...it should really be a dictionary data >type? And then you simply define which order you want? > >Ord is a "bad" typeclass if you interpret it as "the ordering rules for this type"; >but it is OK if you interpret it as "the default ordering rules for this type". :-) This is the similar linguistic trickery as earler You can always select a specific instance and claim it default, and then your rule of thumb becomes very very weak. Lets order some tuples...whats the natural order?.. Ordering the natural numbers, maybe "natural" but I quite often want the reverse order, then I either build custom functions to do this, or have to map between orders (reverse). > Which, >arguably, makes more sense for some types >(Int) and less for others (Text). However, in the case of Ord, there is little harm >in defining a default instance and using more specialized sorting functions that >take an explicit ordering functions; this stuff is simple enough for these things to >not be very intrusive at all, and giving arguable cases the benefit of the doubt, I >guess, is considered pragmatic. Ok...but really your rule of thumb says "Ord" is bad...I haven’t got a problem with that...it may be "bad" but still useful enough to preserve....and the language isnt the arbiter of good practice...that's you. Someone else has used this as a problematic typeclass in another mail (thanks). you can decide :-) Is Ord a bad typeclass? Or is the rule of thumb a bit weak (and allows almost any typeclass if we insert the word "default" into the spec)? (I think Ord is a "bad" typeclass, for your heuristic to survive...and I think your heuristic captures something of value, keep the heuristic and label Ord bad...but still use it). > >> >> There needs to be 1 (or 0) instances because this is all resolved >> compile time?....i.e. so we (the programmer/compiler) need a function >> from types, and function name into instances...if there 0 >> instance...then boom...not defined..so you need to do something, >> that’s fixable....if 2...then boom...you're in trouble? > >Sort of, yes. You can't have two instances of the same typeclass for the same >type. However, because instances are always global, and can be defined >separately from both the type and the typeclass, it is possible to write instances >which, when imported, break the code that imports them by introducing >conflicting instances. This is why the recommendation is to always define >instances either in the module that defines the type, or the module that defines >the typeclass. Which IS interesting. Who's recommendation? Have you got a reference? > Instances that are defined separately from both are called >"orphan instances", and people generally avoid them where possible, but >occasionally practical concerns make them necessary. The most common reason >for orphan instances is to avoid dependencies: suppose you write a library that >defines an alternative string type; and someone else writes a library that defines >useful typeclasses for string-like types. Ideally, you want your custom string type >to have instances for those typeclasses, but you can't put them in the typeclass >library (because you don't control it), and you don't want to put them in your >own library, because then your own library has to depend on the typeclass >library even though most people won't need that functionality. In such a >situation, you'd bite the bullet and provide an extra library that contains just the >instances, peppered with warnings about orphan instances. Another example is >when you write a program that uses types from some third-party library, and >wants to marshal them to and from JSON - for that to work, you need to >implement ToJSON and FromJSON instances for those types, but since you >control neither the type nor the JSON typeclasses, the only choice you have is to >make orphan instances in your program. In that case, the damage is limited, >because you won't expose the orphan instances to the outside world, so it's sort >of acceptable usually. Ok...very interesting. As I say if you've got a reference to some sort of "real world Haskell" book or something like that, then that’s brilliant....I can dig about the edge cases. CONFIDENTIALITY NOTICE This e-mail (and any attached files) is confidential and protected by copyright (and other intellectual property rights). If you are not the intended recipient please e-mail the sender and then delete the email and any attached files immediately. Any further use or dissemination is prohibited. While MTV Networks Europe has taken steps to ensure that this email and any attachments are virus free, it is your responsibility to ensure that this message and any attachments are virus free and do not affect your systems / data. Communicating by email is not 100% secure and carries risks such as delay, data corruption, non-delivery, wrongful interception and unauthorised amendment. If you communicate with us by e-mail, you acknowledge and assume these risks, and you agree to take appropriate measures to minimise these risks when e-mailing us. MTV Networks International, MTV Networks UK & Ireland, Greenhouse, Nickelodeon Viacom Consumer Products, VBSi, Viacom Brand Solutions International, Be Viacom, Viacom International Media Networks and VIMN and Comedy Central are all trading names of MTV Networks Europe. MTV Networks Europe is a partnership between MTV Networks Europe Inc. and Viacom Networks Europe Inc. Address for service in Great Britain is 17-29 Hawley Crescent, London, NW1 8TT. From will.yager at gmail.com Fri Nov 4 17:16:01 2016 From: will.yager at gmail.com (Will Yager) Date: Fri, 4 Nov 2016 12:16:01 -0500 Subject: [Haskell-cafe] programming style...and type classes... In-Reply-To: <20161104151009.GD31501@nibbler> References: <50a704b8-14b7-ca49-7093-143dbe9bbd86@durchholz.org> <836817a9-52f6-fdf6-50db-420c12f91efe@cs.otago.ac.nz> <1FF462D6-9DDB-4227-BDB7-AC5BE67089ED@vimn.com> <20161104132936.GB31501@nibbler> <20161104151009.GD31501@nibbler> Message-ID: > On Nov 4, 2016, at 10:10, Tobias Dammers wrote: > > However, in the case of Ord, there is > little harm in defining a default instance and using more specialized > sorting functions that take an explicit ordering functions; I disagree. This is the purpose of newtype wrappers. There are few scenarios where it's syntactically more convenient to pass around a bunch of random functions rather than just define a newtype with the behavior you want. GeneralizedNewtypeDeriving makes this trivial. Will From tdammers at gmail.com Fri Nov 4 17:38:01 2016 From: tdammers at gmail.com (Tobias Dammers) Date: Fri, 4 Nov 2016 18:38:01 +0100 Subject: [Haskell-cafe] programming style...and type classes... In-Reply-To: References: <50a704b8-14b7-ca49-7093-143dbe9bbd86@durchholz.org> <836817a9-52f6-fdf6-50db-420c12f91efe@cs.otago.ac.nz> <1FF462D6-9DDB-4227-BDB7-AC5BE67089ED@vimn.com> <20161104132936.GB31501@nibbler> <20161104151009.GD31501@nibbler> Message-ID: As with most things "apply taste" and "apply brain"... uhm... apply. On Nov 4, 2016 6:16 PM, "Will Yager" wrote: > > > > On Nov 4, 2016, at 10:10, Tobias Dammers wrote: > > > > However, in the case of Ord, there is > > little harm in defining a default instance and using more specialized > > sorting functions that take an explicit ordering functions; > > I disagree. This is the purpose of newtype wrappers. There are few > scenarios where it's syntactically more convenient to pass around a bunch > of random functions rather than just define a newtype with the behavior you > want. GeneralizedNewtypeDeriving makes this trivial. > > Will -------------- next part -------------- An HTML attachment was scrubbed... URL: From oleg.grenrus at iki.fi Fri Nov 4 18:28:13 2016 From: oleg.grenrus at iki.fi (Oleg Grenrus) Date: Fri, 4 Nov 2016 20:28:13 +0200 Subject: [Haskell-cafe] [ANN] github-0.15 Message-ID: <099E045F-F935-400C-9827-5D9BD939C333@iki.fi> Hi, today I finally released a new version of `github` package [1], providing bindings to the most of GitHub API. [2] The most notable feature, it’s now compatible with GHC-8.0.1. As GitHub doesn’t provide (or I’m not aware of) machine readable specification of their API, the feature completeness and correctness depends on the users of the package. So, please try it out, find out what’s incorrect and missing, and ideally submit a PR. The plan for the next version is to merge in definitions from github-types [3], and then split types from `github` package back into `github-types`, so others can reuse the definitions without the rest of the packages, e.g. for servant-github [4] As you can see, we are still experimenting with “how to write bindings to rest APIs”, if you have some comments, please raise an issue. Cheers, Oleg Grenrus - [1]: http://hackage.haskell.org/package/github - [2]: https://developer.github.com/v3/ - [3]: http://hackage.haskell.org/package/github-types - [4]: http://hackage.haskell.org/package/servant-github -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 842 bytes Desc: Message signed with OpenPGP using GPGMail URL: From tdammers at gmail.com Fri Nov 4 18:32:31 2016 From: tdammers at gmail.com (Tobias Dammers) Date: Fri, 4 Nov 2016 19:32:31 +0100 Subject: [Haskell-cafe] [ANN] github-0.15 In-Reply-To: <099E045F-F935-400C-9827-5D9BD939C333@iki.fi> References: <099E045F-F935-400C-9827-5D9BD939C333@iki.fi> Message-ID: Not very constructive, but I can't help but think that if people were to write actual RESTful APIs, this would be a much more straightforward problem to solve... On Nov 4, 2016 7:28 PM, "Oleg Grenrus" wrote: > Hi, > > today I finally released a new version of `github` package [1], providing > bindings > to the most of GitHub API. [2] > > The most notable feature, it’s now compatible with GHC-8.0.1. > > As GitHub doesn’t provide (or I’m not aware of) machine readable > specification > of their API, the feature completeness and correctness depends on the users > of the package. So, please try it out, find out what’s incorrect and > missing, > and ideally submit a PR. > > The plan for the next version is to merge in definitions from github-types > [3], > and then split types from `github` package back into `github-types`, so > others can reuse the definitions without the rest of the packages, e.g. for > servant-github [4] > > As you can see, we are still experimenting with “how to write bindings to > rest APIs”, > if you have some comments, please raise an issue. > > Cheers, > Oleg Grenrus > > - [1]: http://hackage.haskell.org/package/github > - [2]: https://developer.github.com/v3/ > - [3]: http://hackage.haskell.org/package/github-types > - [4]: http://hackage.haskell.org/package/servant-github > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From olf at aatal-apotheke.de Sat Nov 5 15:45:55 2016 From: olf at aatal-apotheke.de (Olaf Klinke) Date: Sat, 5 Nov 2016 16:45:55 +0100 Subject: [Haskell-cafe] programming style...and type classes... Message-ID: <1195A694-D9E0-4830-BB25-54D886BBD9CA@aatal-apotheke.de> While we have stated in this thread what typeclasses should _not_ be used for, we probably do not have carved out yet what `proper' use is. Please help me here. There are some typeclasses, e.g. Eq, Ord, Num, Monoid, Functor, Monad and Category, that arise from category theory and algebra, so these may be regarded as "good" typeclasses even though a type can have several sensible instances. In that case, newtypes may express this. (Data.Monoid is full of such newtypes.) In defense of Ord, there are in general many ways to totally order a set (read "set" as "total elements of a type"), and none of these ways can be preferred a priori. I would not say this is an inherently bad property of Ord. Similarly, there are many ways to put a monoid or ring structure on a set. Sometimes a type class can be avoided. For example, there is Data.Foldable.toList. Hence, instead of writing a Foldable instance for your type and use a function from the Data.Foldable module, you could instead write your own toList conversion function and then fold that list. (Does anyone know a function involving Foldable that can not be reduced to 'toList' followed by some list operations? Is [] the "free instance" of Fodable?) However, this reduction may be much more inefficient than using the Foldable instance directly. As a contrived example of what I mean by "free instance", consider the following class that abstracts traversal over a sequence of unknown length. class ListLike l where patternmatch :: l a -> Maybe (a,l a) You can write ListLike instances for [], Vector, Sequence and Set, but only [a] is the solution to the type equation x = Maybe (a,x). Then there are multi-parameter type classes. This has been described as metaphorical to a type-level Prolog language [1], since ultimately multi-parameter type classes (without methods) are relations between types. Another debatable use case: You define many record types, each of which has a sort key component: data A = A {foo :: Foo, bar :: Bar, keyA :: Int} data B = B {baz :: Baz, keyB :: Int} data C = C {... , keyC :: Int} It might be convenient to define a typeclass class HasSortKey a where key :: a -> Int and endow the types A, B and C with the obvious instances. But one could also avoid the class by making a parametric type: data Keyed a = Keyed {payload :: a, key :: Int} and then let data A = A {foo :: Foo, bar :: Bar} and so forth. Which version would you say is `proper' use? -- Olaf [1] https://www.reddit.com/r/haskell/comments/ck459/typed_typelevel_programming_in_haskell_part_i/ From ch.howard at zoho.com Sat Nov 5 18:15:54 2016 From: ch.howard at zoho.com (Christopher Howard) Date: Sat, 5 Nov 2016 10:15:54 -0800 Subject: [Haskell-cafe] Guidance on symbol error Message-ID: <96631062-0509-639a-6f10-ed4761ba0caa@zoho.com> Hi list. I'm trying to build gruff on Debian Jessie with GHC 7.6.3. I'm building gruff-0.3.3 because gruff-0.3.4 dependencies seem to be too new for Jessie. I was able to build all the dependencies of gruff-0.3.3 (after installing a ton of -dev packages). But when cabal tries to build the gruff package itself, I get this error: /usr/bin/ld: dist/build/gruff/gruff-tmp/src/compute.o: undefined reference to symbol '_ZdaPv@@GLIBCXX_3.4' //usr/lib/x86_64-linux-gnu/libstdc++.so.6: error adding symbols: DSO missing from command line It's been quite a while since I did any C++ programming... could somebody clarify for me what this means? Thank you. -- https://qlfiles.net My PGP public key ID is 0x340EA95A (pgp.mit.edu). From guthrie at mum.edu Sat Nov 5 19:09:55 2016 From: guthrie at mum.edu (Gregory Guthrie) Date: Sat, 5 Nov 2016 14:09:55 -0500 Subject: [Haskell-cafe] typeclass constraints? Message-ID: <08EF9DA445C4B5439C4733E1F35705BA065BEDD8A4CF@MAIL.cs.mum.edu> I want to define a bunch of tests in a simple demo program, where each test is locally defined, but all can be printed in one standard place. For example, each test result has a description::String, and a value, which can vary across tests. t1 = ("Sqrt(4)", sqrt(4.0)) ... t2 = ("sumList:", sum [1,2,3,4]) ... t3 = ("Description", value) ... So each test is of type: (String, value), for various value types all of which (only) have to be members of the Show class. Then for the summary of the tests, a loop: test (msg, val) = do print $ msg ++ " :: " ++ show val tests ts = mapM test ts ... Do tests [t1, t2, t3] This compiles, and assigns these types: test :: Show a => ([Char], a) -> IO () tests :: (Traversable t, Show a) => t ([Char], a) -> IO (t ()) Which works only as long as all tests have the same type for the second argument. I assume that it is somehow specializing the type to the actual encountered type of the arguments used, even though they are all show'able. So that they can vary on the actual types of the second argument, I tried something like this (pseudo code): type ATest = (Show a) => (String, a) since that wouldn't work, I tried: {-# LANGUAGE RankNTypes #-} type ATest = forall a. (Show a) => (String, a) Which compiles, but still fails on any variation in the value argument. Further, I want to abstract the type of tests from the loop which prints them, but I cannot then use it to convert from: test :: Show a => ([Char], a) -> IO () to test :: ATest -> IO () The basic idea was to define and use a polymorphic type for the tests in the definition of the testing loop. So perhaps a data structure instead; data (Show a) => ATest = Test (String, a) but that also fails, although it does give the right idea; all tests have a common structure, with a second value in the Show typeclass. I realize that generally one is recommended not to put constraints on the data type, but on the functions which use it - but here since I want a collection of tests it seems like I need a polymorphic list with consistent types. What is the right approach for this? Am I just getting the syntax wrong? -------------- next part -------------- An HTML attachment was scrubbed... URL: From will.yager at gmail.com Sat Nov 5 19:43:22 2016 From: will.yager at gmail.com (William Yager) Date: Sat, 5 Nov 2016 14:43:22 -0500 Subject: [Haskell-cafe] typeclass constraints? In-Reply-To: <08EF9DA445C4B5439C4733E1F35705BA065BEDD8A4CF@MAIL.cs.mum.edu> References: <08EF9DA445C4B5439C4733E1F35705BA065BEDD8A4CF@MAIL.cs.mum.edu> Message-ID: You probably want :set -XExistentialQuantification data Test = forall a . Show a => Test String a Under the hood, this works by storing the vtable for the "Show" typeclass for whatever object you're putting in the Test. You could explicitly unpack this like data TestY = forall a . Test String a (a -> String) Cheers, Will On Sat, Nov 5, 2016 at 2:09 PM, Gregory Guthrie wrote: > > data (Show a) => ATest = Test (String, a) > > but that also fails, although it does give the right idea; all tests have > a common structure, with a second value in the Show typeclass. > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Sat Nov 5 20:50:58 2016 From: allbery.b at gmail.com (Brandon Allbery) Date: Sat, 5 Nov 2016 16:50:58 -0400 Subject: [Haskell-cafe] typeclass constraints? In-Reply-To: <08EF9DA445C4B5439C4733E1F35705BA065BEDD8A4CF@MAIL.cs.mum.edu> References: <08EF9DA445C4B5439C4733E1F35705BA065BEDD8A4CF@MAIL.cs.mum.edu> Message-ID: On Sat, Nov 5, 2016 at 3:09 PM, Gregory Guthrie wrote: > So each test is of type: (String, value), for various value types all of > which (only) have to be members of the *Show* class. Had you considered [(String, String)]? Remember that Haskell is lazy; it's not going to evaluate those expressions until their values are needed for e.g. I/O. -- 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 guthrie at mum.edu Sat Nov 5 21:01:41 2016 From: guthrie at mum.edu (Gregory Guthrie) Date: Sat, 5 Nov 2016 16:01:41 -0500 Subject: [Haskell-cafe] typeclass constraints? In-Reply-To: References: <08EF9DA445C4B5439C4733E1F35705BA065BEDD8A4CF@MAIL.cs.mum.edu> Message-ID: <08EF9DA445C4B5439C4733E1F35705BA065BEDD8A4D9@MAIL.cs.mum.edu> Yes – I could move the show() back to the test definitions. This was also mostly/partly to better understand how to do this. Thanks. From: Brandon Allbery [mailto:allbery.b at gmail.com] Sent: Saturday, November 5, 2016 3:51 PM To: Gregory Guthrie Cc: haskell-cafe at haskell.org Subject: Re: [Haskell-cafe] typeclass constraints? On Sat, Nov 5, 2016 at 3:09 PM, Gregory Guthrie > wrote: So each test is of type: (String, value), for various value types all of which (only) have to be members of the Show class. Had you considered [(String, String)]? Remember that Haskell is lazy; it's not going to evaluate those expressions until their values are needed for e.g. I/O. -- 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 dave at zednenem.com Sun Nov 6 03:06:19 2016 From: dave at zednenem.com (David Menendez) Date: Sat, 5 Nov 2016 23:06:19 -0400 Subject: [Haskell-cafe] programming style...and type classes... In-Reply-To: <1195A694-D9E0-4830-BB25-54D886BBD9CA@aatal-apotheke.de> References: <1195A694-D9E0-4830-BB25-54D886BBD9CA@aatal-apotheke.de> Message-ID: On Sat, Nov 5, 2016 at 11:45 AM, Olaf Klinke wrote: > While we have stated in this thread what typeclasses should _not_ be used > for, we probably do not have carved out yet what `proper' use is. Please > help me here. > It may be helpful to recall the original purpose of classes, which was to allow controlled, ad-hoc overloading. Otherwise, we’d be stuck using specialized functions for every type, passing around explicit equality tests, or being stuck with the equivalent of deriving(Eq) on every type. Now that we have qualified types, we can write algorithms which are generic over class members. This, I would say, is the sign that a class is useful. If you can’t usefully write code which is generic over a class, then you don’t gain much from using the class. (You do gain not having to come up with new names, though, and that’s not nothing.) Some people claim that you shouldn’t define a class unless you can describe some sort of algebraic laws for it, but I think that’s too strong. For one thing, it would mean we lose equality and numeric operations for Float, which is one of the things classes were invented for in the first place. Instead, define a class if (1) you have a set of operations that can be applied at multiple types but aren’t polymorphic, (2) you can give a formal or informal description of the operations which are enough to reasonably distinguish a good instance from a bad one, and (3) using a class makes your code easier to understand. -- Dave Menendez -------------- next part -------------- An HTML attachment was scrubbed... URL: From ruben.astud at gmail.com Sun Nov 6 15:02:35 2016 From: ruben.astud at gmail.com (Ruben Astudillo) Date: Sun, 6 Nov 2016 12:02:35 -0300 Subject: [Haskell-cafe] programming style...and type classes... In-Reply-To: References: <1195A694-D9E0-4830-BB25-54D886BBD9CA@aatal-apotheke.de> Message-ID: <6de32b14-25b7-fbcb-49d7-bd7ffdd5cc3a@gmail.com> On 06/11/16 00:06, David Menendez wrote: > Some people claim that you shouldn’t define a class unless you can > describe some sort of algebraic laws for it, but I think that’s too > strong. For one thing, it would mean we lose equality and numeric > operations for Float, which is one of the things classes were invented > for in the first place. I've heard that too and agree with your objection. I think what underlies that critic, is that introduccion type classes without laws makes it harder to see the "intuition" of what such class ought to do (this in the context of reading, not writing). I specifically remember being a beginners and see class RegexOptions regex compOpt execOpt not understanding what really meant and why had to sprinkle it through my code. A good case of what you say is Data.Vector.Generic.Vector, (which argueably make more sense as a backpack-module) that makes the type class usage intuition clear. So in resume, what we want is "easy to understand usage" typeclasses more than laws. To that I think putting emphasis on the important instances goes great length in helping. > Instead, define a class if (1) you have a set of operations that can > be applied at multiple types but aren’t polymorphic, (2) you can give > a formal or informal description of the operations which are enough to > reasonably distinguish a good instance from a bad one, and (3) using a > class makes your code easier to understand. (2) hits the nail, specially when reading others code! -- -- Ruben From ietf-dane at dukhovni.org Mon Nov 7 00:30:59 2016 From: ietf-dane at dukhovni.org (Viktor Dukhovni) Date: Mon, 7 Nov 2016 00:30:59 +0000 Subject: [Haskell-cafe] ResourceT "unmasked" during allocation? Message-ID: <20161107003059.GX26244@mournblade.imrryr.org> I am looking at using ResourceT to manage the acquisiition and deallocation of network sockets. In comparing resourceT's `allocate` with `bracket` I was somewhat perplexed to find that `allocate` in Control.Monad.Trans.Resource seems to not mask exceptions during allocation (see "No mask" comment I inserted): allocateRIO :: IO a -> (a -> IO ()) -> ResourceT IO (ReleaseKey, a) allocateRIO acquire rel = ResourceT $ \istate -> liftIO $ E.mask $ \restore -> do a <- restore acquire -- ^^^ No mask ^^^ key <- register' istate $ rel a return (key, a) allocate :: MonadResource m => IO a -- ^ allocate -> (a -> IO ()) -- ^ free resource -> m (ReleaseKey, a) allocate a = liftResourceT . allocateRIO a By contrast in Exception.Base we see that `bracket` masks the initialization action: bracket before after thing = mask $ \restore -> do a <- before -- ^^^ masked! ^^^ r <- restore (thing a) `onException` after a _ <- after a return r This seems to suggest that ResourceT is more exposes to resource leaks via asynchronous exceptions. Say if a file descriptor is a allocated, but an exception interrupts "allocate" before it can register the resource. Perhaps I am missing something, or there are good reasons for the difference in approach. Can anyone shed some light on the reason why ResourceT differs (seemingly) from bracket in this regard. -- Viktor. From michael at snoyman.com Mon Nov 7 06:46:15 2016 From: michael at snoyman.com (Michael Snoyman) Date: Mon, 7 Nov 2016 08:46:15 +0200 Subject: [Haskell-cafe] ResourceT "unmasked" during allocation? In-Reply-To: <20161107003059.GX26244@mournblade.imrryr.org> References: <20161107003059.GX26244@mournblade.imrryr.org> Message-ID: Yes, there's a good reason: it's a bug :). I wrote that code a while ago, and had a mistaken understanding of how bracket works at the time. Thanks for noticing this, I'll release a new version shortly. On Mon, Nov 7, 2016 at 2:30 AM, Viktor Dukhovni wrote: > I am looking at using ResourceT to manage the acquisiition and > deallocation of network sockets. In comparing resourceT's `allocate` > with `bracket` I was somewhat perplexed to find that `allocate` in > Control.Monad.Trans.Resource seems to not mask exceptions during > allocation (see "No mask" comment I inserted): > > allocateRIO :: IO a -> (a -> IO ()) -> ResourceT IO (ReleaseKey, a) > allocateRIO acquire rel = ResourceT $ \istate -> liftIO $ E.mask $ > \restore -> do > a <- restore acquire > -- ^^^ No mask ^^^ > key <- register' istate $ rel a > return (key, a) > > allocate :: MonadResource m > => IO a -- ^ allocate > -> (a -> IO ()) -- ^ free resource > -> m (ReleaseKey, a) > allocate a = liftResourceT . allocateRIO a > > By contrast in Exception.Base we see that `bracket` masks > the initialization action: > > bracket before after thing = > mask $ \restore -> do > a <- before > -- ^^^ masked! ^^^ > r <- restore (thing a) `onException` after a > _ <- after a > return r > > This seems to suggest that ResourceT is more exposes to resource > leaks via asynchronous exceptions. Say if a file descriptor is a > allocated, but an exception interrupts "allocate" before it can > register the resource. > > Perhaps I am missing something, or there are good reasons for > the difference in approach. Can anyone shed some light on the > reason why ResourceT differs (seemingly) from bracket in this > regard. > > -- > Viktor. > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From pierre.crumeyrolle at c-s.fr Mon Nov 7 09:45:55 2016 From: pierre.crumeyrolle at c-s.fr (CRUMEYROLLE Pierre) Date: Mon, 07 Nov 2016 10:45:55 +0100 Subject: [Haskell-cafe] ghc installation on redhat7 Message-ID: <20161107104555.Horde.ch6kzHPS1rVhWVJibbch-Q1@messagerie.si.c-s.fr> Hello y want to install from source ghc 7.10 on red hat 7 y have installed by rpm method ghc 7.6.3 on my host because for generate ghc it's necessary to have pre install a ghc compiler. y have also perl version 5.16.3 installed. y have downloaded on https://www.haskell.org/ghc/download_ghc_7_10_1 the source distribution ghc-7.10.1-src.tar.bz2 after tar xvf ghc-7.10.1-src.tar.bz2 y launch ./configure --prefix=$HOME y have this error "Could not find module `System.Directory'" my trace below, thanks for explain $ ./configure --prefix=$HOME checking for gfind... no checking for find... /usr/bin/find checking for sort... /usr/bin/sort checking for GHC Git commit id... given ca00def1d7093d6b5b2a937ddfc8a01c152038eb checking for ghc... /usr/bin/ghc checking version of ghc... 7.6.3 checking build system type... x86_64-unknown-linux-gnu checking host system type... x86_64-unknown-linux-gnu checking target system type... x86_64-unknown-linux-gnu Build platform inferred as: x86_64-unknown-linux Host platform inferred as: x86_64-unknown-linux Target platform inferred as: x86_64-unknown-linux GHC build : x86_64-unknown-linux GHC host : x86_64-unknown-linux GHC target : x86_64-unknown-linux configure: Building in-tree ghc-pwd utils/ghc-pwd/Main.hs:4:8: Could not find module `System.Directory' Use -v to see a list of the files searched for. configure: error: Building ghc-pwd failed best regards From claude at mathr.co.uk Mon Nov 7 13:14:11 2016 From: claude at mathr.co.uk (Claude Heiland-Allen) Date: Mon, 7 Nov 2016 13:14:11 +0000 Subject: [Haskell-cafe] Guidance on symbol error In-Reply-To: <96631062-0509-639a-6f10-ed4761ba0caa@zoho.com> References: <96631062-0509-639a-6f10-ed4761ba0caa@zoho.com> Message-ID: <1262fa13-1bb4-ad3b-c05d-3aa05e06fd65@mathr.co.uk> Hi Christopher, On 05/11/16 18:15, Christopher Howard wrote: > Hi list. I'm trying to build gruff on Debian Jessie with GHC 7.6.3. I'm > building gruff-0.3.3 because gruff-0.3.4 dependencies seem to be too new > for Jessie. I was able to build all the dependencies of gruff-0.3.3 > (after installing a ton of -dev packages). But when cabal tries to build > the gruff package itself, I get this error: > > /usr/bin/ld: dist/build/gruff/gruff-tmp/src/compute.o: undefined > reference to symbol '_ZdaPv@@GLIBCXX_3.4' > //usr/lib/x86_64-linux-gnu/libstdc++.so.6: error adding symbols: DSO > missing from command line > > It's been quite a while since I did any C++ programming... could > somebody clarify for me what this means? Thank you. This means the linker in Jessie is stricter than the linker used in development, about needing to specify all link objects explicitly. The solution is to add this to the cabal file (at the bottom of the executable stanza): extra-libraries: stdc++ With this addition I can compile gruff in a Jessie chroot, but have trouble getting it to work (displays a blank screen). I'm not sure if this is down to the chroot environment or a problem in gruff itself. Claude -- https://mathr.co.uk From capn.freako at gmail.com Mon Nov 7 14:25:20 2016 From: capn.freako at gmail.com (David Banas) Date: Mon, 7 Nov 2016 06:25:20 -0800 Subject: [Haskell-cafe] FFT, via homogeneous functions? Message-ID: <9CB5DA5B-C256-4AD2-81FE-67A89CE6C381@gmail.com> Hi all, I’m trying to implement the fast Fourier transform (FFT), using the homogeneous functions described in Sec. 4.2 of *Arrows and Computation* by Ross Paterson: -- FFT implementation -- Note my reversal of Ross' even/odd convention, below. -- I did this, to remain consistent with the explanation, above, which came from a pre-existing work. fft :: RealFloat b => Hom (Complex b) (Complex b) fft = id :&: proc (e, o) -> do e' <- fft -< e o' <- fft >>> twiddle -< o unriffle -< f (e', o') where f (x, y) = (x + y, x - y) twiddle :: RealFloat b => Hom (Complex b) (Complex b) twiddle = id :&: twiddle' 1 twiddle' :: RealFloat b => Int -> Hom (Pair (Complex b)) (Pair (Complex b)) twiddle' n = (id *** (* phi)) :&: (((twiddle' n') *** ((twiddle' n') >>> (arr ((* phi) `prod` (* phi))))) >>> unriffle) where phi = cis (-pi / (fromIntegral (2 ^ n))) n' = n + 1 I’m getting this output, which means that, while my *twiddle* function is working for all tree depths tested, my *fft* function fails for tree depths greater than 3: Tree depth: 0 Testing twiddles...True Testing FFT...True Tree depth: 1 Testing twiddles...True Testing FFT...True Tree depth: 2 Testing twiddles...True Testing FFT...True Tree depth: 3 Testing twiddles...True Testing FFT...True Tree depth: 4 Testing twiddles...True Testing FFT...False Tree depth: 5 Testing twiddles...True Testing FFT...False And I’m wondering if anyone sees the flaw in my code. More here: https://htmlpreview.github.io/?https://github.com/capn-freako/Haskell_Misc/blob/master/Arrows_and_Computation/Arrows_and_Computation.html#ex17x Thanks! -db -------------- next part -------------- An HTML attachment was scrubbed... URL: From hjgtuyl at chello.nl Mon Nov 7 18:13:51 2016 From: hjgtuyl at chello.nl (Henk-Jan van Tuyl) Date: Mon, 07 Nov 2016 19:13:51 +0100 Subject: [Haskell-cafe] TIOBE Index: Is Haskell finally going to hit the top 20? Message-ID: L.S., I know the TIOBE index[0] is not very scientific, but it is nice to see Haskell moving up in the TIOBE Index. From tiobe.com: " TIOBE Index for November 2016 November Headline: Is Haskell finally going to hit the top 20? Some people say that Haskell is the most mature purely functional programming language available nowadays. It has quite a long history, dating back from 1990 and its community is growing, although slowly. This month Haskell is only 0.255% away from the top 20 at position 23. Let's see what happens the next few months. " Haskell ranked 34th last month. Regards, Henk-Jan van Tuyl [0] http://www.tiobe.com/tiobe-index/ -- Folding at home What if you could share your unused computer power to help find a cure? In just 5 minutes you can join the world's biggest networked computer and get us closer sooner. Watch the video. http://folding.stanford.edu/ http://members.chello.nl/hjgtuyl/tourdemonad.html Haskell programming -- From list at mroth.net Mon Nov 7 19:56:54 2016 From: list at mroth.net (Michael Roth) Date: Mon, 7 Nov 2016 20:56:54 +0100 Subject: [Haskell-cafe] Avoid sharing Message-ID: <556465cf-4c50-cfd5-8cd2-1240c3dc6614@mroth.net> Hello! A short question, given: data Seed = ... data Value = ... someGenerator :: Seed -> [Value] createTwo :: Seed -> ([Value], [Value]) createTwo s = (as, bs) where as = someGenerator s bs = drop 1000000000 (someGenerator s) Is it guaranteed that 'someGenerator s' is created twice and not shared between 'as' and 'bs'? Is this by language design? Are there any GHC options that change the behaviour? Thank you, Michael From ezyang at mit.edu Mon Nov 7 20:56:02 2016 From: ezyang at mit.edu (Edward Z. Yang) Date: Mon, 07 Nov 2016 12:56:02 -0800 Subject: [Haskell-cafe] Avoid sharing In-Reply-To: <556465cf-4c50-cfd5-8cd2-1240c3dc6614@mroth.net> References: <556465cf-4c50-cfd5-8cd2-1240c3dc6614@mroth.net> Message-ID: <1478552011-sup-2548@sabre> It's not guaranteed. Unfortunately there aren't really good ways to avoid sharing; the general advice is to convert values into functions, and apply them at the use site where sharing is OK. Unrelatedly, in your sample code, dropping 1000000000 entries is not a good way to build a splittable RNG. Check out http://publications.lib.chalmers.se/records/fulltext/183348/local_183348.pdf and also its related work for some bettera pproaches. Edward Excerpts from Michael Roth's message of 2016-11-07 20:56:54 +0100: > Hello! A short question, given: > > > data Seed = ... > data Value = ... > > someGenerator :: Seed -> [Value] > > createTwo :: Seed -> ([Value], [Value]) > createTwo s = (as, bs) where > as = someGenerator s > bs = drop 1000000000 (someGenerator s) > > > Is it guaranteed that 'someGenerator s' is created twice and not shared > between 'as' and 'bs'? Is this by language design? Are there any GHC > options that change the behaviour? > > > Thank you, > > Michael > From allbery.b at gmail.com Mon Nov 7 21:00:48 2016 From: allbery.b at gmail.com (Brandon Allbery) Date: Mon, 7 Nov 2016 16:00:48 -0500 Subject: [Haskell-cafe] Avoid sharing In-Reply-To: <556465cf-4c50-cfd5-8cd2-1240c3dc6614@mroth.net> References: <556465cf-4c50-cfd5-8cd2-1240c3dc6614@mroth.net> Message-ID: On Mon, Nov 7, 2016 at 2:56 PM, Michael Roth wrote: > as = someGenerator s > bs = drop 1000000000 (someGenerator s) > > Is it guaranteed that 'someGenerator s' is created twice and not shared > between 'as' and 'bs'? Is this by language design? Are there any GHC > options that change the behaviour? > It's not specified in any standard, but ghc will only share something that is directly bound. There is no sensible way to determine sharing automatically that will do what everyone expects, so ghc doesn't try: the programmer is expected to use bindings to specify sharing. -- 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 tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Mon Nov 7 21:10:41 2016 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Mon, 7 Nov 2016 21:10:41 +0000 Subject: [Haskell-cafe] Avoid sharing In-Reply-To: <1478552011-sup-2548@sabre> References: <556465cf-4c50-cfd5-8cd2-1240c3dc6614@mroth.net> <1478552011-sup-2548@sabre> Message-ID: <20161107211041.GB15637@weber> I'm not going to contradict Edward's answer in practice, because he knows far more about the internals of GHC than I do. However, I will contradict it in theory. There is a straightforward operational semantics for Haskell programs as compiled by GHC via Core to STG (without any optimisations applied). I described this semantics in the following talk at Haskell eXchange 2016: https://skillsmatter.com/skillscasts/8726-haskell-programs-how-do-they-run#video and I wrote it up as an article here: http://h2.jaguarpaw.co.uk/posts/haskell-programs-how-do-they-run/ Under that semantics, yes, 'someGenerator s' is bound twice and thus is not shared. Now, GHC may try to apply an "optimisation" and (accidentally?) introduce sharing. That would be a compiler bug, in my opinion. In fact, it would be a terrible blow to Haskell's future as a practical language, because we really need fine-grained control over sharing. So I really hope that Edward is wrong about this. Tom On Mon, Nov 07, 2016 at 12:56:02PM -0800, Edward Z. Yang wrote: > It's not guaranteed. Unfortunately there aren't really good ways > to avoid sharing; the general advice is to convert values into > functions, and apply them at the use site where sharing is OK. > > Unrelatedly, in your sample code, dropping 1000000000 entries > is not a good way to build a splittable RNG. Check out > http://publications.lib.chalmers.se/records/fulltext/183348/local_183348.pdf > and also its related work for some bettera pproaches. > > Edward > > Excerpts from Michael Roth's message of 2016-11-07 20:56:54 +0100: > > Hello! A short question, given: > > > > > > data Seed = ... > > data Value = ... > > > > someGenerator :: Seed -> [Value] > > > > createTwo :: Seed -> ([Value], [Value]) > > createTwo s = (as, bs) where > > as = someGenerator s > > bs = drop 1000000000 (someGenerator s) > > > > > > Is it guaranteed that 'someGenerator s' is created twice and not shared > > between 'as' and 'bs'? Is this by language design? Are there any GHC > > options that change the behaviour? From allbery.b at gmail.com Mon Nov 7 21:18:50 2016 From: allbery.b at gmail.com (Brandon Allbery) Date: Mon, 7 Nov 2016 16:18:50 -0500 Subject: [Haskell-cafe] ghc installation on redhat7 In-Reply-To: <20161107104555.Horde.ch6kzHPS1rVhWVJibbch-Q1@messagerie.si.c-s.fr> References: <20161107104555.Horde.ch6kzHPS1rVhWVJibbch-Q1@messagerie.si.c-s.fr> Message-ID: On Mon, Nov 7, 2016 at 4:45 AM, CRUMEYROLLE Pierre < pierre.crumeyrolle at c-s.fr> wrote: > y have installed by rpm method ghc 7.6.3 on my host because for generate > ghc it's necessary to have pre install a ghc compiler. y have also perl > version 5.16.3 installed. >From where did you get that package? I don't see any ghc version in the centos 7/rhel7 repos. You probably need additional packages to get the "directory" (ghc-)package. -- 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 ezyang at mit.edu Mon Nov 7 21:32:50 2016 From: ezyang at mit.edu (Edward Z. Yang) Date: Mon, 07 Nov 2016 13:32:50 -0800 Subject: [Haskell-cafe] Avoid sharing In-Reply-To: <20161107211041.GB15637@weber> References: <556465cf-4c50-cfd5-8cd2-1240c3dc6614@mroth.net> <1478552011-sup-2548@sabre> <20161107211041.GB15637@weber> Message-ID: <1478554089-sup-5132@sabre> GHC is allowed to do common sub-expression elimination which would cause sharing. For example: module Opt where {-# NOINLINE bar #-} bar :: Int -> Int bar x = x + 3 foo :: Int -> Int foo s = bar s * bar s Here's the core for 'foo': foo = \ (s_ayA :: Int) -> case bar s_ayA of _ [Occ=Dead] { GHC.Types.I# x_aJa -> GHC.Types.I# (GHC.Prim.*# x_aJa x_aJa) } bar is invoked only once. In Michael's original example, CSE doesn't fire, probably because the tuple constructor is lazy. I am not entirely certain what the interaction here is. Edward Excerpts from Tom Ellis's message of 2016-11-07 21:10:41 +0000: > I'm not going to contradict Edward's answer in practice, because he knows > far more about the internals of GHC than I do. However, I will contradict > it in theory. > > There is a straightforward operational semantics for Haskell programs as > compiled by GHC via Core to STG (without any optimisations applied). I > described this semantics in the following talk at Haskell eXchange 2016: > > https://skillsmatter.com/skillscasts/8726-haskell-programs-how-do-they-run#video > > and I wrote it up as an article here: > > http://h2.jaguarpaw.co.uk/posts/haskell-programs-how-do-they-run/ > > Under that semantics, yes, 'someGenerator s' is bound twice and thus is not > shared. > > Now, GHC may try to apply an "optimisation" and (accidentally?) introduce > sharing. That would be a compiler bug, in my opinion. In fact, it would be > a terrible blow to Haskell's future as a practical language, because we > really need fine-grained control over sharing. So I really hope that Edward > is wrong about this. > > Tom > > On Mon, Nov 07, 2016 at 12:56:02PM -0800, Edward Z. Yang wrote: > > It's not guaranteed. Unfortunately there aren't really good ways > > to avoid sharing; the general advice is to convert values into > > functions, and apply them at the use site where sharing is OK. > > > > Unrelatedly, in your sample code, dropping 1000000000 entries > > is not a good way to build a splittable RNG. Check out > > http://publications.lib.chalmers.se/records/fulltext/183348/local_183348.pdf > > and also its related work for some bettera pproaches. > > > > Edward > > > > Excerpts from Michael Roth's message of 2016-11-07 20:56:54 +0100: > > > Hello! A short question, given: > > > > > > > > > data Seed = ... > > > data Value = ... > > > > > > someGenerator :: Seed -> [Value] > > > > > > createTwo :: Seed -> ([Value], [Value]) > > > createTwo s = (as, bs) where > > > as = someGenerator s > > > bs = drop 1000000000 (someGenerator s) > > > > > > > > > Is it guaranteed that 'someGenerator s' is created twice and not shared > > > between 'as' and 'bs'? Is this by language design? Are there any GHC > > > options that change the behaviour? From mail at joachim-breitner.de Mon Nov 7 21:34:23 2016 From: mail at joachim-breitner.de (Joachim Breitner) Date: Mon, 07 Nov 2016 16:34:23 -0500 Subject: [Haskell-cafe] Avoid sharing In-Reply-To: References: <556465cf-4c50-cfd5-8cd2-1240c3dc6614@mroth.net> Message-ID: <1478554463.17993.1.camel@joachim-breitner.de> Hi, Am Montag, den 07.11.2016, 16:00 -0500 schrieb Brandon Allbery: > It's not specified in any standard, but ghc will only share something > that is directly bound. There is no sensible way to determine sharing > automatically that will do what everyone expects, so ghc doesn't try: > the programmer is expected to use bindings to specify sharing. that is not true. GHC applies „common subexpression elimination“, and this optimization pass will likely sum up the two occurrences of "someGenerator s". In places online it says that only code like > let x = e in .... let y = e in .... would be CSEd. But reading the code (CSE.hs) I conclude that also > let x = e in .... foo e .... would get CSEd, which includes the code posted by Michael Roth. Furthermore, the FloatOut pass may turn > … foo e … into > let x = e in … foo x … under certain circumstance, so even a limited form of CSE can apply here. In the end, only looking at the Core of a concrete program can help to answer these questions. Greetings, Joachim -- Joachim “nomeata” Breitner   mail at joachim-breitner.de • https://www.joachim-breitner.de/   XMPP: nomeata at joachim-breitner.de • OpenPGP-Key: 0xF0FBF51F   Debian Developer: nomeata at debian.org -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 801 bytes Desc: This is a digitally signed message part URL: From david.feuer at gmail.com Mon Nov 7 22:02:50 2016 From: david.feuer at gmail.com (David Feuer) Date: Mon, 7 Nov 2016 17:02:50 -0500 Subject: [Haskell-cafe] Strange space leak In-Reply-To: <20161104145832.GB6044@weber> References: <20161104144400.GA6044@weber> <20161104145832.GB6044@weber> Message-ID: Interesting. We generally have pure x = IO (\ s -> (# s, x #)) IO m *> n = IO (\ s -> case m s of (# new_s, a #) -> unIO ((const n) a) new_s) so main = let loop () = IO (\s -> (# s, () #)) *> loop () in loop () ==== let loop () = IO (\s -> case (\s' -> (# s', () #)) s of (# new_s, a #) -> unIO ((const (loop ()) a) new_s) in loop () ==== let loop () = IO (\s -> case (# s, () #) of (# new_s, a #) -> unIO (loop ()) new_s) in loop () ==== let loop () = IO (\s -> unIO (loop ()) s) in loop () My only guess is that *somehow* this is getting memoized and expanding under the lambda to let loop () = IO (\s -> unIO (IO (\s -> unIO ......)) s) in loop () but I know nothing about GHCi internals, so that seems as weird to me as it does to you. On Fri, Nov 4, 2016 at 10:58 AM, Tom Ellis wrote: > On Fri, Nov 04, 2016 at 02:44:00PM +0000, Tom Ellis wrote: >> Can anyone explain why this leaks space: >> >> main :: IO () >> main = let loop () = return () *> loop () >> in loop () >> >> whilst this doesn't: >> >> main :: IO () >> main = let loop = return () *> loop >> in loop > > More strangely, the space leak only appears in ghci (and runhaskell). When > compiled there is no such space leak. > > Tom > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. From will.yager at gmail.com Mon Nov 7 22:32:07 2016 From: will.yager at gmail.com (William Yager) Date: Mon, 7 Nov 2016 16:32:07 -0600 Subject: [Haskell-cafe] Strange space leak In-Reply-To: References: <20161104144400.GA6044@weber> <20161104145832.GB6044@weber> Message-ID: On Mon, Nov 7, 2016 at 4:02 PM, David Feuer wrote: > IO m *> n = IO (\ s -> case m s of (# new_s, a #) -> unIO ((const n) a) > new_s) > >From looking at the Applicative source, this appears to be correct. Why don't we use thenIO instead, which elides the "const" and has the form thenIO (IO m ) k = IO (\ s -> case m s of (# new_s , _ #) -> unIO k new_s ) It doesn't look like thenIO is used or exported, which makes me think someone either forgot about it or there's some good reason that isn't documented. Obviously if things go as planned, the const gets reduced away at compile time, but it seems like if we have thenIO sitting there in the source we might as well use it and not have to worry about compile-time eta-reduction of (\_ -> k). Will -------------- next part -------------- An HTML attachment was scrubbed... URL: From harendra.kumar at gmail.com Tue Nov 8 00:22:48 2016 From: harendra.kumar at gmail.com (Harendra Kumar) Date: Tue, 8 Nov 2016 05:52:48 +0530 Subject: [Haskell-cafe] TIOBE Index: Is Haskell finally going to hit the top 20? In-Reply-To: References: Message-ID: The interesting thing is that Haskell is now way above Scala (at 31) in TIOBE rankings! The redmonk rankings put Haskell at 16 in June 2016 ( http://redmonk.com/sogrady/2016/07/20/language-rankings-6-16/). Of course they both have different methodologies but as long as they are consistent in their methodology and Haskell is moving up, its great news. -harendra On 7 November 2016 at 23:43, Henk-Jan van Tuyl wrote: > > L.S., > > I know the TIOBE index[0] is not very scientific, but it is nice to see > Haskell moving up in the TIOBE Index. > From tiobe.com: > " > TIOBE Index for November 2016 > November Headline: Is Haskell finally going to hit the top 20? > > Some people say that Haskell is the most mature purely functional > programming language available nowadays. It has quite a long history, > dating back from 1990 and its community is growing, although slowly. This > month Haskell is only 0.255% away from the top 20 at position 23. Let's see > what happens the next few months. > " > > Haskell ranked 34th last month. > > Regards, > Henk-Jan van Tuyl > > > [0] http://www.tiobe.com/tiobe-index/ > > > -- > Folding at home > What if you could share your unused computer power to help find a cure? In > just 5 minutes you can join the world's biggest networked computer and get > us closer sooner. Watch the video. > http://folding.stanford.edu/ > > http://members.chello.nl/hjgtuyl/tourdemonad.html > Haskell programming > -- > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mafagafogigante at gmail.com Tue Nov 8 00:33:11 2016 From: mafagafogigante at gmail.com (Bernardo Sulzbach) Date: Mon, 7 Nov 2016 22:33:11 -0200 Subject: [Haskell-cafe] TIOBE Index: Is Haskell finally going to hit the top 20? In-Reply-To: References: Message-ID: <3755c1a1-75f9-8d4e-8b35-bd44c514f598@gmail.com> On 11/07/2016 10:22 PM, Harendra Kumar wrote: > (...) as long as they are consistent > in their methodology and Haskell is moving up, its great news. I share your opinion. More important than the answer to the ultimate life question "is Haskell being used more than assembly is?" is the fact that their sampling algorithm (supposedly) has not changed and Haskell is climbing up. From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Tue Nov 8 08:18:53 2016 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Tue, 8 Nov 2016 08:18:53 +0000 Subject: [Haskell-cafe] Avoid sharing In-Reply-To: <1478554089-sup-5132@sabre> References: <556465cf-4c50-cfd5-8cd2-1240c3dc6614@mroth.net> <1478552011-sup-2548@sabre> <20161107211041.GB15637@weber> <1478554089-sup-5132@sabre> Message-ID: <20161108081853.GC15637@weber> I think we should forbid it then! Or at least only allow it when what is shared is known to be small. On Mon, Nov 07, 2016 at 01:32:50PM -0800, Edward Z. Yang wrote: > GHC is allowed to do common sub-expression elimination which > would cause sharing. For example: > > module Opt where > > {-# NOINLINE bar #-} > bar :: Int -> Int > bar x = x + 3 > > foo :: Int -> Int > foo s = bar s * bar s > > Here's the core for 'foo': > > foo = > \ (s_ayA :: Int) -> > case bar s_ayA of _ [Occ=Dead] { GHC.Types.I# x_aJa -> > GHC.Types.I# (GHC.Prim.*# x_aJa x_aJa) > } > > bar is invoked only once. > > In Michael's original example, CSE doesn't fire, probably because > the tuple constructor is lazy. I am not entirely certain what the > interaction here is. > > Edward > > Excerpts from Tom Ellis's message of 2016-11-07 21:10:41 +0000: > > I'm not going to contradict Edward's answer in practice, because he knows > > far more about the internals of GHC than I do. However, I will contradict > > it in theory. > > > > There is a straightforward operational semantics for Haskell programs as > > compiled by GHC via Core to STG (without any optimisations applied). I > > described this semantics in the following talk at Haskell eXchange 2016: > > > > https://skillsmatter.com/skillscasts/8726-haskell-programs-how-do-they-run#video > > > > and I wrote it up as an article here: > > > > http://h2.jaguarpaw.co.uk/posts/haskell-programs-how-do-they-run/ > > > > Under that semantics, yes, 'someGenerator s' is bound twice and thus is not > > shared. > > > > Now, GHC may try to apply an "optimisation" and (accidentally?) introduce > > sharing. That would be a compiler bug, in my opinion. In fact, it would be > > a terrible blow to Haskell's future as a practical language, because we > > really need fine-grained control over sharing. So I really hope that Edward > > is wrong about this. > > > > Tom > > > > On Mon, Nov 07, 2016 at 12:56:02PM -0800, Edward Z. Yang wrote: > > > It's not guaranteed. Unfortunately there aren't really good ways > > > to avoid sharing; the general advice is to convert values into > > > functions, and apply them at the use site where sharing is OK. > > > > > > Unrelatedly, in your sample code, dropping 1000000000 entries > > > is not a good way to build a splittable RNG. Check out > > > http://publications.lib.chalmers.se/records/fulltext/183348/local_183348.pdf > > > and also its related work for some bettera pproaches. > > > > > > Edward > > > > > > Excerpts from Michael Roth's message of 2016-11-07 20:56:54 +0100: > > > > Hello! A short question, given: > > > > > > > > > > > > data Seed = ... > > > > data Value = ... > > > > > > > > someGenerator :: Seed -> [Value] > > > > > > > > createTwo :: Seed -> ([Value], [Value]) > > > > createTwo s = (as, bs) where > > > > as = someGenerator s > > > > bs = drop 1000000000 (someGenerator s) > > > > > > > > > > > > Is it guaranteed that 'someGenerator s' is created twice and not shared > > > > between 'as' and 'bs'? Is this by language design? Are there any GHC > > > > options that change the behaviour? > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. From list at mroth.net Tue Nov 8 18:28:18 2016 From: list at mroth.net (Michael Roth) Date: Tue, 8 Nov 2016 19:28:18 +0100 Subject: [Haskell-cafe] Avoid sharing In-Reply-To: <1478552011-sup-2548@sabre> References: <556465cf-4c50-cfd5-8cd2-1240c3dc6614@mroth.net> <1478552011-sup-2548@sabre> Message-ID: <4cb04363-5cb4-35ac-ad70-cbee1de5f8a3@mroth.net> Yes, dropping 1000000000 entries is bad, 'someGenerator' was thought as an deputy only. In reality I have some sort of generator which generates a large system state varying over time. It was my fault I didn't state this clearly. Thank you for the interesting reading about RNGs anyway. Michael Am 07.11.2016 um 21:56 schrieb Edward Z. Yang: > It's not guaranteed. Unfortunately there aren't really good ways > to avoid sharing; the general advice is to convert values into > functions, and apply them at the use site where sharing is OK. > > Unrelatedly, in your sample code, dropping 1000000000 entries > is not a good way to build a splittable RNG. Check out > http://publications.lib.chalmers.se/records/fulltext/183348/local_183348.pdf > and also its related work for some bettera pproaches. > > Edward > > Excerpts from Michael Roth's message of 2016-11-07 20:56:54 +0100: >> Hello! A short question, given: >> >> >> data Seed = ... >> data Value = ... >> >> someGenerator :: Seed -> [Value] >> >> createTwo :: Seed -> ([Value], [Value]) >> createTwo s = (as, bs) where >> as = someGenerator s >> bs = drop 1000000000 (someGenerator s) >> >> >> Is it guaranteed that 'someGenerator s' is created twice and not shared >> between 'as' and 'bs'? Is this by language design? Are there any GHC >> options that change the behaviour? >> >> >> Thank you, >> >> Michael >> From code at funwithsoftware.org Wed Nov 9 01:37:07 2016 From: code at funwithsoftware.org (Patrick Pelletier) Date: Tue, 8 Nov 2016 17:37:07 -0800 Subject: [Haskell-cafe] is it normal for docs to be pending for 24 hours? Message-ID: This is only my second time uploading a package to Hackage, so I don't yet have a feel for how it's supposed to go. I uploaded normalization-insensitive-2.0.0.1 about 24 hours ago: https://hackage.haskell.org/package/normalization-insensitive-2.0.0.1 Under "Status", it says "Docs pending". (And the module names are all non-clickable.) Is it normal to take this long to build the docs? Is there some way to find out where in the queue my job is? Is this an indication that something has gone wrong? How do I fix it? Thanks, --Patrick From fa-ml at ariis.it Wed Nov 9 01:59:26 2016 From: fa-ml at ariis.it (Francesco Ariis) Date: Wed, 9 Nov 2016 02:59:26 +0100 Subject: [Haskell-cafe] is it normal for docs to be pending for 24 hours? In-Reply-To: References: Message-ID: <20161109015926.GA838@casa.casa> On Tue, Nov 08, 2016 at 05:37:07PM -0800, Patrick Pelletier wrote: > This is only my second time uploading a package to Hackage, so I don't yet > have a feel for how it's supposed to go. I uploaded > normalization-insensitive-2.0.0.1 about 24 hours ago: > > https://hackage.haskell.org/package/normalization-insensitive-2.0.0.1 > > Under "Status", it says "Docs pending". [..] Sometimes hackage fails to build documentation (maybe there is a hint on why on the logs). In those cases, I take advantage of cabal: cabal upload --documentation (more info with `cabal upload --help`). From code at funwithsoftware.org Wed Nov 9 03:08:31 2016 From: code at funwithsoftware.org (Patrick Pelletier) Date: Tue, 8 Nov 2016 19:08:31 -0800 Subject: [Haskell-cafe] is it normal for docs to be pending for 24 hours? In-Reply-To: <20161109015926.GA838@casa.casa> References: <20161109015926.GA838@casa.casa> Message-ID: <29eb5e0d-53ac-0a12-235d-bb68b30f3f13@funwithsoftware.org> On 11/8/16 5:59 PM, Francesco Ariis wrote: > Sometimes hackage fails to build documentation (maybe there is a > hint on why on the logs). Where can I find those logs? --Patrick From fa-ml at ariis.it Wed Nov 9 05:04:01 2016 From: fa-ml at ariis.it (Francesco Ariis) Date: Wed, 9 Nov 2016 06:04:01 +0100 Subject: [Haskell-cafe] is it normal for docs to be pending for 24 hours? In-Reply-To: <29eb5e0d-53ac-0a12-235d-bb68b30f3f13@funwithsoftware.org> References: <20161109015926.GA838@casa.casa> <29eb5e0d-53ac-0a12-235d-bb68b30f3f13@funwithsoftware.org> Message-ID: <20161109050401.GB1119@casa.casa> On Tue, Nov 08, 2016 at 07:08:31PM -0800, Patrick Pelletier wrote: > On 11/8/16 5:59 PM, Francesco Ariis wrote: > >Sometimes hackage fails to build documentation (maybe there is a > >hint on why on the logs). > > Where can I find those logs? https://hackage.haskell.org/package/normalization-insensitive-2.0/reports/1 They are not yet available for 2.1 though! From code at funwithsoftware.org Wed Nov 9 07:41:54 2016 From: code at funwithsoftware.org (Patrick Pelletier) Date: Tue, 8 Nov 2016 23:41:54 -0800 Subject: [Haskell-cafe] is it normal for docs to be pending for 24 hours? In-Reply-To: <20161109050401.GB1119@casa.casa> References: <20161109015926.GA838@casa.casa> <29eb5e0d-53ac-0a12-235d-bb68b30f3f13@funwithsoftware.org> <20161109050401.GB1119@casa.casa> Message-ID: <7fd3323b-95f2-e268-06f3-e670eea7b780@funwithsoftware.org> On 11/8/16 9:04 PM, Francesco Ariis wrote: > On Tue, Nov 08, 2016 at 07:08:31PM -0800, Patrick Pelletier wrote: >> On 11/8/16 5:59 PM, Francesco Ariis wrote: >>> Sometimes hackage fails to build documentation (maybe there is a >>> hint on why on the logs). >> Where can I find those logs? > https://hackage.haskell.org/package/normalization-insensitive-2.0/reports/1 > > They are not yet available for 2.1 though! So then 2.0.0.1 is still queued up somewhere? Is there a way to check on the queue? --Patrick From fa-ml at ariis.it Wed Nov 9 08:07:53 2016 From: fa-ml at ariis.it (Francesco Ariis) Date: Wed, 9 Nov 2016 09:07:53 +0100 Subject: [Haskell-cafe] is it normal for docs to be pending for 24 hours? In-Reply-To: <7fd3323b-95f2-e268-06f3-e670eea7b780@funwithsoftware.org> References: <20161109015926.GA838@casa.casa> <29eb5e0d-53ac-0a12-235d-bb68b30f3f13@funwithsoftware.org> <20161109050401.GB1119@casa.casa> <7fd3323b-95f2-e268-06f3-e670eea7b780@funwithsoftware.org> Message-ID: <20161109080753.GA4732@casa.casa> On Tue, Nov 08, 2016 at 11:41:54PM -0800, Patrick Pelletier wrote: > on 11/8/16 9:04 pm, francesco ariis wrote: > >on tue, nov 08, 2016 at 07:08:31pm -0800, patrick pelletier wrote: > >>on 11/8/16 5:59 pm, francesco ariis wrote: > >>>sometimes hackage fails to build documentation (maybe there is a > >>>hint on why on the logs). > >>Where can I find those logs? > >https://hackage.haskell.org/package/normalization-insensitive-2.0/reports/1 > > > >They are not yet available for 2.1 though! > > So then 2.0.0.1 is still queued up somewhere? Is there a way to check on > the queue? Not sure really how you can check the queue (maybe someone more experienced can answer), I see that if a package gets 'skipped' for wichever reason, a build is not retriggered. From imantc at gmail.com Wed Nov 9 08:28:05 2016 From: imantc at gmail.com (Imants Cekusins) Date: Wed, 9 Nov 2016 09:28:05 +0100 Subject: [Haskell-cafe] is it normal for docs to be pending for 24 hours? In-Reply-To: <20161109080753.GA4732@casa.casa> References: <20161109015926.GA838@casa.casa> <29eb5e0d-53ac-0a12-235d-bb68b30f3f13@funwithsoftware.org> <20161109050401.GB1119@casa.casa> <7fd3323b-95f2-e268-06f3-e670eea7b780@funwithsoftware.org> <20161109080753.GA4732@casa.casa> Message-ID: it is possible to upload docs manually: Maintainer's Corner edit package information Manage documentation select version Upload documentation or see this post: https://begriffs.com/posts/2014-10-25-creating-package-hackage.html there is a script at the bottom of the page. It works well. New docs appear on Hackage within minutes after running this script. ​ -------------- next part -------------- An HTML attachment was scrubbed... URL: From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Wed Nov 9 13:06:03 2016 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Wed, 9 Nov 2016 13:06:03 +0000 Subject: [Haskell-cafe] is it normal for docs to be pending for 24 hours? In-Reply-To: References: Message-ID: <20161109130603.GC19806@weber> On Tue, Nov 08, 2016 at 05:37:07PM -0800, Patrick Pelletier wrote: > Under "Status", it says "Docs pending". (And the module names are > all non-clickable.) Is it normal to take this long to build the > docs? A related point: If you get your package into Stackage then the docs will be built there too, and it's probably more reliable. I uploaded a new version of Opaleye yesterday and the docs haven't been built by Hackage yet but they have been built by Stackage. Tom From code at funwithsoftware.org Wed Nov 9 20:54:38 2016 From: code at funwithsoftware.org (Patrick Pelletier) Date: Wed, 9 Nov 2016 12:54:38 -0800 Subject: [Haskell-cafe] is it normal for docs to be pending for 24 hours? In-Reply-To: <20161109015926.GA838@casa.casa> References: <20161109015926.GA838@casa.casa> Message-ID: <2aad2167-bd93-92fb-4222-3ab70eab768e@funwithsoftware.org> On 11/8/16 5:59 PM, Francesco Ariis wrote: > Sometimes hackage fails to build documentation (maybe there is a > hint on why on the logs). In those cases, I take advantage of cabal: > > cabal upload --documentation > > (more info with `cabal upload --help`). Thanks! This worked like a charm, although I first had to upgrade my cabal, and I also had to fix an incorrect lower bound for "text" in the "unicode-transforms" package (which is a dependency of normalization-insensitive). I wonder if the incorrect lower bound is why the docs failed to build automatically on Hackage? Although if the docs failed, it really ought to say "docs failed", not "docs pending". --Patrick From code at funwithsoftware.org Wed Nov 9 21:11:14 2016 From: code at funwithsoftware.org (Patrick Pelletier) Date: Wed, 9 Nov 2016 13:11:14 -0800 Subject: [Haskell-cafe] is it normal for docs to be pending for 24 hours? In-Reply-To: <20161109130603.GC19806@weber> References: <20161109130603.GC19806@weber> Message-ID: On 11/9/16 5:06 AM, Tom Ellis wrote: > If you get your package into Stackage then the docs will be built there too, > and it's probably more reliable. I uploaded a new version of Opaleye > yesterday and the docs haven't been built by Hackage yet but they have been > built by Stackage. I get your point, but I don't really like seeing the suggestion that Hackage should be abandoned because Stackage is better. (I especially dislike packages like "resourcet" which have entirely forgone giving a description of the package in the cabal file, and instead have only a note saying you should go to Stackage instead.) Hackage and Stackage serve different purposes. Hackage is all packages, while Stackage is a curated set of packages. (Therefore, Hackage is essentially the "upstream" of Stackage.) We shouldn't give up on Hackage. If FP Complete has a better doc builder, then it would be nice to see FP Complete and haskell.org work together on getting Hackage to use the FP Complete doc builder. Although a bit of competition can be healthy, it would also be nice to see cooperation in places where there is not a difference in philosophy. (And hopefully, "should have docs" is something everyone can agree on.) --Patrick From damian.nadales at gmail.com Wed Nov 9 21:34:23 2016 From: damian.nadales at gmail.com (Damian Nadales) Date: Wed, 9 Nov 2016 22:34:23 +0100 Subject: [Haskell-cafe] Asynchronous computations and error handling in the free monad Message-ID: Yesterday I posted the following question to SO: http://stackoverflow.com/questions/40495304/abstract-result-types-in-free-monads As discussion with Benjamin ensued, in which he stated that it is better to be explicit about the fact that we want parts of our code to run asynchronously. I am not so sure. I also have a similar question about how would you deal with fatal errors that could happen at the interpreter. I guess this could be modeled in the free monad by having a command returning a `Maybe` or `Either` type. However we're adding details about the interpreters in our DSL, since we are stating that certain command could cause fatal errors. So my question is what approach do you or would you use? From will.yager at gmail.com Wed Nov 9 22:10:53 2016 From: will.yager at gmail.com (Will Yager) Date: Wed, 9 Nov 2016 16:10:53 -0600 Subject: [Haskell-cafe] Asynchronous computations and error handling in the free monad In-Reply-To: References: Message-ID: <04C317D3-3727-4B55-9056-C857CE2B0017@gmail.com> Without knowing exactly what the problem is, perhaps you could use "FreeT ast Either"? This will allow you to extend the Free monad with failure semantics. Will > On Nov 9, 2016, at 15:34, Damian Nadales wrote: > > Yesterday I posted the following question to SO: > http://stackoverflow.com/questions/40495304/abstract-result-types-in-free-monads > > As discussion with Benjamin ensued, in which he stated that it is > better to be explicit about the fact that we want parts of our code to > run asynchronously. I am not so sure. > > I also have a similar question about how would you deal with fatal > errors that could happen at the interpreter. I guess this could be > modeled in the free monad by having a command returning a `Maybe` or > `Either` type. However we're adding details about the interpreters in > our DSL, since we are stating that certain command could cause fatal > errors. > > So my question is what approach do you or would you use? > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Wed Nov 9 22:35:59 2016 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Wed, 9 Nov 2016 22:35:59 +0000 Subject: [Haskell-cafe] is it normal for docs to be pending for 24 hours? In-Reply-To: References: <20161109130603.GC19806@weber> Message-ID: <20161109223559.GA21262@weber> On Wed, Nov 09, 2016 at 01:11:14PM -0800, Patrick Pelletier wrote: > On 11/9/16 5:06 AM, Tom Ellis wrote: > >If you get your package into Stackage then the docs will be built there too, > >and it's probably more reliable. I uploaded a new version of Opaleye > >yesterday and the docs haven't been built by Hackage yet but they have been > >built by Stackage. > > I get your point, but I don't really like seeing the suggestion that > Hackage should be abandoned because Stackage is better. I never suggested that! From hon.lianhung at gmail.com Thu Nov 10 12:34:22 2016 From: hon.lianhung at gmail.com (Lian Hung Hon) Date: Thu, 10 Nov 2016 20:34:22 +0800 Subject: [Haskell-cafe] Atomically modify two MVars Message-ID: Dear cafe, Is it possible to atomically modify two MVars? (I know it can be done with TVars) Regards, Hon -------------- next part -------------- An HTML attachment was scrubbed... URL: From mike at barrucadu.co.uk Thu Nov 10 12:36:33 2016 From: mike at barrucadu.co.uk (Michael Walker) Date: Thu, 10 Nov 2016 12:36:33 +0000 Subject: [Haskell-cafe] Atomically modify two MVars In-Reply-To: References: Message-ID: No, unless you have a third MVar to control access to the first two (which doesn't really scale, and is the entire point of STM!) On 10 November 2016 at 12:34, Lian Hung Hon wrote: > Dear cafe, > > Is it possible to atomically modify two MVars? (I know it can be done with > TVars) > > Regards, > Hon > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -- Michael Walker (http://www.barrucadu.co.uk) From whosekiteneverfly at gmail.com Thu Nov 10 12:46:13 2016 From: whosekiteneverfly at gmail.com (Yuji Yamamoto) Date: Thu, 10 Nov 2016 21:46:13 +0900 Subject: [Haskell-cafe] What does intero add to GHCi? Message-ID: Hello, Haskellers! I've recently seen many tools for Haskell IDE backend such as ghc-mod, hsdev, haskell-ide-engine, ide-backend, and intero. In addition, I found GHCi added commands to support IDEs: :complete, :type-at, etc. Then, I heard intero is a fork of GHCi. Actually intero's commands look same with GHCi's. So, what does intero add to GHCi? Thanks in advance. -- 山本悠滋 twitter: @igrep GitHub: https://github.com/igrep Facebook: http://www.facebook.com/igrep Google+: https://plus.google.com/u/0/+YujiYamamoto_igrep -------------- next part -------------- An HTML attachment was scrubbed... URL: From hon.lianhung at gmail.com Thu Nov 10 12:53:34 2016 From: hon.lianhung at gmail.com (Lian Hung Hon) Date: Thu, 10 Nov 2016 20:53:34 +0800 Subject: [Haskell-cafe] Atomically modify two MVars In-Reply-To: References: Message-ID: I see. Thanks Michael! On 10 November 2016 at 20:36, Michael Walker wrote: > No, unless you have a third MVar to control access to the first two > (which doesn't really scale, and is the entire point of STM!) > > On 10 November 2016 at 12:34, Lian Hung Hon > wrote: > > Dear cafe, > > > > Is it possible to atomically modify two MVars? (I know it can be done > with > > TVars) > > > > Regards, > > Hon > > > > _______________________________________________ > > Haskell-Cafe mailing list > > To (un)subscribe, modify options or view archives go to: > > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > Only members subscribed via the mailman list are allowed to post. > > > > -- > Michael Walker (http://www.barrucadu.co.uk) > -------------- next part -------------- An HTML attachment was scrubbed... URL: From pierre.crumeyrolle at c-s.fr Thu Nov 10 13:18:15 2016 From: pierre.crumeyrolle at c-s.fr (CRUMEYROLLE Pierre) Date: Thu, 10 Nov 2016 14:18:15 +0100 Subject: [Haskell-cafe] ghc installation on redhat7 In-Reply-To: References: <20161107104555.Horde.ch6kzHPS1rVhWVJibbch-Q1@messagerie.si.c-s.fr> Message-ID: <20161110141815.Horde.NOqR1NUEaxH3-6ANFcUUUw1@messagerie.si.c-s.fr> hello y have perl -5 installed y have downloaded ghc-7.10.3b-src.tar.bz2 => https://www.haskell.org/ghc/download_ghc_7_10_3 ( source distribution ) Source Distribution The source tarballs provide everything necessary to build the compiler, interactive system, and a minimal set of libraries. For more information on building, see the building guide. ghc-7.10.3b-src.tar.bz2 (13 MB, sig) y have pre installed ghc 7.6.3 Brandon Allbery a écrit : > On Mon, Nov 7, 2016 at 4:45 AM, CRUMEYROLLE Pierre < > pierre.crumeyrolle at c-s.fr> wrote: > >> y have installed by rpm method ghc 7.6.3 on my host because for generate >> ghc it's necessary to have pre install a ghc compiler. y have also perl >> version 5.16.3 installed. > > > From where did you get that package? I don't see any ghc version in the > centos 7/rhel7 repos. > > You probably need additional packages to get the "directory" (ghc-)package. > > -- > brandon s allbery kf8nh sine nomine associates > allbery.b at gmail.com ballbery at sinenomine.net > unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net From amy at nualeargais.ie Thu Nov 10 17:29:42 2016 From: amy at nualeargais.ie (=?UTF-8?Q?de_Buitl=C3=A9ir=2C_Amy?=) Date: Thu, 10 Nov 2016 17:29:42 +0000 Subject: [Haskell-cafe] Getting Haddock docs onto Hackage (using Stack) Message-ID: A package I uploaded to Hackage a week ago still has no docs. (It says "Docs pending" and "Build status unknown".) What is the best way to get Haddock documentation for a package onto Hackage if you are using Stack? Once upon a time, it used to be built automatically after the package was uploaded, and if it wasn't, you could find out the reason why by checking the build logs. When that stopped working, I used a script called hackage-docs.sh that I got from somewhere. But now I've migrated from Cabal to Stack, and the old script no longer works. I can modify it to work with Stack, but is there a better way? Should I instead use the "delete documentation and trigger rebuild" button on Hackage? Here's the package in question: http://hackage.haskell.org/package/grid-7.8.7 From amindfv at gmail.com Thu Nov 10 17:58:45 2016 From: amindfv at gmail.com (amindfv at gmail.com) Date: Thu, 10 Nov 2016 09:58:45 -0800 Subject: [Haskell-cafe] Atomically modify two MVars In-Reply-To: References: Message-ID: > El 10 nov 2016, a las 04:34, Lian Hung Hon escribió: > > Dear cafe, > > Is it possible to atomically modify two MVars? (I know it can be done with TVars) Or TMVars, if you haven't seen those. tom From svenpanne at gmail.com Thu Nov 10 20:26:36 2016 From: svenpanne at gmail.com (Sven Panne) Date: Thu, 10 Nov 2016 21:26:36 +0100 Subject: [Haskell-cafe] Getting Haddock docs onto Hackage (using Stack) In-Reply-To: References: Message-ID: 2016-11-10 18:29 GMT+01:00 de Buitléir, Amy : > [...] Should I instead use the "delete documentation and trigger rebuild" > button on Hackage? [...] > Huh? To be honest, I've never seen such a button. Where is it exactly? Is it something added recently? Cheers, S. -------------- next part -------------- An HTML attachment was scrubbed... URL: From heraldhoi at gmail.com Thu Nov 10 21:47:30 2016 From: heraldhoi at gmail.com (Geraldus) Date: Thu, 10 Nov 2016 21:47:30 +0000 Subject: [Haskell-cafe] Getting Haddock docs onto Hackage (using Stack) In-Reply-To: References: Message-ID: That button does not help me. I tried to trigger doc–rebuild for a few versions of `transient` package and docs are still unavailable (for latest version I've uploaded docs manually). *TL;DR:* There is now *"Maintainer's Corner"* (it is located at the bottom of package page and you'll see it if you're in maintainer group) where you can find *"edit package information"* link. If you'll follow it you'll see maintainer's page of package where you can find *"Manage documentation"* section. There goes a list of uploaded package version. Clicking on arbitrary version will bring you to page with two forms, one for uploading docs and another contains mentioned "*Delete documentation and trigger rebuild*" button. пт, 11 нояб. 2016 г. в 1:26, Sven Panne : > 2016-11-10 18:29 GMT+01:00 de Buitléir, Amy : > > [...] Should I instead use the "delete documentation and trigger rebuild" > button on Hackage? [...] > > > Huh? To be honest, I've never seen such a button. Where is it exactly? Is > it something added recently? > > Cheers, > S. > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From svenpanne at gmail.com Thu Nov 10 21:59:37 2016 From: svenpanne at gmail.com (Sven Panne) Date: Thu, 10 Nov 2016 22:59:37 +0100 Subject: [Haskell-cafe] Getting Haddock docs onto Hackage (using Stack) In-Reply-To: References: Message-ID: 2016-11-10 22:47 GMT+01:00 Geraldus : > [...] There is now *"Maintainer's Corner"* (it is located at the bottom > of package page and you'll see it if you're in maintainer group) where you > can find *"edit package information"* link. If you'll follow it you'll > see maintainer's page of package where you can find *"Manage > documentation"* section. There goes a list of uploaded package version. > Clicking on arbitrary version will bring you to page with two forms, one > for uploading docs and another contains mentioned "*Delete documentation > and trigger rebuild*" button. [...] > o_O Very well hidden, thanks for the hint, I think I would have *never* found that... -------------- next part -------------- An HTML attachment was scrubbed... URL: From simon.jakobi at googlemail.com Thu Nov 10 21:59:09 2016 From: simon.jakobi at googlemail.com (Simon Jakobi) Date: Thu, 10 Nov 2016 22:59:09 +0100 Subject: [Haskell-cafe] Getting Haddock docs onto Hackage (using Stack) In-Reply-To: References: Message-ID: Hi! Stack doesn't currently support uploading haddocks. There's an open issue to add such a feature though, in case anyone is interested in fixing the situation: https://github.com/commercialhaskell/stack/issues/737. AFAIK the neil tool (https://github.com/ndmitchell/neil) supports uploading haddocks, but I don't know how it plays with stack. Hope that helps, Simon 2016-11-10 18:29 GMT+01:00 de Buitléir, Amy : > A package I uploaded to Hackage a week ago still has no docs. (It says > "Docs pending" and "Build status unknown".) What is the best way to get > Haddock documentation for a package onto Hackage if you are using Stack? > > Once upon a time, it used to be built automatically after the package was > uploaded, and if it wasn't, you could find out the reason why by checking > the build logs. When that stopped working, I used a script called > hackage-docs.sh that I got from somewhere. > > But now I've migrated from Cabal to Stack, and the old script no longer > works. I can modify it to work with Stack, but is there a better way? > Should I instead use the "delete documentation and trigger rebuild" button > on Hackage? > > Here's the package in question: http://hackage.haskell.org/pac > kage/grid-7.8.7 > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From code at funwithsoftware.org Thu Nov 10 23:32:56 2016 From: code at funwithsoftware.org (Patrick Pelletier) Date: Thu, 10 Nov 2016 15:32:56 -0800 Subject: [Haskell-cafe] is it normal for docs to be pending for 24 hours? In-Reply-To: <20161109223559.GA21262@weber> References: <20161109130603.GC19806@weber> <20161109223559.GA21262@weber> Message-ID: <11076191-813c-8489-1425-983e2a6178aa@funwithsoftware.org> On 11/9/16 2:35 PM, Tom Ellis wrote: > On Wed, Nov 09, 2016 at 01:11:14PM -0800, Patrick Pelletier wrote: >> On 11/9/16 5:06 AM, Tom Ellis wrote: >>> If you get your package into Stackage then the docs will be built there too, >>> and it's probably more reliable. I uploaded a new version of Opaleye >>> yesterday and the docs haven't been built by Hackage yet but they have been >>> built by Stackage. >> I get your point, but I don't really like seeing the suggestion that >> Hackage should be abandoned because Stackage is better. > I never suggested that! I apologize; I know that's not exactly what you said, and I shouldn't have put words in your mouth. I think I was just expressing frustration with a general feeling I get sometimes that stack / Stackage / haskell-lang.org are trying to replace cabal / Hackage / haskell.org instead of complement them. But I misspoke in attributing that to you. Sorry. --Patrick From code at funwithsoftware.org Fri Nov 11 00:30:40 2016 From: code at funwithsoftware.org (Patrick Pelletier) Date: Thu, 10 Nov 2016 16:30:40 -0800 Subject: [Haskell-cafe] Getting Haddock docs onto Hackage (using Stack) In-Reply-To: References: Message-ID: <89011773-80a6-1e3c-82ce-72702560a17f@funwithsoftware.org> On 11/10/16 9:29 AM, de Buitléir, Amy wrote: > But now I've migrated from Cabal to Stack, and the old script no > longer works. I can modify it to work with Stack, but is there a > better way? My guess would be to use Stack to set up your environment, and then do something like "stack exec -- cabal upload --documentation", but I haven't tried that. > Should I instead use the "delete documentation and trigger rebuild" > button on Hackage? I tried that button when I was having trouble with documentation, and it didn't work for me. > Here's the package in question: > http://hackage.haskell.org/package/grid-7.8.7 If you (or anyone else out there) would like me to upload docs for you, I'd be happy to do so. Just add me to your package's maintainer group. I've already done this for the SFML package: https://github.com/SFML-haskell/SFML/issues/7 and I'd be happy to do it with other packages, at least until I get swamped with requests. I think having up-to-date documentation on Hackage is really important, and I'm happy to help out to achieve this goal. --Patrick From j.stutterheim at me.com Fri Nov 11 07:57:56 2016 From: j.stutterheim at me.com (J. Stutterheim) Date: Fri, 11 Nov 2016 08:57:56 +0100 Subject: [Haskell-cafe] GHC API: type class instance check Message-ID: <6676E53C-14B7-4E0B-A84E-6082584DE8B4@me.com> Hi all, I'm writing a core-to-core GHC plugin and have two questions: - Given some t :: Type, how can I check whether there exists an instance of some type class C for t? - How can I check whether some type class C exists, and if so, how can I get a value c (presumably :: Class) of this class? Thanks! - Jurriën -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 3117 bytes Desc: not available URL: From migmit at gmail.com Fri Nov 11 09:07:16 2016 From: migmit at gmail.com (MigMit) Date: Fri, 11 Nov 2016 10:07:16 +0100 Subject: [Haskell-cafe] GHC API: type class instance check In-Reply-To: <6676E53C-14B7-4E0B-A84E-6082584DE8B4@me.com> References: <6676E53C-14B7-4E0B-A84E-6082584DE8B4@me.com> Message-ID: I'm no expert in GHC plugins, but isn't it true that class instances can be added in other modules? So that this information is simply not available when compiling one? > On 11 Nov 2016, at 08:57, J. Stutterheim wrote: > > Hi all, > > I'm writing a core-to-core GHC plugin and have two questions: > > - Given some t :: Type, how can I check whether there exists an instance of some type class C for t? > - How can I check whether some type class C exists, and if so, how can I get a value c (presumably :: Class) of this class? > > Thanks! > > - Jurriën_______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. From j.stutterheim at me.com Fri Nov 11 09:55:13 2016 From: j.stutterheim at me.com (J. Stutterheim) Date: Fri, 11 Nov 2016 10:55:13 +0100 Subject: [Haskell-cafe] GHC API: type class instance check In-Reply-To: References: <6676E53C-14B7-4E0B-A84E-6082584DE8B4@me.com> Message-ID: <3B5CC323-6BCA-4690-A0B3-996FE7D79827@me.com> Yes, that's true, but suppose we have module M where import OtherModPossiblyWithInstance Then as far as I understand, the compiler will have processed OtherModPossiblyWithInstance already and the existence of class instances in OtherModPossiblyWithInstance should be know. > On 11 Nov 2016, at 10:07, MigMit wrote: > > I'm no expert in GHC plugins, but isn't it true that class instances can be added in other modules? So that this information is simply not available when compiling one? > >> On 11 Nov 2016, at 08:57, J. Stutterheim wrote: >> >> Hi all, >> >> I'm writing a core-to-core GHC plugin and have two questions: >> >> - Given some t :: Type, how can I check whether there exists an instance of some type class C for t? >> - How can I check whether some type class C exists, and if so, how can I get a value c (presumably :: Class) of this class? >> >> Thanks! >> >> - Jurriën_______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view archives go to: >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> Only members subscribed via the mailman list are allowed to post. > -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 3117 bytes Desc: not available URL: From migmit at gmail.com Fri Nov 11 10:00:45 2016 From: migmit at gmail.com (Miguel) Date: Fri, 11 Nov 2016 11:00:45 +0100 Subject: [Haskell-cafe] GHC API: type class instance check In-Reply-To: <3B5CC323-6BCA-4690-A0B3-996FE7D79827@me.com> References: <6676E53C-14B7-4E0B-A84E-6082584DE8B4@me.com> <3B5CC323-6BCA-4690-A0B3-996FE7D79827@me.com> Message-ID: True, but what if it's the other way around? What if OtherModule imports M? Your code in M would think there is no instance and behave accordingly, and when it comes to OtherModule there would be one, so, your compiled code would operate on incorrect assumption. Isn't it dangerous? And what about instances that have context? What if module M contains something like data T a = ... instance OtherClass a => C (T a) and later OtherModule adds instance OtherClass a ? On Fri, Nov 11, 2016 at 10:55 AM, J. Stutterheim wrote: > Yes, that's true, but suppose we have > > module M where > > import OtherModPossiblyWithInstance > > Then as far as I understand, the compiler will have processed > OtherModPossiblyWithInstance already and the existence of class instances > in OtherModPossiblyWithInstance should be know. > > > On 11 Nov 2016, at 10:07, MigMit wrote: > > > > I'm no expert in GHC plugins, but isn't it true that class instances can > be added in other modules? So that this information is simply not available > when compiling one? > > > >> On 11 Nov 2016, at 08:57, J. Stutterheim wrote: > >> > >> Hi all, > >> > >> I'm writing a core-to-core GHC plugin and have two questions: > >> > >> - Given some t :: Type, how can I check whether there exists an > instance of some type class C for t? > >> - How can I check whether some type class C exists, and if so, how can > I get a value c (presumably :: Class) of this class? > >> > >> Thanks! > >> > >> - Jurriën_______________________________________________ > >> Haskell-Cafe mailing list > >> To (un)subscribe, modify options or view archives go to: > >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > >> Only members subscribed via the mailman list are allowed to post. > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From amy at nualeargais.ie Fri Nov 11 11:11:48 2016 From: amy at nualeargais.ie (=?UTF-8?Q?de_Buitl=C3=A9ir=2C_Amy?=) Date: Fri, 11 Nov 2016 11:11:48 +0000 Subject: [Haskell-cafe] Getting Haddock docs onto Hackage (using Stack) In-Reply-To: References: Message-ID: <0dc271b932184f650ca3fbc262f0e648@nualeargais.ie> OK, I've modified the hackage-docs.sh script to work with Stack. In case anyone else wants it, it's at https://github.com/mhwombat/stack-haddock-upload. -------------- next part -------------- An HTML attachment was scrubbed... URL: From markkarpov at openmailbox.org Fri Nov 11 12:12:20 2016 From: markkarpov at openmailbox.org (Mark Karpov) Date: Fri, 11 Nov 2016 15:12:20 +0300 Subject: [Haskell-cafe] Announcing Req -- HTTP client library Message-ID: <87mvh6fc63.fsf@openmailbox.org> Hi, I would like to announce a new HTTP client library called Req, or rather a new API to tried-and-true http-client. The Haddock is available here: https://www.stackage.org/haddock/nightly-2016-11-11/req-0.1.0/Network-HTTP-Req.html It happens to be a complete tutorial on its own, so you can just read through it and it will be clear what it's all about and what kind of API is proposed. Hackage: https://hackage.haskell.org/package/req GitHub: https://github.com/mrkkrp/req Best, Mark From adam at bergmark.nl Fri Nov 11 14:03:00 2016 From: adam at bergmark.nl (Adam Bergmark) Date: Fri, 11 Nov 2016 14:03:00 +0000 Subject: [Haskell-cafe] is it normal for docs to be pending for 24 hours? In-Reply-To: <11076191-813c-8489-1425-983e2a6178aa@funwithsoftware.org> References: <20161109130603.GC19806@weber> <20161109223559.GA21262@weber> <11076191-813c-8489-1425-983e2a6178aa@funwithsoftware.org> Message-ID: Stackage has a much easier time since it only builds against one version of dependencies and one version of GHC. Adding a package to stackage also requires that someone makes sure that any external build dependencies are provided. Hackage on the other hand does not know any of these things so there is a lot that can go wrong. But new library versions can also be temporarily blocked from stackage, so it can take months before a new version has docs on stackage.org. For library authors stackage and hackage, cabal-install and stack are to a large degree complimentary to each other, you will likely want to use both. Application authors have the freedom to choose. - Adam On Fri, Nov 11, 2016 at 12:33 AM Patrick Pelletier wrote: > On 11/9/16 2:35 PM, Tom Ellis wrote: > > On Wed, Nov 09, 2016 at 01:11:14PM -0800, Patrick Pelletier wrote: > >> On 11/9/16 5:06 AM, Tom Ellis wrote: > >>> If you get your package into Stackage then the docs will be built > there too, > >>> and it's probably more reliable. I uploaded a new version of Opaleye > >>> yesterday and the docs haven't been built by Hackage yet but they have > been > >>> built by Stackage. > >> I get your point, but I don't really like seeing the suggestion that > >> Hackage should be abandoned because Stackage is better. > > I never suggested that! > > I apologize; I know that's not exactly what you said, and I shouldn't > have put words in your mouth. I think I was just expressing frustration > with a general feeling I get sometimes that stack / Stackage / > haskell-lang.org are trying to replace cabal / Hackage / haskell.org > instead of complement them. But I misspoke in attributing that to you. > Sorry. > > --Patrick > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gershomb at gmail.com Fri Nov 11 16:43:00 2016 From: gershomb at gmail.com (Gershom B) Date: Fri, 11 Nov 2016 11:43:00 -0500 Subject: [Haskell-cafe] is it normal for docs to be pending for 24 hours? In-Reply-To: References: Message-ID: Sorry — the builder for docs has been in rough shape and we’re working on it. In this case it got stuck due to disk space issues and monitoring didn’t catch it. Its now running again but doing some catching up. (And lots of stuff in the queue it failed to build due to other problems needs to be replaced there, which is a manual process at the moment if we don’t want the queue as a whole to just drown out any new things at all with backlog). It would be much better to expose more queues and have better monitoring (and real prioritization), and another volunteer to help ben out on this would be very welcome (please contact me if you’re interested — the code lives at https://github.com/haskell/hackage-server/blob/master/BuildClient.hs and there’s some uncommitted work on queuing as well). —gerhsom On November 8, 2016 at 8:37:19 PM, Patrick Pelletier (code at funwithsoftware.org) wrote: > This is only my second time uploading a package to Hackage, so I don't > yet have a feel for how it's supposed to go. I uploaded > normalization-insensitive-2.0.0.1 about 24 hours ago: > > https://hackage.haskell.org/package/normalization-insensitive-2.0.0.1 > > Under "Status", it says "Docs pending". (And the module names are all > non-clickable.) Is it normal to take this long to build the docs? Is > there some way to find out where in the queue my job is? Is this an > indication that something has gone wrong? How do I fix it? > > Thanks, > > --Patrick > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. From j.stutterheim at me.com Fri Nov 11 19:32:02 2016 From: j.stutterheim at me.com (J. Stutterheim) Date: Fri, 11 Nov 2016 20:32:02 +0100 Subject: [Haskell-cafe] GHC API: type class instance check In-Reply-To: References: <6676E53C-14B7-4E0B-A84E-6082584DE8B4@me.com> <3B5CC323-6BCA-4690-A0B3-996FE7D79827@me.com> Message-ID: For my purposes, I only need to do something when an instance is explicitly imported, e.g. module M where import ModWithInstances Then in the core pass I would have a check for each module such as: if instanceIsImported theInstanceThatISomehowNeedToIdentify then doSomeThingsToTheModule else leaveTheModuleAlone > On 11 Nov 2016, at 11:00, Miguel wrote: > > True, but what if it's the other way around? What if OtherModule imports M? Your code in M would think there is no instance and behave accordingly, and when it comes to OtherModule there would be one, so, your compiled code would operate on incorrect assumption. Isn't it dangerous? > > And what about instances that have context? What if module M contains something like > > data T a = ... > instance OtherClass a => C (T a) > > and later OtherModule adds > > instance OtherClass a > > ? > > On Fri, Nov 11, 2016 at 10:55 AM, J. Stutterheim wrote: > Yes, that's true, but suppose we have > > module M where > > import OtherModPossiblyWithInstance > > Then as far as I understand, the compiler will have processed OtherModPossiblyWithInstance already and the existence of class instances in OtherModPossiblyWithInstance should be know. > > > On 11 Nov 2016, at 10:07, MigMit wrote: > > > > I'm no expert in GHC plugins, but isn't it true that class instances can be added in other modules? So that this information is simply not available when compiling one? > > > >> On 11 Nov 2016, at 08:57, J. Stutterheim wrote: > >> > >> Hi all, > >> > >> I'm writing a core-to-core GHC plugin and have two questions: > >> > >> - Given some t :: Type, how can I check whether there exists an instance of some type class C for t? > >> - How can I check whether some type class C exists, and if so, how can I get a value c (presumably :: Class) of this class? > >> > >> Thanks! > >> > >> - Jurriën_______________________________________________ > >> Haskell-Cafe mailing list > >> To (un)subscribe, modify options or view archives go to: > >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > >> Only members subscribed via the mailman list are allowed to post. > > > > -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 3117 bytes Desc: not available URL: From gershomb at gmail.com Fri Nov 11 22:29:19 2016 From: gershomb at gmail.com (Gershom B) Date: Fri, 11 Nov 2016 17:29:19 -0500 Subject: [Haskell-cafe] Call for Haskell.org Committee Nominations Message-ID: Dear Haskellers, It is time to put out a call for new nominations (typically but not necessarily self-nominations) to the haskell.org committee. We have four members of our committee due for retirement -- Adam Foltzer, Nicolas Wu, Andres Loeh, and Edward Kmett (who is stepping down early). As per our bylaws, three of the slots will be for regular three year terms, and one will be a short one year term to fill out the remainder of Edward's. To nominate yourself, please send an email to committee at haskell.org by December 2, 2016. The retiring members are eligible to re-nominate themselves. Please feel free to include any information about yourself that you think will help us to make a decision. The Haskell.org committee serves as a board of directors for Haskell.org, a 501(c)3 nonprofit which oversees technical and financial resources related to Haskell community infrastructure. Being a member of the committee does not necessarily require a significant amount of time, but committee members should aim to be responsive during discussions when the committee is called upon to make a decision. Strong leadership, communication, and judgement are very important characteristics for committee members. The role is about setting policy, providing direction/guidance for Haskell.org infrastructure, planning for the long term, and being fiscally responsible with the Haskell.org funds (and donations). As overseers for policy regarding the open source side of Haskell, committee members must also be able to set aside personal or business related bias and make decisions with the good of the open source Haskell community in mind. We seek a broad representation from different segments of the Haskell world -- including but not limited to those focused on education, those focused on industrial applications, those with background in organizing users-groups, and those focused directly on our technical infrastructure. More details about the committee's roles and responsibilities are on https://wiki.haskell.org/Haskell.org_committee If you have any questions about the process, please feel free to e-mail us at committee at haskell.org, or contact one of us individually. Best, Gershom Bazerman From paolo.veronelli at gmail.com Sat Nov 12 06:24:48 2016 From: paolo.veronelli at gmail.com (Paolino) Date: Sat, 12 Nov 2016 07:24:48 +0100 Subject: [Haskell-cafe] TH GadtC parameter In-Reply-To: References: Message-ID: Hello, I couldn't find the evidence for the first parameter of GadtC in Con data type to be a [Name] in place of a simpler Name. https://hackage.haskell.org/package/template-haskell-2.11.0.0/docs/Language-Haskell-TH-Syntax.html#t:Con How should I match a normal gadt constructor syntax with that? Thank you Paolino -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan.loewenstein at gmail.com Sat Nov 12 06:52:42 2016 From: jan.loewenstein at gmail.com (=?UTF-8?Q?Jan_von_L=C3=B6wenstein?=) Date: Sat, 12 Nov 2016 06:52:42 +0000 Subject: [Haskell-cafe] Cross compilation Message-ID: Hi, I have a Mac OS X workstation and want to compile a cli for Linux (and potentially Windows) in addition to OS X. I could not find anything but https://ghc.haskell.org/trac/ghc/wiki/CrossCompilation. This has an explanation how I can build a cross compiling GHC for a specific combination of build and target system/architecture. Stack has an open issue regarding cross compilation. Is that really all there is out there? Regards Jan -------------- next part -------------- An HTML attachment was scrubbed... URL: From matthewtpickering at gmail.com Sat Nov 12 10:37:42 2016 From: matthewtpickering at gmail.com (Matthew Pickering) Date: Sat, 12 Nov 2016 10:37:42 +0000 Subject: [Haskell-cafe] TH GadtC parameter In-Reply-To: References: Message-ID: It is legal to write.. data T where A, B, C :: T So the [Name] corresponds to this possibility. Matt On Sat, Nov 12, 2016 at 6:24 AM, Paolino wrote: > Hello, I couldn't find the evidence for the first parameter of GadtC in Con > data type to be a [Name] in place of a simpler Name. > > https://hackage.haskell.org/package/template-haskell-2.11.0.0/docs/Language-Haskell-TH-Syntax.html#t:Con > > How should I match a normal gadt constructor syntax with that? > > Thank you > > Paolino > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. From code at funwithsoftware.org Sat Nov 12 14:08:19 2016 From: code at funwithsoftware.org (Patrick Pelletier) Date: Sat, 12 Nov 2016 06:08:19 -0800 Subject: [Haskell-cafe] Cross compilation In-Reply-To: References: Message-ID: <5ac476b2-a973-b6ed-2516-f07ac24c9e6e@funwithsoftware.org> On 11/11/16 10:52 PM, Jan von Löwenstein wrote: > I have a Mac OS X workstation and want to compile a cli for Linux (and > potentially Windows) in addition to OS X. > > I could not find anything but > https://ghc.haskell.org/trac/ghc/wiki/CrossCompilation. > This has an explanation how I can build a cross compiling GHC for a > specific combination of build and target system/architecture. > Stack has an open issue regarding cross compilation. > > Is that really all there is out there? I documented my cross-compilation adventure here: https://wiki.haskell.org/OpenWRT However, in my opinion, cross-compilation is one of the areas where ghc and its ecosystem are the weakest. You'll probably be much happier if you find a Linux box or install virtualization software on your Mac. --Patrick -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Sat Nov 12 18:05:32 2016 From: allbery.b at gmail.com (Brandon Allbery) Date: Sat, 12 Nov 2016 13:05:32 -0500 Subject: [Haskell-cafe] Cross compilation In-Reply-To: References: Message-ID: On Sat, Nov 12, 2016 at 1:52 AM, Jan von Löwenstein < jan.loewenstein at gmail.com> wrote: > I have a Mac OS X workstation and want to compile a cli for Linux (and > potentially Windows) in addition to OS X. > I could not find anything but https://ghc.haskell.org/ > trac/ghc/wiki/CrossCompilation. > This has an explanation how I can build a cross compiling GHC for a > specific combination of build and target system/architecture. > Stack has an open issue regarding cross compilation. > > Is that really all there is out there? > Cross-compilation pretty much only exists for porting ghc itself at this point. There are some hacks involving llvm that are used for ARM cross-compiling. -- 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 jan.loewenstein at gmail.com Sat Nov 12 21:17:22 2016 From: jan.loewenstein at gmail.com (=?UTF-8?Q?Jan_von_L=C3=B6wenstein?=) Date: Sat, 12 Nov 2016 21:17:22 +0000 Subject: [Haskell-cafe] Cross compilation In-Reply-To: References: Message-ID: Thanks for the responses. I guess I will "cross compile" via vm/docker then. Glad that I am running on Mac, the other direction would be more difficult I suppose. Regards Jan Brandon Allbery schrieb am Sa., 12. Nov. 2016 19:05: > On Sat, Nov 12, 2016 at 1:52 AM, Jan von Löwenstein < > jan.loewenstein at gmail.com> wrote: > > I have a Mac OS X workstation and want to compile a cli for Linux (and > potentially Windows) in addition to OS X. > I could not find anything but > https://ghc.haskell.org/trac/ghc/wiki/CrossCompilation. > This has an explanation how I can build a cross compiling GHC for a > specific combination of build and target system/architecture. > Stack has an open issue regarding cross compilation. > > Is that really all there is out there? > > > Cross-compilation pretty much only exists for porting ghc itself at this > point. There are some hacks involving llvm that are used for ARM > cross-compiling. > > > -- > 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 Sat Nov 12 21:28:40 2016 From: allbery.b at gmail.com (Brandon Allbery) Date: Sat, 12 Nov 2016 16:28:40 -0500 Subject: [Haskell-cafe] Cross compilation In-Reply-To: References: Message-ID: On Sat, Nov 12, 2016 at 4:17 PM, Jan von Löwenstein < jan.loewenstein at gmail.com> wrote: > Glad that I am running on Mac, the other direction would be more difficult > I suppose. Impossible, legally, since you aren't licensed to install OS X headers and libraries even for cross-compilation on other OSes. You could generate object code (if you can work around not having OS includes, or you don't need them) but final link would need to be done on a Mac to comply with Apple licensing. (Well, since Apple uses dynamic linking exclusively, in theory someone could clean-room enough of a fake e.g. libSystem.dylib to enable cross-link without actually having any of its object code. Lot of work for dubious amount of gain, though, and the edge cases would be horrendous.) -- 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 michael at snoyman.com Sun Nov 13 06:46:34 2016 From: michael at snoyman.com (Michael Snoyman) Date: Sun, 13 Nov 2016 08:46:34 +0200 Subject: [Haskell-cafe] is it normal for docs to be pending for 24 hours? In-Reply-To: References: Message-ID: I shared this thought privately before, but worth sharing publicly if someone wants to try following up on it: all of the docs build for the Stackage server are available on S3, and could by leveraged by Hackage as well. When I brought this up earlier, there was a large-ish list of requested changes to the generated HTML, which I didn't want to implement, but perhaps someone can find a way to bridge the gap. On Fri, Nov 11, 2016 at 6:43 PM, Gershom B wrote: > Sorry — the builder for docs has been in rough shape and we’re working on > it. In this case it got stuck due to disk space issues and monitoring > didn’t catch it. Its now running again but doing some catching up. (And > lots of stuff in the queue it failed to build due to other problems needs > to be replaced there, which is a manual process at the moment if we don’t > want the queue as a whole to just drown out any new things at all with > backlog). It would be much better to expose more queues and have better > monitoring (and real prioritization), and another volunteer to help ben out > on this would be very welcome (please contact me if you’re interested — the > code lives at https://github.com/haskell/hackage-server/blob/master/ > BuildClient.hs and there’s some uncommitted work on queuing as well). > > —gerhsom > > On November 8, 2016 at 8:37:19 PM, Patrick Pelletier ( > code at funwithsoftware.org) wrote: > > This is only my second time uploading a package to Hackage, so I don't > > yet have a feel for how it's supposed to go. I uploaded > > normalization-insensitive-2.0.0.1 about 24 hours ago: > > > > https://hackage.haskell.org/package/normalization-insensitive-2.0.0.1 > > > > Under "Status", it says "Docs pending". (And the module names are all > > non-clickable.) Is it normal to take this long to build the docs? Is > > there some way to find out where in the queue my job is? Is this an > > indication that something has gone wrong? How do I fix it? > > > > Thanks, > > > > --Patrick > > > > _______________________________________________ > > Haskell-Cafe mailing list > > To (un)subscribe, modify options or view archives go to: > > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > Only members subscribed via the mailman list are allowed to post. > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From code at funwithsoftware.org Sun Nov 13 06:59:39 2016 From: code at funwithsoftware.org (Patrick Pelletier) Date: Sat, 12 Nov 2016 22:59:39 -0800 Subject: [Haskell-cafe] is it normal for docs to be pending for 24 hours? In-Reply-To: References: Message-ID: Can you share the list of requested changes? And what is the cause of the difference? Is Stackage running Haddock with different options than Hackage does? Or is it doing something other than just running Haddock? Is the code that builds the Stackage docs available? --Patrick On 11/12/16 10:46 PM, Michael Snoyman wrote: > I shared this thought privately before, but worth sharing publicly if > someone wants to try following up on it: all of the docs build for the > Stackage server are available on S3, and could by leveraged by Hackage > as well. When I brought this up earlier, there was a large-ish list of > requested changes to the generated HTML, which I didn't want to > implement, but perhaps someone can find a way to bridge the gap. > > On Fri, Nov 11, 2016 at 6:43 PM, Gershom B > wrote: > > Sorry — the builder for docs has been in rough shape and we’re > working on it. In this case it got stuck due to disk space issues > and monitoring didn’t catch it. Its now running again but doing > some catching up. (And lots of stuff in the queue it failed to > build due to other problems needs to be replaced there, which is a > manual process at the moment if we don’t want the queue as a whole > to just drown out any new things at all with backlog). It would be > much better to expose more queues and have better monitoring (and > real prioritization), and another volunteer to help ben out on > this would be very welcome (please contact me if you’re interested > — the code lives at > https://github.com/haskell/hackage-server/blob/master/BuildClient.hs > and > there’s some uncommitted work on queuing as well). > > —gerhsom > > On November 8, 2016 at 8:37:19 PM, Patrick Pelletier > (code at funwithsoftware.org ) wrote: > > This is only my second time uploading a package to Hackage, so I > don't > > yet have a feel for how it's supposed to go. I uploaded > > normalization-insensitive-2.0.0.1 about 24 hours ago: > > > > > https://hackage.haskell.org/package/normalization-insensitive-2.0.0.1 > > > > > Under "Status", it says "Docs pending". (And the module names > are all > > non-clickable.) Is it normal to take this long to build the docs? Is > > there some way to find out where in the queue my job is? Is this an > > indication that something has gone wrong? How do I fix it? > > > > Thanks, > > > > --Patrick > > > > _______________________________________________ > > Haskell-Cafe mailing list > > To (un)subscribe, modify options or view archives go to: > > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > > Only members subscribed via the mailman list are allowed to post. > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > Only members subscribed via the mailman list are allowed to post. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at snoyman.com Sun Nov 13 09:29:38 2016 From: michael at snoyman.com (Michael Snoyman) Date: Sun, 13 Nov 2016 11:29:38 +0200 Subject: [Haskell-cafe] is it normal for docs to be pending for 24 hours? In-Reply-To: References: Message-ID: Here were Duncan's comments at the time: * the docs need to match the URL scheme on hackage, in terms of linking back to other packages docs on hackage. This needs to be done using sufficiently-relative urls so that http & https works. * it's generally not desirable to overwrite/replace existing docs. You can check which packages are missing docs by consulting this resource: http://hackage.haskell.org/packages/docs.json * we generate the docs so that only one style is listed, so that haddock does not include it's style switcher menu. * we do include all the files haddock generates, including the minus.gif, synopsis.png. * hackage currently does not use a shared haddock css and js file (though doing so is a good idea), so these are also included in the doc bundle, just as haddock produces them. This presumes having some kind of an upload script running from the Stackage side, whereas my recommendation had been that Hackage be modified to use the Stackage S3 docs as a backup for when its doc building fails. You can see an example of generated docs at: https://s3.amazonaws.com/haddock.stackage.org/lts-7.0/ tagstream-conduit-0.5.5.3/Text-HTML-TagStream-ByteString.html The code which calls Haddock is available at: https://github.com/fpco/stackage-curator/blob/master/ Stackage/PerformBuild.hs By the way, regarding your comments about resourcet and FP Complete: I'm honestly offended at this tone. I've clearly attempted quite often and quite sincerely to get such cooperation to happen, and have been rebuffed. Even if you're unaware of that, the implied accusation assumes a lot which isn't true. I honestly considered ignoring this thread entirely based on this tone, I'm tired of dealing with it. On Sun, Nov 13, 2016 at 8:59 AM, Patrick Pelletier wrote: > Can you share the list of requested changes? And what is the cause of the > difference? Is Stackage running Haddock with different options than > Hackage does? Or is it doing something other than just running Haddock? > Is the code that builds the Stackage docs available? > > --Patrick > > > > On 11/12/16 10:46 PM, Michael Snoyman wrote: > > I shared this thought privately before, but worth sharing publicly if > someone wants to try following up on it: all of the docs build for the > Stackage server are available on S3, and could by leveraged by Hackage as > well. When I brought this up earlier, there was a large-ish list of > requested changes to the generated HTML, which I didn't want to implement, > but perhaps someone can find a way to bridge the gap. > > On Fri, Nov 11, 2016 at 6:43 PM, Gershom B wrote: > >> Sorry — the builder for docs has been in rough shape and we’re working on >> it. In this case it got stuck due to disk space issues and monitoring >> didn’t catch it. Its now running again but doing some catching up. (And >> lots of stuff in the queue it failed to build due to other problems needs >> to be replaced there, which is a manual process at the moment if we don’t >> want the queue as a whole to just drown out any new things at all with >> backlog). It would be much better to expose more queues and have better >> monitoring (and real prioritization), and another volunteer to help ben out >> on this would be very welcome (please contact me if you’re interested — the >> code lives at https://github.com/haskell/hackage-server/blob/master/Bui >> ldClient.hs and there’s some uncommitted work on queuing as well). >> >> —gerhsom >> >> On November 8, 2016 at 8:37:19 PM, Patrick Pelletier ( >> code at funwithsoftware.org) wrote: >> > This is only my second time uploading a package to Hackage, so I don't >> > yet have a feel for how it's supposed to go. I uploaded >> > normalization-insensitive-2.0.0.1 about 24 hours ago: >> > >> > https://hackage.haskell.org/package/normalization-insensitive-2.0.0.1 >> > >> > Under "Status", it says "Docs pending". (And the module names are all >> > non-clickable.) Is it normal to take this long to build the docs? Is >> > there some way to find out where in the queue my job is? Is this an >> > indication that something has gone wrong? How do I fix it? >> > >> > Thanks, >> > >> > --Patrick >> > >> > _______________________________________________ >> > Haskell-Cafe mailing list >> > To (un)subscribe, modify options or view archives go to: >> > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> > Only members subscribed via the mailman list are allowed to post. >> >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view archives go to: >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> Only members subscribed via the mailman list are allowed to post. >> > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From markkarpov at openmailbox.org Sun Nov 13 12:34:53 2016 From: markkarpov at openmailbox.org (Mark Karpov) Date: Sun, 13 Nov 2016 15:34:53 +0300 Subject: [Haskell-cafe] megaparsec 5.1.2 - missing doc links on hackage In-Reply-To: References: Message-ID: <878tsno8wi.fsf@openmailbox.org> Hey Charles, I uploaded the docs manually. If you run into this problem again remember that there is usually a version of the docs available on Stackage as well: https://www.stackage.org/nightly-2016-11-13/package/megaparsec-5.1.2 Best, Mark Charles Martin writes: > Just drawing your attention to the missing documentation links for the > current version: > https://hackage.haskell.org/package/megaparsec-5.1.2 > > Cheers - Charles From saurabhnanda at gmail.com Sun Nov 13 13:35:00 2016 From: saurabhnanda at gmail.com (Saurabh Nanda) Date: Sun, 13 Nov 2016 19:05:00 +0530 Subject: [Haskell-cafe] is it normal for docs to be pending for 24 hours? In-Reply-To: References: <20161109130603.GC19806@weber> Message-ID: > > Hackage and Stackage serve different purposes. Hackage is all packages, > while Stackage is a curated set of packages. (Therefore, Hackage is > essentially the "upstream" of Stackage.) We shouldn't give up on Hackage. > I know I'm jumping into a very, very touchy topic, but isn't the following possible: * Stackage & Hackage combine -- even the .cabal & .stack file formats (if possible) * The combined entity supports curated packages (via LTS) AND a global free-for-all package list. I, as a user, get to decide how I want my packages to be resolved -- via a curated LTS or via the global package index. * The combined entity focuses on building a kickass, unified, piece of community infra, instead of dividing effort+resources and solving similar problems twice. -- Saurabh. -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at snoyman.com Sun Nov 13 13:46:20 2016 From: michael at snoyman.com (Michael Snoyman) Date: Sun, 13 Nov 2016 15:46:20 +0200 Subject: [Haskell-cafe] is it normal for docs to be pending for 24 hours? In-Reply-To: References: <20161109130603.GC19806@weber> Message-ID: On Sun, Nov 13, 2016 at 3:35 PM, Saurabh Nanda wrote: > Hackage and Stackage serve different purposes. Hackage is all packages, >> while Stackage is a curated set of packages. (Therefore, Hackage is >> essentially the "upstream" of Stackage.) We shouldn't give up on Hackage. >> > > I know I'm jumping into a very, very touchy topic, but isn't the following > possible: > > * Stackage & Hackage combine -- even the .cabal & .stack file formats (if > possible) > Let's not conflate two things. I assume you're talking about stack.yaml as the .stack file format. This should be a completely separate discussion for multiple reasons: * That's about Stack vs cabal-install instead of Stackage vs Hackage * It's completely necessary to have package-level vs project-level configuration (even cabal-install has a separate project config format separate from the .cabal format) > * The combined entity supports curated packages (via LTS) AND a global > free-for-all package list. I, as a user, get to decide how I want my > packages to be resolved -- via a curated LTS or via the global package > index. > This was discussed in ernest at ICFP in 2014, and the resulting proposal was GPS Haskell. The idea was that Hackage would add support for curated package sets. Personally, I didn't think this was necessary, and cabal-install should have just learnt logic to get information from stackage.org so that adding the functionality to Hackage wasn't a blocker for getting curated package sets available to users. In reality, the curated package set feature never got added to Hackage, cabal-install never added curated package set support, GPS Haskell was abandoned, and Stack and LTS Haskell were created instead. > * The combined entity focuses on building a kickass, unified, piece of > community infra, instead of dividing effort+resources and solving similar > problems twice. > > > It's a wonderful idea. Michael -------------- next part -------------- An HTML attachment was scrubbed... URL: From saurabhnanda at gmail.com Sun Nov 13 14:05:28 2016 From: saurabhnanda at gmail.com (Saurabh Nanda) Date: Sun, 13 Nov 2016 19:35:28 +0530 Subject: [Haskell-cafe] is it normal for docs to be pending for 24 hours? In-Reply-To: References: <20161109130603.GC19806@weber> Message-ID: > > >> * Stackage & Hackage combine -- even the .cabal & .stack file formats (if >> possible) >> > > Let's not conflate two things. I assume you're talking about stack.yaml as > the .stack file format. This should be a completely separate discussion for > multiple reasons: > > * That's about Stack vs cabal-install instead of Stackage vs Hackage > * It's completely necessary to have package-level vs project-level > configuration (even cabal-install has a separate project config format > separate from the .cabal format) > I didn't realise that. Let me read more about the problems that stack is trying to solve vs those that cabal is trying to solve. To my untrained eye, they're solving very similar problems to exist as two separate projects. Isn't a package a kind of a project? Or vice-versa. As I said, I need to read more on this topic. > This was discussed in ernest at ICFP in 2014, and the resulting proposal > was GPS Haskell. The idea was that Hackage would add support for curated > package sets. Personally, I didn't think this was necessary, and > cabal-install should have just learnt logic to get information from > stackage.org so that adding the functionality to Hackage wasn't a blocker > for getting curated package sets available to users. > Was the only reason to suggest the fetching of curated lists from Stackage in interest of faster go-to-market? Wouldn't it require the community to maintain 2 sets of highly-available infra? Also, wondering aloud, is the curation process purely algorithmic or human assisted? > In reality, the curated package set feature never got added to Hackage, > cabal-install never added curated package set support, GPS Haskell was > abandoned, and Stack and LTS Haskell were created instead. > Where can I read more about GPS Haskell? I managed to get to http://www.ozonehouse.com/mark/platform/GPS-Haskell-HIW2014.pdf from your blog post at https://www.fpcomplete.com/blog/2014/12/backporting-bug-fixes, but it's a 404 right now. -- Saurabh. -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at snoyman.com Sun Nov 13 14:14:35 2016 From: michael at snoyman.com (Michael Snoyman) Date: Sun, 13 Nov 2016 16:14:35 +0200 Subject: [Haskell-cafe] is it normal for docs to be pending for 24 hours? In-Reply-To: References: <20161109130603.GC19806@weber> Message-ID: On Sun, Nov 13, 2016 at 4:05 PM, Saurabh Nanda wrote: > >>> * Stackage & Hackage combine -- even the .cabal & .stack file formats >>> (if possible) >>> >> >> Let's not conflate two things. I assume you're talking about stack.yaml >> as the .stack file format. This should be a completely separate discussion >> for multiple reasons: >> >> * That's about Stack vs cabal-install instead of Stackage vs Hackage >> * It's completely necessary to have package-level vs project-level >> configuration (even cabal-install has a separate project config format >> separate from the .cabal format) >> > > > I didn't realise that. Let me read more about the problems that stack is > trying to solve vs those that cabal is trying to solve. To my untrained > eye, they're solving very similar problems to exist as two separate > projects. Isn't a package a kind of a project? Or vice-versa. > > As I said, I need to read more on this topic. > > > This has been discussed a few times on this mailing list and Reddit (I think), but I don't have any links handy. The basic idea is: * A package is a single .cabal file and everything it references * A project is a set of 1 or more packages, plus some project settings * Project settings include things like "use this version of GHC," "use these dependencies," etc. * Projects allow us to work on multiple packages at once in a coherent way, without hard-coding things like a specific GHC version into a package configuration. > This was discussed in ernest at ICFP in 2014, and the resulting proposal >> was GPS Haskell. The idea was that Hackage would add support for curated >> package sets. Personally, I didn't think this was necessary, and >> cabal-install should have just learnt logic to get information from >> stackage.org so that adding the functionality to Hackage wasn't a >> blocker for getting curated package sets available to users. >> > > > Was the only reason to suggest the fetching of curated lists from Stackage > in interest of faster go-to-market? Wouldn't it require the community to > maintain 2 sets of highly-available infra? Also, wondering aloud, is the > curation process purely algorithmic or human assisted? > > One aspect was "faster go-to-market." But I also think there's no reason why one website needs to be the central location for all things. Some people disagree with me, which is fine. In practice though, Hackage has had issues with adding new features, whereas adding new functionality elsewhere is much simpler. As to "maintain[ing] 2 sets of highly-available infra," ignoring questions of whether we actually have 2 such infras right now: all of the Stackage snapshot configurations are actually stored in Git repositories on Github, so: 1. It's trivial to mirror them to as many places as desired, and 2. We're leveraging pre-existing infrastructure from others In other words, when I said above "point at Stackage," that's not really too relevant anymore. It would really be "point at relevant Github repos," which is precisely what Stack does. You probably will want to read the stackage README[1] and linked locations, it include the relevant repos, maintainer agreement, and curator guides, which explains what pieces of the puzzle are algorithmic and which parts human assisted. [1] https://github.com/fpco/stackage#stackage > > >> In reality, the curated package set feature never got added to Hackage, >> cabal-install never added curated package set support, GPS Haskell was >> abandoned, and Stack and LTS Haskell were created instead. >> > > > Where can I read more about GPS Haskell? I managed to get to > http://www.ozonehouse.com/mark/platform/GPS-Haskell-HIW2014.pdf from your > blog post at https://www.fpcomplete.com/blog/2014/12/backporting-bug-fixes, > but it's a 404 right now. > > -- Saurabh. > I don't have a copy of the presentation linked from the blog post, but here's the email I sent after ICFP 2014 describing the work items to make GPS Haskell a reality: https://gist.github.com/snoyberg/b53672e04a432ecbedb106d63725b5a4 Michael -------------- next part -------------- An HTML attachment was scrubbed... URL: From code at funwithsoftware.org Sun Nov 13 16:43:29 2016 From: code at funwithsoftware.org (Patrick Pelletier) Date: Sun, 13 Nov 2016 08:43:29 -0800 Subject: [Haskell-cafe] is it normal for docs to be pending for 24 hours? In-Reply-To: References: Message-ID: <2ca4105a-899e-b9ba-f815-7138122d9c35@funwithsoftware.org> On 11/13/16 1:29 AM, Michael Snoyman wrote: > By the way, regarding your comments about resourcet and FP Complete: > I'm honestly offended at this tone. I've clearly attempted quite often > and quite sincerely to get such cooperation to happen, and have been > rebuffed. Even if you're unaware of that, the implied accusation > assumes a lot which isn't true. I honestly considered ignoring this > thread entirely based on this tone, I'm tired of dealing with it. I'm very sorry! I did not mean to offend. I take Simon PJ seriously in his call to have a productive, respectful discourse in the Haskell community. To be clear, I did not object to resourcet linking to Stackage; what I objected to is that the link to stackage is in place of having any sort of description of resourcet, rather than in addition to it. To me, that feels like it is making Hackage less useful (by denying it the package description) rather than making the most of Hackage, even though it isn't perfect. This makes me a little grouchy, and perhaps this grouchiness seeped into my comments, for which I apologize. Also, Hackage does have the ability to upload docs very conveniently, via "cabal upload --documentation", so this can be used to work around the fact that "Hackage documentation generation is not reliable." We need to all work together in good faith to make the Haskell ecosystem better. I am doing my best to do that, even if I am not perfect. I have already volunteered privately to Gershom B to work on the Hackage documentation generation code. I would like to make Hackage docs more reliable. This may or may not involve integrating with the S3 docs. That is a technical decision, and no slight should be implied, whatever the outcome. Once again, I'm sorry if I have not succeeded in upholding Simon PJ's standards for the Haskell community. I genuinely appreciate the contributions you and FP Complete have made to the Haskell ecosystem. --Patrick -------------- next part -------------- An HTML attachment was scrubbed... URL: From code at funwithsoftware.org Sun Nov 13 16:44:07 2016 From: code at funwithsoftware.org (Patrick Pelletier) Date: Sun, 13 Nov 2016 08:44:07 -0800 Subject: [Haskell-cafe] is it normal for docs to be pending for 24 hours? In-Reply-To: References: <20161109130603.GC19806@weber> Message-ID: <7d9ef823-16ea-c5de-5990-a9731ffb88b3@funwithsoftware.org> On 11/13/16 6:05 AM, Saurabh Nanda wrote: > > * Stackage & Hackage combine -- even the .cabal & .stack file > formats (if possible) > > > Let's not conflate two things. I assume you're talking about > stack.yaml as the ..stack file format. This should be a completely > separate discussion for multiple reasons: > > * That's about Stack vs cabal-install instead of Stackage vs Hackage > * It's completely necessary to have package-level vs project-level > configuration (even cabal-install has a separate project config > format separate from the .cabal format) > > > > I didn't realise that. Let me read more about the problems that stack > is trying to solve vs those that cabal is trying to solve. To my > untrained eye, they're solving very similar problems to exist as two > separate projects. Isn't a package a kind of a project? Or vice-versa. Here's what I wrote last time this was discussed: https://mail.haskell.org/pipermail/haskell-cafe/2016-September/124896.html which is pretty much what Snoyman said in his follow-up here. To me, stack is trying to solve the same problems as hsenv, as well as the same problems as cabal-install, as well as some problems that neither solves. And although there's overlap between cabal-install and stack, that's not the same as saying there's overlap between stack.yaml and .cabal files. --Patrick -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at snoyman.com Sun Nov 13 17:04:51 2016 From: michael at snoyman.com (Michael Snoyman) Date: Sun, 13 Nov 2016 19:04:51 +0200 Subject: [Haskell-cafe] is it normal for docs to be pending for 24 hours? In-Reply-To: <2ca4105a-899e-b9ba-f815-7138122d9c35@funwithsoftware.org> References: <2ca4105a-899e-b9ba-f815-7138122d9c35@funwithsoftware.org> Message-ID: On Sun, Nov 13, 2016 at 6:43 PM, Patrick Pelletier wrote: > On 11/13/16 1:29 AM, Michael Snoyman wrote: > > By the way, regarding your comments about resourcet and FP Complete: I'm > honestly offended at this tone. I've clearly attempted quite often and > quite sincerely to get such cooperation to happen, and have been rebuffed. > Even if you're unaware of that, the implied accusation assumes a lot which > isn't true. I honestly considered ignoring this thread entirely based on > this tone, I'm tired of dealing with it. > > > I'm very sorry! I did not mean to offend. I take Simon PJ seriously in > his call to have a productive, respectful discourse in the Haskell > community. > > To be clear, I did not object to resourcet linking to Stackage; what I > objected to is that the link to stackage is in place of having any sort of > description of resourcet, rather than in addition to it. To me, that feels > like it is making Hackage less useful (by denying it the package > description) rather than making the most of Hackage, even though it isn't > perfect. This makes me a little grouchy, and perhaps this grouchiness > seeped into my comments, for which I apologize. > > Also, Hackage does have the ability to upload docs very conveniently, via > "cabal upload --documentation", so this can be used to work around the fact > that "Hackage documentation generation is not reliable." > > We need to all work together in good faith to make the Haskell ecosystem > better. I am doing my best to do that, even if I am not perfect. I have > already volunteered privately to Gershom B to work on the Hackage > documentation generation code. I would like to make Hackage docs more > reliable. This may or may not involve integrating with the S3 docs. That > is a technical decision, and no slight should be implied, whatever the > outcome. > > Once again, I'm sorry if I have not succeeded in upholding Simon PJ's > standards for the Haskell community. I genuinely appreciate the > contributions you and FP Complete have made to the Haskell ecosystem. > > --Patrick > > Thank you for that, offense _un_taken :). Just to let you (and others) know where I'm coming from on this: I regularly get complaints of "why don't you do X," where X is a significant amount of extra work. Writing up dual descriptions in both README.md and cabal description fields is a prime example, and something I argued very hard for on Hackage. I'm disappointed with the way the description is displayed; I'd have much preferred that the README.md files I write would have been used. If you look on resourcet on Hackage, for example, there's a much more thorough description of the package at the bottom. I think this was a major mistake, but there's not much I can do about it. So my general request: instead of saying "I dislike X" and imply that the author (me, in this case) should take on some unspecified work to change what they're doing, try assuming some good faith. I put a lot of effort into getting display of my packages to be better on Hackage, and eventually gave up. Each comment about how I didn't do enough work is offensive, and pretty much puts another nail in the coffin of me wanting to be involved in Hackage ever again. Michael -------------- next part -------------- An HTML attachment was scrubbed... URL: From saurabhnanda at gmail.com Sun Nov 13 18:55:01 2016 From: saurabhnanda at gmail.com (Saurabh Nanda) Date: Mon, 14 Nov 2016 00:25:01 +0530 Subject: [Haskell-cafe] is it normal for docs to be pending for 24 hours? In-Reply-To: <7d9ef823-16ea-c5de-5990-a9731ffb88b3@funwithsoftware.org> References: <20161109130603.GC19806@weber> <7d9ef823-16ea-c5de-5990-a9731ffb88b3@funwithsoftware.org> Message-ID: > > Here's what I wrote last time this was discussed: > > https://mail.haskell.org/pipermail/haskell-cafe/2016-September/124896.html > > which is pretty much what Snoyman said in his follow-up here. To me, > stack is trying to solve the same problems as hsenv, as well as the same > problems as cabal-install, as well as some problems that neither solves. > And although there's overlap between cabal-install and stack, that's not > the same as saying there's overlap between stack.yaml and .cabal files. > I read that and https://www.fpcomplete.com/blog/2015/06/why-is-stack-not-cabal as well. Comparing to the Ruby world, would it be fair to say stack is analogous to rvm (or rbenv) and cabal is analogous to rubygems? One of the things that makes stack different from a Gemfile.lock is probably the following (from https://www.fpcomplete.com/blog/2015/06/why-is-stack-not-cabal): It's also a black box which depends on three pieces of global, mutable, > implicit state: the compiler and versions of system libraries on your > system, the Cabal packages installed in GHC’s package database, and the > package metadata du jour downloaded from Hackage (via cabal update). > Running cabal install at different times can lead to wildly different > install plans, without giving any good reason to the user. Basically the LTS. If you're using the same LTS resolver+OS, you'll get the same set of dependent packages every single time, right? Still pressing this further, is there really no way to wrap dependency management (cabal) and environment management (stack) in a single UI? Although that's lesser of a problem than the hackage/stackage divide. Really hope to see a unified tool that everyone gets behind, instead of diving effort and resources. -- Saurabh. -------------- next part -------------- An HTML attachment was scrubbed... URL: From cdsmith at gmail.com Sun Nov 13 19:13:04 2016 From: cdsmith at gmail.com (Chris Smith) Date: Sun, 13 Nov 2016 11:13:04 -0800 Subject: [Haskell-cafe] is it normal for docs to be pending for 24 hours? In-Reply-To: References: <20161109130603.GC19806@weber> <7d9ef823-16ea-c5de-5990-a9731ffb88b3@funwithsoftware.org> Message-ID: Saurabh Nanda wrote: > > Really hope to see a unified tool that everyone gets behind, instead of > diving effort and resources. > I disagree that this is always the best approach. Duplication of effort is not the worst thing that can happen to Haskell. To the contrary, many of us *love* working with Haskell. At the point we're at right now, it's more important to let people work on stuff they care about without being told they are doing it wrong. Let's be aware that efforts to dictate unification in this area have led to a lot of social wounds, that just need to be given time to heal before they are stressed again. -------------- next part -------------- An HTML attachment was scrubbed... URL: From saurabhnanda at gmail.com Sun Nov 13 19:36:21 2016 From: saurabhnanda at gmail.com (Saurabh Nanda) Date: Mon, 14 Nov 2016 01:06:21 +0530 Subject: [Haskell-cafe] is it normal for docs to be pending for 24 hours? In-Reply-To: References: <20161109130603.GC19806@weber> <7d9ef823-16ea-c5de-5990-a9731ffb88b3@funwithsoftware.org> Message-ID: On Mon, Nov 14, 2016 at 12:43 AM, Chris Smith wrote: > Saurabh Nanda wrote: >> >> Really hope to see a unified tool that everyone gets behind, instead of >> diving effort and resources. >> > > I disagree that this is always the best approach. Duplication of effort > is not the worst thing that can happen to Haskell. To the contrary, many > of us *love* working with Haskell. At the point we're at right now, it's > more important to let people work on stuff they care about without being > told they are doing it wrong. Let's be aware that efforts to dictate > unification in this area have led to a lot of social wounds, that just need > to be given time to heal before they are stressed again. > I know this is a sensitive topic. I won't press this further. -- Saurabh. -------------- next part -------------- An HTML attachment was scrubbed... URL: From sylvain at haskus.fr Mon Nov 14 00:54:42 2016 From: sylvain at haskus.fr (Sylvain Henry) Date: Mon, 14 Nov 2016 01:54:42 +0100 Subject: [Haskell-cafe] Named arguments to functions? In-Reply-To: References: Message-ID: <5ba9b855-9c58-845a-0b91-177f1b0a2793@haskus.fr> Hi Saurabh, Implicit parameters already look like named arguments: > :set -XImplicitParams > let f = ?x + ?y > let { ?y = 5; ?x = 10 } in f 15 > let g = f where { ?x = 5; ?y = 10 } > g 15 Perhaps we could extend TypeApplications to support the following more natural syntax: > f @(?y = 5) @(?x = 10) which would be syntaxic sugar for the code above. Sylvain On 13/11/2016 14:38, Saurabh Nanda wrote: > Thank you for your reply. > > If you are interested in something like this, you may want to > start a discussion of the design on one of the other lists, or > perhaps write up a proposal for GHC. > > > While I would like the general area of records getting better in > Haskell, I don't think I have the necessary technical chops to lead a > GHC proposal around this. Do you know any proposal/extension in GHC > that is already trying to solve: (a) records, and/or (b) named arguments? > > The proposals currently under discussion are on the `github` URL. > > > Possible to update the prime.haskell.org > website to reflect the current state of affairs? > > -- Saurabh. > > > On 10/11/2016 22:59, Iavor Diatchki wrote: >> Hello, >> >> I would say that this is a too complex of a change to discuss for >> Haskell Prime without implementation or prior experience. If you >> are interested in something like this, you may want to start a >> discussion of the design on one of the other lists, or perhaps write >> up a proposal for GHC. >> >> The proposals currently under discussion are on the `github` URL. >> >> Cheers, >> -Iavor >> >> >> >> >> >> On Thu, Nov 10, 2016 at 2:16 AM, Saurabh Nanda >> > wrote: >> >> Hi Everyone, >> >> I was going through >> https://prime.haskell.org/wiki/Process#Proposals >> and noticed >> the following: >> >> > Ideally the language change should be implemented already, so >> that experience gained with the implementation can inform the >> discussion >> >> Is this a hard requirement? I would like to see the ability to >> pass named arguments to functions somehow (most probably through >> anonymous records). I'm unaware of any existing language >> extension that solves this problem. Does this render the >> discussion out-of-bounds from a Haskell Prime perspective? Has >> this already been proposed and considered? >> >> Also, going by what is given on the Wiki, I'm confused about >> where to check the current status of proposals that are being >> considered. Which is the primary link: >> >> * >> https://prime.haskell.org/query?status=new&status=assigned&status=reopened&group=state >> >> * Or, https://github.com/haskell/rfcs >> >> >> -- Saurabh. >> >> _______________________________________________ >> Haskell-prime mailing list >> Haskell-prime at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-prime >> >> >> From hvriedel at gmail.com Mon Nov 14 15:23:14 2016 From: hvriedel at gmail.com (Herbert Valerio Riedel) Date: Mon, 14 Nov 2016 16:23:14 +0100 Subject: [Haskell-cafe] Synopsis vs Description vs README (was: is it normal for docs to be pending for 24 hours?) In-Reply-To: (Michael Snoyman's message of "Sun, 13 Nov 2016 19:04:51 +0200") References: <2ca4105a-899e-b9ba-f815-7138122d9c35@funwithsoftware.org> Message-ID: <87y40mgk65.fsf_-_@gnu.org> On 2016-11-13 at 18:04:51 +0100, Michael Snoyman wrote: [...] > I regularly get complaints of "why don't you do X," where X is a > significant amount of extra work. Writing up dual descriptions in both > README.md and cabal description fields is a prime example, and something I > argued very hard for on Hackage. > I'm disappointed with the way the description is displayed; I'd have > much preferred that the README.md files I write would have been used. Maybe the reasoning behind this wasn't explained well enough, so let me try again. The three seemingly overlapping parts a) synopsis b) description c) README serve three different purposes and have different technical properties (and you find a very similar 3-part division in e.g. Debian's packaging and others): a) the synopsis is a single-line short title which `cabal list` or search results show as a single line; it should give a first rough idea what the package is about in order to decide whether you want to look closer at b) b) this is like a paper abstract, giving you the gist of what a package is about, and wether to give it a try; it's displayed by e.g. `cabal info somepkg` or at the top of Hackage packages; this should contain enough information to know the feature scope of the package in order to decide whether to continue looking at c) and/or the Haddocks. The description field is typically just a few paragraphs, and ideally fits on a terminal screen; you don't want it to be too long, as it's supposed to be an elevator-pitch for your package. ---- c) Finally, the README is for additional information which isn't suitable for the description-field (like e.g. more in-depth explainations, history about package (NB: not the changelog), code examples, installation instructions, information about contributing etc...); also, since the README is quite easily rather large is *not* included in the 01-index.tar So while there may appear to be some overlap between b) and c), it's really not that much; and there's precedent for doing it this way. Also note there's a technical boundary between b) & c) in that a) & b) are indexed; i.e. by being inside the `.cabal` meta-data, they are contained in 01-index.tar, and thus are available to external tooling for text-indexing; Moreover, the synopsis/description fields are part of the meta-data that gets registered with ghc-pkg, so that information is available via `ghc-pkg` as well. Whereas in order to access/search c) you'd currently have to download the source-tarball (or bypass hackage-security, and access hackage.h.o's web-services directly but that would come with its own technical problems by doing so). So READMEs are rather out-of-band information, and should be treaated as such. > If you look on resourcet on Hackage, for example, there's a much more > thorough description of the package at the bottom. I think this was a > major mistake, but there's not much I can do about it. Btw, you can modify the current `description` (as well as the `synopsis`) field via .cabal editing on Hackage if you want to set a more meaningful description for the benefit of e.g. `cabal info resourcet` or also Hackage users (since the README is *not* indexed bythe Hackage search service). From ben at well-typed.com Mon Nov 14 18:20:38 2016 From: ben at well-typed.com (Ben Gamari) Date: Mon, 14 Nov 2016 13:20:38 -0500 Subject: [Haskell-cafe] is it normal for docs to be pending for 24 hours? In-Reply-To: References: Message-ID: <8760npzzwp.fsf@ben-laptop.smart-cactus.org> Patrick Pelletier writes: > This is only my second time uploading a package to Hackage, so I don't > yet have a feel for how it's supposed to go. I uploaded > normalization-insensitive-2.0.0.1 about 24 hours ago: > > https://hackage.haskell.org/package/normalization-insensitive-2.0.0.1 > > Under "Status", it says "Docs pending". (And the module names are all > non-clickable.) Is it normal to take this long to build the docs? Is > there some way to find out where in the queue my job is? Is this an > indication that something has gone wrong? How do I fix it? > Should it be normal? No. Has it been normal in the past? Sadly yes. In fact, due to some unfortunately interactions with our CDN it was not uncommon for builds to silently fail and never be reattempted. However, we have been slowly plugging away at the builder to try to sort out the common failure modes, including this one. One of the challenges has been working out how to retry the builds that have previously failed (of which there are many) without harming build latencies for new uploads. The problem is that there are two classes of failed documentation builds, a) Expected, reproducible failures (e.g. the builder environment missing native library dependencies). b) Various sporatic failures such as the CDN issue noted above While ideally we would like to rebuild only those packages falling in class (b), it's not so easy to accomplish this. Consequently I instead opted to retry all failed builds (over 17000 packages) and queue the work in such a way to prioritize new uploads. Unfortunately, my previous attempt at fair scheduling wasn't quite behaving as expected. However, this morning I took another look at this and things should now be back to normal. Let me know if you still see issues. Cheers, - Ben -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 454 bytes Desc: not available URL: From skippy_lou at hotmail.com Mon Nov 14 21:51:24 2016 From: skippy_lou at hotmail.com (Lawrence Wickert) Date: Mon, 14 Nov 2016 21:51:24 +0000 Subject: [Haskell-cafe] bizarre behaviour Message-ID: Hi, Ok, I am just learning Haskell. So, every day I open a text editor, a pdf file of a Haskell book and a terminal to run ghci. I resize the windows and go on my merry way. Yesterday I decided to install this script https://raw.githubusercontent.com/hotice/webupd8/master/session with the object to save my session windows and restore them the next day. Worked fine although I had to authorize some keyring popup box before it would work. Now I opened Google Chrome and an iHeart radio link. At this point the following appeared at the ghci prompt: Prelude> Vector smash protection is enabled. ghci continues to run fine. If I close and then re-open the iHeart link the message reappears. I am using Ububtu 16.04LTS and I don't use drugs or alcohol. Any ideas as to what is going on? Larry -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Mon Nov 14 21:58:41 2016 From: allbery.b at gmail.com (Brandon Allbery) Date: Mon, 14 Nov 2016 16:58:41 -0500 Subject: [Haskell-cafe] bizarre behaviour In-Reply-To: References: Message-ID: On Mon, Nov 14, 2016 at 4:51 PM, Lawrence Wickert wrote: > Prelude> Vector smash protection is enabled. The same terminal window that has your ghci in it, also has some back-end that iHeart Radio uses running in it. When the iHeart front-end app is opened, the back-end is issuing that message and it gets mixed in with your ghci's output. The session script itself doesn't tell me anything useful without also having the saved session that it is restoring. Possibly restoring incorrectly, where the back-end was running in a different terminal but got grouped with the ghci incorrectly. This is one problem with trying to impose a session "externally": it can be difficult to tie an application to a specific window, and front-end/back-end architecture usually makes it even more complicated; especially when the terminal is often *also* front-end/back-end, so you really can't tell which front-end is which because all the programs are linked to the back-end instead of to the front-ends they are visible in. -- 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 code at funwithsoftware.org Tue Nov 15 00:06:49 2016 From: code at funwithsoftware.org (Patrick Pelletier) Date: Mon, 14 Nov 2016 16:06:49 -0800 Subject: [Haskell-cafe] .haddock files Message-ID: Where can I find documentation about .haddock files? What is in them? Is it possible to generate a .haddock file from source code and then later produce HTML documentation from the .haddock file? Or is that not what it's for? The documentation for Haddock doesn't even seem to mention .haddock files, unless I'm missing something. I tried subscribing to the Haddock mailing list so I could post this question there, but at http://projects.haskell.org/cgi-bin/mailman/subscribe/haddock I got the message: "We're sorry, we hit a bug! Mailman experienced a very low level failure and could not even generate a useful traceback for you. Please report this to the Mailman administrator at this site." Anybody know what's going on with that? Thanks, --Patrick From gershomb at gmail.com Tue Nov 15 05:07:24 2016 From: gershomb at gmail.com (Gershom B) Date: Tue, 15 Nov 2016 00:07:24 -0500 Subject: [Haskell-cafe] .haddock files In-Reply-To: References: Message-ID: The mailinglists at projects.haskell.org are all basically unmaintained and rotted. I went and cleared some logfiles on that machine (which we’ve long wanted to decommission — see http://blog.haskell.org/post/7/the_future_of_community.haskell.org/ ) to free up space since the drive the lists are on was at capacity (leading to the error). But really, no projects should be pointing there for their lists anymore (the last post to that list in the archives is from 2014, and before then there was no traffic of note since sept 2013). An issue on the github is probably the best way to communicate to the appropriate parties now. The problem seems to be that the haddock homepage is way out of date — not even pointing to the github repo. I’ll open a ticket and co-ordinate updating the page a bit. —Gershom On November 14, 2016 at 7:06:57 PM, Patrick Pelletier (code at funwithsoftware.org) wrote: > Where can I find documentation about .haddock files? What is in them? > Is it possible to generate a .haddock file from source code and then > later produce HTML documentation from the .haddock file? Or is that not > what it's for? The documentation for Haddock doesn't even seem to > mention .haddock files, unless I'm missing something. > > I tried subscribing to the Haddock mailing list so I could post this > question there, but at > http://projects.haskell.org/cgi-bin/mailman/subscribe/haddock I got the > message: > > "We're sorry, we hit a bug! Mailman experienced a very low level > failure and could not even generate a useful traceback for you. Please > report this to the Mailman administrator at this site." > > Anybody know what's going on with that? > > Thanks, > > --Patrick > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. From johannes.waldmann at htwk-leipzig.de Tue Nov 15 12:01:35 2016 From: johannes.waldmann at htwk-leipzig.de (Johannes Waldmann) Date: Tue, 15 Nov 2016 13:01:35 +0100 Subject: [Haskell-cafe] commenting out a line of code Message-ID: <8929fe34-3bcf-137c-e7c9-4c10c327b1b3@htwk-leipzig.de> Dear Cafe - Sometimes, a comment can change the meaning of a program. No? Well, but "commenting out" a line of code certainly does. So, can you guess what this program will output? main = do if True then do putStrLn "A" else do -- putStrLn "B" putStrLn "done" I nominate this for inclusion in a hypothetical Haskell equivalent of http://www.javapuzzlers.com/ - J. From timmelzer at gmail.com Tue Nov 15 12:31:10 2016 From: timmelzer at gmail.com (Norbert Melzer) Date: Tue, 15 Nov 2016 12:31:10 +0000 Subject: [Haskell-cafe] commenting out a line of code In-Reply-To: <8929fe34-3bcf-137c-e7c9-4c10c327b1b3@htwk-leipzig.de> References: <8929fe34-3bcf-137c-e7c9-4c10c327b1b3@htwk-leipzig.de> Message-ID: I'm not quite sure, but I'd guess either one of 1.) It does not compile at all because of suspicious indentation 2.) It will just print "A" but not "done" because that is considered beeing in the else-branch. Johannes Waldmann schrieb am Di., 15. Nov. 2016 um 13:11 Uhr: > Dear Cafe - > > Sometimes, a comment can change the meaning of a program. > No? Well, but "commenting out" a line of code certainly does. > So, can you guess what this program will output? > > main = do > if True > then do > putStrLn "A" > else do > -- putStrLn "B" > putStrLn "done" > > I nominate this for inclusion in a hypothetical > Haskell equivalent of http://www.javapuzzlers.com/ > > - J. > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From doaitse at swierstra.net Tue Nov 15 12:53:09 2016 From: doaitse at swierstra.net (Doaitse Swierstra) Date: Tue, 15 Nov 2016 13:53:09 +0100 Subject: [Haskell-cafe] commenting out a line of code In-Reply-To: References: <8929fe34-3bcf-137c-e7c9-4c10c327b1b3@htwk-leipzig.de> Message-ID: <6A576150-694B-4E02-A6EC-B7CC6D2C024F@swierstra.net> The answer is very simple ;-} The report says that after a do the first symbol to encounter determines the indentation level; so putStrLn “done” is part of the else branch. Obvious, isn’t it. Se also https://wiki.haskell.org/Common_Misunderstandings Doaitse > Op 15 nov. 2016, om 13:31 heeft Norbert Melzer het volgende geschreven: > > I'm not quite sure, but I'd guess either one of > > 1.) It does not compile at all because of suspicious indentation > 2.) It will just print "A" but not "done" because that is considered beeing in the else-branch. > > Johannes Waldmann > schrieb am Di., 15. Nov. 2016 um 13:11 Uhr: > Dear Cafe - > > Sometimes, a comment can change the meaning of a program. > No? Well, but "commenting out" a line of code certainly does. > So, can you guess what this program will output? > > main = do > if True > then do > putStrLn "A" > else do > -- putStrLn "B" > putStrLn "done" > > I nominate this for inclusion in a hypothetical > Haskell equivalent of http://www.javapuzzlers.com/ > > - J. > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From dct25-561bs at mythic-beasts.com Tue Nov 15 13:14:35 2016 From: dct25-561bs at mythic-beasts.com (David Turner) Date: Tue, 15 Nov 2016 13:14:35 +0000 Subject: [Haskell-cafe] commenting out a line of code In-Reply-To: <6A576150-694B-4E02-A6EC-B7CC6D2C024F@swierstra.net> References: <8929fe34-3bcf-137c-e7c9-4c10c327b1b3@htwk-leipzig.de> <6A576150-694B-4E02-A6EC-B7CC6D2C024F@swierstra.net> Message-ID: On 15 November 2016 at 12:53, Doaitse Swierstra wrote: > The answer is very simple ;-} The report says that after a do the first > symbol to encounter determines the indentation level; so putStrLn “done” is > part of the else branch. Obvious, isn’t it. > The outer do block should be desugared first, and the `putStrLn "done"` has the same indent as the `if` so it gets a semicolon, in that block, meaning it looks like this: main = do { if True then do putStrLn "A" else do -- putStrLn "B" ; putStrLn "done" } On 15 November 2016 at 12:31, Norbert Melzer wrote: > I'm not quite sure, but I'd guess either one of > > 1.) It does not compile at all because of suspicious indentation > 2.) It will just print "A" but not "done" because that is considered > beeing in the else-branch. > I get *both* of these behaviours! When building, it complains about an empty 'do' block. When running through `stack ghci` it doesn't seem to mind. [linuxadmin at trac-leeds-09-vm01 13:07:57 ~/indent-puzzle ] $ stack build indent-puzzle-0.1.0.0: build Preprocessing executable 'indent-puzzle-exe' for indent-puzzle-0.1.0.0... [1 of 1] Compiling Main ( app/Main.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/indent- puzzle-exe/indent-puzzle-exe-tmp/Main.o ) /home/linuxadmin/indent-puzzle/app/Main.hs:5:10: Empty 'do' block -- While building package indent-puzzle-0.1.0.0 using: /home/linuxadmin/.stack/setup-exe-cache/x86_64-linux/setup- Simple-Cabal-1.22.5.0-ghc-7.10.3 --builddir=.stack-work/dist/x86_64-linux/Cabal-1.22.5.0 build exe:indent-puzzle-exe --ghc-options " -ddump-hi -ddump-to-file" Process exited with code: ExitFailure 1 [linuxadmin at trac-leeds-09-vm01 13:08:00 ~/indent-puzzle ] $ stack ghci indent-puzzle-0.1.0.0: build Preprocessing executable 'indent-puzzle-exe' for indent-puzzle-0.1.0.0... [1 of 1] Compiling Main ( app/Main.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/indent- puzzle-exe/indent-puzzle-exe-tmp/Main.o ) /home/linuxadmin/indent-puzzle/app/Main.hs:5:10: Empty 'do' block -- While building package indent-puzzle-0.1.0.0 using: /home/linuxadmin/.stack/setup-exe-cache/x86_64-linux/setup- Simple-Cabal-1.22.5.0-ghc-7.10.3 --builddir=.stack-work/dist/x86_64-linux/Cabal-1.22.5.0 build exe:indent-puzzle-exe --ghc-options " -ddump-hi -ddump-to-file" Process exited with code: ExitFailure 1 Warning: build failed, but optimistically launching GHCi anyway The following GHC options are incompatible with GHCi and have not been passed to it: -threaded Using main module: 1. Package `indent-puzzle' component exe:indent-puzzle-exe with main-is file: /home/linuxadmin/indent- puzzle/app/Main.hs Configuring GHCi with the following packages: indent-puzzle GHCi, version 7.10.3: http://www.haskell.org/ghc/ :? for help [1 of 1] Compiling Main ( /home/linuxadmin/indent-puzzle/app/Main.hs, interpreted ) Ok, modules loaded: Main. *Main> main A *Main> -------------- next part -------------- An HTML attachment was scrubbed... URL: From lanablack at amok.cc Tue Nov 15 15:12:12 2016 From: lanablack at amok.cc (Lana Black) Date: Tue, 15 Nov 2016 15:12:12 +0000 Subject: [Haskell-cafe] commenting out a line of code In-Reply-To: References: <8929fe34-3bcf-137c-e7c9-4c10c327b1b3@htwk-leipzig.de> <6A576150-694B-4E02-A6EC-B7CC6D2C024F@swierstra.net> Message-ID: <20161115151212.4395089.77979.5808@amok.cc> An HTML attachment was scrubbed... URL: From i.caught.air at gmail.com Tue Nov 15 15:15:24 2016 From: i.caught.air at gmail.com (Alex Belanger) Date: Tue, 15 Nov 2016 10:15:24 -0500 Subject: [Haskell-cafe] commenting out a line of code In-Reply-To: <20161115151212.4395089.77979.5808@amok.cc> References: <8929fe34-3bcf-137c-e7c9-4c10c327b1b3@htwk-leipzig.de> <6A576150-694B-4E02-A6EC-B7CC6D2C024F@swierstra.net> <20161115151212.4395089.77979.5808@amok.cc> Message-ID: GHCi is very lax with do blocks; but as far as I know GHC should refuse to compile that snippet and give a diagnosis about an empty do. - nitrix On Nov 15, 2016 10:12 AM, "Lana Black" wrote: > I havve just tested this with ghc8, and surprisingly when B is commented > out the last putStrLn is treated as a part of if-else. So, with B commented > out the only thing printed out is A and not 'done'. > > *From: *David Turner > *Sent: *Tuesday, November 15, 2016 1:14 PM > *To: *Haskell Cafe > *Subject: *Re: [Haskell-cafe] commenting out a line of code > > On 15 November 2016 at 12:53, Doaitse Swierstra > wrote: > >> The answer is very simple ;-} The report says that after a do the first >> symbol to encounter determines the indentation level; so putStrLn “done” is >> part of the else branch. Obvious, isn’t it. >> > > The outer do block should be desugared first, and the `putStrLn "done"` > has the same indent as the `if` so it gets a semicolon, in that block, > meaning it looks like this: > > main = do > { if True > then do > putStrLn "A" > else do > -- putStrLn "B" > ; putStrLn "done" > } > > > > On 15 November 2016 at 12:31, Norbert Melzer wrote: > >> I'm not quite sure, but I'd guess either one of >> >> 1.) It does not compile at all because of suspicious indentation >> 2.) It will just print "A" but not "done" because that is considered >> beeing in the else-branch. >> > > > I get *both* of these behaviours! When building, it complains about an > empty 'do' block. When running through `stack ghci` it doesn't seem to mind. > > > [linuxadmin at trac-leeds-09-vm01 13:07:57 ~/indent-puzzle ] > $ stack build > indent-puzzle-0.1.0.0: build > Preprocessing executable 'indent-puzzle-exe' for indent-puzzle-0.1.0.0... > [1 of 1] Compiling Main ( app/Main.hs, > .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/indent-pu > zzle-exe/indent-puzzle-exe-tmp/Main.o ) > > /home/linuxadmin/indent-puzzle/app/Main.hs:5:10: Empty 'do' block > > -- While building package indent-puzzle-0.1.0.0 using: > /home/linuxadmin/.stack/setup-exe-cache/x86_64-linux/setup-S > imple-Cabal-1.22.5.0-ghc-7.10.3 --builddir=.stack-work/dist/x86_64-linux/Cabal-1.22.5.0 > build exe:indent-puzzle-exe --ghc-options " -ddump-hi -ddump-to-file" > Process exited with code: ExitFailure 1 > [linuxadmin at trac-leeds-09-vm01 13:08:00 ~/indent-puzzle ] > $ stack ghci > indent-puzzle-0.1.0.0: build > Preprocessing executable 'indent-puzzle-exe' for indent-puzzle-0.1.0.0... > [1 of 1] Compiling Main ( app/Main.hs, > .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/indent-pu > zzle-exe/indent-puzzle-exe-tmp/Main.o ) > > /home/linuxadmin/indent-puzzle/app/Main.hs:5:10: Empty 'do' block > > -- While building package indent-puzzle-0.1.0.0 using: > /home/linuxadmin/.stack/setup-exe-cache/x86_64-linux/setup-S > imple-Cabal-1.22.5.0-ghc-7.10.3 --builddir=.stack-work/dist/x86_64-linux/Cabal-1.22.5.0 > build exe:indent-puzzle-exe --ghc-options " -ddump-hi -ddump-to-file" > Process exited with code: ExitFailure 1 > Warning: build failed, but optimistically launching GHCi anyway > The following GHC options are incompatible with GHCi and have not been > passed to it: -threaded > Using main module: 1. Package `indent-puzzle' component > exe:indent-puzzle-exe with main-is file: /home/linuxadmin/indent-puzzle > /app/Main.hs > Configuring GHCi with the following packages: indent-puzzle > GHCi, version 7.10.3: http://www.haskell.org/ghc/ :? for help > [1 of 1] Compiling Main ( /home/linuxadmin/indent-puzzle/app/Main.hs, > interpreted ) > Ok, modules loaded: Main. > *Main> main > A > *Main> > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bh at intevation.de Tue Nov 15 16:21:51 2016 From: bh at intevation.de (Bernhard Herzog) Date: Tue, 15 Nov 2016 17:21:51 +0100 Subject: [Haskell-cafe] commenting out a line of code Message-ID: <201611151721.51302.bh@intevation.de> On 15.11.2016, David Turner wrote: > The outer do block should be desugared first, and the `putStrLn "done"` has > the same indent as the `if` so it gets a semicolon, in that block, meaning > it looks like this: > > main = do > { if True > then do > putStrLn "A" > else do > -- putStrLn "B" > ; putStrLn "done" > } That's what one would expect. Except that GHC treats the 'putStrLn "done"' as part of the do-block in the else branch by default. This is due to the NondecreasingIndentation extension which is enabled by default (see https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/bugs.html#context-free-syntax). With the option -XNoNondecreasingIndentation (or -XHaskell2010) GHC does produce an error message because of the empty do-block. Bernhard From gershomb at gmail.com Wed Nov 16 18:01:28 2016 From: gershomb at gmail.com (Gershom B) Date: Wed, 16 Nov 2016 13:01:28 -0500 Subject: [Haskell-cafe] is it normal for docs to be pending for 24 hours? In-Reply-To: References: Message-ID: As an update -- the builder had a few other issues besides disk-space in terms of getting a better retry policy in place, and properly prioritizing new over older packages, etc. I think as of this morning they're finally all worked through and it seems to be slowly chugging through the backlog in a reasonable order, prioritizing new uploads.I'll be checking in on the logs daily for the time being to make sure it does't seem to be getting stuck. If your docs haven't built and you're impatient (understandably so!), please don't bump your package version to kick the priority -- that'll just put more metadata on the server we don't need. Instead, you can build and upload your own docs as in this sample shell script: https://github.com/ekmett/lens/blob/master/scripts/hackage-docs.sh Best, Gershom On Fri, Nov 11, 2016 at 11:43 AM, Gershom B wrote: > Sorry — the builder for docs has been in rough shape and we’re working on it. In this case it got stuck due to disk space issues and monitoring didn’t catch it. Its now running again but doing some catching up. (And lots of stuff in the queue it failed to build due to other problems needs to be replaced there, which is a manual process at the moment if we don’t want the queue as a whole to just drown out any new things at all with backlog). It would be much better to expose more queues and have better monitoring (and real prioritization), and another volunteer to help ben out on this would be very welcome (please contact me if you’re interested — the code lives at https://github.com/haskell/hackage-server/blob/master/BuildClient.hs and there’s some uncommitted work on queuing as well). > > —gerhsom > > On November 8, 2016 at 8:37:19 PM, Patrick Pelletier (code at funwithsoftware.org) wrote: >> This is only my second time uploading a package to Hackage, so I don't >> yet have a feel for how it's supposed to go. I uploaded >> normalization-insensitive-2.0.0.1 about 24 hours ago: >> >> https://hackage.haskell.org/package/normalization-insensitive-2.0.0.1 >> >> Under "Status", it says "Docs pending". (And the module names are all >> non-clickable.) Is it normal to take this long to build the docs? Is >> there some way to find out where in the queue my job is? Is this an >> indication that something has gone wrong? How do I fix it? >> >> Thanks, >> >> --Patrick >> >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view archives go to: >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> Only members subscribed via the mailman list are allowed to post. > From tdammers at gmail.com Thu Nov 17 08:05:49 2016 From: tdammers at gmail.com (Tobias Dammers) Date: Thu, 17 Nov 2016 09:05:49 +0100 Subject: [Haskell-cafe] [ANN] Ginger: Jinja-like HTML templates for Haskell Message-ID: <20161117080548.GA32359@nibbler> Dear Cafe, I've been working on this for a while now, and figured now is as good a time as any to announce it properly, so here it is. https://ginger.tobiasdammers.nl/ Ginger is a Haskell implementation of Jinja (http://jinja.pocoo.org/), the best-of-breed in the "DOM-agnostic HTML template engines for Python" arena (or at least I think it is). The reason I built this is because upon researching HTML templating solutions for Haskell, I noticed that almost all of them are typesafe compile-time solutions (either EDSLs or something TH/QQ), which is awesome but doesn't fit my use cases. I believe I am not alone here. Code is on github: https://github.com/tdammers/ginger And also on bitbucket: https://bitbucket.org/tdammers/ginger And of course Ginger is available from hackage: http://ginger.tobiasdammers.nl/ Any kind of feedback is very welcome. Thanks for your time! - Tobias -- Tobias Dammers - tdammers at gmail.com From bayesragem at gmail.com Thu Nov 17 11:05:51 2016 From: bayesragem at gmail.com (Josh Barney) Date: Thu, 17 Nov 2016 06:05:51 -0500 Subject: [Haskell-cafe] [ANN] Ginger: Jinja-like HTML templates for Haskell In-Reply-To: <20161117080548.GA32359@nibbler> References: <20161117080548.GA32359@nibbler> Message-ID: <70F2F861-AB1E-4605-917C-A1A215063B90@gmail.com> I'm glad to see this--I use jinja2 for so many things and having more options is good. I love how saying the name 'ginger' with the right accent sounds exactly like 'jinja' :) Sent from my iPhone > On Nov 17, 2016, at 3:05 AM, Tobias Dammers wrote: > > Dear Cafe, > > I've been working on this for a while now, and figured now is as good a > time as any to announce it properly, so here it is. > > https://ginger.tobiasdammers.nl/ > > Ginger is a Haskell implementation of Jinja (http://jinja.pocoo.org/), > the best-of-breed in the "DOM-agnostic HTML template engines for Python" > arena (or at least I think it is). > > The reason I built this is because upon researching HTML templating > solutions for Haskell, I noticed that almost all of them are > typesafe compile-time solutions (either EDSLs or something TH/QQ), which > is awesome but doesn't fit my use cases. I believe I am not alone here. > > Code is on github: > https://github.com/tdammers/ginger > > And also on bitbucket: > https://bitbucket.org/tdammers/ginger > > And of course Ginger is available from hackage: > http://ginger.tobiasdammers.nl/ > > Any kind of feedback is very welcome. > > Thanks for your time! > > - Tobias > > -- > Tobias Dammers - tdammers at gmail.com > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. From j.stutterheim at me.com Thu Nov 17 12:38:47 2016 From: j.stutterheim at me.com (J. Stutterheim) Date: Thu, 17 Nov 2016 13:38:47 +0100 Subject: [Haskell-cafe] CFP: Dutch Functional Programming Day 2017 Message-ID: <5CA228B9-972B-4A3D-98C3-7744DA0FFED4@me.com> Call for Participation: Dear Friends of Functional Programming, The next Dutch FP Day will be held on Friday, January 6 2017 at the Radboud University in Nijmegen. You are invited to some or all of: participate, give a presentation, join the dinner. For further information, please see the website. https://wiki.clean.cs.ru.nl/NL-FP_dag_2017 Feel free to forward this invitation to colleagues and students who might be interested. Best regards on behalf of Markus Klinik -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 3117 bytes Desc: not available URL: From tdammers at gmail.com Thu Nov 17 13:21:42 2016 From: tdammers at gmail.com (Tobias Dammers) Date: Thu, 17 Nov 2016 14:21:42 +0100 Subject: [Haskell-cafe] [ANN] Ginger: Jinja-like HTML templates for Haskell In-Reply-To: <70F2F861-AB1E-4605-917C-A1A215063B90@gmail.com> References: <20161117080548.GA32359@nibbler> <70F2F861-AB1E-4605-917C-A1A215063B90@gmail.com> Message-ID: <20161117132141.GA13663@nibbler> On Thu, Nov 17, 2016 at 06:05:51AM -0500, Josh Barney wrote: > I love how saying the name 'ginger' with the right accent sounds exactly like 'jinja' :) That's intentional :) From eraker at gmail.com Thu Nov 17 13:36:21 2016 From: eraker at gmail.com (erik) Date: Thu, 17 Nov 2016 05:36:21 -0800 Subject: [Haskell-cafe] [ANN] Ginger: Jinja-like HTML templates for Haskell In-Reply-To: <20161117132141.GA13663@nibbler> References: <20161117080548.GA32359@nibbler> <70F2F861-AB1E-4605-917C-A1A215063B90@gmail.com> <20161117132141.GA13663@nibbler> Message-ID: This look really interesting. I especially appreciate all the documentation. I did have a question, though, from looking at the Readme, about what the context looks like. For instance, your example in the Readme iterates over items and puts `item.url` into the template, but that dotted lookup looks weird to me when I think about the haskell data types getting injected into the template. Is that a list of Haskell records? Anyway, it might be worth including a sample context in the Readme, to complete that example. More broadly, I realized that there may be some mental paradigm shifts I would have to do when going from Haskell to Jinja or vice versa. It looks like a solid effort, though, and very interesting. On Nov 17, 2016 5:22 AM, "Tobias Dammers" wrote: > On Thu, Nov 17, 2016 at 06:05:51AM -0500, Josh Barney wrote: > > I love how saying the name 'ginger' with the right accent sounds exactly > like 'jinja' :) > > That's intentional :) > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From andreas.abel at ifi.lmu.de Thu Nov 17 16:15:53 2016 From: andreas.abel at ifi.lmu.de (Andreas Abel) Date: Thu, 17 Nov 2016 17:15:53 +0100 Subject: [Haskell-cafe] commenting out a line of code In-Reply-To: <201611151721.51302.bh@intevation.de> References: <201611151721.51302.bh@intevation.de> Message-ID: <0489fa3f-7221-141f-7233-c771a44d50c3@ifi.lmu.de> NondecreasingIndentation is useful to model the imperative pattern // exit early if cond if (cond) return res; // otherwise continue bla in Haskell: if cond then return res else do bla If you have several exit conditions and have to indent every time you get ugly "staircase" code. However, it feels unintuitive that "then" and "else" do not set the indentation when they are first on a new line. Thus, you get valid Haskell which defies any aethestics: test = do if False then putStrLn "No" else case True of False -> putStrLn "No" True -> putStrLn "Yes" To be fair, Haskell is one of the first bigger languages with layout-sensitive parsing, and it is not surprising that the design is not smooth. On 15.11.2016 17:21, Bernhard Herzog wrote: > On 15.11.2016, David Turner wrote: >> The outer do block should be desugared first, and the `putStrLn "done"` has >> the same indent as the `if` so it gets a semicolon, in that block, meaning >> it looks like this: >> >> main = do >> { if True >> then do >> putStrLn "A" >> else do >> -- putStrLn "B" >> ; putStrLn "done" >> } > > That's what one would expect. Except that GHC treats the 'putStrLn "done"' as > part of the do-block in the else branch by default. This is due to the > NondecreasingIndentation extension which is enabled by default (see > https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/bugs.html#context-free-syntax). > With the option -XNoNondecreasingIndentation (or -XHaskell2010) GHC does > produce an error message because of the empty do-block. > > Bernhard > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > -- 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 timotej.tomandl at gmail.com Fri Nov 18 03:37:47 2016 From: timotej.tomandl at gmail.com (Timotej Tomandl) Date: Fri, 18 Nov 2016 03:37:47 +0000 Subject: [Haskell-cafe] Preventing dereferencing an STRef after taking an action Message-ID: Hi, is it possible to prevent an STRef passed to one ST action from being passed further on to another ST action? I am trying to prevent these usages: invalid :: STRef s a -> STRef s b -> ST s () invalid x y=action1 x y >>=action2 x y invalid1 :: STRef s a -> STRef s b -> ST s () invalid1 x y=action1 x y >>=action2 y while still being able to do this: valid :: STRef s a -> STRef s b -> ST s () valid x y=action1 x y >>=action2 x where action1 will modify x and y inplace, but in the end only x will hold the useful information. In other words I am trying to make it impossible for any action after action1 to have a same argument as action1's second argument. timo -------------- next part -------------- An HTML attachment was scrubbed... URL: From j.stutterheim at me.com Fri Nov 18 08:36:44 2016 From: j.stutterheim at me.com (J. Stutterheim) Date: Fri, 18 Nov 2016 09:36:44 +0100 Subject: [Haskell-cafe] GHC plugin: custom wired-in package, module, and type class Message-ID: Hi all, I'm looking for a way to add my own wired-in package/module/type class for use in a core-to-core plugin. My first challenge is to identify the type class that I want to find. I have the following code: myPkgUnitId :: UnitId myPkgUnitId = fsToUnitId (fsLit "mypackage") mkMyModule :: FastString -> Module mkMyModule m = mkModule myPkgUnitId (mkModuleNameFS m) myModule :: Module myModule = mkMyModule (fsLit "My.Module") myClassName :: Name myClassName = clsQual myModule (fsLit "MyClass") myClassKey myClassKey :: Unique -- How do I get this? Here the missing piece is the myClassKey. Looking at how this is done for, e.g., the Monad class: monadClassKey :: Unique monadClassKey = mkPreludeClassUnique 8 we see that it has a hard-coded unique identifier. Is there a way to do the same for my own type class? Or to somehow find the Unique key dynamically? The second challenge is more or less the same in that I want to identify a member of MyClass: myFunMName :: Name myFunMName = varQual myModule (fsLit "myFun") myFunMClassOpKey myFunMClassOpKey :: Unique -- How do I get this? Again, the identifier is hard-coded for, e.g., ">>=". Any insights will be much appreciated. Best regards, Jurriën -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 3117 bytes Desc: not available URL: From johannes.waldmann at htwk-leipzig.de Fri Nov 18 12:09:45 2016 From: johannes.waldmann at htwk-leipzig.de (Johannes Waldmann) Date: Fri, 18 Nov 2016 13:09:45 +0100 Subject: [Haskell-cafe] 4.4.2 Fixity Declarations - and what happens when they are missing Message-ID: Yeah, I know, it's bikeshedding, some 30 years after the fact, but - How on Earth was this allowed to happen? "Any operator lacking a fixity declaration is assumed to be infixl 9" https://www.haskell.org/onlinereport/haskell2010/haskellch4.html#x10-820061 If I don't specify associativity or precedence for an operator, then the parser should simply reject any expression whose meaning would depend on such declarations. So I'd have to write parentheses at each (ambiguous) use site - or write a fixity declaration. Both would serve to document the code. The current situation feels like "the type of identifiers without type declaration is int". Short of repairing the standard - I'd welcome GHC to print a huge warning for each definition and use (!) of "operator without fixity decl". - J. PS: to show that I did at least some research * there's no mention of this in 4.2 "Infix operators" in http://research.microsoft.com/~simonpj/papers/history-of-haskell/history.pdf * Scala also has default rules (6.12.3) "The precedence of an infix operator is determined by the operator’s first character." "Operators ending in a colon ‘ : ’ are right-associative. All other operators are left-associative." and why do I care at all? This: https://github.com/jwaldmann/haskell-obdd/issues/1 From cma at bitemyapp.com Fri Nov 18 22:14:33 2016 From: cma at bitemyapp.com (Christopher Allen) Date: Fri, 18 Nov 2016 16:14:33 -0600 Subject: [Haskell-cafe] Esqueleto maintainership Message-ID: Cross-posting my intent to take over maintainership of Esqueleto. Can read more here: https://github.com/haskell-infra/hackage-trustees/issues/84 This has gone on for awhile, but it's beginning to eat into maintenance of my work projects and it seems like there are others eager to contribute and help share the load where there wasn't 6 or 12 months ago. Cheers, Chris Allen From johndreaver at gmail.com Fri Nov 18 22:20:09 2016 From: johndreaver at gmail.com (David Reaver) Date: Fri, 18 Nov 2016 14:20:09 -0800 Subject: [Haskell-cafe] Esqueleto maintainership In-Reply-To: References: Message-ID: +1 Esqueleto has been unmaintained for a few months now. It's one of the packages preventing postgres users from using the recent Stackage snapshots. We've had to use a fork for many months. There are open PRs that would bring it up to date, but no one has merged them. On Fri, Nov 18, 2016 at 2:14 PM, Christopher Allen wrote: > Cross-posting my intent to take over maintainership of Esqueleto. > > Can read more here: https://github.com/haskell- > infra/hackage-trustees/issues/84 > > This has gone on for awhile, but it's beginning to eat into > maintenance of my work projects and it seems like there are others > eager to contribute and help share the load where there wasn't 6 or 12 > months ago. > > Cheers, > Chris Allen > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From amos.robinson at gmail.com Fri Nov 18 23:04:23 2016 From: amos.robinson at gmail.com (Amos Robinson) Date: Fri, 18 Nov 2016 23:04:23 +0000 Subject: [Haskell-cafe] GHC plugin: custom wired-in package, module, and type class In-Reply-To: References: Message-ID: Hi, We tried to do something similar a few years ago and couldn't get a nice solution for this. We ended up just requiring the user code to define a binding with a hard-coded name as a struct containing everything. I got the impression that the plugin ran too late in the pipeline to load new modules, so we couldn't add an import for the module we wanted. https://github.com/DDCSF/repa/blob/master/icebox/abandoned/repa-plugin/Data/Array/Repa/Plugin/Primitives.hs#L142 https://github.com/DDCSF/repa/blob/master/icebox/abandoned/repa-plugin/test/01-Simple/Main.hs#L11 On Fri, 18 Nov 2016 at 19:36 J. Stutterheim wrote: > Hi all, > > I'm looking for a way to add my own wired-in package/module/type class for > use in a core-to-core plugin. > > My first challenge is to identify the type class that I want to find. I > have the following code: > > myPkgUnitId :: UnitId > myPkgUnitId = fsToUnitId (fsLit "mypackage") > > mkMyModule :: FastString -> Module > mkMyModule m = mkModule myPkgUnitId (mkModuleNameFS m) > > myModule :: Module > myModule = mkMyModule (fsLit "My.Module") > > myClassName :: Name > myClassName = clsQual myModule (fsLit "MyClass") myClassKey > > myClassKey :: Unique -- How do I get this? > > Here the missing piece is the myClassKey. Looking at how this is done for, > e.g., the Monad class: > > monadClassKey :: Unique > monadClassKey = mkPreludeClassUnique 8 > > we see that it has a hard-coded unique identifier. Is there a way to do > the same for my own type class? Or to somehow find the Unique key > dynamically? > > The second challenge is more or less the same in that I want to identify a > member of MyClass: > > myFunMName :: Name > myFunMName = varQual myModule (fsLit "myFun") myFunMClassOpKey > > myFunMClassOpKey :: Unique -- How do I get this? > > Again, the identifier is hard-coded for, e.g., ">>=". > > Any insights will be much appreciated. > > Best regards, > > Jurriën_______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From moritz.angermann at gmail.com Sat Nov 19 03:27:20 2016 From: moritz.angermann at gmail.com (Moritz Angermann) Date: Sat, 19 Nov 2016 11:27:20 +0800 Subject: [Haskell-cafe] How to profile haskell web applications? Message-ID: Hi, I’m looking to (perf, heap) profile a haskell web application. With ekg and the ekg wai middleware I can get some data on the rts, gc, and latency. What’s the approach towards performance (-p) and heap (-h) profiling for web applications? Cheers, moritz From rik at dcs.bbk.ac.uk Sat Nov 19 13:43:04 2016 From: rik at dcs.bbk.ac.uk (Rik Howard) Date: Sat, 19 Nov 2016 13:43:04 +0000 Subject: [Haskell-cafe] Investigating Evaluation, Typing and Deduction -- WIP Message-ID: Comments welcome. http://www.dcs.bbk.ac.uk/~rik/gallery/investigating-evaluation-typing-and-deduction/document.pdf -------------- next part -------------- An HTML attachment was scrubbed... URL: From raichoo at googlemail.com Sun Nov 20 09:43:44 2016 From: raichoo at googlemail.com (raichoo) Date: Sun, 20 Nov 2016 10:43:44 +0100 Subject: [Haskell-cafe] Am I misunderstanding something about `StableName` and `hashStableName`? Message-ID: Hi, I've been playing around with `System.Mem.StableName` and `hashStableName` and stumbled across a behavior that seems to be rather weird. First of all the documentation of `hashStableName` says the following: The Int returned is not necessarily unique; several StableNames may map to the same Int (in practice however, the chances of this are small, so the result of hashStableName makes a good hash key). OK, sounds fine, let's put this to the test. So I wrote a little program. module Main where import Control.Monad import System.Mem.StableName import System.Environment main :: IO () main = do args <- getArgs res <- forM [0..10000] $ \i -> do x <- makeStableName i let h' = hashStableName x unless (null args) $ print h' return h' putStrLn "---------------------------" print $ minimum res print $ maximum res Running this program without an argument only prints aus the minimum and maximum hash values that where produced. So surprises here: $ ./Test --------------------------- 1 10000 Here is how things get a bit weird when I make the progam print out the hash values while they are being produced I get a completely different result. Not only that but I get a whole lot of hash collisions, since the hashes produced only seem to be within the range of 1 and 260. $ ./Test print [...] 128 127 126 125 124 123 122 121 120 119 118 117 116 115 114 --------------------------- 1 260 Am I missing something fundamental here, because this behavior seems to be rather confusing. Kind regards, raichoo -------------- next part -------------- An HTML attachment was scrubbed... URL: From bertram.felgenhauer at googlemail.com Sun Nov 20 13:32:03 2016 From: bertram.felgenhauer at googlemail.com (Bertram Felgenhauer) Date: Sun, 20 Nov 2016 14:32:03 +0100 Subject: [Haskell-cafe] Am I misunderstanding something about `StableName` and `hashStableName`? In-Reply-To: References: Message-ID: <20161120133202.GA31075@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> raichoo via Haskell-Cafe wrote: > First of all the documentation of `hashStableName` says the following: > > The Int returned is not necessarily unique; several StableNames may map > to the same Int (in practice however, the chances of this are small, so > the result of hashStableName makes a good hash key). > OK, sounds fine, let's put this to the test. So I wrote a little program. > > module Main where > > import Control.Monad > > import System.Mem.StableName > import System.Environment > > main :: IO () > main = do > args <- getArgs > res <- forM [0..10000] $ \i -> do > x <- makeStableName i > let h' = hashStableName x > unless (null args) $ > print h' > return h' > > putStrLn "---------------------------" > print $ minimum res > print $ maximum res There is nothing in this program that keeps the stable names alive. It appears, from your experiments, that once a stable name is garbage collected, its ID, which also serves as its hash value, may be reused for another stable pointer. Consider this variant of your main function: main = do res <- forM [0..10000] $ fmap hashStableName . makeStableName performGC res <- forM [0..10000] $ fmap hashStableName . makeStableName performGC res <- forM [0..10000] $ fmap hashStableName . makeStableName print (minimum res, maximum res) This produces `(1,10001)` as output in my tests. I'm not sure how exactly `print` affects garbage collections. Overall, I believe the documentation of `hashStableName` is mostly correct, but it would make sense to stress that the statement is only valid for stable names that are currently alive at a particular point in time, not globally for the whole run of a program. Cheers, Bertram From anderspapitto at gmail.com Sun Nov 20 17:27:08 2016 From: anderspapitto at gmail.com (Anders Papitto) Date: Sun, 20 Nov 2016 09:27:08 -0800 Subject: [Haskell-cafe] difficulty writing GEq instance Message-ID: Hello! I'm having a lot of trouble writing a Data.GADT.Compare.GEq instance - can anyone help me fill in the blank? For context - I'm generating Tag types automatically for using with DSum, and I need a GEq instance. That's part of an attempt to add efficient rendering of sum types to Reflex/Reflex-Dom (https://github.com/anderspapitto/reflex-sumtype- render/blob/master/src/ReflexHelpers.hs). I put this question on stackoverflow as well a day ago ( http://stackoverflow.com/questions/40698207/how-can-i- write-this-geq-instance). Here's the code (it's a full, standalone file - you can copy it into Foo.hs and run ghc to see the full error I'm facing). The error I get is that when I try to recursively call geq on the unwrapped x and y, I can't because ghc considers them to have different types - Quux a and Quux b. However, the whole point of why I'm trying to call geq is to see if a and b are the same, so I'm pretty confused. Note that I'm making use of the generics-sop library, which is where NP and NS and I come from. {-# LANGUAGE GADTs #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE KindSignatures #-} {-# LANGUAGE RankNTypes #-} module Foo where import Data.GADT.Compare import Generics.SOP import qualified GHC.Generics as GHC data Quux i xs where Quux :: Quux (NP I xs) xs newtype GTag t i = GTag { unTag :: NS (Quux i) (Code t) } instance GEq (GTag t) where -- I don't know how to do this geq (GTag (S x)) (GTag (S y)) = let _ = x `geq` y in undefined -------------- next part -------------- An HTML attachment was scrubbed... URL: From oleg.grenrus at iki.fi Sun Nov 20 18:37:39 2016 From: oleg.grenrus at iki.fi (Oleg Grenrus) Date: Sun, 20 Nov 2016 20:37:39 +0200 Subject: [Haskell-cafe] difficulty writing GEq instance In-Reply-To: References: Message-ID: I was just writing a blog post related to that. You’d need to use newtype GTag xs a = GTag { unTag :: NS ((:~:) a) xs } Then you can recover needed type equality. https://gist.github.com/phadej/bfdffc3bd5ba6ce4f586bb988a8d399c Alternatively: You could use `NS Proxy xs`, but than it’s much easier to make a mistake. - Oleg > On 20 Nov 2016, at 19:27, Anders Papitto wrote: > > Hello! I'm having a lot of trouble writing a Data.GADT.Compare.GEq instance - can anyone help me fill in the blank? For context - I'm generating Tag types automatically for using with DSum, and I need a GEq instance. That's part of an attempt to add efficient rendering of sum types to Reflex/Reflex-Dom (https://github.com/anderspapitto/reflex-sumtype-render/blob/master/src/ReflexHelpers.hs ). > > I put this question on stackoverflow as well a day ago (http://stackoverflow.com/questions/40698207/how-can-i-write-this-geq-instance ). > > Here's the code (it's a full, standalone file - you can copy it into Foo.hs and run ghc to see the full error I'm facing). The error I get is that when I try to recursively call geq on the unwrapped x and y, I can't because ghc considers them to have different types - Quux a and Quux b. However, the whole point of why I'm trying to call geq is to see if a and b are the same, so I'm pretty confused. > > Note that I'm making use of the generics-sop library, which is where NP and NS and I come from. > > {-# LANGUAGE GADTs #-} > {-# LANGUAGE DataKinds #-} > {-# LANGUAGE TypeOperators #-} > {-# LANGUAGE KindSignatures #-} > {-# LANGUAGE RankNTypes #-} > > module Foo where > > import Data.GADT.Compare > import Generics.SOP > import qualified GHC.Generics as GHC > > data Quux i xs where Quux :: Quux (NP I xs) xs > > newtype GTag t i = GTag { unTag :: NS (Quux i) (Code t) } > > instance GEq (GTag t) where > -- I don't know how to do this > geq (GTag (S x)) (GTag (S y)) = > let _ = x `geq` y > in undefined > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 842 bytes Desc: Message signed with OpenPGP using GPGMail URL: From anderspapitto at gmail.com Sun Nov 20 19:35:49 2016 From: anderspapitto at gmail.com (Anders Papitto) Date: Sun, 20 Nov 2016 11:35:49 -0800 Subject: [Haskell-cafe] difficulty writing GEq instance In-Reply-To: References: Message-ID: Thanks Oleg. Could you expand on that a little more? I've read your post and tried a few things, but I'm still unable to write the instance (either for the original version I had, or for your modified version). This is all pretty new to me, so I can't quite follow the jump from your hint to a full typechecking solution. In particular, trying to compile this snippet gives the same error as I was facing originally - I'm still not able to recurse with geq x y. newtype OlegTag xs a = OlegTag { unTag :: NS ((:~:) a) xs } instance GEq (OlegTag xs) where geq (OlegTag (Z x)) (OlegTag (Z y)) = case x `geq` y of _ -> undefined On Sun, Nov 20, 2016 at 10:37 AM, Oleg Grenrus wrote: > I was just writing a blog post related to that. > > You’d need to use > > newtype GTag xs a = GTag { unTag :: NS ((:~:) a) xs } > > Then you can recover needed type equality. > > https://gist.github.com/phadej/bfdffc3bd5ba6ce4f586bb988a8d399c > > Alternatively: > You could use `NS Proxy xs`, but than it’s much easier to make a mistake. > > - Oleg > > > > On 20 Nov 2016, at 19:27, Anders Papitto wrote: > > Hello! I'm having a lot of trouble writing a Data.GADT.Compare.GEq > instance - can anyone help me fill in the blank? For context - I'm > generating Tag types automatically for using with DSum, and I need a GEq > instance. That's part of an attempt to add efficient rendering of sum types > to Reflex/Reflex-Dom (https://github.com/anderspapi > tto/reflex-sumtype-render/blob/master/src/ReflexHelpers.hs). > > I put this question on stackoverflow as well a day ago ( > http://stackoverflow.com/questions/40698207/how-can-i-write > -this-geq-instance). > > Here's the code (it's a full, standalone file - you can copy it into > Foo.hs and run ghc to see the full error I'm facing). The error I get is > that when I try to recursively call geq on the unwrapped x and y, I can't > because ghc considers them to have different types - Quux a and Quux b. > However, the whole point of why I'm trying to call geq is to see if a and b > are the same, so I'm pretty confused. > > Note that I'm making use of the generics-sop library, which is where NP > and NS and I come from. > > {-# LANGUAGE GADTs #-} > {-# LANGUAGE DataKinds #-} > {-# LANGUAGE TypeOperators #-} > {-# LANGUAGE KindSignatures #-} > {-# LANGUAGE RankNTypes #-} > > module Foo where > > import Data.GADT.Compare > import Generics.SOP > import qualified GHC.Generics as GHC > > data Quux i xs where Quux :: Quux (NP I xs) xs > > newtype GTag t i = GTag { unTag :: NS (Quux i) (Code t) } > > instance GEq (GTag t) where > -- I don't know how to do this > geq (GTag (S x)) (GTag (S y)) = > let _ = x `geq` y > in undefined > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From adam at bergmark.nl Sun Nov 20 22:03:20 2016 From: adam at bergmark.nl (Adam Bergmark) Date: Sun, 20 Nov 2016 22:03:20 +0000 Subject: [Haskell-cafe] Esqueleto maintainership In-Reply-To: References: Message-ID: CCi'ng Felipe On Fri, Nov 18, 2016 at 11:14 PM Christopher Allen wrote: > Cross-posting my intent to take over maintainership of Esqueleto. > > Can read more here: > https://github.com/haskell-infra/hackage-trustees/issues/84 > > This has gone on for awhile, but it's beginning to eat into > maintenance of my work projects and it seems like there are others > eager to contribute and help share the load where there wasn't 6 or 12 > months ago. > > Cheers, > Chris Allen > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From cma at bitemyapp.com Sun Nov 20 22:26:06 2016 From: cma at bitemyapp.com (Christopher Allen) Date: Sun, 20 Nov 2016 16:26:06 -0600 Subject: [Haskell-cafe] Esqueleto maintainership In-Reply-To: References: Message-ID: Thank you! On Sun, Nov 20, 2016 at 4:03 PM, Adam Bergmark wrote: > CCi'ng Felipe > > On Fri, Nov 18, 2016 at 11:14 PM Christopher Allen > wrote: >> >> Cross-posting my intent to take over maintainership of Esqueleto. >> >> Can read more here: >> https://github.com/haskell-infra/hackage-trustees/issues/84 >> >> This has gone on for awhile, but it's beginning to eat into >> maintenance of my work projects and it seems like there are others >> eager to contribute and help share the load where there wasn't 6 or 12 >> months ago. >> >> Cheers, >> Chris Allen >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view archives go to: >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> Only members subscribed via the mailman list are allowed to post. -- Chris Allen Currently working on http://haskellbook.com From hyarion at iinet.net.au Sun Nov 20 23:14:14 2016 From: hyarion at iinet.net.au (Ben Mellor) Date: Mon, 21 Nov 2016 10:14:14 +1100 Subject: [Haskell-cafe] Am I misunderstanding something about `StableName` and `hashStableName`? In-Reply-To: <20161120133202.GA31075@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> References: <20161120133202.GA31075@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> Message-ID: On November 21, 2016 12:32:03 AM GMT+11:00, Bertram Felgenhauer via Haskell-Cafe wrote: >raichoo via Haskell-Cafe wrote: >> First of all the documentation of `hashStableName` says the >following: >> >> The Int returned is not necessarily unique; several StableNames may >map >> to the same Int (in practice however, the chances of this are small, >so >> the result of hashStableName makes a good hash key). > >> OK, sounds fine, let's put this to the test. So I wrote a little >program. >> >> module Main where >> >> import Control.Monad >> >> import System.Mem.StableName >> import System.Environment >> >> main :: IO () >> main = do >> args <- getArgs >> res <- forM [0..10000] $ \i -> do >> x <- makeStableName i >> let h' = hashStableName x >> unless (null args) $ >> print h' >> return h' >> >> putStrLn "---------------------------" >> print $ minimum res >> print $ maximum res > >There is nothing in this program that keeps the stable names alive. >It appears, from your experiments, that once a stable name is garbage >collected, its ID, which also serves as its hash value, may be reused >for another stable pointer. Consider this variant of your main >function: > > main = do > res <- forM [0..10000] $ fmap hashStableName . makeStableName > performGC > res <- forM [0..10000] $ fmap hashStableName . makeStableName > performGC > res <- forM [0..10000] $ fmap hashStableName . makeStableName > print (minimum res, maximum res) > >This produces `(1,10001)` as output in my tests. > >I'm not sure how exactly `print` affects garbage collections. > >Overall, I believe the documentation of `hashStableName` is mostly >correct, but it would make sense to stress that the statement is >only valid for stable names that are currently alive at a particular >point in time, not globally for the whole run of a program. > >Cheers, > >Bertram > >_______________________________________________ >Haskell-Cafe mailing list >To (un)subscribe, modify options or view archives go to: >http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >Only members subscribed via the mailman list are allowed to post. I suspect that when print h' isn't called, then `let h' = hashStableName x` stays as a thunk in the list, until you later compute the minimum and maximum. The thunk refers to the stable name, and keeps it from being GCed. So they *are* all live at the same time. When you print h' in the loop body, that forces the hash calculation and discharges the thunk. So the stable name becomes garbage immediately, and once collected the internal id is available for reuse. Perhaps the 1-260 range observed tells you roughly how many iterations of that loop you can get through in the smallest GC generation, on your system. -------------- next part -------------- An HTML attachment was scrubbed... URL: From atrudyjane at protonmail.com Mon Nov 21 04:18:24 2016 From: atrudyjane at protonmail.com (Atrudyjane) Date: Sun, 20 Nov 2016 23:18:24 -0500 Subject: [Haskell-cafe] Haskell with ncurses Message-ID: As a beginning Haskeller working my way through the Haskell book, I'm looking ahead at different options for a user interface. The idea is to build various small tools for personal use. After reading around, it looks like web apps are preferred. Tried to use the Atom editor, and it just seemed a little slow on my machine. The interfaces don't need to be complex or "pretty", just clean looking. I would almost prefer something simple like ncurses. What are your opinions/experiences with using ncurses with Haskell? Or is that the wrong path altogether? Regards, Andrea Sent with [ProtonMail](https://protonmail.com) Secure Email. -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Mon Nov 21 04:21:58 2016 From: allbery.b at gmail.com (Brandon Allbery) Date: Sun, 20 Nov 2016 23:21:58 -0500 Subject: [Haskell-cafe] Haskell with ncurses In-Reply-To: References: Message-ID: On Sun, Nov 20, 2016 at 11:18 PM, Atrudyjane via Haskell-Cafe < haskell-cafe at haskell.org> wrote: > I would almost prefer something simple like ncurses. ncurses is rarely as simple as it looks. The API has rather ridiculous edge cases, because curses was originally ripped out of the vi source code and wasn't intended for general use; the Haskell bindings to it are either low level and little different from C programming, or higher level but annoyingly incomplete. http://hackage.haskell.org/package/brick might be of more interest. -- 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 palotai.robin at gmail.com Mon Nov 21 06:53:30 2016 From: palotai.robin at gmail.com (Robin Palotai) Date: Mon, 21 Nov 2016 07:53:30 +0100 Subject: [Haskell-cafe] Haskell with ncurses In-Reply-To: References: Message-ID: I used vty-ui in the past with great pleasure. But on hackage now I see it's deprecated in favor of [brick]( https://hackage.haskell.org/package/brick). Have fun! Robin 2016-11-21 5:21 GMT+01:00 Brandon Allbery : > > On Sun, Nov 20, 2016 at 11:18 PM, Atrudyjane via Haskell-Cafe < > haskell-cafe at haskell.org> wrote: > >> I would almost prefer something simple like ncurses. > > > ncurses is rarely as simple as it looks. The API has rather ridiculous > edge cases, because curses was originally ripped out of the vi source code > and wasn't intended for general use; the Haskell bindings to it are either > low level and little different from C programming, or higher level but > annoyingly incomplete. > > http://hackage.haskell.org/package/brick might be of more interest. > > -- > 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 > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rik at dcs.bbk.ac.uk Mon Nov 21 07:24:23 2016 From: rik at dcs.bbk.ac.uk (Rik Howard) Date: Mon, 21 Nov 2016 07:24:23 +0000 Subject: [Haskell-cafe] Investigating Evaluation, Typing and Deduction -- WIP In-Reply-To: References: Message-ID: This paper has been withdrawn. On 19 November 2016 at 13:43, Rik Howard wrote: > Comments welcome. > > http://www.dcs.bbk.ac.uk/~rik/gallery/investigating-evaluation-typing-and- > deduction/document.pdf > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From briand at aracnet.com Mon Nov 21 06:01:01 2016 From: briand at aracnet.com (briand at aracnet.com) Date: Sun, 20 Nov 2016 22:01:01 -0800 Subject: [Haskell-cafe] debugging vector index out of range Message-ID: <20161120220101.6ce32115@basalt.deldotd.com> Hi, I'm getting a vector index out of range. I'm trying to figure out how to get something to give the line number of the offender. However, attempting to use 'ghc -prof' gives me a problem because several of the libraries I'm using don't have profiled versions. Is there some way for me to debug this ? That is some way to debug it without inserting debug traces everywhere checking the vector indices ? Thanks. From m at jaspervdj.be Mon Nov 21 11:03:46 2016 From: m at jaspervdj.be (Jasper Van der Jeugt) Date: Mon, 21 Nov 2016 12:03:46 +0100 Subject: [Haskell-cafe] Package takeover: indents Message-ID: The indents [1] package provides a very simple way to create indentation-aware parsers with Parsec. Unfortunately, it does not compose very well (the user cannot use a custom monad anymore), and there are several bugs in it, for example this pretty bad one [2]. I have patches that has been running in production at Fugue [3] for over a year which fixes all of these issues, while keeping a fully compatible API. I have tried contacting the author (CC'ed) over a year ago (June 2015) but I haven't received a response. The latest package upload is from May, 2012. I would like to take over this package so I can share the fixes. [1]: https://hackage.haskell.org/package/indents [2]: http://lpaste.net/344393 [3]: https://fugue.co/ Regards, Jasper From pierre.crumeyrolle at c-s.fr Mon Nov 21 14:04:38 2016 From: pierre.crumeyrolle at c-s.fr (CRUMEYROLLE Pierre) Date: Mon, 21 Nov 2016 15:04:38 +0100 Subject: [Haskell-cafe] [cabal-install bootstrap failed] ghc-pkg: missing --global-package-db option, location of global package database unknown Message-ID: <20161121150438.Horde.153MLIqsDKQzsxbPiEOLNg5@messagerie.c-s.fr> hello i try to reinstall cabal in a customized directory but bootstrap launch fail because ghc-pkg list is failed thanks for help $ ghc --version The Glorious Glasgow Haskell Compilation System, version 7.10.3 $ ./bootstrap.sh --no-doc Using gcc for C compiler. If this is not what you want, set CC. Using /usr/libexec/gcc/x86_64-redhat-linux/4.8.5/collect2 instead. Checking installed packages for ghc-7.10.3... ghc-pkg: missing --global-package-db option, location of global package database unknown Error during cabal-install bootstrap: running 'ghc-pkg list' failed $ ghc-pkg list ghc-pkg: missing --global-package-db option, location of global package database unknown From simon at joyful.com Mon Nov 21 14:26:17 2016 From: simon at joyful.com (Simon Michael) Date: Mon, 21 Nov 2016 06:26:17 -0800 Subject: [Haskell-cafe] Haskell with ncurses In-Reply-To: References: Message-ID: brick (and vty) are well maintained and wonderful - recommended! From atrudyjane at protonmail.com Mon Nov 21 19:32:53 2016 From: atrudyjane at protonmail.com (Atrudyjane) Date: Mon, 21 Nov 2016 14:32:53 -0500 Subject: [Haskell-cafe] Haskell with ncurses In-Reply-To: References: Message-ID: Downloaded brick and tried a couple of the demo programs last night, looks great. This could work. Thanks everybody for pointing the way! Andrea Sent with [ProtonMail](https://protonmail.com) Secure Email. -------- Original Message -------- Subject: Re: [Haskell-cafe] Haskell with ncurses Local Time: November 21, 2016 8:26 AM UTC Time: November 21, 2016 2:26 PM From: simon at joyful.com To: haskell-cafe at haskell.org brick (and vty) are well maintained and wonderful - recommended! _______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From byorgey at gmail.com Mon Nov 21 22:49:23 2016 From: byorgey at gmail.com (Brent Yorgey) Date: Mon, 21 Nov 2016 22:49:23 +0000 Subject: [Haskell-cafe] Package takeover: indents In-Reply-To: References: Message-ID: Yes please! I think I'd actually like to use that package. On Mon, Nov 21, 2016 at 5:04 AM Jasper Van der Jeugt wrote: > The indents [1] package provides a very simple way to create > indentation-aware parsers with Parsec. > > Unfortunately, it does not compose very well (the user cannot use a > custom monad anymore), and there are several bugs in it, for example > this pretty bad one [2]. I have patches that has been running in > production at Fugue [3] for over a year which fixes all of these > issues, while keeping a fully compatible API. > > I have tried contacting the author (CC'ed) over a year ago (June 2015) > but I haven't received a response. The latest package upload is from > May, 2012. I would like to take over this package so I can share the > fixes. > > [1]: https://hackage.haskell.org/package/indents > [2]: http://lpaste.net/344393 > [3]: https://fugue.co/ > > Regards, > Jasper > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From drkoster at qq.com Tue Nov 22 03:30:07 2016 From: drkoster at qq.com (winter) Date: Tue, 22 Nov 2016 11:30:07 +0800 Subject: [Haskell-cafe] An idea on extensible effects (anonymous record) Message-ID: <768F646D-5B5A-44F9-B482-A0B466BCC564@qq.com> Hi everyone! First of all, i don't know if this idea is already being discussed so if there's a discussion on this i'd like to follow. To illustrate, first i want to create a class like: class Has a t where get :: t -> a then i define instance for simple product type such as tuple: instance Has a (a, b) where get (a, _) = a instance Has b (a, b) where get (_, b) = b ... You can image i will use th to make lots of instance for difference tuple size. Now if i want an extensible reader, i use Has class like this: someReader :: Has Int t => Reader t Int someReader = do x <- ask return $ get x + 1 Then i can run it with any tuple with an Int field like: runReader someReader (0 :: Int, "adad”) -- 1 This typeclass almost solved all problem of my network application: sometime’s i want ensure a logger, a sql backend and a http client pool in my monad’s environment, but i don’t want to fix my environment into a record. We can add a set :: a -> t -> t, or use lens to define Has, so that we can have extensible states. We can also use Tagged to achieve something like: (Has (Tagged “SqlBackEndOne” SqlBackEnd) t, Has (Tagged “SqlBackEndTwo" SqlBackEnd) t) => Reader t () It there a library doing this, maybe in lens? or there’re some drawbacks i didn’t notice? All ideas are welcomed! Cheers~ Winter -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Tue Nov 22 03:32:54 2016 From: allbery.b at gmail.com (Brandon Allbery) Date: Mon, 21 Nov 2016 22:32:54 -0500 Subject: [Haskell-cafe] An idea on extensible effects (anonymous record) In-Reply-To: <768F646D-5B5A-44F9-B482-A0B466BCC564@qq.com> References: <768F646D-5B5A-44F9-B482-A0B466BCC564@qq.com> Message-ID: On Mon, Nov 21, 2016 at 10:30 PM, winter wrote: > To illustrate, first i want to create a class like: > > class Has a t where > get :: t -> a > Does this differ significantly from fclabels or the upcoming OverloadedRecordFields extension? (Aside from being purely type driven, which has problems in your example if you compose a second Int into 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 drkoster at qq.com Tue Nov 22 03:39:55 2016 From: drkoster at qq.com (winter) Date: Tue, 22 Nov 2016 11:39:55 +0800 Subject: [Haskell-cafe] An idea on extensible effects (anonymous record) In-Reply-To: References: <768F646D-5B5A-44F9-B482-A0B466BCC564@qq.com> Message-ID: 1. Yes, it’s similar to OverloadedRecordFields but doesn’t force you to use a label, and you may use Tagged to label a field if you want. 2. Yes, but again, you can use Tagged to allow same type in different disguise. > On 22 Nov 2016, at 11:32, Brandon Allbery wrote: > > > On Mon, Nov 21, 2016 at 10:30 PM, winter > wrote: > To illustrate, first i want to create a class like: > > class Has a t where > get :: t -> a > > Does this differ significantly from fclabels or the upcoming OverloadedRecordFields extension? (Aside from being purely type driven, which has problems in your example if you compose a second Int into 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 monkleyon at googlemail.com Tue Nov 22 07:33:17 2016 From: monkleyon at googlemail.com (MarLinn) Date: Tue, 22 Nov 2016 08:33:17 +0100 Subject: [Haskell-cafe] An idea on extensible effects (anonymous record) In-Reply-To: References: <768F646D-5B5A-44F9-B482-A0B466BCC564@qq.com> Message-ID: >> Does this differ significantly from fclabels or the upcoming >> OverloadedRecordFields extension? (Aside from being purely type >> driven, which has problems in your example if you compose a second >> Int into it.) > 1. Yes, it’s similar to OverloadedRecordFields but doesn’t force you > to use a label, and you may use Tagged to label a field if you want. > 2. Yes, but again, you can use Tagged to allow same type in different > disguise. I can see a potential problem because you can't hide instances. Once you define a Has-relationship, you can't cheaply change it. That could lead to conflicts, unless you hack around it with orphaned instances in a separate module. But you say you want to solve conflicts with tagging – so it would be reasonable to incorporate the tag in the class from the start. Which brings us back to fclabels I suppose. MarLinn -------------- next part -------------- An HTML attachment was scrubbed... URL: From drkoster at qq.com Tue Nov 22 09:27:52 2016 From: drkoster at qq.com (winter) Date: Tue, 22 Nov 2016 17:27:52 +0800 Subject: [Haskell-cafe] An idea on extensible effects (anonymous record) In-Reply-To: References: <768F646D-5B5A-44F9-B482-A0B466BCC564@qq.com> Message-ID: <1C251FDC-4448-4593-AFBE-50024BA51AB2@qq.com> > Which brings us back to fclabels I suppose. Can you elaborate this? I haven’t fully understand what is “incorporate the tag in the class from the start” . Thanks you. Cheer~ Winter > On 22 Nov 2016, at 15:33, MarLinn via Haskell-Cafe wrote: > >>> Does this differ significantly from fclabels or the upcoming OverloadedRecordFields extension? (Aside from being purely type driven, which has problems in your example if you compose a second Int into it.) >> >> 1. Yes, it’s similar to OverloadedRecordFields but doesn’t force you to use a label, and you may use Tagged to label a field if you want. >> 2. Yes, but again, you can use Tagged to allow same type in different disguise. > > I can see a potential problem because you can't hide instances. Once you define a Has-relationship, you can't cheaply change it. That could lead to conflicts, unless you hack around it with orphaned instances in a separate module. But you say you want to solve conflicts with tagging – so it would be reasonable to incorporate the tag in the class from the start. Which brings us back to fclabels I suppose. > > MarLinn > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gale at sefer.org Tue Nov 22 12:08:41 2016 From: gale at sefer.org (Yitzchak Gale) Date: Tue, 22 Nov 2016 14:08:41 +0200 Subject: [Haskell-cafe] Package takeover: indents In-Reply-To: References: Message-ID: Jasper Van der Jeugt wrote: >> The indents package... I have patches... >> I have tried contacting the author (CC'ed) over a year ago (June 2015) >> but I haven't received a response. The latest package upload is from >> May, 2012. I would like to take over this package so I can share the >> fixes. There is a different email address (CC'ed) on github for a person with the same name as the author of that package. Github shows that person to be an active member of the Haskell community. So if that's the author, it's probably a case of an abandoned email address, not an abandoned package. Let's wait a bit to see if there is a response. Thanks, Yitz From clintonmead at gmail.com Tue Nov 22 13:37:57 2016 From: clintonmead at gmail.com (Clinton Mead) Date: Wed, 23 Nov 2016 00:37:57 +1100 Subject: [Haskell-cafe] Debug tracing in Haskell Message-ID: I've been debugging some Haskell code, including a lot of work on Mutable Vectors, so naturally I've found `trace` useful, and in particular `traceM`, because it fits in nicely with monadic code. The problem is that unlike `assert`, both `trace` and `traceM` execute unconditionally, I can't toggle them with a compiler flag. I could however do something like this in every file I want to do tracing. {-# LANGUAGE CPP #-} #ifdef TRACE trace = Debug.Trace.trace traceM = Debug.Trace.traceM #else trace _ = id traceM _ = pure () #endif But already, that's a lot of boilerplate. I'd also like to trace based on debug levels. For example, at TRACE level 2, only print trace statements at level 1 or 2, but at TRACE level 4, print trace statements at level 1, 2, 3 and 4, providing more detail (but more noise). This makes the above code even more complex. This wouldn't be a problem if I could put the code in a separate package, but I can't, as then whether tracing is on or not depends on the compiler settings of the tracing package, not on the calling package, which defeats the purpose somewhat. I considered using implicit parameters to quietly pass whether I want tracing and at what level into the tracing module, but it seems to be that implicit parameters can't be defined at the top level. It gets even more complex. When debugging, I might want to print something of type 'a'. Obviously 'a' will need some sort of show method for this to work, but outside of debug mode I don't want to restrict my function's types to things which are showable. So I considered doing this: #ifdef TRACE type DebugShow a = Show a debugShow = show #else type DebugShow a = () debugShow _ = error "DEBUG SHOWING OUTSIDE OF DEBUG MODE" #endif And of course, if you're only using `debugShow` as part of an argument to `trace`, lazy evaluation will avoid `debugShow` ever being called when tracing is not enabled. But put all this together and you've got around a dozen lines of boilerplate just to do tracing, without even having tracing levels yet, that have to be put in every module you want to use tracing, but don't want a whole lot of debug data being spat out in a release compile. Also, adding any other tracing functions just makes this longer. The only approach I can think of so far is to whack this all in a template haskell module and add code that splices it all into the current module: e.g. #ifdef TRACE $(traceFunctions True) #else $(traceFunctions False) #endif Where `traceFunctions` is a template haskell function that dumps all the appropriate functions and type definitions mentioned above (and maybe more) at the top level of the calling module. So my questions are: 1. Is there a better way? And 2. Has this problem already been solved? -------------- next part -------------- An HTML attachment was scrubbed... URL: From daniel.trstenjak at gmail.com Tue Nov 22 13:45:53 2016 From: daniel.trstenjak at gmail.com (Daniel Trstenjak) Date: Tue, 22 Nov 2016 14:45:53 +0100 Subject: [Haskell-cafe] Debug tracing in Haskell In-Reply-To: References: Message-ID: <20161122134553.GA3286@octa> Hi Clinton, On Wed, Nov 23, 2016 at 12:37:57AM +1100, Clinton Mead wrote: > The only approach I can think of so far is to whack this all in a template > haskell module and add code that splices it all into the current module: If you're already using cpp you could also put everyting into a 'Trace.h' file and include it: #include "Trace.h" Greetings, Daniel From monkleyon at googlemail.com Tue Nov 22 13:48:26 2016 From: monkleyon at googlemail.com (MarLinn) Date: Tue, 22 Nov 2016 14:48:26 +0100 Subject: [Haskell-cafe] An idea on extensible effects (anonymous record) In-Reply-To: <1C251FDC-4448-4593-AFBE-50024BA51AB2@qq.com> References: <768F646D-5B5A-44F9-B482-A0B466BCC564@qq.com> <1C251FDC-4448-4593-AFBE-50024BA51AB2@qq.com> Message-ID: <650b0e8d-0ab3-f192-81ef-663fe758b86d@gmail.com> >> Which brings us back to fclabels I suppose. > Can you elaborate this? I haven’t fully understand what is > “incorporate the tag in the class from the start” . Thanks you. Suppose you have the original definitions class Has a t where get :: t -> a instance Has a (a, b) where get (a, _) = a instance Has b (a, b) where get (_, b) = b This creates a conflict if you use an (Int,Int) tuple because there are either no definitions or two conflicting definitions for get. As a solution you propose something along the lines of Has (Tagged “GetGetsFirst” a) (a,b) All I'm saying is that it seems useful or even necessary for sanity to combine Hasand Taggedso that you can write Has “fst” a (a,b) The implementation should be something simple like class (KnownSymbol label) => Has label part whole | whole,label -> part where get :: Proxy label -> whole -> part -- 'Proxy label' is necessary because 'whole' and 'part' alone are not sufficient to determine the label. See (Int,Int). The obvious downside is that it doesn't make as much sense to have such a class now. I must admit I'm not too familiar with the alternatives, so I can't really compare it. But this was just a flaw I saw. Hope this cleared up what I meant. Cheers, MarLinn >>>> Does this differ significantly from fclabels or the upcoming >>>> OverloadedRecordFields extension? (Aside from being purely type >>>> driven, which has problems in your example if you compose a second >>>> Int into it.) >>> 1. Yes, it’s similar to OverloadedRecordFields but doesn’t force you >>> to use a label, and you may use Tagged to label a field if you want. >>> 2. Yes, but again, you can use Tagged to allow same type in >>> different disguise. >> I can see a potential problem because you can't hide instances. Once >> you define a Has-relationship, you can't cheaply change it. That >> could lead to conflicts, unless you hack around it with orphaned >> instances in a separate module. But you say you want to solve >> conflicts with tagging – so it would be reasonable to incorporate the >> tag in the class from the start. Which brings us back to fclabels I >> suppose. -------------- next part -------------- An HTML attachment was scrubbed... URL: From drkoster at qq.com Tue Nov 22 14:14:41 2016 From: drkoster at qq.com (winter) Date: Tue, 22 Nov 2016 22:14:41 +0800 Subject: [Haskell-cafe] An idea on extensible effects (anonymous record) In-Reply-To: <650b0e8d-0ab3-f192-81ef-663fe758b86d@gmail.com> References: <768F646D-5B5A-44F9-B482-A0B466BCC564@qq.com> <1C251FDC-4448-4593-AFBE-50024BA51AB2@qq.com> <650b0e8d-0ab3-f192-81ef-663fe758b86d@gmail.com> Message-ID: Hi MarLinn! In my use case the type collision is definitely much less likely to happen, that is i often want to compose different effects like logger, sql and network ,etc. without Has class, i will have a hard time trying to compose `Reader Logger ()` and `Reader (Logger, HttpClient) ()`, since the concrete type can't be unified. If i need two different Logger in environment, i still can do it without Tagged, i can define following newtypes in library site: newtype StdLogger = StdLogger Logger newtype FileLogger = FileLogger Logger librarySite :: (Has StdLogger r, Has FileLogger r, MonadReader r m) => m () librarySite = do ... stdLogger :: StdLogger <- asks get logWith stdLogger ... fileLogger :: FileLogger <- asks get logWith fileLogger ... And in application site i should supply a (StdLogger log1, FileLogger log2, ...). Does above example illustrate my use case to you? Cheers~ Winter > On 22 Nov 2016, at 21:48, MarLinn wrote: > >>> Which brings us back to fclabels I suppose. >> Can you elaborate this? I haven’t fully understand what is “incorporate the tag in the class from the start” . Thanks you. > > Suppose you have the original definitions > class Has a t where > get :: t -> a > > instance Has a (a, b) where > get (a, _) = a > > instance Has b (a, b) where > get (_, b) = b > This creates a conflict if you use an (Int,Int) tuple because there are either no definitions or two conflicting definitions for get. > As a solution you propose something along the lines of > Has (Tagged “GetGetsFirst” a) (a,b) > All I'm saying is that it seems useful or even necessary for sanity to combine Has and Tagged so that you can write > Has “fst” a (a,b) > The implementation should be something simple like > class (KnownSymbol label) => Has label part whole | whole,label -> part where > get :: Proxy label -> whole -> part > -- 'Proxy label' is necessary because 'whole' and 'part' alone are not sufficient to determine the label. See (Int,Int). > The obvious downside is that it doesn't make as much sense to have such a class now. I must admit I'm not too familiar with the alternatives, so I can't really compare it. But this was just a flaw I saw. Hope this cleared up what I meant. > > Cheers, > MarLinn > >>>>> Does this differ significantly from fclabels or the upcoming OverloadedRecordFields extension? (Aside from being purely type driven, which has problems in your example if you compose a second Int into it.) >>>> >>>> 1. Yes, it’s similar to OverloadedRecordFields but doesn’t force you to use a label, and you may use Tagged to label a field if you want. >>>> 2. Yes, but again, you can use Tagged to allow same type in different disguise. >>> I can see a potential problem because you can't hide instances. Once you define a Has-relationship, you can't cheaply change it. That could lead to conflicts, unless you hack around it with orphaned instances in a separate module. But you say you want to solve conflicts with tagging – so it would be reasonable to incorporate the tag in the class from the start. Which brings us back to fclabels I suppose. -------------- next part -------------- An HTML attachment was scrubbed... URL: From monkleyon at googlemail.com Tue Nov 22 14:38:27 2016 From: monkleyon at googlemail.com (MarLinn) Date: Tue, 22 Nov 2016 15:38:27 +0100 Subject: [Haskell-cafe] Debug tracing in Haskell In-Reply-To: References: Message-ID: <970325f1-48f7-b49b-83c0-ee4268c805b1@gmail.com> This sounds an awful lot like a different name for what monad-logger offers. Pro: + uses Template Haskell for decoupling and to add source positions + used in Yesod so probably well maintained + the underlying fast-logger was optimized for performance, including in concurrent production environments Contra: - only usable in monadic contexts - I haven't found a better documentation than looking at how its used in Yesod source code Pro/Contra: * The package is from the Yesod/Stack corner of our world, so depending on your political viewpoint this can be anything from a bonus to a deal-breaker ;-) From corentin.dupont at gmail.com Tue Nov 22 14:58:52 2016 From: corentin.dupont at gmail.com (Corentin Dupont) Date: Tue, 22 Nov 2016 15:58:52 +0100 Subject: [Haskell-cafe] Debug tracing in Haskell In-Reply-To: References: Message-ID: Hi Clinton, I've been running into the same problem recently: regularly adding and then removing a lot of traces from my code. Personally I don't like adding conditional compilation/cpp in my code (it's quite ugly and difficult to maintain). I've been looking into a logging packages: https://hackage.haskell.org/package/tinylog-0.14.0/candidate/docs/System-Logger.html The question is: how to carry around the settings of the logger (i.e. the log levels: Warn, Fatal...) in your program? I usually structure my programs around a big State monad, that I access using Lenses. The log level could be added there. On Tue, Nov 22, 2016 at 2:37 PM, Clinton Mead wrote: > I've been debugging some Haskell code, including a lot of work on Mutable > Vectors, so naturally I've found `trace` useful, and in particular > `traceM`, because it fits in nicely with monadic code. > > The problem is that unlike `assert`, both `trace` and `traceM` execute > unconditionally, I can't toggle them with a compiler flag. > > I could however do something like this in every file I want to do tracing. > > {-# LANGUAGE CPP #-} > > #ifdef TRACE > trace = Debug.Trace.trace > traceM = Debug.Trace.traceM > #else > trace _ = id > traceM _ = pure () > #endif > > But already, that's a lot of boilerplate. > > I'd also like to trace based on debug levels. For example, at TRACE level > 2, only print trace statements at level 1 or 2, but at TRACE level 4, print > trace statements at level 1, 2, 3 and 4, providing more detail (but more > noise). > > This makes the above code even more complex. > > This wouldn't be a problem if I could put the code in a separate package, > but I can't, as then whether tracing is on or not depends on the compiler > settings of the tracing package, not on the calling package, which defeats > the purpose somewhat. > > I considered using implicit parameters to quietly pass whether I want > tracing and at what level into the tracing module, but it seems to be that > implicit parameters can't be defined at the top level. > > It gets even more complex. When debugging, I might want to print something > of type 'a'. Obviously 'a' will need some sort of show method for this to > work, but outside of debug mode I don't want to restrict my function's > types to things which are showable. So I considered doing this: > > #ifdef TRACE > type DebugShow a = Show a > debugShow = show > #else > type DebugShow a = () > debugShow _ = error "DEBUG SHOWING OUTSIDE OF DEBUG MODE" > #endif > > And of course, if you're only using `debugShow` as part of an argument to > `trace`, lazy evaluation will avoid `debugShow` ever being called when > tracing is not enabled. > > But put all this together and you've got around a dozen lines of > boilerplate just to do tracing, without even having tracing levels yet, > that have to be put in every module you want to use tracing, but don't want > a whole lot of debug data being spat out in a release compile. > > Also, adding any other tracing functions just makes this longer. > > The only approach I can think of so far is to whack this all in a template > haskell module and add code that splices it all into the current module: > > e.g. > > #ifdef TRACE > $(traceFunctions True) > #else > $(traceFunctions False) > #endif > > Where `traceFunctions` is a template haskell function that dumps all the > appropriate functions and type definitions mentioned above (and maybe more) > at the top level of the calling module. > > So my questions are: > > 1. Is there a better way? And > 2. Has this problem already been solved? > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From corentin.dupont at gmail.com Tue Nov 22 15:01:56 2016 From: corentin.dupont at gmail.com (Corentin Dupont) Date: Tue, 22 Nov 2016 16:01:56 +0100 Subject: [Haskell-cafe] Debug tracing in Haskell In-Reply-To: References: Message-ID: PS: adding a new monad transformer to the monad stack just to add log capacity seems overkill. what do you guys think? On Tue, Nov 22, 2016 at 3:58 PM, Corentin Dupont wrote: > > Hi Clinton, > I've been running into the same problem recently: regularly adding and > then removing a lot of traces from my code. > > Personally I don't like adding conditional compilation/cpp in my code > (it's quite ugly and difficult to maintain). > I've been looking into a logging packages: https://hackage.haskell.org/ > package/tinylog-0.14.0/candidate/docs/System-Logger.html > > The question is: how to carry around the settings of the logger (i.e. the > log levels: Warn, Fatal...) in your program? > I usually structure my programs around a big State monad, that I access > using Lenses. The log level could be added there. > > > > > > On Tue, Nov 22, 2016 at 2:37 PM, Clinton Mead > wrote: > >> I've been debugging some Haskell code, including a lot of work on Mutable >> Vectors, so naturally I've found `trace` useful, and in particular >> `traceM`, because it fits in nicely with monadic code. >> >> The problem is that unlike `assert`, both `trace` and `traceM` execute >> unconditionally, I can't toggle them with a compiler flag. >> >> I could however do something like this in every file I want to do tracing. >> >> {-# LANGUAGE CPP #-} >> >> #ifdef TRACE >> trace = Debug.Trace.trace >> traceM = Debug.Trace.traceM >> #else >> trace _ = id >> traceM _ = pure () >> #endif >> >> But already, that's a lot of boilerplate. >> >> I'd also like to trace based on debug levels. For example, at TRACE level >> 2, only print trace statements at level 1 or 2, but at TRACE level 4, print >> trace statements at level 1, 2, 3 and 4, providing more detail (but more >> noise). >> >> This makes the above code even more complex. >> >> This wouldn't be a problem if I could put the code in a separate package, >> but I can't, as then whether tracing is on or not depends on the compiler >> settings of the tracing package, not on the calling package, which defeats >> the purpose somewhat. >> >> I considered using implicit parameters to quietly pass whether I want >> tracing and at what level into the tracing module, but it seems to be that >> implicit parameters can't be defined at the top level. >> >> It gets even more complex. When debugging, I might want to print >> something of type 'a'. Obviously 'a' will need some sort of show method for >> this to work, but outside of debug mode I don't want to restrict my >> function's types to things which are showable. So I considered doing this: >> >> #ifdef TRACE >> type DebugShow a = Show a >> debugShow = show >> #else >> type DebugShow a = () >> debugShow _ = error "DEBUG SHOWING OUTSIDE OF DEBUG MODE" >> #endif >> >> And of course, if you're only using `debugShow` as part of an argument to >> `trace`, lazy evaluation will avoid `debugShow` ever being called when >> tracing is not enabled. >> >> But put all this together and you've got around a dozen lines of >> boilerplate just to do tracing, without even having tracing levels yet, >> that have to be put in every module you want to use tracing, but don't want >> a whole lot of debug data being spat out in a release compile. >> >> Also, adding any other tracing functions just makes this longer. >> >> The only approach I can think of so far is to whack this all in a >> template haskell module and add code that splices it all into the current >> module: >> >> e.g. >> >> #ifdef TRACE >> $(traceFunctions True) >> #else >> $(traceFunctions False) >> #endif >> >> Where `traceFunctions` is a template haskell function that dumps all the >> appropriate functions and type definitions mentioned above (and maybe more) >> at the top level of the calling module. >> >> So my questions are: >> >> 1. Is there a better way? And >> 2. Has this problem already been solved? >> >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view archives go to: >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> Only members subscribed via the mailman list are allowed to post. >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From simon at joyful.com Tue Nov 22 15:52:51 2016 From: simon at joyful.com (Simon Michael) Date: Tue, 22 Nov 2016 07:52:51 -0800 Subject: [Haskell-cafe] Debug tracing in Haskell In-Reply-To: References: Message-ID: Hi Clinton, at http://hackage.haskell.org/package/hledger-lib-1.0.1/docs/Hledger-Utils-Debug.html you can see an approach using unsafePerformIO. This lets me invoke programs with --debug[=1..9] to get progressively more debug output. It seems to work for me, see what you think.. On 11/22/16 5:37 AM, Clinton Mead wrote: > I've been debugging some Haskell code, including a lot of work on Mutable > Vectors, so naturally I've found `trace` useful, and in particular > `traceM`, because it fits in nicely with monadic code. > > The problem is that unlike `assert`, both `trace` and `traceM` execute > unconditionally, I can't toggle them with a compiler flag. > > I could however do something like this in every file I want to do tracing. > > {-# LANGUAGE CPP #-} > > #ifdef TRACE > trace = Debug.Trace.trace > traceM = Debug.Trace.traceM > #else > trace _ = id > traceM _ = pure () > #endif > > But already, that's a lot of boilerplate. > > I'd also like to trace based on debug levels. For example, at TRACE level > 2, only print trace statements at level 1 or 2, but at TRACE level 4, print > trace statements at level 1, 2, 3 and 4, providing more detail (but more > noise). > > This makes the above code even more complex. > > This wouldn't be a problem if I could put the code in a separate package, > but I can't, as then whether tracing is on or not depends on the compiler > settings of the tracing package, not on the calling package, which defeats > the purpose somewhat. > > I considered using implicit parameters to quietly pass whether I want > tracing and at what level into the tracing module, but it seems to be that > implicit parameters can't be defined at the top level. > > It gets even more complex. When debugging, I might want to print something > of type 'a'. Obviously 'a' will need some sort of show method for this to > work, but outside of debug mode I don't want to restrict my function's > types to things which are showable. So I considered doing this: > > #ifdef TRACE > type DebugShow a = Show a > debugShow = show > #else > type DebugShow a = () > debugShow _ = error "DEBUG SHOWING OUTSIDE OF DEBUG MODE" > #endif > > And of course, if you're only using `debugShow` as part of an argument to > `trace`, lazy evaluation will avoid `debugShow` ever being called when > tracing is not enabled. > > But put all this together and you've got around a dozen lines of > boilerplate just to do tracing, without even having tracing levels yet, > that have to be put in every module you want to use tracing, but don't want > a whole lot of debug data being spat out in a release compile. > > Also, adding any other tracing functions just makes this longer. > > The only approach I can think of so far is to whack this all in a template > haskell module and add code that splices it all into the current module: > > e.g. > > #ifdef TRACE > $(traceFunctions True) > #else > $(traceFunctions False) > #endif > > Where `traceFunctions` is a template haskell function that dumps all the > appropriate functions and type definitions mentioned above (and maybe more) > at the top level of the calling module. > > So my questions are: > > 1. Is there a better way? And > 2. Has this problem already been solved? > > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. From harendra.kumar at gmail.com Tue Nov 22 16:41:42 2016 From: harendra.kumar at gmail.com (Harendra Kumar) Date: Tue, 22 Nov 2016 22:11:42 +0530 Subject: [Haskell-cafe] Bangalore Haskell User Group Meetups Message-ID: This is for Haskellers in Bangalore, I apologize for wide distribution. We are having Haskell meetups in Bangalore on a regular basis now. If you are in Bangalore please join us by signing up at https://www.meetup.com/The-Bangalore-Haskell-User-Group/ . You can also join the gitter chat room at https://gitter.im/blrhaskell/Lobby . We have had a few lively and productive sessions in the recent past and hope to continue to do so in future. Looking forward to your participation. -harendra -------------- next part -------------- An HTML attachment was scrubbed... URL: From ezyang at mit.edu Tue Nov 22 21:11:35 2016 From: ezyang at mit.edu (Edward Z. Yang) Date: Tue, 22 Nov 2016 16:11:35 -0500 Subject: [Haskell-cafe] Debug tracing in Haskell In-Reply-To: References: Message-ID: <1479848470-sup-5257@sabre> Hello Clinton, Just to clarify, you are asking how to toggle traceability on a per-module (or perhaps per-package) basis? Because if you're OK with tracing be a global affair then putting everything in a package works quite well (you can use a flag to control whether or not you want to build with or without tracing.) Edward Excerpts from Clinton Mead's message of 2016-11-23 00:37:57 +1100: > I've been debugging some Haskell code, including a lot of work on Mutable > Vectors, so naturally I've found `trace` useful, and in particular > `traceM`, because it fits in nicely with monadic code. > > The problem is that unlike `assert`, both `trace` and `traceM` execute > unconditionally, I can't toggle them with a compiler flag. > > I could however do something like this in every file I want to do tracing. > > {-# LANGUAGE CPP #-} > > #ifdef TRACE > trace = Debug.Trace.trace > traceM = Debug.Trace.traceM > #else > trace _ = id > traceM _ = pure () > #endif > > But already, that's a lot of boilerplate. > > I'd also like to trace based on debug levels. For example, at TRACE level > 2, only print trace statements at level 1 or 2, but at TRACE level 4, print > trace statements at level 1, 2, 3 and 4, providing more detail (but more > noise). > > This makes the above code even more complex. > > This wouldn't be a problem if I could put the code in a separate package, > but I can't, as then whether tracing is on or not depends on the compiler > settings of the tracing package, not on the calling package, which defeats > the purpose somewhat. > > I considered using implicit parameters to quietly pass whether I want > tracing and at what level into the tracing module, but it seems to be that > implicit parameters can't be defined at the top level. > > It gets even more complex. When debugging, I might want to print something > of type 'a'. Obviously 'a' will need some sort of show method for this to > work, but outside of debug mode I don't want to restrict my function's > types to things which are showable. So I considered doing this: > > #ifdef TRACE > type DebugShow a = Show a > debugShow = show > #else > type DebugShow a = () > debugShow _ = error "DEBUG SHOWING OUTSIDE OF DEBUG MODE" > #endif > > And of course, if you're only using `debugShow` as part of an argument to > `trace`, lazy evaluation will avoid `debugShow` ever being called when > tracing is not enabled. > > But put all this together and you've got around a dozen lines of > boilerplate just to do tracing, without even having tracing levels yet, > that have to be put in every module you want to use tracing, but don't want > a whole lot of debug data being spat out in a release compile. > > Also, adding any other tracing functions just makes this longer. > > The only approach I can think of so far is to whack this all in a template > haskell module and add code that splices it all into the current module: > > e.g. > > #ifdef TRACE > $(traceFunctions True) > #else > $(traceFunctions False) > #endif > > Where `traceFunctions` is a template haskell function that dumps all the > appropriate functions and type definitions mentioned above (and maybe more) > at the top level of the calling module. > > So my questions are: > > 1. Is there a better way? And > 2. Has this problem already been solved? From david.feuer at gmail.com Wed Nov 23 04:38:10 2016 From: david.feuer at gmail.com (David Feuer) Date: Tue, 22 Nov 2016 23:38:10 -0500 Subject: [Haskell-cafe] debugging vector index out of range In-Reply-To: <20161120220101.6ce32115@basalt.deldotd.com> References: <20161120220101.6ce32115@basalt.deldotd.com> Message-ID: There may well be a way to get what you want. I don't personally know much about the newly improved debugging features. What I do know is that if you have a giant blob of code and you're getting a vector indexing error *somewhere*, then you're doing things wrong. Vector indexing is error-prone. You should really avoid doing it any more than necessary. Try to confine indexing operations to simple functions implementing higher-level vector operations, and write QuickCheck and/or SmallCheck tests for those functions. When possible, prefer the high-level operations already available in the vector package (and even the vector-algorithms package). Another idea I've been playing with lately is using reflection to tie an index into a vector to the size of that vector. I can create an "index" that I know is in bounds, and then pass it around freely while the type system keeps track of the fact that it's in bounds. I don't think this sort of thing is terribly practical at the moment, but it may become more practical as Haskell gets closer to dependent types. On Mon, Nov 21, 2016 at 1:01 AM, wrote: > Hi, > > I'm getting a vector index out of range. > > I'm trying to figure out how to get something to give the line number of the offender. > > However, attempting to use 'ghc -prof' gives me a problem because several of the libraries I'm using don't have profiled versions. > > Is there some way for me to debug this ? That is some way to debug it without inserting debug traces everywhere checking the vector indices ? > > Thanks. > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. From michael at snoyman.com Wed Nov 23 05:11:01 2016 From: michael at snoyman.com (Michael Snoyman) Date: Wed, 23 Nov 2016 07:11:01 +0200 Subject: [Haskell-cafe] Intended behavior of -no-rtsopts-suggestions Message-ID: I'm trying to compile an executable which will totally ignore RTS options flags (have the runtime completely ignore them). It seemed like a combo of -rtsopts=none and -no-rtsopts-suggestions[1] would achieve this. However, I can't figure out what the presence of that flag is doing. Can someone give me a pointer to what my expected behavior should be here, and even better how to achieve my goal of having the runtime ignore +RTS on the command line? $ cat Main.hs import System.Environment main = getArgs >>= print $ ghc -rtsopts=none -no-rtsopts-suggestions Main.hs -fforce-recomp && ./Main +RTS -s [1 of 1] Compiling Main ( Main.hs, Main.o ) Linking Main ... Main: RTS options are disabled. Link with -rtsopts to enable them. $ ghc -rtsopts=none Main.hs -fforce-recomp && ./Main +RTS -s [1 of 1] Compiling Main ( Main.hs, Main.o ) Linking Main ... Main: RTS options are disabled. Link with -rtsopts to enable them. [1] https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/phases.html?highlight=rtsopts#ghc-flag--no-rtsopts-suggestions -------------- next part -------------- An HTML attachment was scrubbed... URL: From briand at aracnet.com Wed Nov 23 05:51:17 2016 From: briand at aracnet.com (briand at aracnet.com) Date: Tue, 22 Nov 2016 21:51:17 -0800 Subject: [Haskell-cafe] debugging vector index out of range In-Reply-To: References: <20161120220101.6ce32115@basalt.deldotd.com> Message-ID: <20161122215117.360c8c19@basalt.deldotd.com> On Tue, 22 Nov 2016 23:38:10 -0500 David Feuer wrote: > There may well be a way to get what you want. I don't personally know > much about the newly improved debugging features. What I do know is > that if you have a giant blob of code and you're getting a vector > indexing error *somewhere*, then you're doing things wrong. Vector > indexing is error-prone. You should really avoid doing it any more > than necessary. Try to confine indexing operations to simple functions That's exactly right. Generally i'm using vector map, fold, etc... however in this particular instance i was pulling a specific value out of a matrix. and wouldn't you know m ! 0 ! n m ! n ! 0 one of those works. and one of them gives me an index error. The problem is that it was a matrix in the first place. m is 8x1, so really should have been a vector. then the operation would have succeeded by virtue of the way i had the problem set-up, because n was well know to be in bounds. so ultimately you are right, i was doing it wrong. i should have extracted the column as a vector and then done the indexing. Brian From i.caught.air at gmail.com Wed Nov 23 15:32:04 2016 From: i.caught.air at gmail.com (Alex Belanger) Date: Wed, 23 Nov 2016 10:32:04 -0500 Subject: [Haskell-cafe] Debug tracing in Haskell In-Reply-To: <1479848470-sup-5257@sabre> References: <1479848470-sup-5257@sabre> Message-ID: I personally prefer the approach in this package: https://hackage.haskell.org/package/NoTrace You import Debug.Trace when you want traces and switch the import to Debug.NoTrace to disable them. You could use a similar strategy with verbosity levels; plus you might not even need levels, as this is module-based you don't get the extra noise from other modules. - nitrix On Nov 22, 2016 4:11 PM, "Edward Z. Yang" wrote: > Hello Clinton, > > Just to clarify, you are asking how to toggle traceability on a > per-module (or perhaps per-package) basis? Because if you're > OK with tracing be a global affair then putting everything in > a package works quite well (you can use a flag to control > whether or not you want to build with or without tracing.) > > Edward > > Excerpts from Clinton Mead's message of 2016-11-23 00:37:57 +1100: > > I've been debugging some Haskell code, including a lot of work on Mutable > > Vectors, so naturally I've found `trace` useful, and in particular > > `traceM`, because it fits in nicely with monadic code. > > > > The problem is that unlike `assert`, both `trace` and `traceM` execute > > unconditionally, I can't toggle them with a compiler flag. > > > > I could however do something like this in every file I want to do > tracing. > > > > {-# LANGUAGE CPP #-} > > > > #ifdef TRACE > > trace = Debug.Trace.trace > > traceM = Debug.Trace.traceM > > #else > > trace _ = id > > traceM _ = pure () > > #endif > > > > But already, that's a lot of boilerplate. > > > > I'd also like to trace based on debug levels. For example, at TRACE level > > 2, only print trace statements at level 1 or 2, but at TRACE level 4, > print > > trace statements at level 1, 2, 3 and 4, providing more detail (but more > > noise). > > > > This makes the above code even more complex. > > > > This wouldn't be a problem if I could put the code in a separate package, > > but I can't, as then whether tracing is on or not depends on the compiler > > settings of the tracing package, not on the calling package, which > defeats > > the purpose somewhat. > > > > I considered using implicit parameters to quietly pass whether I want > > tracing and at what level into the tracing module, but it seems to be > that > > implicit parameters can't be defined at the top level. > > > > It gets even more complex. When debugging, I might want to print > something > > of type 'a'. Obviously 'a' will need some sort of show method for this to > > work, but outside of debug mode I don't want to restrict my function's > > types to things which are showable. So I considered doing this: > > > > #ifdef TRACE > > type DebugShow a = Show a > > debugShow = show > > #else > > type DebugShow a = () > > debugShow _ = error "DEBUG SHOWING OUTSIDE OF DEBUG MODE" > > #endif > > > > And of course, if you're only using `debugShow` as part of an argument to > > `trace`, lazy evaluation will avoid `debugShow` ever being called when > > tracing is not enabled. > > > > But put all this together and you've got around a dozen lines of > > boilerplate just to do tracing, without even having tracing levels yet, > > that have to be put in every module you want to use tracing, but don't > want > > a whole lot of debug data being spat out in a release compile. > > > > Also, adding any other tracing functions just makes this longer. > > > > The only approach I can think of so far is to whack this all in a > template > > haskell module and add code that splices it all into the current module: > > > > e.g. > > > > #ifdef TRACE > > $(traceFunctions True) > > #else > > $(traceFunctions False) > > #endif > > > > Where `traceFunctions` is a template haskell function that dumps all the > > appropriate functions and type definitions mentioned above (and maybe > more) > > at the top level of the calling module. > > > > So my questions are: > > > > 1. Is there a better way? And > > 2. Has this problem already been solved? > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From chris at kahn.pro Thu Nov 24 02:52:14 2016 From: chris at kahn.pro (chris at kahn.pro) Date: Wed, 23 Nov 2016 18:52:14 -0800 (PST) Subject: [Haskell-cafe] Is it possible to get the selector functions when defining a generic class? Message-ID: <2055743c-2aac-492a-8ddd-960940167d63@googlegroups.com> Hey all! I'm trying to understand what's going on in GHC.Generics and defining a generic class... I understand that there's a `Selector` class and `selName` function that can get the *name* of a selector, but is there a way to access the selector function itself? The documentation conveniently avoids examples involving records and is otherwise quite barren. So if I have a data type like... data Person = Person { name :: String , age :: Int } deriving Generic instance MyTypeClass Person I want my generic implementation of MyTypeClass to be able to access each selector function in the record, f :: Person -> String, g :: Person -> Int, etc. Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.feuer at gmail.com Thu Nov 24 03:06:32 2016 From: david.feuer at gmail.com (David Feuer) Date: Wed, 23 Nov 2016 22:06:32 -0500 Subject: [Haskell-cafe] Is it possible to get the selector functions when defining a generic class? In-Reply-To: <2055743c-2aac-492a-8ddd-960940167d63@googlegroups.com> References: <2055743c-2aac-492a-8ddd-960940167d63@googlegroups.com> Message-ID: Sorry if anyone gets this twice; the first copy somehow went to a non-existent Google Groups version of haskell-cafe. GHC.Generics doesn't offer any built-in support for such things. It *looks* like there *might* be some support in packages built around generics-sop. When you're working directly with GHC.Generics, the notion of a record barely even makes sense. A record is seen as simply a possibly-nested product. For example, ('a','b','c') will look *approximately* like 'a' :*: ('b' :*: 'c'). You're generally not "supposed" to care how large a record you may be dealing with, let alone what field names it has. May I ask what you're actually trying to do? Your specific request sounds peculiarly un-generic. On Wed, Nov 23, 2016 at 9:52 PM, wrote: > Hey all! > > I'm trying to understand what's going on in GHC.Generics and defining a > generic class... I understand that there's a `Selector` class and `selName` > function that can get the name of a selector, but is there a way to access > the selector function itself? The documentation conveniently avoids examples > involving records and is otherwise quite barren. > > So if I have a data type like... > > data Person = Person > { name :: String > , age :: Int > } deriving Generic > > instance MyTypeClass Person > > I want my generic implementation of MyTypeClass to be able to access each > selector function in the record, f :: Person -> String, g :: Person -> Int, > etc. > > Chris > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. From chris at kahn.pro Thu Nov 24 03:17:31 2016 From: chris at kahn.pro (Chris Kahn) Date: Wed, 23 Nov 2016 22:17:31 -0500 Subject: [Haskell-cafe] Is it possible to get the selector functions when defining a generic class? In-Reply-To: References: <2055743c-2aac-492a-8ddd-960940167d63@googlegroups.com> Message-ID: <56492bed-9c90-3c73-50c2-dddee326a3ac@kahn.pro> Aaaand you'll get mine twice since I forgot to reply-all the first time :) Sure, so in postgresql-simple there are two classes for automatically generating functions that encode/decode database rows, `FromRow` and `ToRow`. In the Hasql library--another postgres library--the encoders and decoders must be written by hand for each user-defined type. I want to write a class that will automatically generate these. I successfully wrote a `FromRow` class that can generate Hasql's `Row` type, since it's basically identical to what's in postgresql-simple's `FromRow`. But in Hasql the encoder type, Params, is contravariant and encoders are defined like: personEncoder :: Params Person personEncoder = contramap name (value text) <> contramap age (value int) The `value text` part can be determined based on the type information, but it's also expecting a matching selector function. I'm at a total loss for how I could generate something like this. On 11/23/2016 10:06 PM, David Feuer wrote: > Sorry if anyone gets this twice; the first copy somehow went to a > non-existent Google Groups version of haskell-cafe. > > GHC.Generics doesn't offer any built-in support for such things. It > *looks* like there *might* be some support in packages built around > generics-sop. When you're working directly with GHC.Generics, the > notion of a record barely even makes sense. A record is seen as simply > a possibly-nested product. For example, ('a','b','c') will look > *approximately* like 'a' :*: ('b' :*: 'c'). You're generally not > "supposed" to care how large a record you may be dealing with, let > alone what field names it has. May I ask what you're actually trying > to do? Your specific request sounds peculiarly un-generic. > > On Wed, Nov 23, 2016 at 9:52 PM, wrote: >> Hey all! >> >> I'm trying to understand what's going on in GHC.Generics and defining a >> generic class... I understand that there's a `Selector` class and `selName` >> function that can get the name of a selector, but is there a way to access >> the selector function itself? The documentation conveniently avoids examples >> involving records and is otherwise quite barren. >> >> So if I have a data type like... >> >> data Person = Person >> { name :: String >> , age :: Int >> } deriving Generic >> >> instance MyTypeClass Person >> >> I want my generic implementation of MyTypeClass to be able to access each >> selector function in the record, f :: Person -> String, g :: Person -> Int, >> etc. >> >> Chris >> >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view archives go to: >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> Only members subscribed via the mailman list are allowed to post. From david.feuer at gmail.com Thu Nov 24 03:28:15 2016 From: david.feuer at gmail.com (David Feuer) Date: Wed, 23 Nov 2016 22:28:15 -0500 Subject: [Haskell-cafe] Is it possible to get the selector functions when defining a generic class? In-Reply-To: References: <2055743c-2aac-492a-8ddd-960940167d63@googlegroups.com> <56492bed-9c90-3c73-50c2-dddee326a3ac@kahn.pro> Message-ID: I don't know much about this database stuff, but I'm pretty sure you want to *build* the selector, rather than *extracting* it. You should use the Generics metadata to get the string for parsing/printing, but aside from that, you just have the products. On Nov 23, 2016 10:19 PM, "Chris Kahn" wrote: Aaaand you'll get mine twice since I forgot to reply-all the first time :) Sure, so in postgresql-simple there are two classes for automatically generating functions that encode/decode database rows, `FromRow` and `ToRow`. In the Hasql library--another postgres library--the encoders and decoders must be written by hand for each user-defined type. I want to write a class that will automatically generate these. I successfully wrote a `FromRow` class that can generate Hasql's `Row` type, since it's basically identical to what's in postgresql-simple's `FromRow`. But in Hasql the encoder type, Params, is contravariant and encoders are defined like: personEncoder :: Params Person personEncoder = contramap name (value text) <> contramap age (value int) The `value text` part can be determined based on the type information, but it's also expecting a matching selector function. I'm at a total loss for how I could generate something like this. On 11/23/2016 10:06 PM, David Feuer wrote: > Sorry if anyone gets this twice; the first copy somehow went to a > non-existent Google Groups version of haskell-cafe. > > GHC.Generics doesn't offer any built-in support for such things. It > *looks* like there *might* be some support in packages built around > generics-sop. When you're working directly with GHC.Generics, the > notion of a record barely even makes sense. A record is seen as simply > a possibly-nested product. For example, ('a','b','c') will look > *approximately* like 'a' :*: ('b' :*: 'c'). You're generally not > "supposed" to care how large a record you may be dealing with, let > alone what field names it has. May I ask what you're actually trying > to do? Your specific request sounds peculiarly un-generic. > > On Wed, Nov 23, 2016 at 9:52 PM, wrote: >> Hey all! >> >> I'm trying to understand what's going on in GHC.Generics and defining a >> generic class... I understand that there's a `Selector` class and `selName` >> function that can get the name of a selector, but is there a way to access >> the selector function itself? The documentation conveniently avoids examples >> involving records and is otherwise quite barren. >> >> So if I have a data type like... >> >> data Person = Person >> { name :: String >> , age :: Int >> } deriving Generic >> >> instance MyTypeClass Person >> >> I want my generic implementation of MyTypeClass to be able to access each >> selector function in the record, f :: Person -> String, g :: Person -> Int, >> etc. >> >> Chris >> >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view archives go to: >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gershomb at gmail.com Thu Nov 24 05:30:41 2016 From: gershomb at gmail.com (Gershom B) Date: Wed, 23 Nov 2016 21:30:41 -0800 Subject: [Haskell-cafe] ANN: Haskell Website Working Group Message-ID: The following text is reproduced from Neil Mitchell’s blog (I’m just the messanger) where it lives at: https://neilmitchell.blogspot.com/2016/11/the-haskellorg-website-working-group.html == The Haskell.org Website Working Group (HWWG) == Haskell represents both a language and a user community - and moreover a fantastic community full of friends, fun, and deep technical debate. Unfortunately, in recent times the community has started to fracture, e.g. Cabal vs Stack, haskell.org vs haskell-lang.org. These divisions have risen above technical disagreements and at some points turned personal. The solution, shepherded by Simon Peyton Jones, and agreed to by both members of the haskell.org committee and the maintainers of haskell-lang.org, is to form the Haskell Website Working Group (HWWG). The charter of the group is at the bottom of this post. The goal of the Haskell Website Working Group is to make sure the Haskell website caters to the needs of Haskell programmers, particularly beginners. In doing so we hope to either combine or differentiate haskell.org and haskell-lang.org, and give people clear recommendations of what "downloading Haskell" means. Concretely, we hope that either haskell-lang.org redirects to haskell.org, or that haskell-lang.org ends up being used for something very different from today. == The Haskell Website Working Group (HWWG) == - Scope and goals - * The HWWG is responsible for the design and content of the user-facing haskell.org web site, including tutorials, videos, news, resource, downloads, etc. * The HWWG is not responsible for:    * The infrastructure of haskell.org    * Toolchains, Hackage, compilers, etc * The HWWG focuses on serving users of Haskell, not suppliers of technology or libraries. * An explicit goal is to re-unite the haskell.org and haskell-lang.org web sites. - Expected mode of operation - * HWWG is not responsible for actually doing everything! The web site is on github. Anyone can make a pull request. The general expectation is that uncontroversial changes will be accepted and committed without much debate. * If there is disagreement about a proposed change, it's up to the HWWG to engage in (open) debate, and to seek input as widely as time allows, but finally to make a decision. - Membership - Initial membership comprises of: * Neil Mitchell (chair) * Nicolas Wu * Andrew Cowie * Vincent Hanquez * Ryan Trinkle * Chris Done It is expected the committee will change over time, but the mechanism has not yet been thought about. - Rules of engagement - * Recognising that honestly-held judgements may differ, we will be scrupulously polite both in public and in private. * Recognising that Haskell has many users, and that different users have different needs and tastes, we want haskell.org to be inclusive rather than exclusive, providing a variety of alternative resources (toolchains, tutorials, books, etc) clearly signposted with their intended audiences. * Ultimately the haskell.org committee owns the haskell.org URL, but it delegates authority for the design and content of the web site to the HWWG. In extremis, if the haskell.org committee believes that the HWWG is mismanaging the web site, it can revoke that delegation. From jan.loewenstein at gmail.com Thu Nov 24 06:57:57 2016 From: jan.loewenstein at gmail.com (=?UTF-8?Q?Jan_von_L=C3=B6wenstein?=) Date: Thu, 24 Nov 2016 06:57:57 +0000 Subject: [Haskell-cafe] Offline compilation with Stack/Cabal Message-ID: Hi, Consider the following use case: I have to ship a Haskell application as source, bundled with its dependencies and a script that can produce the binary on a machine without internet connectivity. Is that possible with Stack or Cabal? Any pointers would be much appreciated. Ideally I would like to build each dependency package individually. That way I could cache results per Haskell package and don't need to rebuild dependencies until they actually change. Best Jan -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan.miljenovic at gmail.com Thu Nov 24 07:02:21 2016 From: ivan.miljenovic at gmail.com (Ivan Lazar Miljenovic) Date: Thu, 24 Nov 2016 18:02:21 +1100 Subject: [Haskell-cafe] Offline compilation with Stack/Cabal In-Reply-To: References: Message-ID: On 24 November 2016 at 17:57, Jan von Löwenstein wrote: > Hi, > > Consider the following use case: > I have to ship a Haskell application as source, bundled with its > dependencies and a script that can produce the binary on a machine without > internet connectivity. > > Is that possible with Stack or Cabal? > Any pointers would be much appreciated. > > Ideally I would like to build each dependency package individually. That way > I could cache results per Haskell package and don't need to rebuild > dependencies until they actually change. I believe (but have not verified) that it is possible with both of them to specify local directories where source tarballs can be found. Alternatively, both definitely support through various mechanisms to be pointed at local unpacked copies of source files (directly in stack.yaml files). > > Best > Jan > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -- Ivan Lazar Miljenovic Ivan.Miljenovic at gmail.com http://IvanMiljenovic.wordpress.com From tdammers at gmail.com Thu Nov 24 07:55:59 2016 From: tdammers at gmail.com (Tobias Dammers) Date: Thu, 24 Nov 2016 08:55:59 +0100 Subject: [Haskell-cafe] Offline compilation with Stack/Cabal In-Reply-To: References: Message-ID: Another, rather drastic, solution would be to run a hackage server locally on the target, and point the relevant DNS entries to localhosts via the hosts file. Probably not necessary though. On Nov 24, 2016 8:02 AM, "Ivan Lazar Miljenovic" wrote: > On 24 November 2016 at 17:57, Jan von Löwenstein > wrote: > > Hi, > > > > Consider the following use case: > > I have to ship a Haskell application as source, bundled with its > > dependencies and a script that can produce the binary on a machine > without > > internet connectivity. > > > > Is that possible with Stack or Cabal? > > Any pointers would be much appreciated. > > > > Ideally I would like to build each dependency package individually. That > way > > I could cache results per Haskell package and don't need to rebuild > > dependencies until they actually change. > > I believe (but have not verified) that it is possible with both of > them to specify local directories where source tarballs can be found. > Alternatively, both definitely support through various mechanisms to > be pointed at local unpacked copies of source files (directly in > stack.yaml files). > > > > > Best > > Jan > > > > _______________________________________________ > > Haskell-Cafe mailing list > > To (un)subscribe, modify options or view archives go to: > > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > Only members subscribed via the mailman list are allowed to post. > > > > -- > Ivan Lazar Miljenovic > Ivan.Miljenovic at gmail.com > http://IvanMiljenovic.wordpress.com > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From codygman.consulting at gmail.com Thu Nov 24 08:45:20 2016 From: codygman.consulting at gmail.com (Cody Goodman) Date: Thu, 24 Nov 2016 02:45:20 -0600 Subject: [Haskell-cafe] Overriding CPP preprocessor on OSX Message-ID: I'm having some problems[0] with the derive-storable package on OSX I don't have on Ubuntu. I would like to use g++ rather than clang to preprocess CPP code. Is there a way to do this with cabal? Thanks! 0: https://github.com/mkloczko/derive-storable/issues/1 -------------- next part -------------- An HTML attachment was scrubbed... URL: From adam at well-typed.com Thu Nov 24 08:50:18 2016 From: adam at well-typed.com (Adam Gundry) Date: Thu, 24 Nov 2016 08:50:18 +0000 Subject: [Haskell-cafe] Is it possible to get the selector functions when defining a generic class? In-Reply-To: References: <2055743c-2aac-492a-8ddd-960940167d63@googlegroups.com> <56492bed-9c90-3c73-50c2-dddee326a3ac@kahn.pro> Message-ID: Hi Chris, With the addition of type-level metadata to GHC.Generics in GHC 8, it's possible to build a field selector generically. I hacked a rough implementation together a while back [1]. (This would undoubtedly be nicer with generics-sop, but I believe the work to adapt it to support type-level metadata is ongoing.) It's somewhat unsatisfying that GHC has already got a selector function, but we can't get at it generically. Depending on the details of your use case, the HasField class to be introduced as part of the OverloadedRecordFields work [2] might provide an alternative. Hope this helps, Adam [1] https://gist.github.com/adamgundry/2eea6ca04fd6e5b6e76ce9bfee454a6b [2] https://github.com/ghc-proposals/ghc-proposals/pull/6 On 24/11/16 03:28, David Feuer wrote: > I don't know much about this database stuff, but I'm pretty sure you > want to *build* the selector, rather than *extracting* it. You should > use the Generics metadata to get the string for parsing/printing, but > aside from that, you just have the products. > > > On Nov 23, 2016 10:19 PM, "Chris Kahn" > wrote: > > Aaaand you'll get mine twice since I forgot to reply-all the first > time :) > > Sure, so in postgresql-simple there are two classes for automatically > generating functions that encode/decode database rows, `FromRow` and > `ToRow`. In the Hasql library--another postgres library--the encoders > and decoders must be written by hand for each user-defined type. I want > to write a class that will automatically generate these. > > I successfully wrote a `FromRow` class that can generate Hasql's `Row` > type, since it's basically identical to what's in postgresql-simple's > `FromRow`. But in Hasql the encoder type, Params, is contravariant and > encoders are defined like: > > personEncoder :: Params Person > personEncoder = contramap name (value text) <> > contramap age (value int) > > The `value text` part can be determined based on the type information, > but it's also expecting a matching selector function. I'm at a total > loss for how I could generate something like this. > > > > On 11/23/2016 10:06 PM, David Feuer wrote: > > Sorry if anyone gets this twice; the first copy somehow went to a > > non-existent Google Groups version of haskell-cafe. > > > > GHC.Generics doesn't offer any built-in support for such things. It > > *looks* like there *might* be some support in packages built around > > generics-sop. When you're working directly with GHC.Generics, the > > notion of a record barely even makes sense. A record is seen as simply > > a possibly-nested product. For example, ('a','b','c') will look > > *approximately* like 'a' :*: ('b' :*: 'c'). You're generally not > > "supposed" to care how large a record you may be dealing with, let > > alone what field names it has. May I ask what you're actually trying > > to do? Your specific request sounds peculiarly un-generic. > > > > On Wed, Nov 23, 2016 at 9:52 PM, > wrote: > >> Hey all! > >> > >> I'm trying to understand what's going on in GHC.Generics and > defining a > >> generic class... I understand that there's a `Selector` class and > `selName` > >> function that can get the name of a selector, but is there a way > to access > >> the selector function itself? The documentation conveniently > avoids examples > >> involving records and is otherwise quite barren. > >> > >> So if I have a data type like... > >> > >> data Person = Person > >> { name :: String > >> , age :: Int > >> } deriving Generic > >> > >> instance MyTypeClass Person > >> > >> I want my generic implementation of MyTypeClass to be able to > access each > >> selector function in the record, f :: Person -> String, g :: > Person -> Int, > >> etc. > >> > >> Chris -- Adam Gundry, Haskell Consultant Well-Typed LLP, http://www.well-typed.com/ From dct25-561bs at mythic-beasts.com Thu Nov 24 09:13:50 2016 From: dct25-561bs at mythic-beasts.com (David Turner) Date: Thu, 24 Nov 2016 09:13:50 +0000 Subject: [Haskell-cafe] Offline compilation with Stack/Cabal In-Reply-To: References: Message-ID: Hi, Does stack build --prefetch --dry-run get close to what you want? That seems to download all the necessary packages, and by using stack you get the ability to share compiled dependencies between packages. Cheers, David On 24 November 2016 at 06:57, Jan von Löwenstein wrote: > Hi, > > Consider the following use case: > I have to ship a Haskell application as source, bundled with its > dependencies and a script that can produce the binary on a machine without > internet connectivity. > > Is that possible with Stack or Cabal? > Any pointers would be much appreciated. > > Ideally I would like to build each dependency package individually. That > way I could cache results per Haskell package and don't need to rebuild > dependencies until they actually change. > > Best > Jan > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at andres-loeh.de Thu Nov 24 12:12:34 2016 From: mail at andres-loeh.de (Andres Loeh) Date: Thu, 24 Nov 2016 13:12:34 +0100 Subject: [Haskell-cafe] Is it possible to get the selector functions when defining a generic class? In-Reply-To: <56492bed-9c90-3c73-50c2-dddee326a3ac@kahn.pro> References: <2055743c-2aac-492a-8ddd-960940167d63@googlegroups.com> <56492bed-9c90-3c73-50c2-dddee326a3ac@kahn.pro> Message-ID: Hi Chris. Here's a proof-of-concept implementation using generics-sop: https://gist.github.com/kosmikus/83a644fcaa620b5f5505d48540a5f155 It's entirely untested, but it should in principle work, and it should demonstrate how you can do the contramap/selector stuff generically, so perhaps it helps. Cheers, Andres On Thu, Nov 24, 2016 at 4:17 AM, Chris Kahn wrote: > Aaaand you'll get mine twice since I forgot to reply-all the first time :) > > Sure, so in postgresql-simple there are two classes for automatically > generating functions that encode/decode database rows, `FromRow` and > `ToRow`. In the Hasql library--another postgres library--the encoders > and decoders must be written by hand for each user-defined type. I want > to write a class that will automatically generate these. > > I successfully wrote a `FromRow` class that can generate Hasql's `Row` > type, since it's basically identical to what's in postgresql-simple's > `FromRow`. But in Hasql the encoder type, Params, is contravariant and > encoders are defined like: > > personEncoder :: Params Person > personEncoder = contramap name (value text) <> > contramap age (value int) > > The `value text` part can be determined based on the type information, > but it's also expecting a matching selector function. I'm at a total > loss for how I could generate something like this. > > > > On 11/23/2016 10:06 PM, David Feuer wrote: >> Sorry if anyone gets this twice; the first copy somehow went to a >> non-existent Google Groups version of haskell-cafe. >> >> GHC.Generics doesn't offer any built-in support for such things. It >> *looks* like there *might* be some support in packages built around >> generics-sop. When you're working directly with GHC.Generics, the >> notion of a record barely even makes sense. A record is seen as simply >> a possibly-nested product. For example, ('a','b','c') will look >> *approximately* like 'a' :*: ('b' :*: 'c'). You're generally not >> "supposed" to care how large a record you may be dealing with, let >> alone what field names it has. May I ask what you're actually trying >> to do? Your specific request sounds peculiarly un-generic. >> >> On Wed, Nov 23, 2016 at 9:52 PM, wrote: >>> Hey all! >>> >>> I'm trying to understand what's going on in GHC.Generics and defining a >>> generic class... I understand that there's a `Selector` class and `selName` >>> function that can get the name of a selector, but is there a way to access >>> the selector function itself? The documentation conveniently avoids examples >>> involving records and is otherwise quite barren. >>> >>> So if I have a data type like... >>> >>> data Person = Person >>> { name :: String >>> , age :: Int >>> } deriving Generic >>> >>> instance MyTypeClass Person >>> >>> I want my generic implementation of MyTypeClass to be able to access each >>> selector function in the record, f :: Person -> String, g :: Person -> Int, >>> etc. >>> >>> Chris >>> >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> To (un)subscribe, modify options or view archives go to: >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>> Only members subscribed via the mailman list are allowed to post. > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. From jan.loewenstein at gmail.com Thu Nov 24 12:34:18 2016 From: jan.loewenstein at gmail.com (=?UTF-8?Q?Jan_von_L=C3=B6wenstein?=) Date: Thu, 24 Nov 2016 12:34:18 +0000 Subject: [Haskell-cafe] Offline compilation with Stack/Cabal In-Reply-To: References: Message-ID: Thanks for all the responses. @Ivan I couldn't yet find an option in stack to point to local source tarballs. Custom snapshots at least currently only support Hackage packages and that was the closest I found. I briefly looked into `stack unpack `, that might indeed provide a workable solution. Although options other than the list of packages would have to be duplicated between my "normal" stack.yaml and the one I use to enable offline compilation. @Tobias I already thought about that, yackage sounds like a package that would help implement it. Not sure if I like that option very much though. @David Not sure if I get your proposal. Running `stack build --prefetch --dry-run` lists my local packages as "Would build". How would I get source tarballs of my dependencies and how would I build them on an offline machine? Best Jan David Turner schrieb am Do., 24. Nov. 2016 um 10:13 Uhr: > Hi, > > Does > > stack build --prefetch --dry-run > > get close to what you want? That seems to download all the necessary > packages, and by using stack you get the ability to share compiled > dependencies between packages. > > Cheers, > > David > > On 24 November 2016 at 06:57, Jan von Löwenstein < > jan.loewenstein at gmail.com> wrote: > > Hi, > > Consider the following use case: > I have to ship a Haskell application as source, bundled with its > dependencies and a script that can produce the binary on a machine without > internet connectivity. > > Is that possible with Stack or Cabal? > Any pointers would be much appreciated. > > Ideally I would like to build each dependency package individually. That > way I could cache results per Haskell package and don't need to rebuild > dependencies until they actually change. > > Best > Jan > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan.miljenovic at gmail.com Thu Nov 24 12:40:49 2016 From: ivan.miljenovic at gmail.com (Ivan Lazar Miljenovic) Date: Thu, 24 Nov 2016 23:40:49 +1100 Subject: [Haskell-cafe] Offline compilation with Stack/Cabal In-Reply-To: References: Message-ID: On 24 November 2016 at 23:34, Jan von Löwenstein wrote: > Thanks for all the responses. > > @Ivan > I couldn't yet find an option in stack to point to local source tarballs. > Custom snapshots at least currently only support Hackage packages and that > was the closest I found. https://docs.haskellstack.org/en/stable/yaml_configuration/#packages > > I briefly looked into `stack unpack `, that might indeed provide a > workable solution. Although options other than the list of packages would > have to be duplicated between my "normal" stack.yaml and the one I use to > enable offline compilation. > > @Tobias > I already thought about that, yackage sounds like a package that would help > implement it. Not sure if I like that option very much though. > > @David > Not sure if I get your proposal. > Running `stack build --prefetch --dry-run` lists my local packages as "Would > build". How would I get source tarballs of my dependencies and how would I > build them on an offline machine? > > Best > Jan > > David Turner schrieb am Do., 24. Nov. 2016 > um 10:13 Uhr: >> >> Hi, >> >> Does >> >> stack build --prefetch --dry-run >> >> get close to what you want? That seems to download all the necessary >> packages, and by using stack you get the ability to share compiled >> dependencies between packages. >> >> Cheers, >> >> David >> >> On 24 November 2016 at 06:57, Jan von Löwenstein >> wrote: >>> >>> Hi, >>> >>> Consider the following use case: >>> I have to ship a Haskell application as source, bundled with its >>> dependencies and a script that can produce the binary on a machine without >>> internet connectivity. >>> >>> Is that possible with Stack or Cabal? >>> Any pointers would be much appreciated. >>> >>> Ideally I would like to build each dependency package individually. That >>> way I could cache results per Haskell package and don't need to rebuild >>> dependencies until they actually change. >>> >>> Best >>> Jan >>> >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> To (un)subscribe, modify options or view archives go to: >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>> Only members subscribed via the mailman list are allowed to post. > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -- Ivan Lazar Miljenovic Ivan.Miljenovic at gmail.com http://IvanMiljenovic.wordpress.com From acowley at seas.upenn.edu Thu Nov 24 14:46:16 2016 From: acowley at seas.upenn.edu (Anthony Cowley) Date: Thu, 24 Nov 2016 09:46:16 -0500 Subject: [Haskell-cafe] Overriding CPP preprocessor on OSX In-Reply-To: References: Message-ID: Cody Goodman writes: > I'm having some problems[0] with the derive-storable package on OSX I don't > have on Ubuntu. I would like to use g++ rather than clang to preprocess CPP > code. Is there a way to do this with cabal? > > Thanks! > > 0: https://github.com/mkloczko/derive-storable/issues/1 You can go a step further and avoid depending on cpp from any of the big C compilers! Add `hpp` to your `build-depends`, and add this to your .cabal file, ``` ghc-options: -pgmPhpp ``` Then if the preprocessor does something untoward, we can actually fix it! Or you can use the same style of `ghc-options` flag to call gcc's cpp. Anthony From dct25-561bs at mythic-beasts.com Thu Nov 24 15:52:18 2016 From: dct25-561bs at mythic-beasts.com (David Turner) Date: Thu, 24 Nov 2016 15:52:18 +0000 Subject: [Haskell-cafe] Offline compilation with Stack/Cabal In-Reply-To: References: Message-ID: Hi, > Running `stack build --prefetch --dry-run` lists my local packages as "Would build". How would I get source tarballs of my dependencies and how would I build them on an offline machine? I think that means you've already got all the source tarballs that you would need. On a reasonably clean machine (no $HOME/.stack directory at least), running `stack setup` and then `stack build --prefetch --dry-run` does a bunch of downloading (but nothing else), such that I can switch to aeroplane mode and then run `stack build` without needing further network access. There's a full transcript below. This certainly seems to imply that all the source tarballs are available locally - I think they go somewhere in $HOME/.stack. What I think this means is that if you do this then copy your $HOME/.stack across to the isolated machine then that should be everything you need in order to build everything. HTH, David $ stack setup Downloaded lts-3.6 build plan. Fetching package index ...remote: Counting objects: 233532, done. remote: Compressing objects: 100% (188553/188553), done. remote: Total 233532 (delta 62098), reused 185305 (delta 42595), pack-reused 0 Receiving objects: 100% (233532/233532), 55.26 MiB | 1.97 MiB/s, done. Resolving deltas: 100% (62098/62098), completed with 1 local objects. >From https://github.com/commercialhaskell/all-cabal-hashes * [new tag] current-hackage -> current-hackage Fetched package index. Populated index cache. Preparing to install GHC to an isolated location. This will not interfere with any system-level installation. Downloaded ghc-7.10.2. Installed GHC. stack will use a locally installed GHC For more information on paths, see 'stack path' and 'stack exec env' To use this GHC and packages outside of a project, consider using: stack ghc, stack ghci, stack runghc, or stack exec $ stack build --prefetch --dry-run asn1-parse-0.9.1: download ansi-terminal-0.6.2.3: download asn1-types-0.3.0: download aeson-0.8.0.2: download async-2.0.2: download attoparsec-0.12.1.6: download ansi-wl-pprint-0.6.7.3: download base64-bytestring-1.0.0.1: download blaze-builder-0.4.0.1: download byteable-0.1.1: download asn1-encoding-0.9.2: download case-insensitive-1.2.0.4: download cookie-0.4.1.6: download cereal-0.4.1.1: download connection-0.2.5: download cryptonite-0.6: download data-default-class-0.0.1: download exceptions-0.8.0.2: download dlist-0.7.1.2: download http-client-tls-0.2.2: download hourglass-0.2.9: download http-client-0.4.23: download hashable-1.2.3.3: download memory-0.7: download http-types-0.8.6: download mime-types-0.1.0.6: download network-2.6.2.1: download mtl-2.2.1: download old-locale-1.0.0.7: download optparse-applicative-0.11.0.2: download network-uri-2.6.0.3: download parsec-3.1.9: download pem-0.2.2: download scientific-0.3.3.8: download primitive-0.6: download socks-0.5.4: download stm-2.4.4: download random-1.1: download syb-0.5.1: download text-1.2.1.3: download streaming-commons-0.1.13: download transformers-compat-0.4.0.4: download unordered-containers-0.2.5.1: download tls-1.3.2: download x509-1.6.1: download x509-validation-1.6.2: download x509-store-1.6.1: download vector-0.10.12.3: download zlib-0.5.4.2: download x509-system-1.6.1: download No packages would be unregistered. Would build: aeson-0.8.0.2: database=snapshot, source=package index, after: attoparsec-0.12.1.6,dlist-0.7.1.2,hashable-1.2.3.3,mtl-2.2.1,scientific-0.3.3.8,syb-0.5.1,text-1.2.1.3,unordered-containers-0.2.5.1,vector-0.10.12.3 ansi-terminal-0.6.2.3: database=snapshot, source=package index ansi-wl-pprint-0.6.7.3: database=snapshot, source=package index, after: ansi-terminal-0.6.2.3 asn1-encoding-0.9.2: database=snapshot, source=package index, after: asn1-types-0.3.0,hourglass-0.2.9,mtl-2.2.1 asn1-parse-0.9.1: database=snapshot, source=package index, after: asn1-encoding-0.9.2,asn1-types-0.3.0,mtl-2.2.1 asn1-types-0.3.0: database=snapshot, source=package index, after: hourglass-0.2.9 async-2.0.2: database=snapshot, source=package index, after: stm-2.4.4 attoparsec-0.12.1.6: database=snapshot, source=package index, after: scientific-0.3.3.8,text-1.2.1.3 autoharvest-0.1.0.0: database=local, source=/home/davidturner/autoharvest/, after: aeson-0.8.0.2,http-client-0.4.23,http-client-tls-0.2.2,http-types-0.8.6,optparse-applicative-0.11.0.2,text-1.2.1.3 base64-bytestring-1.0.0.1: database=snapshot, source=package index blaze-builder-0.4.0.1: database=snapshot, source=package index, after: text-1.2.1.3 byteable-0.1.1: database=snapshot, source=package index case-insensitive-1.2.0.4: database=snapshot, source=package index, after: hashable-1.2.3.3,text-1.2.1.3 cereal-0.4.1.1: database=snapshot, source=package index connection-0.2.5: database=snapshot, source=package index, after: byteable-0.1.1,data-default-class-0.0.1,network-2.6.2.1,socks-0.5.4,tls-1.3.2,x509-1.6.1,x509-store-1.6.1,x509-system-1.6.1,x509-validation-1.6.2 cookie-0.4.1.6: database=snapshot, source=package index, after: blaze-builder-0.4.0.1,data-default-class-0.0.1,old-locale-1.0.0.7,text-1.2.1.3 cryptonite-0.6: database=snapshot, source=package index, after: memory-0.7 data-default-class-0.0.1: database=snapshot, source=package index dlist-0.7.1.2: database=snapshot, source=package index exceptions-0.8.0.2: database=snapshot, source=package index, after: mtl-2.2.1,stm-2.4.4,transformers-compat-0.4.0.4 hashable-1.2.3.3: database=snapshot, source=package index, after: text-1.2.1.3 hourglass-0.2.9: database=snapshot, source=package index http-client-0.4.23: database=snapshot, source=package index, after: base64-bytestring-1.0.0.1,blaze-builder-0.4.0.1,case-insensitive-1.2.0.4,cookie-0.4.1.6,data-default-class-0.0.1,exceptions-0.8.0.2,http-types-0.8.6,mime-types-0.1.0.6,network-2.6.2.1,network-uri-2.6.0.3,random-1.1,streaming-commons-0.1.13,text-1.2.1.3 http-client-tls-0.2.2: database=snapshot, source=package index, after: connection-0.2.5,data-default-class-0.0.1,http-client-0.4.23,network-2.6.2.1,tls-1.3.2 http-types-0.8.6: database=snapshot, source=package index, after: blaze-builder-0.4.0.1,case-insensitive-1.2.0.4,text-1.2.1.3 memory-0.7: database=snapshot, source=package index mime-types-0.1.0.6: database=snapshot, source=package index, after: text-1.2.1.3 mtl-2.2.1: database=snapshot, source=package index network-2.6.2.1: database=snapshot, source=package index network-uri-2.6.0.3: database=snapshot, source=package index, after: parsec-3.1.9 old-locale-1.0.0.7: database=snapshot, source=package index optparse-applicative-0.11.0.2: database=snapshot, source=package index, after: ansi-wl-pprint-0.6.7.3,transformers-compat-0.4.0.4 parsec-3.1.9: database=snapshot, source=package index, after: mtl-2.2.1,text-1.2.1.3 pem-0.2.2: database=snapshot, source=package index, after: base64-bytestring-1.0.0.1,mtl-2.2.1 primitive-0.6: database=snapshot, source=package index random-1.1: database=snapshot, source=package index scientific-0.3.3.8: database=snapshot, source=package index, after: hashable-1.2.3.3,text-1.2.1.3 socks-0.5.4: database=snapshot, source=package index, after: cereal-0.4.1.1,network-2.6.2.1 stm-2.4.4: database=snapshot, source=package index streaming-commons-0.1.13: database=snapshot, source=package index, after: blaze-builder-0.4.0.1,network-2.6.2.1,random-1.1,stm-2.4.4,text-1.2.1.3,zlib-0.5.4.2 syb-0.5.1: database=snapshot, source=package index text-1.2.1.3: database=snapshot, source=package index tls-1.3.2: database=snapshot, source=package index, after: asn1-encoding-0.9.2,asn1-types-0.3.0,async-2.0.2,cereal-0.4.1.1,cryptonite-0.6,data-default-class-0.0.1,memory-0.7,mtl-2.2.1,network-2.6.2.1,x509-1.6.1,x509-store-1.6.1,x509-validation-1.6.2 transformers-compat-0.4.0.4: database=snapshot, source=package index unordered-containers-0.2.5.1: database=snapshot, source=package index, after: hashable-1.2.3.3 vector-0.10.12.3: database=snapshot, source=package index, after: primitive-0.6 x509-1.6.1: database=snapshot, source=package index, after: asn1-encoding-0.9.2,asn1-parse-0.9.1,asn1-types-0.3.0,cryptonite-0.6,hourglass-0.2.9,memory-0.7,mtl-2.2.1,pem-0.2.2 x509-store-1.6.1: database=snapshot, source=package index, after: asn1-encoding-0.9.2,asn1-types-0.3.0,cryptonite-0.6,mtl-2.2.1,pem-0.2.2,x509-1.6.1 x509-system-1.6.1: database=snapshot, source=package index, after: mtl-2.2.1,pem-0.2.2,x509-1.6.1,x509-store-1.6.1 x509-validation-1.6.2: database=snapshot, source=package index, after: asn1-encoding-0.9.2,asn1-types-0.3.0,byteable-0.1.1,cryptonite-0.6,data-default-class-0.0.1,hourglass-0.2.9,memory-0.7,mtl-2.2.1,pem-0.2.2,x509-1.6.1,x509-store-1.6.1 zlib-0.5.4.2: database=snapshot, source=package index No executables to be installed. On 24 November 2016 at 12:34, Jan von Löwenstein wrote: > > Thanks for all the responses. > > @Ivan > I couldn't yet find an option in stack to point to local source tarballs. Custom snapshots at least currently only support Hackage packages and that was the closest I found. > > I briefly looked into `stack unpack `, that might indeed provide a workable solution. Although options other than the list of packages would have to be duplicated between my "normal" stack.yaml and the one I use to enable offline compilation. > > @Tobias > I already thought about that, yackage sounds like a package that would help implement it. Not sure if I like that option very much though. > > @David > Not sure if I get your proposal. > Running `stack build --prefetch --dry-run` lists my local packages as "Would build". How would I get source tarballs of my dependencies and how would I build them on an offline machine? > > Best > Jan > > David Turner schrieb am Do., 24. Nov. 2016 um 10:13 Uhr: >> >> Hi, >> >> Does >> >> stack build --prefetch --dry-run >> >> get close to what you want? That seems to download all the necessary packages, and by using stack you get the ability to share compiled dependencies between packages. >> >> Cheers, >> >> David >> >> On 24 November 2016 at 06:57, Jan von Löwenstein < jan.loewenstein at gmail.com> wrote: >>> >>> Hi, >>> >>> Consider the following use case: >>> I have to ship a Haskell application as source, bundled with its dependencies and a script that can produce the binary on a machine without internet connectivity. >>> >>> Is that possible with Stack or Cabal? >>> Any pointers would be much appreciated. >>> >>> Ideally I would like to build each dependency package individually. That way I could cache results per Haskell package and don't need to rebuild dependencies until they actually change. >>> >>> Best >>> Jan >>> >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> To (un)subscribe, modify options or view archives go to: >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>> Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From codygman.consulting at gmail.com Thu Nov 24 18:20:50 2016 From: codygman.consulting at gmail.com (Cody Goodman) Date: Thu, 24 Nov 2016 12:20:50 -0600 Subject: [Haskell-cafe] Creating a instance for (Storable Text) Message-ID: Any ideas on how I'd write this instance? I know for it to be storable it needs a size, couldn't I just get the length of the text? Has anyone did anything similar? I ran into a surprise when trying to use storable-record and derive-storable and tried using them with a record that contained a Text field. My end goal is having a vector of records that could contain Text, UTCTime, or other similarly complex types which I can write as an mmap to disk and then read back to the original format. Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at snoyman.com Thu Nov 24 18:23:53 2016 From: michael at snoyman.com (Michael Snoyman) Date: Thu, 24 Nov 2016 18:23:53 +0000 Subject: [Haskell-cafe] Creating a instance for (Storable Text) In-Reply-To: References: Message-ID: It can't be done. Instances of Storable need to have a fixed serialized size, and Text values don't. On Thu, Nov 24, 2016, 8:21 PM Cody Goodman wrote: > Any ideas on how I'd write this instance? I know for it to be storable it > needs a size, couldn't I just get the length of the text? Has anyone did > anything similar? > > I ran into a surprise when trying to use storable-record and > derive-storable and tried using them with a record that contained a Text > field. > > My end goal is having a vector of records that could contain Text, > UTCTime, or other similarly complex types which I can write as an mmap to > disk and then read back to the original format. > > Thanks! > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From chris at kahn.pro Thu Nov 24 19:19:56 2016 From: chris at kahn.pro (Chris Kahn) Date: Thu, 24 Nov 2016 11:19:56 -0800 Subject: [Haskell-cafe] Is it possible to get the selector functions when defining a generic class? In-Reply-To: References: <2055743c-2aac-492a-8ddd-960940167d63@googlegroups.com> <56492bed-9c90-3c73-50c2-dddee326a3ac@kahn.pro> Message-ID: <1480015196.217773.798327145.1AE0DB3B@webmail.messagingengine.com> Thanks for this! Seems like that's what I want. I didn't know about generics-sop. Although something about the code for the enumerator types doesn't compile and throws this GHC panic: ghc: panic! (the 'impossible' happened) (GHC version 8.0.1 for x86_64-unknown-linux): print_equality ~ Do you think it's related to this ticket? (https://ghc.haskell.org/trac/ghc/ticket/12041) But at least, when I remove the definitions for enumerated types it compiles, so I'll test it out and see how this is working. On Thu, Nov 24, 2016, at 04:12 AM, Andres Loeh wrote: > Hi Chris. > > Here's a proof-of-concept implementation using generics-sop: > > https://gist.github.com/kosmikus/83a644fcaa620b5f5505d48540a5f155 > > It's entirely untested, but it should in principle work, and it should > demonstrate how you can do the contramap/selector stuff generically, > so perhaps it helps. > > Cheers, > Andres > > > On Thu, Nov 24, 2016 at 4:17 AM, Chris Kahn wrote: > > Aaaand you'll get mine twice since I forgot to reply-all the first time :) > > > > Sure, so in postgresql-simple there are two classes for automatically > > generating functions that encode/decode database rows, `FromRow` and > > `ToRow`. In the Hasql library--another postgres library--the encoders > > and decoders must be written by hand for each user-defined type. I want > > to write a class that will automatically generate these. > > > > I successfully wrote a `FromRow` class that can generate Hasql's `Row` > > type, since it's basically identical to what's in postgresql-simple's > > `FromRow`. But in Hasql the encoder type, Params, is contravariant and > > encoders are defined like: > > > > personEncoder :: Params Person > > personEncoder = contramap name (value text) <> > > contramap age (value int) > > > > The `value text` part can be determined based on the type information, > > but it's also expecting a matching selector function. I'm at a total > > loss for how I could generate something like this. > > > > > > > > On 11/23/2016 10:06 PM, David Feuer wrote: > >> Sorry if anyone gets this twice; the first copy somehow went to a > >> non-existent Google Groups version of haskell-cafe. > >> > >> GHC.Generics doesn't offer any built-in support for such things. It > >> *looks* like there *might* be some support in packages built around > >> generics-sop. When you're working directly with GHC.Generics, the > >> notion of a record barely even makes sense. A record is seen as simply > >> a possibly-nested product. For example, ('a','b','c') will look > >> *approximately* like 'a' :*: ('b' :*: 'c'). You're generally not > >> "supposed" to care how large a record you may be dealing with, let > >> alone what field names it has. May I ask what you're actually trying > >> to do? Your specific request sounds peculiarly un-generic. > >> > >> On Wed, Nov 23, 2016 at 9:52 PM, wrote: > >>> Hey all! > >>> > >>> I'm trying to understand what's going on in GHC.Generics and defining a > >>> generic class... I understand that there's a `Selector` class and `selName` > >>> function that can get the name of a selector, but is there a way to access > >>> the selector function itself? The documentation conveniently avoids examples > >>> involving records and is otherwise quite barren. > >>> > >>> So if I have a data type like... > >>> > >>> data Person = Person > >>> { name :: String > >>> , age :: Int > >>> } deriving Generic > >>> > >>> instance MyTypeClass Person > >>> > >>> I want my generic implementation of MyTypeClass to be able to access each > >>> selector function in the record, f :: Person -> String, g :: Person -> Int, > >>> etc. > >>> > >>> Chris > >>> > >>> _______________________________________________ > >>> Haskell-Cafe mailing list > >>> To (un)subscribe, modify options or view archives go to: > >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > >>> Only members subscribed via the mailman list are allowed to post. > > _______________________________________________ > > Haskell-Cafe mailing list > > To (un)subscribe, modify options or view archives go to: > > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > Only members subscribed via the mailman list are allowed to post. From mail at andres-loeh.de Thu Nov 24 19:51:55 2016 From: mail at andres-loeh.de (Andres Loeh) Date: Thu, 24 Nov 2016 20:51:55 +0100 Subject: [Haskell-cafe] Is it possible to get the selector functions when defining a generic class? In-Reply-To: <1480015196.217773.798327145.1AE0DB3B@webmail.messagingengine.com> References: <2055743c-2aac-492a-8ddd-960940167d63@googlegroups.com> <56492bed-9c90-3c73-50c2-dddee326a3ac@kahn.pro> <1480015196.217773.798327145.1AE0DB3B@webmail.messagingengine.com> Message-ID: Hi Chris. Yes, it's this known issue, which seems to be triggered by partial applications of (~), and which is fixed in 8.0.2. [It actually compiles for me with 8.0.1 though. It just happens under certain circumstances, for example if I ask for the type of gEValue. Strange that you say you cannot even compile it.] Here's another workaround that seems to work for me: class (a ~ b) => Equal a b instance (a ~ b) => Equal a b This may require extra language extensions, in particular PolyKinds. Then replace all three occurrences of ((~) '[]) with (Equal '[]). I'm not all that certain about the enumeration type generic definitions anyway, though. There are many different ways in which you might want to represent an enumeration type in an SQL database table, so more thought might be required here anyway. Cheers, Andres On Thu, Nov 24, 2016 at 8:19 PM, Chris Kahn wrote: > Thanks for this! Seems like that's what I want. I didn't know about > generics-sop. > > Although something about the code for the enumerator types doesn't > compile and throws this GHC panic: > > ghc: panic! (the 'impossible' happened) > (GHC version 8.0.1 for x86_64-unknown-linux): > print_equality ~ > > Do you think it's related to this ticket? > (https://ghc.haskell.org/trac/ghc/ticket/12041) > > But at least, when I remove the definitions for enumerated types it > compiles, so I'll test it out and see how this is working. > > > On Thu, Nov 24, 2016, at 04:12 AM, Andres Loeh wrote: >> Hi Chris. >> >> Here's a proof-of-concept implementation using generics-sop: >> >> https://gist.github.com/kosmikus/83a644fcaa620b5f5505d48540a5f155 >> >> It's entirely untested, but it should in principle work, and it should >> demonstrate how you can do the contramap/selector stuff generically, >> so perhaps it helps. >> >> Cheers, >> Andres >> >> >> On Thu, Nov 24, 2016 at 4:17 AM, Chris Kahn wrote: >> > Aaaand you'll get mine twice since I forgot to reply-all the first time :) >> > >> > Sure, so in postgresql-simple there are two classes for automatically >> > generating functions that encode/decode database rows, `FromRow` and >> > `ToRow`. In the Hasql library--another postgres library--the encoders >> > and decoders must be written by hand for each user-defined type. I want >> > to write a class that will automatically generate these. >> > >> > I successfully wrote a `FromRow` class that can generate Hasql's `Row` >> > type, since it's basically identical to what's in postgresql-simple's >> > `FromRow`. But in Hasql the encoder type, Params, is contravariant and >> > encoders are defined like: >> > >> > personEncoder :: Params Person >> > personEncoder = contramap name (value text) <> >> > contramap age (value int) >> > >> > The `value text` part can be determined based on the type information, >> > but it's also expecting a matching selector function. I'm at a total >> > loss for how I could generate something like this. >> > >> > >> > >> > On 11/23/2016 10:06 PM, David Feuer wrote: >> >> Sorry if anyone gets this twice; the first copy somehow went to a >> >> non-existent Google Groups version of haskell-cafe. >> >> >> >> GHC.Generics doesn't offer any built-in support for such things. It >> >> *looks* like there *might* be some support in packages built around >> >> generics-sop. When you're working directly with GHC.Generics, the >> >> notion of a record barely even makes sense. A record is seen as simply >> >> a possibly-nested product. For example, ('a','b','c') will look >> >> *approximately* like 'a' :*: ('b' :*: 'c'). You're generally not >> >> "supposed" to care how large a record you may be dealing with, let >> >> alone what field names it has. May I ask what you're actually trying >> >> to do? Your specific request sounds peculiarly un-generic. >> >> >> >> On Wed, Nov 23, 2016 at 9:52 PM, wrote: >> >>> Hey all! >> >>> >> >>> I'm trying to understand what's going on in GHC.Generics and defining a >> >>> generic class... I understand that there's a `Selector` class and `selName` >> >>> function that can get the name of a selector, but is there a way to access >> >>> the selector function itself? The documentation conveniently avoids examples >> >>> involving records and is otherwise quite barren. >> >>> >> >>> So if I have a data type like... >> >>> >> >>> data Person = Person >> >>> { name :: String >> >>> , age :: Int >> >>> } deriving Generic >> >>> >> >>> instance MyTypeClass Person >> >>> >> >>> I want my generic implementation of MyTypeClass to be able to access each >> >>> selector function in the record, f :: Person -> String, g :: Person -> Int, >> >>> etc. >> >>> >> >>> Chris >> >>> >> >>> _______________________________________________ >> >>> Haskell-Cafe mailing list >> >>> To (un)subscribe, modify options or view archives go to: >> >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> >>> Only members subscribed via the mailman list are allowed to post. >> > _______________________________________________ >> > Haskell-Cafe mailing list >> > To (un)subscribe, modify options or view archives go to: >> > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> > Only members subscribed via the mailman list are allowed to post. From novadenizen at gmail.com Thu Nov 24 20:07:56 2016 From: novadenizen at gmail.com (Ken Bateman) Date: Thu, 24 Nov 2016 15:07:56 -0500 Subject: [Haskell-cafe] Creating a instance for (Storable Text) In-Reply-To: References: Message-ID: Maybe you want to use Data.Serialize? Encode to and from a bytestring. On Nov 24, 2016 1:24 PM, "Michael Snoyman" wrote: > It can't be done. Instances of Storable need to have a fixed serialized > size, and Text values don't. > > On Thu, Nov 24, 2016, 8:21 PM Cody Goodman > wrote: > >> Any ideas on how I'd write this instance? I know for it to be storable it >> needs a size, couldn't I just get the length of the text? Has anyone did >> anything similar? >> >> I ran into a surprise when trying to use storable-record and >> derive-storable and tried using them with a record that contained a Text >> field. >> >> My end goal is having a vector of records that could contain Text, >> UTCTime, or other similarly complex types which I can write as an mmap to >> disk and then read back to the original format. >> >> Thanks! >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view archives go to: >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> Only members subscribed via the mailman list are allowed to post. > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From hvriedel at gmail.com Thu Nov 24 21:48:38 2016 From: hvriedel at gmail.com (Herbert Valerio Riedel) Date: Thu, 24 Nov 2016 22:48:38 +0100 Subject: [Haskell-cafe] Offline compilation with Stack/Cabal In-Reply-To: ("Jan von \=\?utf-8\?Q\?L\=C3\=B6wenstein\=22's\?\= message of "Thu, 24 Nov 2016 06:57:57 +0000") References: Message-ID: <87k2bs7dmx.fsf@gnu.org> Hi, On 2016-11-24 at 07:57:57 +0100, Jan von Löwenstein wrote: > Consider the following use case: > I have to ship a Haskell application as source, bundled with its > dependencies and a script that can produce the binary on a machine without > internet connectivity. This situation is not that uncommon; one example is when you have build-bots which a more or less cut off from the internet (such as Ubuntu's launchpad buildfarm) > Is that possible with Stack or Cabal? > Any pointers would be much appreciated. > Ideally I would like to build each dependency package individually. That > way I could cache results per Haskell package and don't need to rebuild > dependencies until they actually change. This sounds like something I'd use cabal's filesystem-local repository feature[1] for, and it should be possible to specify such local repositories in your `cabal.config` or `cabal.project`[2] files to produce a self-contained source distribution. If you're interested in pursuing this approach or have any questions about it, let me know! [1]: http://cabal.readthedocs.io/en/latest/installing-packages.html#repository-specification [2]: http://cabal.readthedocs.io/en/latest/nix-local-build-overview.html Cheers From lambda.fairy at gmail.com Fri Nov 25 01:59:28 2016 From: lambda.fairy at gmail.com (Chris Wong) Date: Fri, 25 Nov 2016 14:59:28 +1300 Subject: [Haskell-cafe] Creating a instance for (Storable Text) In-Reply-To: References: Message-ID: Since Text is represented as UTF-16 underneath, you can retrieve the length in terms of 16-bit code units. I don't think you'll be able to mmap them though, since the backing array may be moved by the garbage collector. See https://hackage.haskell.org/package/text-1.2.2.1/docs/Data-Text-Foreign.html On Fri, Nov 25, 2016 at 7:20 AM, Cody Goodman wrote: > Any ideas on how I'd write this instance? I know for it to be storable it > needs a size, couldn't I just get the length of the text? Has anyone did > anything similar? > > I ran into a surprise when trying to use storable-record and derive-storable > and tried using them with a record that contained a Text field. > > My end goal is having a vector of records that could contain Text, UTCTime, > or other similarly complex types which I can write as an mmap to disk and > then read back to the original format. > > Thanks! > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -- Chris Wong (https://lambda.xyz) "I had not the vaguest idea what this meant and when I could not remember the words, my tutor threw the book at my head, which did not stimulate my intellect in any way." -- Bertrand Russell From ietf-dane at dukhovni.org Fri Nov 25 09:20:35 2016 From: ietf-dane at dukhovni.org (Viktor Dukhovni) Date: Fri, 25 Nov 2016 04:20:35 -0500 Subject: [Haskell-cafe] Haskell TLS and monad-control? Message-ID: <00100DAC-9783-4F1B-BB70-1CCF0762D45E@dukhovni.org> [ Knowledge of DANE entirely optional, if some of the below is Greek to you, just skip the bits that are unfamiliar. ] I have the beginning of a DANE verification module for hs-tls as an alternative to Data.X509.Validation. So far it just handles the easy case of checking just the leaf certificate against DANE-EE(3) certificate usage TLSA records, the rest is more complex, but follows naturally enough. Having verified the certificate a la DANE, I'd like to be able to return more detail to the caller than just success/failure. This part seems difficult to do cleanly. The TLS client state is encapsulated in a State monad which keeps track of the shared (SMTP) protocol state across a source/conduit/sink triple: type SmtpM = StateT ProtoState IO source :: Source SmtpM ByteString proto :: Conduit ByteString SmtpM ByteString sink :: Sink ByteString SmtpM () When the peer supports STARTTLS, I perform a TLS handshake, and make use of a TLS-enabled source/sink pair. This works well enough, but I also need to capture TLS-handshake metadata in the protocol state: * The peer's validated certificate chain. * The DNS name matched in the peer certificate. * Which TLSA record matched the peer's chain * ... A plausible interface is for the DANE version of the X509 verification code to expose one or more optional callbacks that will invoke a function of the caller's choice that will be passed the desired metadata. It would then be up to that function to squirrel this data away for later use. If this callback were to be invoked in the context of the application state monad, I'd just call "modify" in the callback and examine the results post-handshake as needed. However, life is not so simple. The TLS handshake is performed via Network.TLS.handshake, which internally calls the certificate verification code via: processCertificate :: ClientParams -> Context -> Handshake -> IO (RecvState IO) processCertificate cparams ctx (Certificates certs) = do -- run certificate recv hook ctxWithHooks ctx (\hooks -> hookRecvCertificates hooks $ certs) -- then run certificate validation usage <- catchException (wrapCertificateChecks <$> checkCert) rejectOnException case usage of CertificateUsageAccept -> return () CertificateUsageReject reason -> certificateRejected reason return $ RecvStateHandshake (processServerKeyExchange ctx) where shared = clientShared cparams checkCert = (onServerCertificate $ clientHooks cparams) (sharedCAStore shared) (sharedValidationCache shared) (clientServerIdentification cparams) certs processCertificate _ ctx p = processServerKeyExchange ctx p which lives in the base IO monad, and even if I pass in the current state to the `checkCert` hook, there is no opportunity to return the modified state into a context where "restoreM" can make appropriate updates in the caller. The best I can do is provide the hook with a suitable mutable object (likely an MVar). Interestingly enough, the outer Network.TLS.handshake function appears to be more flexible: handshake :: MonadIO m => Context -> m () Which makes possible calls of the form: res <- liftBaseWith $ \runInIO -> do Sys.timeout tmout $ Sys.tryIOError $ runInIO $ TLS.handshake ctx case res of Just x | Right st <- x -> restoreM st; ... success ... | Left e <- x -> ... I/O Error ... _ -> ... timeout ... which turn out futile, since `handshake` immediately switches to doing all the work in the IO monad, and so the underlying internals are not compatible with MonadControl. This prevents back-propagation of state changes via the various callbacks in TLS.ClientParams.clientHooks. -- | Handshake for a new TLS connection -- This is to be called at the beginning of a connection, and during renegotiation handshake :: MonadIO m => Context -> m () handshake ctx = liftIO $ handleException $ withRWLock ctx (ctxDoHandshake ctx $ ctx) where handleException f = catchException f $ \exception -> do let tlserror = maybe (Error_Misc $ show exception) id $ fromException exception setEstablished ctx False sendPacket ctx (errorToAlert tlserror) handshakeFailed tlserror So my question is whether it makes sense to rework the TLS modules to live in a more abstract monad (as in the handshake function) and only work in the base IO monad briefly, when performing actual I/O operations? Thus, perhaps instead: processCertificate :: MonadIO m => ClientParams -> Context -> Handshake -> m (RecvState m) ... Doing this throughout the TLS stack looks a lot of work, so the question is perhaps whether such an effort would be justified? Or is it too late to retrofit monad control over large existing code bases, with the monad control pattern mostly suitable just for de novo work? -- Viktor. From tdammers at gmail.com Sat Nov 26 20:27:45 2016 From: tdammers at gmail.com (Tobias Dammers) Date: Sat, 26 Nov 2016 21:27:45 +0100 Subject: [Haskell-cafe] [ANN] Sprinkles - zero-programming web dev platform Message-ID: <20161126202742.GA17344@nibbler> A little something I've been working on: https://sprinkles.tobiasdammers.nl/ You feed it a bunch of templates, content in files, databases, APIs, etc., define routes and map them onto data sources and templates using a YAML configuration file, and it'll serve that as a full blown website. It sits somewhere in between a classic CMS and a static site generator. The code is available on github: https://github.com/tdammers/sprinkles Both the sprinkles website and that for ginger (https://ginger.tobiasdammers.nl/) are built on Sprinkles (following some advice about dog food I read somewhere). Before I unleash this to a more general audience, I'd like to get some honest (harsh) criticism here, on both the code itself and the available materials (website, documentation). Feel free to roast me relentlessly. -- Tobias Dammers - tdammers at gmail.com From michael at schmong.org Sat Nov 26 23:52:22 2016 From: michael at schmong.org (Michael Litchard) Date: Sat, 26 Nov 2016 15:52:22 -0800 Subject: [Haskell-cafe] Searching for free copy of Bird paper Message-ID: I'm looking for a copy of the paper below. Can anyone point me to a free copy? Bird, R. S. (1984) Using circular programs to eliminate multiple traversals of data -------------- next part -------------- An HTML attachment was scrubbed... URL: From saurabhnanda at gmail.com Sun Nov 27 03:34:26 2016 From: saurabhnanda at gmail.com (Saurabh Nanda) Date: Sun, 27 Nov 2016 09:04:26 +0530 Subject: [Haskell-cafe] [ANN] Sprinkles - zero-programming web dev platform In-Reply-To: <20161126202742.GA17344@nibbler> References: <20161126202742.GA17344@nibbler> Message-ID: Following is not clear from the front page: * How is this different from Jekyll? * What would make a good use-case for this tool? When is a full-blown CMS overkill? When is a static-site generator too limiting? What is the sweet spot for this project? -- Saurabh. On 27 Nov 2016 1:58 am, "Tobias Dammers" wrote: > A little something I've been working on: > > https://sprinkles.tobiasdammers.nl/ > > You feed it a bunch of templates, content in files, databases, APIs, > etc., define routes and map them onto data sources and templates using a > YAML configuration file, and it'll serve that as a full blown website. > It sits somewhere in between a classic CMS and a static site generator. > > The code is available on github: > > https://github.com/tdammers/sprinkles > > Both the sprinkles website and that for ginger > (https://ginger.tobiasdammers.nl/) are built on Sprinkles (following > some advice about dog food I read somewhere). > > Before I unleash this to a more general audience, I'd like to get some > honest (harsh) criticism here, on both the code itself and the available > materials (website, documentation). Feel free to roast me relentlessly. > > -- > Tobias Dammers - tdammers at gmail.com > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gale at sefer.org Sun Nov 27 08:12:16 2016 From: gale at sefer.org (Yitzchak Gale) Date: Sun, 27 Nov 2016 10:12:16 +0200 Subject: [Haskell-cafe] Package takeover: indents In-Reply-To: References: Message-ID: Jasper Van der Jeugt wrote: >>> The indents package... >>> I would like to take over this package so I can share the >>> fixes. I wrote: >> There is a different email address... Let's wait a bit >> to see if there is a response. I did receive a response: > I have not updated that package or checked that email > in quite some time. I would be quite happy to give away > ownership of the indents package, as I have no intention > of maintaining it, and haven't updated it years. I am not > subscribed to the Haskell Cafe mailing list, but I'll check > out the thread. Regards, Yitz From abela at chalmers.se Sun Nov 27 18:58:44 2016 From: abela at chalmers.se (Andreas Abel) Date: Sun, 27 Nov 2016 19:58:44 +0100 Subject: [Haskell-cafe] 2nd Cfa TTT 2017 (Type Theory Based Tools) Message-ID: 2ND CALL FOR ABSTRACTS TTT : Type Theory Based Tools ============================= Satellite workshop of POPL 2017, Paris France, January 15th [We have funding possibilities for students and young researchers, see below. Note the early deadline!] Overview ======== The aim of this workshop is to showcase modern tools based on type theory, whether designed for programming or for verification, whether academic projects or used in an industrial setting. It will provide a forum to highlight and discuss their common and their distinctive features, and the future directions of development of the tools. The program will consist of invited and contributed talks, and will encourage informal discussion. Abstracts will be displayed on the website of the workshop but there will be no proceedings. We solicit abstract submissions proposing demos, case studies, describing the impact of a theoretical result on practice, or any other aspect of the development and use of tools based on type theory. In particular, we welcome submissions about prototype implementations and promising work in progress, as soon as they have the potential of raising interesting discussions. This workshop is funded by the EUTypes COST project (https://eutypes.cs.ru.nl/). The program will include a plenary discussion on the role of the EUTypes project in the community and planning of activities for 2017. Invited Speakers ================ Robbert Krebbers, Delft University of Technology, Netherlands Aaron Tomb, Galois, US More speakers to be confirmed Registration ============ Registration information will be soon available at the main POPL 2017 website: http://conf.researchr.org/home/POPL-2017 Participant funding =================== The EUTypes COST project (https://eutypes.cs.ru.nl/) can fund students and young researchers from countries participating in the project to attend the workshop – check http://www.cost.eu/COST_Actions/ca/CA15123?parties to see if your country is listed. The application should include the following information: * Your name * Your institution * The name of your supervisor(s) * The url of your webpage if you have one * Your research topics or interests in 1 paragraph and should be sent to ttt2017 at easychair.org as soon as possible and no later than November 20th. Contact ======= For any query about this workshop, please contact us at ttt2017 at easychair.org Call for abstracts ================== Submissions for talks and demonstrations should be described in an extended abstract, between 1 and 2 pages in length. We suggest formatting the text using the two-column SIGPLAN LaTeX style (9pt font). Submission page: https://easychair.org/conferences/?conf=ttt2017 Important dates =============== Submission deadline: 30 November 2016 Notification: 15 December 2016 Workshop: 15 January 2017 Program Committee ================= Andreas Abel, Gothenburg University, Sweden Andrej Bauer, University of Ljubljana, Slovenia Assia Mahboubi, Inria Université Paris-Saclay, France Keiko Nakata, Germany -- 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 To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post. -- 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 david.feuer at gmail.com Sun Nov 27 23:19:22 2016 From: david.feuer at gmail.com (David Feuer) Date: Sun, 27 Nov 2016 18:19:22 -0500 Subject: [Haskell-cafe] Creating a instance for (Storable Text) In-Reply-To: References: Message-ID: Chris Wong, the Storable class documents that sizeOf and alignmentOf are not supposed to depend on the values they're passed. If the class were being designed today, we'd likely have something more like sizeOf :: proxy a -> Int or possibly sizeOf# :: Proxy# a -> Int# But when Storable was designed, the proxy-passing "pattern" had not yet been established. On Thu, Nov 24, 2016 at 8:59 PM, Chris Wong wrote: > Since Text is represented as UTF-16 underneath, you can retrieve the > length in terms of 16-bit code units. > > I don't think you'll be able to mmap them though, since the backing > array may be moved by the garbage collector. > > See https://hackage.haskell.org/package/text-1.2.2.1/docs/Data-Text-Foreign.html > > On Fri, Nov 25, 2016 at 7:20 AM, Cody Goodman > wrote: >> Any ideas on how I'd write this instance? I know for it to be storable it >> needs a size, couldn't I just get the length of the text? Has anyone did >> anything similar? >> >> I ran into a surprise when trying to use storable-record and derive-storable >> and tried using them with a record that contained a Text field. >> >> My end goal is having a vector of records that could contain Text, UTCTime, >> or other similarly complex types which I can write as an mmap to disk and >> then read back to the original format. >> >> Thanks! >> >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view archives go to: >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> Only members subscribed via the mailman list are allowed to post. > > > > -- > Chris Wong (https://lambda.xyz) > > "I had not the vaguest idea what this meant and when I could not > remember the words, my tutor threw the book at my head, which did not > stimulate my intellect in any way." -- Bertrand Russell > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. From 78emil at gmail.com Mon Nov 28 08:12:46 2016 From: 78emil at gmail.com (Emil Axelsson) Date: Mon, 28 Nov 2016 09:12:46 +0100 Subject: [Haskell-cafe] Searching for free copy of Bird paper In-Reply-To: References: Message-ID: I'll send you a copy privately. / Emil Den 2016-11-27 kl. 00:52, skrev Michael Litchard: > Using circular programs to eliminate multiple traversals of data From m at jaspervdj.be Mon Nov 28 10:26:00 2016 From: m at jaspervdj.be (Jasper Van der Jeugt) Date: Mon, 28 Nov 2016 11:26:00 +0100 Subject: [Haskell-cafe] Package takeover: indents In-Reply-To: References: Message-ID: Thank you for relaying that. In that case, I will take over the package soon to fix the issues. Kind regards, Jasper On Sun, Nov 27, 2016 at 9:12 AM, Yitzchak Gale wrote: > Jasper Van der Jeugt wrote: >>>> The indents package... >>>> I would like to take over this package so I can share the >>>> fixes. > > I wrote: >>> There is a different email address... Let's wait a bit >>> to see if there is a response. > > I did receive a response: > >> I have not updated that package or checked that email >> in quite some time. I would be quite happy to give away >> ownership of the indents package, as I have no intention >> of maintaining it, and haven't updated it years. I am not >> subscribed to the Haskell Cafe mailing list, but I'll check >> out the thread. > > Regards, > Yitz From chneukirchen at gmail.com Mon Nov 28 12:56:33 2016 From: chneukirchen at gmail.com (Christian Neukirchen) Date: Mon, 28 Nov 2016 13:56:33 +0100 Subject: [Haskell-cafe] Munich Haskell Meeting, 2016-11-30 @ 19:30 Message-ID: <877f7n3gqm.fsf@gmail.com> Dear all, This week, our monthly Munich Haskell Meeting will take place again on Wednesday, November 30 at Max-Emanuel-Brauerei at 19h30. For details see here: http://muenchen.haskell.bayern/dates.html If you plan to join, please add yourself to this dudle so we can reserve enough seats! It is OK to add yourself to the dudle anonymously or pseudonymously. https://dudle.inf.tu-dresden.de/haskell-munich-nov-2016/ Everybody is welcome! cu, -- Christian Neukirchen http://chneukirchen.org From simon at joyful.com Wed Nov 30 15:07:22 2016 From: simon at joyful.com (Simon Michael) Date: Wed, 30 Nov 2016 07:07:22 -0800 Subject: [Haskell-cafe] [ANN] Sprinkles - zero-programming web dev platform In-Reply-To: <20161126202742.GA17344@nibbler> References: <20161126202742.GA17344@nibbler> Message-ID: On 11/26/16 12:27 PM, Tobias Dammers wrote: > https://sprinkles.tobiasdammers.nl/ Hi Tobias, thanks for this. A few thoughts I had so far while trying it on OSX: I love the concept! Holds the promise of significantly lowering the cost of building routine web apps. The flexibility of storage backends and content formats is great. I wished for a hackage release to try it out more easily. Installing all the C deps was not hard using brew, but I would have preferred if it just used the ones I have (postgres) and disabled the others (mysql, fcgi). The country demo failed some of the time due to the demo account exceeding its quota. I wishfully assumed it would reload all config files and content on the fly. Awww. I think that would be in keeping with it's "quick and easy" direction. Sprinkles doesn't make app development programming-free of course. It removes the compilation step (you still have to restart the app), and replaces functional, scalable Haskell programming with imperative, easy-to-start-with ginger and yaml code. Those do not look so lovely to a haskeller, but the advantages for rapid development and sharing with non-haskellers could be quite persuasive, especially with more dynamic reloading. Down the road, it seems also possible that such "interpreted" web apps could be mechanically "compiled" to some degree. From ben.richard.spencer at me.com Wed Nov 30 15:22:01 2016 From: ben.richard.spencer at me.com (Ben Spencer) Date: Wed, 30 Nov 2016 10:22:01 -0500 Subject: [Haskell-cafe] HWWG Message-ID: <5FF56EEC-E1F4-408F-B20E-A7E50B2A8C84@me.com> Hello all, Is there a way to get involved with the HWWG? Is there a slack channel or a mailing list? Best, Ben Spencer Sent from my iPhone From lsp at informatik.uni-kiel.de Wed Nov 30 16:13:21 2016 From: lsp at informatik.uni-kiel.de (lennart spitzner) Date: Wed, 30 Nov 2016 17:13:21 +0100 Subject: [Haskell-cafe] An idea on extensible effects (anonymous record) In-Reply-To: <768F646D-5B5A-44F9-B482-A0B466BCC564@qq.com> References: <768F646D-5B5A-44F9-B482-A0B466BCC564@qq.com> Message-ID: <8043ddca-55b5-62cc-5393-fac2705d7618@informatik.uni-kiel.de> hi winter, This seems to be equivalent to the idea behind the multistate package [1], and its MultiReader type [2]. The `MonadMultiReader` class [3] does a lookup in a type-level (linked) list similar to your Tuple-focussed `Has` class. [1] https://hackage.haskell.org/package/multistate [2] hackage.haskell.org/package/multistate-0.7.1.1/docs/Control-Monad-MultiReader.html [3] https://hackage.haskell.org/package/multistate-0.7.1.1/docs/Control-Monad-Trans-MultiReader-Class.html The type signature would become > (MonadMultiReader (Tagged “SqlBackEndOne” SqlBackEnd) m, MonadMultiReader (Tagged “SqlBackEndTwo" SqlBackEnd) m) => m () Note that one main drawback of this approach is the necessity of dropping the functional dependency present on MultiReader (for MonadMultiReader). So the cost of automatic type-based lookup is less type inference; a simple example would be `mAsk >>= print` being ambiguous where `ask >>= print` is not (if the surrounding `m` is known). -- lennart On 22/11/16 04:30, winter wrote: > Hi everyone! > > First of all, i don't know if this idea is already being discussed so if there's a discussion on this i'd like to follow. > > To illustrate, first i want to create a class like: > > class Has a t where > get :: t -> a > > then i define instance for simple product type such as tuple: > > instance Has a (a, b) where > get (a, _) = a > > instance Has b (a, b) where > get (_, b) = b > > ... > > You can image i will use th to make lots of instance for difference tuple size. Now if i want an extensible reader, i use Has class like this: > > someReader :: Has Int t => Reader t Int > someReader = do > x <- ask > return $ get x + 1 > > Then i can run it with any tuple with an Int field like: > > runReader someReader (0 :: Int, "adad”) -- 1 > > This typeclass almost solved all problem of my network application: sometime’s i want ensure a logger, a sql backend and a http client pool in my monad’s environment, but i don’t want to fix my environment into a record. > > We can add a set :: a -> t -> t, or use lens to define Has, so that we can have extensible states. > We can also use Tagged to achieve something like: > > (Has (Tagged “SqlBackEndOne” SqlBackEnd) t, Has (Tagged “SqlBackEndTwo" SqlBackEnd) t) => Reader t () > > It there a library doing this, maybe in lens? or there’re some drawbacks i didn’t notice? All ideas are welcomed! > > > Cheers~ > Winter > > > > > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > From michael at schmong.org Wed Nov 30 18:15:09 2016 From: michael at schmong.org (Michael Litchard) Date: Wed, 30 Nov 2016 10:15:09 -0800 Subject: [Haskell-cafe] complexity of functions in PriorityQ.hs Message-ID: I'm trying to figure out the complexity of the functions in Melissa O'Neill's Priority Queue library, Priority.Q.hs Below find definitions, and what I think the complexity is. I'd appreciate feedback, especially on the ones I have marked as guesses. data PriorityQ k v = Lf | Br {-# UNPACK #-} !k v !(PriorityQ k v) !(PriorityQ k v) deriving (Eq, Ord, Read, Show) O(log n) . This is a guess but alternating which side of the sub-tree is being traversed is my hint. insert :: Ord k => k -> v -> PriorityQ k v -> PriorityQ k v insert wk wv (Br vk vv t1 t2) | wk <= vk = Br wk wv (insert vk vv t2) t1 | otherwise = Br vk vv (insert wk wv t2) t1 insert wk wv Lf = Br wk wv Lf Lf I have no idea. Reasoning help here please. siftdown :: Ord k => k -> v -> PriorityQ k v -> PriorityQ k v -> PriorityQ k v siftdown wk wv Lf _ = Br wk wv Lf Lf siftdown wk wv (t @ (Br vk vv _ _)) Lf | wk <= vk = Br wk wv t Lf | otherwise = Br vk vv (Br wk wv Lf Lf) Lf siftdown wk wv (t1 @ (Br vk1 vv1 p1 q1)) (t2 @ (Br vk2 vv2 p2 q2)) | wk <= vk1 && wk <= vk2 = Br wk wv t1 t2 | vk1 <= vk2 = Br vk1 vv1 (siftdown wk wv p1 q1) t2 | otherwise = Br vk2 vv2 t1 (siftdown wk wv p2 q2) Whatever the cost of siftdown is. deleteMinAndInsert :: Ord k => k -> v -> PriorityQ k v -> PriorityQ k v deleteMinAndInsert wk wv Lf = error "Empty PriorityQ" deleteMinAndInsert wk wv (Br _ _ t1 t2) = siftdown wk wv t1 t2 This looks like O(log N) to me. leftrem :: PriorityQ k v -> (k, v, PriorityQ k v) leftrem (Br vk vv Lf Lf) = (vk, vv, Lf) leftrem (Br vk vv t1 t2) = (wk, wv, Br vk vv t2 t) where (wk, wv, t) = leftrem t1 leftrem _ = error "Empty heap!" The cost of siftdown, which is probably more expensive than leftrem. deleteMin :: Ord k => PriorityQ k v -> PriorityQ k v deleteMin (Br vk vv Lf _) = Lf deleteMin (Br vk vv t1 t2) = siftdown wk wv t2 t where (wk,wv,t) = leftrem t1 deleteMin _ = error "Empty heap!" Thanks for the feedback. I'm new to computational analysis and this is the most complicated code I have tried to tackle thus far. I have Okasaki's book, but am having trouble making best use of it. -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at schmong.org Wed Nov 30 21:30:15 2016 From: michael at schmong.org (Michael Litchard) Date: Wed, 30 Nov 2016 13:30:15 -0800 Subject: [Haskell-cafe] complexity of functions in PriorityQ.hs In-Reply-To: <583F3C7A.1040601@ens.fr> References: <583F3C7A.1040601@ens.fr> Message-ID: Thank you Xia for your generous help. Enclosed find the file with PriorityQ.hs, and the web page where I found the link. https://wiki.haskell.org/Prime_numbers#External_links http://www.cs.hmc.edu/~oneill/code/haskell-primes.zip On Wed, Nov 30, 2016 at 12:54 PM, Li-yao Xia wrote: > Hello Michael, > > Would you have a link to this library? I couldn't find it. > > Alternating the subtree in which we recursively call insert is indeed a > good hint. Another detail is that the keys do not affect the shape of the > tree (that is, what is left if you ignore the keys and the values, or > replace them all with ()). > > - The only difference between the first two branches of insert is that the > key-value pairs are swapped. In both cases, the shape of the tree is > transformed in the same way. > > - We can also see that "siftdown wk wv t1 t2" has the same shape as "Br wk > wv t1 t2", and as the primary component of deleteMinAndInsert, it follows > that this function does not change the shape of the tree, it only moves the > key-value pairs in it. > > We have insert, deleteMin, and deleteMinAndInsert. It is natural to wonder > whether deleteMinAndInsert behaves the same as the composition of insert > and deleteMin. While the key-value pairs may be shuffled around > differently, the swapping of subtrees that happens in insert appears to be > mirrored by leftRem (called by deleteMin). > > In other words, we have that "insert () ()" and deleteMin are inverses of > each other. (The units make the key-values undinstiguishable.) > > All this means that the shape of a PriorityQ is entirely determined by the > number n of elements in it, and in particular that shape can be obtained by > iterating "insert () ()" n times starting from the empty queue Lf. > > shape :: Int -> PriorityQ () () > shape 0 = Lf > shape n = insert () () (shape (n-1)) > > Since "insert () ()" simply calls itself alternatingly on each subtree, > which both start off as Lf after the first insertion, the subtrees of a > "shape n" are also "shape k" for some value(s) of k: > > shape (2 * n + 1) = Br () () (shape n) (shape n) > shape (2 * n + 2) = Br () () (shape (n + 1)) (shape n) > > That is a good characterization of that shape. We can get their depth: > > depth :: PriorityQ k v -> Int > depth Lf = 0 > depth (Br _ _ l r) = 1 + max (depth l) (depth r) > > Let us do some empirical measurements: > > depth (shape n): 0 1 2 2 3 3 3 3 ... > floor (log2 n): _ 0 1 1 2 2 2 2 ... > > Generalize: > > depth (shape n) = floor (log2 n) + 1 > > And since the functions presented all recurse through the tree in depth, > their complexities are proportional to it, thus logarithmic. > > Li-yao > > > Le 11/30/2016 6:15 PM, Michael Litchard a écrit : > >> I'm trying to figure out the complexity of the functions in Melissa >> O'Neill's Priority Queue library, Priority.Q.hs >> >> Below find definitions, and what I think the complexity is. I'd >> appreciate feedback, especially on the ones I have marked as guesses. >> >> data PriorityQ k v = Lf >> | Br {-# UNPACK #-} !k v !(PriorityQ k v) >> !(PriorityQ k v) >> deriving (Eq, Ord, Read, Show) >> >> O(log n) . >> This is a guess but alternating which side of the sub-tree is being >> traversed is my hint. >> >> insert :: Ord k => k -> v -> PriorityQ k v -> PriorityQ k v >> insert wk wv (Br vk vv t1 t2) >> | wk <= vk = Br wk wv (insert vk vv t2) t1 >> | otherwise = Br vk vv (insert wk wv t2) t1 >> insert wk wv Lf = Br wk wv Lf Lf >> >> I have no idea. Reasoning help here please. >> siftdown :: Ord k => k -> v -> PriorityQ k v -> PriorityQ k v -> >> PriorityQ k v >> siftdown wk wv Lf _ = Br wk wv Lf Lf >> siftdown wk wv (t @ (Br vk vv _ _)) Lf >> | wk <= vk = Br wk wv t Lf >> | otherwise = Br vk vv (Br wk wv Lf Lf) Lf >> siftdown wk wv (t1 @ (Br vk1 vv1 p1 q1)) (t2 @ (Br vk2 vv2 p2 q2)) >> | wk <= vk1 && wk <= vk2 = Br wk wv t1 t2 >> | vk1 <= vk2 = Br vk1 vv1 (siftdown wk wv p1 q1) t2 >> | otherwise = Br vk2 vv2 t1 (siftdown wk wv p2 q2) >> >> Whatever the cost of siftdown is. >> deleteMinAndInsert :: Ord k => k -> v -> PriorityQ k v -> PriorityQ k v >> deleteMinAndInsert wk wv Lf = error "Empty PriorityQ" >> deleteMinAndInsert wk wv (Br _ _ t1 t2) = siftdown wk wv t1 t2 >> >> This looks like O(log N) to me. >> leftrem :: PriorityQ k v -> (k, v, PriorityQ k v) >> leftrem (Br vk vv Lf Lf) = (vk, vv, Lf) >> leftrem (Br vk vv t1 t2) = (wk, wv, Br vk vv t2 t) where >> (wk, wv, t) = leftrem t1 >> leftrem _ = error "Empty heap!" >> >> The cost of siftdown, which is probably more expensive than leftrem. >> >> deleteMin :: Ord k => PriorityQ k v -> PriorityQ k v >> deleteMin (Br vk vv Lf _) = Lf >> deleteMin (Br vk vv t1 t2) = siftdown wk wv t2 t where >> (wk,wv,t) = leftrem t1 >> deleteMin _ = error "Empty heap!" >> >> Thanks for the feedback. I'm new to computational analysis and this is >> the most complicated code I have tried to tackle thus far. I have >> Okasaki's book, but am having trouble making best use of it. >> >> >> >> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view archives go to: >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> Only members subscribed via the mailman list are allowed to post. >> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From corentin.dupont at gmail.com Wed Nov 30 21:47:16 2016 From: corentin.dupont at gmail.com (Corentin Dupont) Date: Wed, 30 Nov 2016 22:47:16 +0100 Subject: [Haskell-cafe] Debug tracing in Haskell In-Reply-To: References: Message-ID: I came accross https://hackage.haskell.org/package/hslogger-1.2.10 Which seems quite good to solve your problem. On Tue, Nov 22, 2016 at 2:37 PM, Clinton Mead wrote: > I've been debugging some Haskell code, including a lot of work on Mutable > Vectors, so naturally I've found `trace` useful, and in particular > `traceM`, because it fits in nicely with monadic code. > > The problem is that unlike `assert`, both `trace` and `traceM` execute > unconditionally, I can't toggle them with a compiler flag. > > I could however do something like this in every file I want to do tracing. > > {-# LANGUAGE CPP #-} > > #ifdef TRACE > trace = Debug.Trace.trace > traceM = Debug.Trace.traceM > #else > trace _ = id > traceM _ = pure () > #endif > > But already, that's a lot of boilerplate. > > I'd also like to trace based on debug levels. For example, at TRACE level > 2, only print trace statements at level 1 or 2, but at TRACE level 4, print > trace statements at level 1, 2, 3 and 4, providing more detail (but more > noise). > > This makes the above code even more complex. > > This wouldn't be a problem if I could put the code in a separate package, > but I can't, as then whether tracing is on or not depends on the compiler > settings of the tracing package, not on the calling package, which defeats > the purpose somewhat. > > I considered using implicit parameters to quietly pass whether I want > tracing and at what level into the tracing module, but it seems to be that > implicit parameters can't be defined at the top level. > > It gets even more complex. When debugging, I might want to print something > of type 'a'. Obviously 'a' will need some sort of show method for this to > work, but outside of debug mode I don't want to restrict my function's > types to things which are showable. So I considered doing this: > > #ifdef TRACE > type DebugShow a = Show a > debugShow = show > #else > type DebugShow a = () > debugShow _ = error "DEBUG SHOWING OUTSIDE OF DEBUG MODE" > #endif > > And of course, if you're only using `debugShow` as part of an argument to > `trace`, lazy evaluation will avoid `debugShow` ever being called when > tracing is not enabled. > > But put all this together and you've got around a dozen lines of > boilerplate just to do tracing, without even having tracing levels yet, > that have to be put in every module you want to use tracing, but don't want > a whole lot of debug data being spat out in a release compile. > > Also, adding any other tracing functions just makes this longer. > > The only approach I can think of so far is to whack this all in a template > haskell module and add code that splices it all into the current module: > > e.g. > > #ifdef TRACE > $(traceFunctions True) > #else > $(traceFunctions False) > #endif > > Where `traceFunctions` is a template haskell function that dumps all the > appropriate functions and type definitions mentioned above (and maybe more) > at the top level of the calling module. > > So my questions are: > > 1. Is there a better way? And > 2. Has this problem already been solved? > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From drkoster at qq.com Wed Nov 30 23:47:56 2016 From: drkoster at qq.com (winter) Date: Thu, 1 Dec 2016 07:47:56 +0800 Subject: [Haskell-cafe] An idea on extensible effects (anonymous record) In-Reply-To: <8043ddca-55b5-62cc-5393-fac2705d7618@informatik.uni-kiel.de> References: <768F646D-5B5A-44F9-B482-A0B466BCC564@qq.com> <8043ddca-55b5-62cc-5393-fac2705d7618@informatik.uni-kiel.de> Message-ID: <12B0DBED-2C0C-4025-A725-250EF7277C2C@qq.com> Hi, Lennart there're several extensible effect systems build around HList(typed aligned sequence in general), but one thing bother me is that HList 's efficiency. I'm not sure if HList can be totally inlined. But as far as I can tell, inline tuple field is very easy for ghc. I'd be very happy if you can prove me HList is just fine. I also want to reuse mtl as much as possible, so it's easier for beginner to get started, thus there's no need to create another monad transformers library. After all, `Has x r` is short than `MonadXXX x m`, so you won't have a long signature all the way down. Cheers Winter~ 发自我的 iPhone > 在 2016年12月1日,上午12:13,lennart spitzner 写道: > > hi winter, > > This seems to be equivalent to the idea behind the multistate package [1], > and its MultiReader type [2]. The `MonadMultiReader` class [3] does a lookup > in a type-level (linked) list similar to your Tuple-focussed `Has` class. > > [1] https://hackage.haskell.org/package/multistate > [2] hackage.haskell.org/package/multistate-0.7.1.1/docs/Control-Monad-MultiReader.html > [3] https://hackage.haskell.org/package/multistate-0.7.1.1/docs/Control-Monad-Trans-MultiReader-Class.html > > The type signature would become > >> (MonadMultiReader (Tagged “SqlBackEndOne” SqlBackEnd) m, MonadMultiReader (Tagged “SqlBackEndTwo" SqlBackEnd) m) => m () > > Note that one main drawback of this approach is the necessity of dropping > the functional dependency present on MultiReader (for MonadMultiReader). > So the cost of automatic type-based lookup is less type inference; > a simple example would be `mAsk >>= print` being ambiguous where > `ask >>= print` is not (if the surrounding `m` is known). > > > -- lennart > > >> On 22/11/16 04:30, winter wrote: >> Hi everyone! >> >> First of all, i don't know if this idea is already being discussed so if there's a discussion on this i'd like to follow. >> >> To illustrate, first i want to create a class like: >> >> class Has a t where >> get :: t -> a >> >> then i define instance for simple product type such as tuple: >> >> instance Has a (a, b) where >> get (a, _) = a >> >> instance Has b (a, b) where >> get (_, b) = b >> >> ... >> >> You can image i will use th to make lots of instance for difference tuple size. Now if i want an extensible reader, i use Has class like this: >> >> someReader :: Has Int t => Reader t Int >> someReader = do >> x <- ask >> return $ get x + 1 >> >> Then i can run it with any tuple with an Int field like: >> >> runReader someReader (0 :: Int, "adad”) -- 1 >> >> This typeclass almost solved all problem of my network application: sometime’s i want ensure a logger, a sql backend and a http client pool in my monad’s environment, but i don’t want to fix my environment into a record. >> >> We can add a set :: a -> t -> t, or use lens to define Has, so that we can have extensible states. >> We can also use Tagged to achieve something like: >> >> (Has (Tagged “SqlBackEndOne” SqlBackEnd) t, Has (Tagged “SqlBackEndTwo" SqlBackEnd) t) => Reader t () >> >> It there a library doing this, maybe in lens? or there’re some drawbacks i didn’t notice? All ideas are welcomed! >> >> >> Cheers~ >> Winter >> >> >> >> >> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view archives go to: >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> Only members subscribed via the mailman list are allowed to post. >> > > From li-yao.xia at ens.fr Wed Nov 30 20:54:18 2016 From: li-yao.xia at ens.fr (Li-yao Xia) Date: Wed, 30 Nov 2016 20:54:18 +0000 Subject: [Haskell-cafe] complexity of functions in PriorityQ.hs In-Reply-To: References: Message-ID: <583F3C7A.1040601@ens.fr> Hello Michael, Would you have a link to this library? I couldn't find it. Alternating the subtree in which we recursively call insert is indeed a good hint. Another detail is that the keys do not affect the shape of the tree (that is, what is left if you ignore the keys and the values, or replace them all with ()). - The only difference between the first two branches of insert is that the key-value pairs are swapped. In both cases, the shape of the tree is transformed in the same way. - We can also see that "siftdown wk wv t1 t2" has the same shape as "Br wk wv t1 t2", and as the primary component of deleteMinAndInsert, it follows that this function does not change the shape of the tree, it only moves the key-value pairs in it. We have insert, deleteMin, and deleteMinAndInsert. It is natural to wonder whether deleteMinAndInsert behaves the same as the composition of insert and deleteMin. While the key-value pairs may be shuffled around differently, the swapping of subtrees that happens in insert appears to be mirrored by leftRem (called by deleteMin). In other words, we have that "insert () ()" and deleteMin are inverses of each other. (The units make the key-values undinstiguishable.) All this means that the shape of a PriorityQ is entirely determined by the number n of elements in it, and in particular that shape can be obtained by iterating "insert () ()" n times starting from the empty queue Lf. shape :: Int -> PriorityQ () () shape 0 = Lf shape n = insert () () (shape (n-1)) Since "insert () ()" simply calls itself alternatingly on each subtree, which both start off as Lf after the first insertion, the subtrees of a "shape n" are also "shape k" for some value(s) of k: shape (2 * n + 1) = Br () () (shape n) (shape n) shape (2 * n + 2) = Br () () (shape (n + 1)) (shape n) That is a good characterization of that shape. We can get their depth: depth :: PriorityQ k v -> Int depth Lf = 0 depth (Br _ _ l r) = 1 + max (depth l) (depth r) Let us do some empirical measurements: depth (shape n): 0 1 2 2 3 3 3 3 ... floor (log2 n): _ 0 1 1 2 2 2 2 ... Generalize: depth (shape n) = floor (log2 n) + 1 And since the functions presented all recurse through the tree in depth, their complexities are proportional to it, thus logarithmic. Li-yao Le 11/30/2016 6:15 PM, Michael Litchard a écrit : > I'm trying to figure out the complexity of the functions in Melissa > O'Neill's Priority Queue library, Priority.Q.hs > > Below find definitions, and what I think the complexity is. I'd > appreciate feedback, especially on the ones I have marked as guesses. > > data PriorityQ k v = Lf > | Br {-# UNPACK #-} !k v !(PriorityQ k v) > !(PriorityQ k v) > deriving (Eq, Ord, Read, Show) > > O(log n) . > This is a guess but alternating which side of the sub-tree is being > traversed is my hint. > > insert :: Ord k => k -> v -> PriorityQ k v -> PriorityQ k v > insert wk wv (Br vk vv t1 t2) > | wk <= vk = Br wk wv (insert vk vv t2) t1 > | otherwise = Br vk vv (insert wk wv t2) t1 > insert wk wv Lf = Br wk wv Lf Lf > > I have no idea. Reasoning help here please. > siftdown :: Ord k => k -> v -> PriorityQ k v -> PriorityQ k v -> > PriorityQ k v > siftdown wk wv Lf _ = Br wk wv Lf Lf > siftdown wk wv (t @ (Br vk vv _ _)) Lf > | wk <= vk = Br wk wv t Lf > | otherwise = Br vk vv (Br wk wv Lf Lf) Lf > siftdown wk wv (t1 @ (Br vk1 vv1 p1 q1)) (t2 @ (Br vk2 vv2 p2 q2)) > | wk <= vk1 && wk <= vk2 = Br wk wv t1 t2 > | vk1 <= vk2 = Br vk1 vv1 (siftdown wk wv p1 q1) t2 > | otherwise = Br vk2 vv2 t1 (siftdown wk wv p2 q2) > > Whatever the cost of siftdown is. > deleteMinAndInsert :: Ord k => k -> v -> PriorityQ k v -> PriorityQ k v > deleteMinAndInsert wk wv Lf = error "Empty PriorityQ" > deleteMinAndInsert wk wv (Br _ _ t1 t2) = siftdown wk wv t1 t2 > > This looks like O(log N) to me. > leftrem :: PriorityQ k v -> (k, v, PriorityQ k v) > leftrem (Br vk vv Lf Lf) = (vk, vv, Lf) > leftrem (Br vk vv t1 t2) = (wk, wv, Br vk vv t2 t) where > (wk, wv, t) = leftrem t1 > leftrem _ = error "Empty heap!" > > The cost of siftdown, which is probably more expensive than leftrem. > > deleteMin :: Ord k => PriorityQ k v -> PriorityQ k v > deleteMin (Br vk vv Lf _) = Lf > deleteMin (Br vk vv t1 t2) = siftdown wk wv t2 t where > (wk,wv,t) = leftrem t1 > deleteMin _ = error "Empty heap!" > > Thanks for the feedback. I'm new to computational analysis and this is > the most complicated code I have tried to tackle thus far. I have > Okasaki's book, but am having trouble making best use of it. > > > > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. >