From doaitse at swierstra.net Wed Jun 1 09:35:30 2016 From: doaitse at swierstra.net (S. Doaitse Swierstra) Date: Wed, 1 Jun 2016 11:35:30 +0200 Subject: [Haskell-cafe] Is there any way to use somethig like global backtrack with parsec In-Reply-To: <5b638355-d791-4ff9-a0d9-55a426fcd414@googlegroups.com> References: <8324cff3-086e-4801-97a4-39b77986e826@googlegroups.com> <5b638355-d791-4ff9-a0d9-55a426fcd414@googlegroups.com> Message-ID: <3A201210-0D0E-4965-90F0-EB979DF43B88@swierstra.net> > Op 31 mei 2016, om 3:52 heeft Erik Rantapaa > het volgende geschreven: > > If don't have to use Parsec, you can use a parser library like ReadP / ReadS. > > For example: > > import Text.ParserCombinators.ReadP > > abc = (choice [ string "a", string "ab" ] ) >> char 'c' >> eof > > run p s = case (readP_to_S p) s of > [] -> Left "no parse" > ((a,_):_) -> Right a > > test1 = run abc "ac" > test2 = run abc "abc" > test3 = run abc "ab" -- should fail > > > On Monday, May 30, 2016 at 1:15:25 PM UTC-5, Petr Sokolov wrote: > For example this parser doesn't parse "abc" > > test :: Parser String > test = ((try $ string "a") <|> (string "ab")) *> (string "c") > > I can rewrite it so it would parse "abc", but is there any general approach to force parser to return and try other branches? If you use uu-parsinglib all your problems will be gone. No need to hasskel around with ?try? constructs. All alternatives are tried ?in parallel?. Doaitse > > (try a <|> b) *> c > > Something like > > (tryOtherBranchesIfFail (try a <|> b)) *> c > > So if it cannot parse "abc" with (try a *> c) it could return and try (b *> c) > Or it isn't possible? > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe -------------- next part -------------- An HTML attachment was scrubbed... URL: From johannes.waldmann at htwk-leipzig.de Thu Jun 2 21:00:29 2016 From: johannes.waldmann at htwk-leipzig.de (Johannes Waldmann) Date: Thu, 2 Jun 2016 23:00:29 +0200 Subject: [Haskell-cafe] how to reify an API? Message-ID: <29fb2945-4144-eb7d-4a4a-3b8ac3f8e568@htwk-leipzig.de> Dear Cafe, I wanted to benchmark (part of) an API of a package, by enumerating all possible (nested) calls by size of their AST, much as smallcheck does it for data. So I made this straightforward AST representation and (generically) got its Serial instances. That last part has been in smallcheck for a long time, and works nicely. But I do wonder if there is a way to get the AST (and corresponding interpreter) with less boilerplate code (than this: https://github.com/jwaldmann/pretty-test/blob/master/src/Lib.hs#L29 ) If you read the code: it also has a type for "AST contexts" because I wanted to iterate them (to produce larger trees). Again - easy to write down, but boring. - J. From yallop at gmail.com Thu Jun 2 21:27:10 2016 From: yallop at gmail.com (Jeremy Yallop) Date: Thu, 2 Jun 2016 22:27:10 +0100 Subject: [Haskell-cafe] International summer school on metaprogramming (Cambridge, 8-12 Aug 2016) Message-ID: ==================================================================== International summer school on metaprogramming Robinson College, Cambridge, United Kingdom 8th-12th August, 2016 http://www.cl.cam.ac.uk/events/metaprog2016/ ==================================================================== Metaprogramming is an approach to improving programs by treating program fragments (such as expressions or types) as values that the program can manipulate. Metaprogramming comes in various forms, including * staged programming: treating expressions as program values. The execution of a staged program is spread over several phases, with each stage using the available data to generate specialized code. Staged programming has a wide variety of applications ? numeric computations, parsing, database queries, generic programming, domain specific languages, and many more. Precompiling the staged code can have dramatic performance improvements, in some cases an order of magnitude or more. * generic programming: treating types as program values. Generic programming can improve code flexibility, allowing to give a single definition of a function that operates in a predictable (but not uniform) way on many different types. Generic programming techniques can be used to define a wide variety of functions, including traversals, comparisons, pretty printers, serialization functions, and many more. The goal of the summer school is to explore the state-of-the art in metaprogramming and its applications, covering both theory and practice. -------------------------------------------------------------------- Lecturers and courses Philip Wadler, Sam Lindley and Shayan Najd (University of Edinburgh) Normalisation and embedding Simon Peyton Jones (Microsoft Research) Oleg Kiselyov (Tohoku University) Type-safe embedding and optimizing domain-specific languages in the typed final style Laurence Tratt (Kings College London) The highs and lows of macros in a modern language Jeremy Yallop (University of Cambridge) Staging generic programming Martin Berger (University of Sussex) Foundations of meta-programming Jos? Pedro Magalh?es (Standard Chartered) -------------------------------------------------------------------- Prerequisites The school is aimed at graduate students in programming languages and related areas, but is open to researchers, practitioners and strong masters students with the support of a supervisor. Some experience of typed functional programming in Haskell, OCaml, Scala, or a similar language will be assumed. -------------------------------------------------------------------- Costs Thanks to generous industrial sponsorship, we are able to offer places with significantly reduced fees. There are three categories of fees, all of which cover registration, accommodation in Robinson College from Monday to Friday, and all meals and refreshments. Participants who can pay the full fees will help allocate more fully-subsidised slots to less financially-able students. Your category of fees will not have any direct bearing on your acceptance into the school, but could affect how many slots we can offer. * The full fee is ?800. * The standard (partly-subsidised) fee is ?295. * We also have a limited number of fully-subsidised places available for a nominal registration fee of ?50. We will notify you of your fee upon acceptance. -------------------------------------------------------------------- Application procedure You will need to complete the online registration form at: http://www.cl.cam.ac.uk/events/metaprog2016/application.html and ensure your referees send your references to: metaprog-2016 at cl.cam.ac.uk by the application deadline. TIMETABLE * 30 June: Application and reference letters deadline. * 10 July: Notification of acceptance. * 24 July: Registration deadline. * 8 August: Summer school. -------------------------------------------------------------------- Further information For questions relating to the material of the school, please contact Jeremy Yallop (jeremy.yallop at cl.cam.ac.uk) Ohad Kammar (ohad.kammar at cs.ox.ac.uk) For administrative questions, please contact Gemma Gordon (gg417 at cl.cam.ac.uk) From dons00 at gmail.com Fri Jun 3 12:14:13 2016 From: dons00 at gmail.com (Don Stewart) Date: Fri, 03 Jun 2016 12:14:13 +0000 Subject: [Haskell-cafe] 10 open roles in expanding team at Standard Chartered Message-ID: I have another ten open roles in the growing Strats team at Standard Chartered. https://donsbot.wordpress.com/2016/06/03/multiple-haskell-developer-roles-in-strats-at-standard-chartered/ These are full time or contract Haskell developer positions in London or Singapore. Details in the post . -------------- next part -------------- An HTML attachment was scrubbed... URL: From gracjanpolak at gmail.com Sat Jun 4 11:56:31 2016 From: gracjanpolak at gmail.com (Gracjan Polak) Date: Sat, 4 Jun 2016 14:56:31 +0300 Subject: [Haskell-cafe] Month in Haskell Mode May 2016 Message-ID: Hi, Month in Haskell Mode May 2016 progress report is available: https://github.com/haskell/haskell-mode/wiki/Month-in-Haskell-Mode-May-2016 -- Gracjan -------------- next part -------------- An HTML attachment was scrubbed... URL: From martin.drautzburg at web.de Sat Jun 4 13:24:39 2016 From: martin.drautzburg at web.de (martin) Date: Sat, 4 Jun 2016 15:24:39 +0200 Subject: [Haskell-cafe] New version of itself Message-ID: <5752D697.5080507@web.de> Hello all, I find myself frequentlly writing types like this data Logger a l = Lgr { runLogger :: a -> Log l -> (Log l, Logger a l) } The purpose is to give a logger a chance to carry an internal state. It could e.g. choose to log only every n invocations. To do this it must keep track of how many times it has been called. I want to leave such things private to the Logger. (1) I know that this is not an unusal thing to do, but it has an OO feel to it. Is there a more functional alternative to it. Should I just not worry? (2) I can write a combinator which creates a Logger from a list of Loggers. Since each Logger potentially returns a new version of itself, I must always re-assemble the combined logger from all the returned new versions. I am worried that this is a costly operation, particularly when most Loggers just return themselves unaltered. I don't have any hard numbers about the performance penalty though. These Loggers are used in a discrete-event-simulation and they will get called many times (once for each event), but only occastionally actually write to the Log. From i.caught.air at gmail.com Sat Jun 4 14:30:07 2016 From: i.caught.air at gmail.com (Alex Belanger) Date: Sat, 4 Jun 2016 10:30:07 -0400 Subject: [Haskell-cafe] New version of itself In-Reply-To: <5752D697.5080507@web.de> References: <5752D697.5080507@web.de> Message-ID: Before I go into crazy suggestions, have you looked at the Writer monad? On Jun 4, 2016 9:25 AM, "martin" wrote: > > Hello all, > > I find myself frequentlly writing types like this > > data Logger a l = Lgr { > runLogger :: a -> Log l -> (Log l, Logger a l) > } > > The purpose is to give a logger a chance to carry an internal state. It could e.g. choose to log only every n > invocations. To do this it must keep track of how many times it has been called. I want to leave such things private to > the Logger. > > > (1) I know that this is not an unusal thing to do, but it has an OO feel to it. Is there a more functional alternative > to it. Should I just not worry? > > (2) I can write a combinator which creates a Logger from a list of Loggers. Since each Logger potentially returns a new > version of itself, I must always re-assemble the combined logger from all the returned new versions. I am worried that > this is a costly operation, particularly when most Loggers just return themselves unaltered. I don't have any hard > numbers about the performance penalty though. > > These Loggers are used in a discrete-event-simulation and they will get called many times (once for each event), but > only occastionally actually write to the Log. > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe -------------- next part -------------- An HTML attachment was scrubbed... URL: From carter.schonwald at gmail.com Sat Jun 4 14:59:02 2016 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Sat, 04 Jun 2016 14:59:02 +0000 Subject: [Haskell-cafe] announce: arithmoi 0.4.2.0 Message-ID: It is with great pleasure that the arithmoi maintainers (andrew lelechenko and myself) would like to share the 0.4.2.0 release with the haskell community. This release https://hackage.haskell.org/package/arithmoi-0.4.2.0 includes a multiplicatively infinite (but addititively finite) increase in test coverage and correspondingly every known bug in arithmoi has been fixed (so theres no known crashing/faulting bugs, and all tested code gives mathematically correct answers) I would especially like to thank Andrew Lelechenko for becoming a fellow maintainer, his incredibly meticulous, clean, thorough engineering is really what made this release possible and excellent. this should treated as a stable library version release. -------------- next part -------------- An HTML attachment was scrubbed... URL: From diaz.carrete at gmail.com Sat Jun 4 15:00:59 2016 From: diaz.carrete at gmail.com (=?UTF-8?Q?Daniel_D=C3=ADaz?=) Date: Sat, 4 Jun 2016 08:00:59 -0700 (PDT) Subject: [Haskell-cafe] New version of itself In-Reply-To: <5752D697.5080507@web.de> References: <5752D697.5080507@web.de> Message-ID: This is a bit of a tangent, but one can use the FoldM type from the foldl package to build composable logger-like things that perform effects. The semigroupoids package contains the Extend typeclass, which is basically "Comonad without extract". If we make FoldM an instance of Extend, we can "single-step" a FoldM with the function: import Data.Functor.Extend (duplicated ) import qualified Control.Foldl as L singleStep :: i -> L.FoldM IO i r -> IO (L.FoldM IO i r) singleStep i :: flip L.foldM [i] . duplicated Which is basically a logging function. Also, since FoldM is an instance of Applicative, you can combine a list of loggers using sequenceA_ . Another way to define a logger type would be with Cofree from the free package. Something like: type Logger = Cofree ((->) String) (IO ()) Which would also be an Applicative. One could then define stateful loggers using Cofree's unfold . I think the Cofree version has the advantage that you can be sure the logger's state only depends on the messages it receives (even as it emits IO actions on each step). The FoldM version, meanwhile, could perform some devious IO action to update its state. On Saturday, June 4, 2016 at 3:24:57 PM UTC+2, martin wrote: > > Hello all, > > I find myself frequentlly writing types like this > > data Logger a l = Lgr { > runLogger :: a -> Log l -> (Log l, Logger a l) > } > > The purpose is to give a logger a chance to carry an internal state. It > could e.g. choose to log only every n > invocations. To do this it must keep track of how many times it has been > called. I want to leave such things private to > the Logger. > > > (1) I know that this is not an unusal thing to do, but it has an OO feel > to it. Is there a more functional alternative > to it. Should I just not worry? > > (2) I can write a combinator which creates a Logger from a list of > Loggers. Since each Logger potentially returns a new > version of itself, I must always re-assemble the combined logger from all > the returned new versions. I am worried that > this is a costly operation, particularly when most Loggers just return > themselves unaltered. I don't have any hard > numbers about the performance penalty though. > > These Loggers are used in a discrete-event-simulation and they will get > called many times (once for each event), but > only occastionally actually write to the Log. > _______________________________________________ > Haskell-Cafe mailing list > Haskel... at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From martin.drautzburg at web.de Sat Jun 4 15:18:45 2016 From: martin.drautzburg at web.de (martin) Date: Sat, 4 Jun 2016 17:18:45 +0200 Subject: [Haskell-cafe] Accumulating and threading output of functions Message-ID: <5752F155.109@web.de> Hello all, I have a number of functions, whose type is something like this: f:: a -> b -> (b, c) i.e. it returns a modified b and an additional c. Now I want to write a combinator, which assembles a list of such functions into a single one. This combinator will have to thread the bs from one function to the next and accumulate the cs into a single c. While I was able to write this using a fold, I am not happy with it (my first attempt had a bad error in it, which is always a bad sign). Are you aware of any idioms, how to do such things on the beaten track? From chpatrick at gmail.com Sat Jun 4 16:46:25 2016 From: chpatrick at gmail.com (Patrick Chilton) Date: Sat, 4 Jun 2016 18:46:25 +0200 Subject: [Haskell-cafe] Accumulating and threading output of functions In-Reply-To: <5752F155.109@web.de> References: <5752F155.109@web.de> Message-ID: If c is a Monoid, you can use the RWS a c b () type instead and combine them with sequence_. On 4 Jun 2016 5:19 pm, "martin" wrote: > Hello all, > > I have a number of functions, whose type is something like this: > > f:: a -> b -> (b, c) > > i.e. it returns a modified b and an additional c. > > Now I want to write a combinator, which assembles a list of such functions > into a single one. This combinator will have > to thread the bs from one function to the next and accumulate the cs into > a single c. > > While I was able to write this using a fold, I am not happy with it (my > first attempt had a bad error in it, which is > always a bad sign). > > Are you aware of any idioms, how to do such things on the beaten track? > > > > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From miguelimo38 at yandex.ru Sat Jun 4 16:52:54 2016 From: miguelimo38 at yandex.ru (MigMit) Date: Sat, 4 Jun 2016 18:52:54 +0200 Subject: [Haskell-cafe] Accumulating and threading output of functions In-Reply-To: <5752F155.109@web.de> References: <5752F155.109@web.de> Message-ID: First of all: where does your first argument (`a`) come from? Is it the same for all of those functions? If so, you can get rid of it by using `map ($ a)`. Now, you have a list of functions of type `b -> (b, c)`. The most natural thing here is to convert them to the State monad: `State b c`. And your original functions would be `a -> State b c`. Try to use State monad from the start. Then, from the list of type `[State b c]`, the `sequence` function gives you `State b [c]` instead. `evalState` would give you just `[c]`, and you can convert the list of `c`s into a single `c` in any way you want. > On 04 Jun 2016, at 17:18, martin wrote: > > Hello all, > > I have a number of functions, whose type is something like this: > > f:: a -> b -> (b, c) > > i.e. it returns a modified b and an additional c. > > Now I want to write a combinator, which assembles a list of such functions into a single one. This combinator will have > to thread the bs from one function to the next and accumulate the cs into a single c. > > While I was able to write this using a fold, I am not happy with it (my first attempt had a bad error in it, which is > always a bad sign). > > Are you aware of any idioms, how to do such things on the beaten track? > > > > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe From monnier at iro.umontreal.ca Sat Jun 4 16:52:58 2016 From: monnier at iro.umontreal.ca (Stefan Monnier) Date: Sat, 04 Jun 2016 12:52:58 -0400 Subject: [Haskell-cafe] Accumulating and threading output of functions References: <5752F155.109@web.de> Message-ID: > f:: a -> b -> (b, c) > i.e. it returns a modified b and an additional c. Sounds like a monad (think of "b" as the state that's threaded). Stefan From chowells79 at gmail.com Sat Jun 4 17:10:11 2016 From: chowells79 at gmail.com (Carl Howells) Date: Sat, 4 Jun 2016 10:10:11 -0700 Subject: [Haskell-cafe] New version of itself In-Reply-To: References: <5752D697.5080507@web.de> Message-ID: That's basically a Mealy machine. See https://hackage.haskell.org/package/machines-0.6/docs/Data-Machine-Mealy.html newtype Logger a l = Logger (Mealy (a, Log l) (Log l)) Not quite an exact isomorphism since (,) is lifted, but it's close. You're not actually doing anything weird there. That's a pretty standard functional representation of a state machine. On Sat, Jun 4, 2016 at 8:00 AM, Daniel D?az wrote: > This is a bit of a tangent, but one can use the FoldM type from the foldl > package to build composable logger-like things that perform effects. > > The semigroupoids package contains the Extend typeclass, which is basically > "Comonad without extract". If we make FoldM an instance of Extend, we can > "single-step" a FoldM with the function: > > import Data.Functor.Extend (duplicated) > import qualified Control.Foldl as L > > singleStep :: i -> L.FoldM IO i r -> IO (L.FoldM IO i r) > singleStep i :: flip L.foldM [i] . duplicated > > Which is basically a logging function. > > Also, since FoldM is an instance of Applicative, you can combine a list of > loggers using sequenceA_. > > Another way to define a logger type would be with Cofree from the free > package. Something like: > > type Logger = Cofree ((->) String) (IO ()) > > Which would also be an Applicative. One could then define stateful loggers > using Cofree's unfold. > > I think the Cofree version has the advantage that you can be sure the > logger's state only depends on the messages it receives (even as it emits IO > actions on each step). The FoldM version, meanwhile, could perform some > devious IO action to update its state. > > On Saturday, June 4, 2016 at 3:24:57 PM UTC+2, martin wrote: >> >> Hello all, >> >> I find myself frequentlly writing types like this >> >> data Logger a l = Lgr { >> runLogger :: a -> Log l -> (Log l, Logger a l) >> } >> >> The purpose is to give a logger a chance to carry an internal state. It >> could e.g. choose to log only every n >> invocations. To do this it must keep track of how many times it has been >> called. I want to leave such things private to >> the Logger. >> >> >> (1) I know that this is not an unusal thing to do, but it has an OO feel >> to it. Is there a more functional alternative >> to it. Should I just not worry? >> >> (2) I can write a combinator which creates a Logger from a list of >> Loggers. Since each Logger potentially returns a new >> version of itself, I must always re-assemble the combined logger from all >> the returned new versions. I am worried that >> this is a costly operation, particularly when most Loggers just return >> themselves unaltered. I don't have any hard >> numbers about the performance penalty though. >> >> These Loggers are used in a discrete-event-simulation and they will get >> called many times (once for each event), but >> only occastionally actually write to the Log. >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskel... at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > From mitchellwrosen at gmail.com Sat Jun 4 20:32:08 2016 From: mitchellwrosen at gmail.com (Mitchell Rosen) Date: Sat, 4 Jun 2016 13:32:08 -0700 (PDT) Subject: [Haskell-cafe] Strange type error with -XTypeApplications Message-ID: This program: * {-# LANGUAGE TypeApplications #-}* * main = print (fromDynamic @Int undefined)* produces this error message: * foo.hs:3:15: error:* * ? Cannot apply expression of type ?t0?* * to a visible type argument ?Int?* * ? In the first argument of ?print?, namely* * ?(fromDynamic @Int undefined)?* * In the expression: print (fromDynamic @Int undefined)* * In an equation for ?main?:* * main = print (fromDynamic @Int undefined)* However, I'd expect it to be "Not in scope: fromDynamic" -------------- next part -------------- An HTML attachment was scrubbed... URL: From sperber at deinprogramm.de Sun Jun 5 13:09:17 2016 From: sperber at deinprogramm.de (Michael Sperber) Date: Sun, 05 Jun 2016 15:09:17 +0200 Subject: [Haskell-cafe] Final CFP: 4th ACM SIGPLAN International Workshop on Functional Art, Music, Modelling and Design Message-ID: 4th ACM SIGPLAN International Workshop on Functional Art, Music, Modelling and Design http://functional-art.org/2016/ Co-located with ICFP Nara, Japan, 24 September, 2016 Key Dates: Submission deadline - June 24 Author Notification - 15 July Camera Ready - 31 July Workshop - September 24, 2016 We welcome submissions from academic, professional, and independent programmers and artists. Final Call for Papers, Demos, *and* Performances The ACM SIGPLAN International Workshop on Functional Art, Music, Modelling and Design (FARM) gathers together people who are harnessing functional techniques in the pursuit of creativity and expression. Functional Programming has emerged as a mainstream software development paradigm, and its artistic and creative use is booming. A growing number of software toolkits, frameworks and environments for art, music and design now employ functional programming languages and techniques. FARM is a forum for exploration and critical evaluation of these developments, for example to consider potential benefits of greater consistency, tersity, and closer mapping to a problem domain. FARM encourages submissions from across art, craft and design, including textiles, visual art, music, 3D sculpture, animation, GUIs, video games, 3D printing and architectural models, choreography, poetry, and even VLSI layouts, GPU configurations, or mechanical engineering designs. Theoretical foundations, language design, implementation issues, and applications in industry or the arts are all within the scope of the workshop. The language used need not be purely functional ("mostly functional" is fine), and may be manifested as a domain specific language or tool. Moreover, submissions focusing on questions or issues about the use of functional programming are within the scope. Submit at : https://easychair.org/conferences/?conf=farm2016 From lcjanke2012 at gmail.com Sun Jun 5 17:35:49 2016 From: lcjanke2012 at gmail.com (Leonard Janke) Date: Sun, 5 Jun 2016 13:35:49 -0400 Subject: [Haskell-cafe] haskell-ide-engine versus hsdev (and Debuggers) Message-ID: Hello, I am new to Haskell and thinking of contributing to the IDE efforts. I've noticed two projects which aim to provide a "service" that editors and IDEs can call to help present useful information to programmers. I am wondering how these projects differ and why they are separate efforts since they seem to have very similar end goals? Another thing that I am wondering is if either of these two projects aims to provide debugger support and what the general state of debuggers for Haskell is? I've seen a project for a Haskell remote debugger which looks it was ghci/interpreter based and was being used by Eclipse and IntelliJ. It didn't work when I tried it, however, and I am not sure that the project is still active. It also looks like ghc only recently began adding support for debugging compiled Haskell and that initial efforts may be to get things working with gdb or lldb. Am I correctly understanding the current landscape as far as Haskell debuggers go? Thanks! Leonard -------------- next part -------------- An HTML attachment was scrubbed... URL: From dxld at darkboxed.org Sun Jun 5 18:02:27 2016 From: dxld at darkboxed.org (Daniel =?iso-8859-1?Q?Gr=F6ber?=) Date: Sun, 5 Jun 2016 20:02:27 +0200 Subject: [Haskell-cafe] haskell-ide-engine versus hsdev (and Debuggers) In-Reply-To: References: Message-ID: <20160605180227.GA7770@grml> Hi, On Sun, Jun 05, 2016 at 01:35:49PM -0400, Leonard Janke wrote: > I am new to Haskell and thinking of contributing to the IDE efforts. I've > noticed two projects which aim to provide a "service" that editors and IDEs > can call to help present useful information to programmers. I am wondering > how these projects differ and why they are separate efforts since they seem > to have very similar end goals? I think the differentiating factor is haskell-ide-engine is a very collaborative project with a lot more contributors than hsdev, which is pretty much a one-man show. Having worked in the Haskell developer tooling space for quite a while now I have to say I never really saw any official announcement of the hsdev project I just sort of stumbled upon it when I noticed it was using my project (ghc-mod). Haskell-ide-engine on the other hand was officially announced and discussed publicly quite a bit. > Another thing that I am wondering is if either of these two projects aims > to provide debugger support and what the general state of debuggers for > Haskell is? I've seen a project for a Haskell remote debugger which looks > it was ghci/interpreter based and was being used by Eclipse and IntelliJ. > It didn't work when I tried it, however, and I am not sure that the project > is still active. It also looks like ghc only recently began adding support > for debugging compiled Haskell and that initial efforts may be to get > things working with gdb or lldb. Am I correctly understanding the current > landscape as far as Haskell debuggers go? I think debugger support pretty much has to come from GHC there isn't all that much an external project can do other than pass through whatever GHC provides to the IDE but I'm not too familliar with the debug support that does exist. --Daniel -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: From erbalrajs at gmail.com Sun Jun 5 20:21:56 2016 From: erbalrajs at gmail.com (Balraj Singh) Date: Mon, 6 Jun 2016 01:51:56 +0530 Subject: [Haskell-cafe] Having issue in running Haskell code in Atom Message-ID: Hello All, I have started learning Haskell couple of days ago. I was looking for an IDE and found Atom as one of them. When I started using it I installed multiple packages and tried running creating Haskell files and saving it. This IDE always gives me following error. Please help to debug this: [Enter steps to reproduce below:] 1. ... 2. ... **Atom Version**: 1.7.4 **System**: Microsoft Windows 10 Pro **Thrown From**: [haskell-ghc-mod]( https://github.com/atom-haskell/haskell-ghc-mod) package, v1.14.5 ### Stack Trace Haskell-ghc-mod: ghc-mod failed to launch. It is probably missing or misconfigured. ENOENT ``` At Error: spawn ghc-mod ENOENT PATH: undefined path: undefined Path: C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Users\Balraj Singh\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Java\jdk1.7.0_71\lib;C:\Program Files (x86)\Java\jre7\lib;C:\Program Files (x86)\Java\jdk1.7.0_71\bin;C:\Program Files (x86)\Java\jre7\bin;C:\Program Files\Git\cmd;C:\Program Files (x86)\WinMerge;C:\ghc-8.0.1\bin;C:\Users\Balraj Singh\AppData\Local\atom\bin Error at file:///C:/Users/Balraj Singh/.atom/packages/haskell-ghc-mod/lib/util.coffee:60:26 at exithandler (child_process.js:232:5) at ChildProcess.errorhandler (child_process.js:244:5) at emitOne (events.js:77:13) at ChildProcess.emit (events.js:169:7) at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12) at onErrorNT (internal/child_process.js:344:16) at doNTCallback2 (node.js:465:9) at process._tickCallback (node.js:379:17) ``` ### Commands ``` -8:25.4.0 core:backspace (atom-text-editor.editor.is-focused) 3x -8:22 core:save (atom-text-editor.editor.is-focused) -8:00.7.0 tabs:open-in-new-window (li.texteditor.tab.sortable.active.right-clicked) -7:50.5.0 tree-view:show-in-file-manager (span.name.icon.icon-file-text) -3:30.1.0 core:save (atom-text-editor.editor.is-focused) -3:22.2.0 haskell-ghc-mod:go-to-declaration (atom-text-editor.editor.is-focused) 2x -2:53 ide-haskell:prettify-file (atom-text-editor.editor.is-focused) -2:39.2.0 ide-haskell:toggle-output (atom-text-editor.editor.is-focused) -2:34.6.0 ide-haskell-cabal:build (atom-text-editor.editor.is-focused) -2:24.8.0 ide-haskell-cabal:test (atom-text-editor.editor.is-focused) -2:18.5.0 haskell-ghc-mod:check-file (atom-text-editor.editor.is-focused) -2:14.6.0 haskell-ghc-mod:lint-file (atom-text-editor.editor.is-focused) -2:03.4.0 ide-haskell:prettify-file (atom-text-editor.editor.is-focused) -1:53.1.0 haskell-ghc-mod:lint-file (atom-text-editor.editor.is-focused) 2x -0:59.2.0 haskell-ghc-mod:check-file (atom-text-editor.editor.is-focused) -0:03.8.0 haskell-ghc-mod:shutdown-backend (atom-text-editor.editor.is-focused) ``` ### Config ```json {} ``` ### Installed Packages ```coffee # User haskell-ghc-mod, v1.14.5 ide-haskell, v1.6.5 ide-haskell-cabal, v1.4.0 ide-haskell-repl, v0.0.23 language-haskell, v1.7.16 # Dev No dev packages ``` Regards, Balraj Singh -------------- next part -------------- An HTML attachment was scrubbed... URL: From sean at mistersg.net Sun Jun 5 21:00:35 2016 From: sean at mistersg.net (Sean Gillespie) Date: Sun, 5 Jun 2016 17:00:35 -0400 Subject: [Haskell-cafe] Having issue in running Haskell code in Atom In-Reply-To: References: Message-ID: <20160605210035.GA25612@sean-archlinux-2> > Hello All, > > I have started learning Haskell couple of days ago. I was looking for an > IDE and found Atom as one of them. When I started using it I installed > multiple packages and tried running creating Haskell files and saving it. > This IDE always gives me following error. Please help to debug this: > > Haskell-ghc-mod: ghc-mod failed to launch. It is probably missing or > misconfigured. ENOENT A quick guess here--ghc-mod is either not installed or is not in your execution path. Try adding it's path to your "Path" variable and try again. From erbalrajs at gmail.com Sun Jun 5 21:19:20 2016 From: erbalrajs at gmail.com (Balraj Singh) Date: Mon, 6 Jun 2016 02:49:20 +0530 Subject: [Haskell-cafe] Having issue in running Haskell code in Atom In-Reply-To: <20160605210035.GA25612@sean-archlinux-2> References: <20160605210035.GA25612@sean-archlinux-2> Message-ID: I read the following configuration needs to be set:- [image: Inline image 1] But i don't have any .cabal folder. I have .atom folder. Am i missing something? Plus you may see i have installed *ide-haskell-cabal, v1.4.0 * in the above error message. On Mon, Jun 6, 2016 at 2:30 AM, Sean Gillespie wrote: > > Hello All, > > > > I have started learning Haskell couple of days ago. I was looking for an > > IDE and found Atom as one of them. When I started using it I installed > > multiple packages and tried running creating Haskell files and saving it. > > This IDE always gives me following error. Please help to debug this: > > > > Haskell-ghc-mod: ghc-mod failed to launch. It is probably missing or > > misconfigured. ENOENT > > A quick guess here--ghc-mod is either not installed or is not in your > execution > path. Try adding it's path to your "Path" variable and try again. > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image.png Type: image/png Size: 70763 bytes Desc: not available URL: From yoyoyonny at gmail.com Sun Jun 5 21:29:54 2016 From: yoyoyonny at gmail.com (Jonne Ransijn) Date: Sun, 5 Jun 2016 23:29:54 +0200 Subject: [Haskell-cafe] Having issue in running Haskell code in Atom In-Reply-To: References: Message-ID: First you need the Haskell Platform (I would asume you already have it installed?) Run 'cabal install ghc-mod'. If you have cabal, it should now have installed ghc-mod. Now, if you run 'which ghc-mod' (or 'where ghc-mod', or 'whereis ghc-mod', depending on your system) you will get a path to put in ghcModPath. -------------- next part -------------- An HTML attachment was scrubbed... URL: From erbalrajs at gmail.com Sun Jun 5 22:18:26 2016 From: erbalrajs at gmail.com (Balraj Singh) Date: Mon, 6 Jun 2016 03:48:26 +0530 Subject: [Haskell-cafe] Having issue in running Haskell code in Atom In-Reply-To: References: Message-ID: Hi, I did try to follow your steps to install ghc-mod via cabal in Windows. But i believe cabal package that i installed within atom ide is not working fine. When so ever i am trying to install a dependency using cabal within atom ide it gives the following error: [Enter steps to reproduce below:] 1. ... 2. ... **Atom Version**: 1.7.4 **System**: Microsoft Windows 10 Pro **Thrown From**: [cabal](https://github.com/edsko/atom-cabal) package, v0.0.17 ### Stack Trace Uncaught TypeError: path must be a string ``` At fs.js:856 TypeError: path must be a string at TypeError (native) at Object.fs.readdirSync (fs.js:856:18) at Object.fs.readdirSync (ATOM_SHELL_ASAR.js:497:28) at containsCabalFile (file:///C:/Users/Balraj Singh/.atom/packages/cabal/lib/cabal.coffee:263:17) at findCabalFile (file:///C:/Users/Balraj Singh/.atom/packages/cabal/lib/cabal.coffee:248:13) at Object.module.exports.Cabal.cabalInstallDeps (file:///C:/Users/Balraj Singh/.atom/packages/cabal/lib/cabal.coffee:97:30) at atom-workspace.subscriptions.add.atom.commands.add.cabal:install-dependencies (file:///C:/Users/Balraj Singh/.atom/packages/cabal/lib/cabal.coffee:39:8) at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (C:\Users\Balraj Singh\AppData\Local\atom\app-1.7.4\resources\app.asar\src\command-registry.js:260:29) at CommandRegistry.handleCommandEvent (C:\Users\Balraj Singh\AppData\Local\atom\app-1.7.4\resources\app.asar\src\command-registry.js:3:61) at CommandRegistry.module.exports.CommandRegistry.dispatch (C:\Users\Balraj Singh\AppData\Local\atom\app-1.7.4\resources\app.asar\src\command-registry.js:160:19) at AtomEnvironment.module.exports.AtomEnvironment.dispatchApplicationMenuCommand (C:\Users\Balraj Singh\AppData\Local\atom\app-1.7.4\resources\app.asar\src\atom-environment.js:1100:28) at EventEmitter.outerCallback (C:\Users\Balraj Singh\AppData\Local\atom\app-1.7.4\resources\app.asar\src\application-delegate.js:314:25) at emitTwo (events.js:87:13) at EventEmitter.emit (events.js:172:7) ``` ### Commands ``` -9:33.3.0 cabal:install-dependencies (atom-text-editor.editor.is-focused) -8:30.9.0 cabal:build-and-install (atom-text-editor.editor.is-focused) 2x -7:50.9.0 cabal:install-dependencies (atom-text-editor.editor.is-focused) -4:40.6.0 command-palette:toggle (atom-text-editor.editor.is-focused) -4:13.5.0 core:select-all (atom-text-editor.editor.mini.is-focused) -4:12.6.0 core:paste (atom-text-editor.editor.mini.is-focused) -4:11 core:confirm (atom-text-editor.editor.mini.is-focused) -0:08.6.0 cabal:install-dependencies (atom-text-editor.editor.is-focused) ``` ### Config ```json {} ``` ### Installed Packages ```coffee # User cabal, v0.0.17 # Dev No dev packages ``` On Mon, Jun 6, 2016 at 2:59 AM, Jonne Ransijn wrote: > First you need the Haskell Platform (I would asume you already have it > installed?) > > Run 'cabal install ghc-mod'. > > If you have cabal, it should now have installed ghc-mod. Now, if you run > 'which ghc-mod' (or 'where ghc-mod', or 'whereis ghc-mod', depending on > your system) you will get a path to put in ghcModPath. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From yoyoyonny at gmail.com Mon Jun 6 06:04:21 2016 From: yoyoyonny at gmail.com (Jonne Ransijn) Date: Mon, 6 Jun 2016 08:04:21 +0200 Subject: [Haskell-cafe] Having issue in running Haskell code in Atom In-Reply-To: References: Message-ID: Try to run the commands from the command line and make sure the Haskell Platform is installed. The cabal package in atom provides a minimal replacement, not the full Haskell Platform. -------------- next part -------------- An HTML attachment was scrubbed... URL: From yoyoyonny at gmail.com Mon Jun 6 06:15:12 2016 From: yoyoyonny at gmail.com (Jonne Ransijn) Date: Mon, 6 Jun 2016 08:15:12 +0200 Subject: [Haskell-cafe] Having issue in running Haskell code in Atom In-Reply-To: References: Message-ID: EDIT: You seem to have https://atom.io/packages/cabal installed, which is deprecated in favor of the ide-haskell-cabal package. Please uninstall this package (and any other packages related to Haskell) and install the ide-haskell-* packages. -------------- next part -------------- An HTML attachment was scrubbed... URL: From martin.drautzburg at web.de Mon Jun 6 08:00:31 2016 From: martin.drautzburg at web.de (martin) Date: Mon, 6 Jun 2016 10:00:31 +0200 Subject: [Haskell-cafe] New version of itself In-Reply-To: References: <5752D697.5080507@web.de> Message-ID: <57552D9F.10807@web.de> Carl, thanks for pointing me towards mealy machines. Maybe you can help me with this one: I am trying to compose two mealy machines into one. Suppose I have m1 :: Mealy a Bool m2 :: Mealy a Bool now I want a combinded mealy machine which outputs True when both m1 and m2 return True and False otherwise. I can write this using runMealy. But this looks awkward, because it is a bare-bones implementation and doesn't make use of any of the typeclasses Mealy is a member of. I.e. the machines package is basically not used at all. Am 06/04/2016 um 07:10 PM schrieb Carl Howells: > That's basically a Mealy machine. See > https://hackage.haskell.org/package/machines-0.6/docs/Data-Machine-Mealy.html > > newtype Logger a l = Logger (Mealy (a, Log l) (Log l)) > > Not quite an exact isomorphism since (,) is lifted, but it's close. > > You're not actually doing anything weird there. That's a pretty > standard functional representation of a state machine. > From hesselink at gmail.com Mon Jun 6 08:20:45 2016 From: hesselink at gmail.com (Erik Hesselink) Date: Mon, 6 Jun 2016 10:20:45 +0200 Subject: [Haskell-cafe] New version of itself In-Reply-To: <57552D9F.10807@web.de> References: <5752D697.5080507@web.de> <57552D9F.10807@web.de> Message-ID: Since `Mealy a` is an instance of `Applicative` you can do: (&&) <$> m1 <*> m2 It's also a monad, so do notation would also work. Erik On 6 June 2016 at 10:00, martin wrote: > Carl, > > thanks for pointing me towards mealy machines. > > Maybe you can help me with this one: I am trying to compose two mealy machines into one. Suppose I have > > m1 :: Mealy a Bool > m2 :: Mealy a Bool > > now I want a combinded mealy machine which outputs True when both m1 and m2 return True and False otherwise. I can write > this using runMealy. But this looks awkward, because it is a bare-bones implementation and doesn't make use of any of > the typeclasses Mealy is a member of. I.e. the machines package is basically not used at all. > > > > Am 06/04/2016 um 07:10 PM schrieb Carl Howells: >> That's basically a Mealy machine. See >> https://hackage.haskell.org/package/machines-0.6/docs/Data-Machine-Mealy.html >> >> newtype Logger a l = Logger (Mealy (a, Log l) (Log l)) >> >> Not quite an exact isomorphism since (,) is lifted, but it's close. >> >> You're not actually doing anything weird there. That's a pretty >> standard functional representation of a state machine. >> > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe From lambda.fairy at gmail.com Mon Jun 6 08:24:27 2016 From: lambda.fairy at gmail.com (Chris Wong) Date: Mon, 6 Jun 2016 20:24:27 +1200 Subject: [Haskell-cafe] New version of itself In-Reply-To: <57552D9F.10807@web.de> References: <5752D697.5080507@web.de> <57552D9F.10807@web.de> Message-ID: On Mon, Jun 6, 2016 at 8:00 PM, martin wrote: > Carl, > > thanks for pointing me towards mealy machines. > > Maybe you can help me with this one: I am trying to compose two mealy machines into one. Suppose I have > > m1 :: Mealy a Bool > m2 :: Mealy a Bool > > now I want a combinded mealy machine which outputs True when both m1 and m2 return True and False otherwise. I can write > this using runMealy. But this looks awkward, because it is a bare-bones implementation and doesn't make use of any of > the typeclasses Mealy is a member of. I.e. the machines package is basically not used at all. Hi Martin, I'm not terribly familiar with machines, but since Mealy is an Applicative you can try (&&) <$> m1 <*> m2 Hope this helps. > > Am 06/04/2016 um 07:10 PM schrieb Carl Howells: >> That's basically a Mealy machine. See >> https://hackage.haskell.org/package/machines-0.6/docs/Data-Machine-Mealy.html >> >> newtype Logger a l = Logger (Mealy (a, Log l) (Log l)) >> >> Not quite an exact isomorphism since (,) is lifted, but it's close. >> >> You're not actually doing anything weird there. That's a pretty >> standard functional representation of a state machine. >> > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe -- 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 martin.drautzburg at web.de Mon Jun 6 09:11:09 2016 From: martin.drautzburg at web.de (martin) Date: Mon, 6 Jun 2016 11:11:09 +0200 Subject: [Haskell-cafe] New version of itself In-Reply-To: References: <5752D697.5080507@web.de> <57552D9F.10807@web.de> Message-ID: <57553E2D.3050104@web.de> Applicative does the trick. But using do-notation was my first attempts, but I could not figure it out. Can you see how to do this (other than using `ap`)? Am 06/06/2016 um 10:20 AM schrieb Erik Hesselink: > Since `Mealy a` is an instance of `Applicative` you can do: > > (&&) <$> m1 <*> m2 > > It's also a monad, so do notation would also work. > > Erik > > On 6 June 2016 at 10:00, martin wrote: >> Carl, >> >> thanks for pointing me towards mealy machines. >> >> Maybe you can help me with this one: I am trying to compose two mealy machines into one. Suppose I have >> >> m1 :: Mealy a Bool >> m2 :: Mealy a Bool >> >> now I want a combinded mealy machine which outputs True when both m1 and m2 return True and False otherwise. I can write >> this using runMealy. But this looks awkward, because it is a bare-bones implementation and doesn't make use of any of >> the typeclasses Mealy is a member of. I.e. the machines package is basically not used at all. From hesselink at gmail.com Mon Jun 6 10:42:55 2016 From: hesselink at gmail.com (Erik Hesselink) Date: Mon, 6 Jun 2016 12:42:55 +0200 Subject: [Haskell-cafe] New version of itself In-Reply-To: <57553E2D.3050104@web.de> References: <5752D697.5080507@web.de> <57552D9F.10807@web.de> <57553E2D.3050104@web.de> Message-ID: do r1 <- m1 r2 <- m2 return (r1 && r2) Erik On 6 June 2016 at 11:11, martin wrote: > Applicative does the trick. But using do-notation was my first attempts, but I could not figure it out. Can you see how > to do this (other than using `ap`)? > > > Am 06/06/2016 um 10:20 AM schrieb Erik Hesselink: >> Since `Mealy a` is an instance of `Applicative` you can do: >> >> (&&) <$> m1 <*> m2 >> >> It's also a monad, so do notation would also work. >> >> Erik >> >> On 6 June 2016 at 10:00, martin wrote: >>> Carl, >>> >>> thanks for pointing me towards mealy machines. >>> >>> Maybe you can help me with this one: I am trying to compose two mealy machines into one. Suppose I have >>> >>> m1 :: Mealy a Bool >>> m2 :: Mealy a Bool >>> >>> now I want a combinded mealy machine which outputs True when both m1 and m2 return True and False otherwise. I can write >>> this using runMealy. But this looks awkward, because it is a bare-bones implementation and doesn't make use of any of >>> the typeclasses Mealy is a member of. I.e. the machines package is basically not used at all. > From martin.drautzburg at web.de Mon Jun 6 11:54:08 2016 From: martin.drautzburg at web.de (martin) Date: Mon, 6 Jun 2016 13:54:08 +0200 Subject: [Haskell-cafe] New version of itself In-Reply-To: References: <5752D697.5080507@web.de> <57552D9F.10807@web.de> <57553E2D.3050104@web.de> Message-ID: <57556460.5030109@web.de> Am 06/06/2016 um 12:42 PM schrieb Erik Hesselink: > do r1 <- m1 > r2 <- m2 > return (r1 && r2) > > Erik > > On 6 June 2016 at 11:11, martin wrote: >> Applicative does the trick. But using do-notation was my first attempts, but I could not figure it out. Can you see how >> to do this (other than using `ap`)? I thought this was what I tried, but I must have made a silly mistake somewhere. After your reassurance it works. Thanks. From dominic at steinitz.org Mon Jun 6 13:03:04 2016 From: dominic at steinitz.org (Dominic Steinitz) Date: Mon, 6 Jun 2016 14:03:04 +0100 Subject: [Haskell-cafe] New Haddock Message-ID: <6046CE60-F8F9-4447-B00F-7657FDE1C965@steinitz.org> I couldn?t find an announcement of the new version of Haddock. You can now document your libraries even more beautifully. For example, > -- \[ > -- f(k;n,p) = \Pr(X = k) = \binom n k p^k(1-p)^{n-k} > -- \] will render as https://hackage.haskell.org/package/random-fu-0.2.7.0/docs/Data-Random-Distribution-Binomial.html#v:integralBinomialPDF Also don?t forget you can put really nice diagrams in your documentation e.g. http://hackage.haskell.org/package/diagrams-contrib-1.3.0.7/docs/Diagrams-Example-Logo.html and http://hackage.haskell.org/package/diagrams-contrib-1.3.0.7/docs/Diagrams-TwoD-Layout-Tree.html . Dominic Steinitz dominic at steinitz.org http://idontgetoutmuch.wordpress.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From simon at joyful.com Mon Jun 6 14:19:51 2016 From: simon at joyful.com (Simon Michael) Date: Mon, 6 Jun 2016 07:19:51 -0700 Subject: [Haskell-cafe] Having issue in running Haskell code in Atom In-Reply-To: References: Message-ID: On 6/5/16 1:21 PM, Balraj Singh wrote: > I have started learning Haskell couple of days ago. I was looking for an > IDE and found Atom as one of them. When I started using it I installed > multiple packages and tried running creating Haskell files and saving it. > This IDE always gives me following error. Please help to debug this: Here's an Atom setup how-to: http://github.com/simonmichael/haskell-atom-setup The #haskell-ide IRC channel is also available for troubleshooting. From plevexier at gmail.com Mon Jun 6 15:03:58 2016 From: plevexier at gmail.com (Patrice) Date: Mon, 6 Jun 2016 11:03:58 -0400 Subject: [Haskell-cafe] uninstalling ghc-8.0.1-x86_64 installed through "install-haskell-platform.sh" Message-ID: Hi all, How can I uninstall cleanly ghc-8.0.1-x86_64 that I installed using the script install-haskell-platform.sh (found on haskell.org website under Generic Linux). I'm on ubuntu Trusty. Thanks, Pat -------------- next part -------------- An HTML attachment was scrubbed... URL: From gfixler at gmail.com Mon Jun 6 16:05:10 2016 From: gfixler at gmail.com (Gary Fixler) Date: Mon, 6 Jun 2016 09:05:10 -0700 Subject: [Haskell-cafe] uninstalling ghc-8.0.1-x86_64 installed through "install-haskell-platform.sh" In-Reply-To: References: Message-ID: I grabbed the "Minimal (64 bit)" tar (YMMV if you got the Full or 32-bit versions) and had a look inside. It contains just the .sh file and a .gz archive. The contents of the script are small; beyond a few tests, it basically just does a `tar -C /` on the .gz file, which just unpacks all the files in there to their original directories under root, and then calls a setup script that unpacks with/into that big list of files. Listing the contents of the .gz, every single file path (of 7,377) begins with "usr/local/haskell/ghc-8.0.1-x86_64/", so everything unpacked should be contained in there. The follow-up script that gets called is in there under .../bin/activate-hs. Things get a bit more complex in that script. It can be called with a few options, but isn't called with any from the initial install script, so the following few things then happen (after some simple, script-internal, setup stuff): 1) these symlink calls fire off, linking bin, man, and doc files from the /usr/local/haskell/ghc*/ dir created above to the same locations in the default directory (/usr/local/, as set at the top of the script), and note that the script cleanly exits if it doesn't find bin and share in the default dir (i.e. if you don't have /usr/local/bin and /usr/local/share for some reason): symLinkInto "$prefix/bin" "$ghcRoot"/bin/* symLinkInto "$prefix/share/man/man1" "$ghcRoot"/share/man/man1/* symLinkInto "$prefix/share/doc" "$ghcRoot"/share/doc/ghc The files in the bin dir that should have been copied from the aforementioned `tar -C /`, which would alll get linked over are: usr/local/haskell/ghc-8.0.1-x86_64/bin/hp2ps usr/local/haskell/ghc-8.0.1-x86_64/bin/ghc-8.0.1 usr/local/haskell/ghc-8.0.1-x86_64/bin/runghc usr/local/haskell/ghc-8.0.1-x86_64/bin/happy usr/local/haskell/ghc-8.0.1-x86_64/bin/activate-hs usr/local/haskell/ghc-8.0.1-x86_64/bin/HsColour usr/local/haskell/ghc-8.0.1-x86_64/bin/ghc-pkg-8.0.1 usr/local/haskell/ghc-8.0.1-x86_64/bin/hpc usr/local/haskell/ghc-8.0.1-x86_64/bin/runhaskell usr/local/haskell/ghc-8.0.1-x86_64/bin/runghc-8.0.1 usr/local/haskell/ghc-8.0.1-x86_64/bin/hsc2hs usr/local/haskell/ghc-8.0.1-x86_64/bin/ghci usr/local/haskell/ghc-8.0.1-x86_64/bin/alex usr/local/haskell/ghc-8.0.1-x86_64/bin/cabal usr/local/haskell/ghc-8.0.1-x86_64/bin/stack usr/local/haskell/ghc-8.0.1-x86_64/bin/haddock usr/local/haskell/ghc-8.0.1-x86_64/bin/ghci-8.0.1 usr/local/haskell/ghc-8.0.1-x86_64/bin/ghc-pkg usr/local/haskell/ghc-8.0.1-x86_64/bin/haddock-ghc-8.0.1 usr/local/haskell/ghc-8.0.1-x86_64/bin/ghc Likewise, the man1 files linked over are just this one: usr/local/haskell/ghc-8.0.1-x86_64/share/man/man1/ghc.1 And finally, the [large number of] doc files... well, I'm not sure how this works, as it's symlinking from"$ghcRoot"/share/doc/ghc/ in the call above, but the files are all contained in "$ghcRoot"/share/doc/ghc-8.0.1/ in the .gz file. I'm wondering if this is a bug in the installation (and why I never seemed to have any local docs for ghc): usr/local/haskell/ghc-8.0.1-x86_64/share/doc/ghc-8.0.1/html/ usr/local/haskell/ghc-8.0.1-x86_64/share/doc/ghc-8.0.1/html/users_guide/ usr/local/haskell/ghc-8.0.1-x86_64/share/doc/ghc-8.0.1/html/users_guide/phases.html usr/local/haskell/ghc-8.0.1-x86_64/share/doc/ghc-8.0.1/html/users_guide/_images/ usr/local/haskell/ghc-8.0.1-x86_64/share/doc/ghc-8.0.1/html/users_guide/_images/prof_scc.svg usr/local/haskell/ghc-8.0.1-x86_64/share/doc/ghc-8.0.1/html/users_guide/ghc.html ...snipped here, as there are 3,633 in all, but all under .../ghc-8.0.1/... 2) packages then get registered via: for conf in "$ghcRoot"/etc/registrations/* do run "$ghcRoot"/bin/ghc-pkg register --verbose=0 --force $conf 2>/dev/null done The only thing I see in the .gz for registrations is: usr/local/haskell/ghc-8.0.1-x86_64/etc/registrations/hscolour-1.24 I don't know what unregistering packages entails, sorry. 3) finally, some reporting on what it did I think that's it. If you installed the full version, you may have much more than this, but maybe this will serve as a guide to figuring that out. It's not as messy as I guessed, but I don't know that there's any command or one-liner that cleanly removes it all. -g On Mon, Jun 6, 2016 at 8:03 AM, Patrice wrote: > Hi all, > > How can I uninstall cleanly ghc-8.0.1-x86_64 that I installed using the > script install-haskell-platform.sh (found on haskell.org website under > Generic Linux). I'm on ubuntu Trusty. > > Thanks, > > Pat > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > From plevexier at gmail.com Mon Jun 6 17:39:29 2016 From: plevexier at gmail.com (Patrice) Date: Mon, 6 Jun 2016 13:39:29 -0400 Subject: [Haskell-cafe] uninstalling ghc-8.0.1-x86_64 installed through "install-haskell-platform.sh" In-Reply-To: References: Message-ID: Thank you Gary, I should have done that myself, that's why I hoped for a 1 liner :) What I actually did was to remove that directory usr/local/haskell/ghc-8.0.1-x86_64/, and installed haskell-platform with apt-get, which I believe overwrote all the sym links. After that, I just apt-get remove haskell-platform and everything seems to be clean. Pat On Mon, Jun 6, 2016 at 12:05 PM, Gary Fixler wrote: > I grabbed the "Minimal (64 bit)" tar (YMMV if you got the Full or > 32-bit versions) and had a look inside. It contains just the .sh file > and a .gz archive. The contents of the script are small; beyond a few > tests, it basically just does a `tar -C /` on the .gz file, which just > unpacks all the files in there to their original directories under > root, and then calls a setup script that unpacks with/into that big > list of files. > > Listing the contents of the .gz, every single file path (of 7,377) > begins with "usr/local/haskell/ghc-8.0.1-x86_64/", so everything > unpacked should be contained in there. The follow-up script that gets > called is in there under .../bin/activate-hs. Things get a bit more > complex in that script. It can be called with a few options, but isn't > called with any from the initial install script, so the following few > things then happen (after some simple, script-internal, setup stuff): > > 1) these symlink calls fire off, linking bin, man, and doc files from > the /usr/local/haskell/ghc*/ dir created above to the same locations > in the default directory (/usr/local/, as set at the top of the > script), and note that the script cleanly exits if it doesn't find bin > and share in the default dir (i.e. if you don't have /usr/local/bin > and /usr/local/share for some reason): > > symLinkInto "$prefix/bin" "$ghcRoot"/bin/* > symLinkInto "$prefix/share/man/man1" "$ghcRoot"/share/man/man1/* > symLinkInto "$prefix/share/doc" "$ghcRoot"/share/doc/ghc > > The files in the bin dir that should have been copied from the > aforementioned `tar -C /`, which would alll get linked over are: > > usr/local/haskell/ghc-8.0.1-x86_64/bin/hp2ps > usr/local/haskell/ghc-8.0.1-x86_64/bin/ghc-8.0.1 > usr/local/haskell/ghc-8.0.1-x86_64/bin/runghc > usr/local/haskell/ghc-8.0.1-x86_64/bin/happy > usr/local/haskell/ghc-8.0.1-x86_64/bin/activate-hs > usr/local/haskell/ghc-8.0.1-x86_64/bin/HsColour > usr/local/haskell/ghc-8.0.1-x86_64/bin/ghc-pkg-8.0.1 > usr/local/haskell/ghc-8.0.1-x86_64/bin/hpc > usr/local/haskell/ghc-8.0.1-x86_64/bin/runhaskell > usr/local/haskell/ghc-8.0.1-x86_64/bin/runghc-8.0.1 > usr/local/haskell/ghc-8.0.1-x86_64/bin/hsc2hs > usr/local/haskell/ghc-8.0.1-x86_64/bin/ghci > usr/local/haskell/ghc-8.0.1-x86_64/bin/alex > usr/local/haskell/ghc-8.0.1-x86_64/bin/cabal > usr/local/haskell/ghc-8.0.1-x86_64/bin/stack > usr/local/haskell/ghc-8.0.1-x86_64/bin/haddock > usr/local/haskell/ghc-8.0.1-x86_64/bin/ghci-8.0.1 > usr/local/haskell/ghc-8.0.1-x86_64/bin/ghc-pkg > usr/local/haskell/ghc-8.0.1-x86_64/bin/haddock-ghc-8.0.1 > usr/local/haskell/ghc-8.0.1-x86_64/bin/ghc > > Likewise, the man1 files linked over are just this one: > > usr/local/haskell/ghc-8.0.1-x86_64/share/man/man1/ghc.1 > > And finally, the [large number of] doc files... well, I'm not sure how > this works, as it's symlinking from"$ghcRoot"/share/doc/ghc/ in the > call above, but the files are all contained in > "$ghcRoot"/share/doc/ghc-8.0.1/ in the .gz file. I'm wondering if this > is a bug in the installation (and why I never seemed to have any local > docs for ghc): > > usr/local/haskell/ghc-8.0.1-x86_64/share/doc/ghc-8.0.1/html/ > usr/local/haskell/ghc-8.0.1-x86_64/share/doc/ghc-8.0.1/html/users_guide/ > > usr/local/haskell/ghc-8.0.1-x86_64/share/doc/ghc-8.0.1/html/users_guide/phases.html > > usr/local/haskell/ghc-8.0.1-x86_64/share/doc/ghc-8.0.1/html/users_guide/_images/ > > usr/local/haskell/ghc-8.0.1-x86_64/share/doc/ghc-8.0.1/html/users_guide/_images/prof_scc.svg > > usr/local/haskell/ghc-8.0.1-x86_64/share/doc/ghc-8.0.1/html/users_guide/ghc.html > ...snipped here, as there are 3,633 in all, but all under .../ghc-8.0.1/... > > 2) packages then get registered via: > > for conf in "$ghcRoot"/etc/registrations/* > do > run "$ghcRoot"/bin/ghc-pkg register --verbose=0 --force $conf > 2>/dev/null > done > > The only thing I see in the .gz for registrations is: > > usr/local/haskell/ghc-8.0.1-x86_64/etc/registrations/hscolour-1.24 > > I don't know what unregistering packages entails, sorry. > > 3) finally, some reporting on what it did > > > I think that's it. If you installed the full version, you may have > much more than this, but maybe this will serve as a guide to figuring > that out. It's not as messy as I guessed, but I don't know that > there's any command or one-liner that cleanly removes it all. > > -g > > > > On Mon, Jun 6, 2016 at 8:03 AM, Patrice wrote: > > Hi all, > > > > How can I uninstall cleanly ghc-8.0.1-x86_64 that I installed using the > > script install-haskell-platform.sh (found on haskell.org website under > > Generic Linux). I'm on ubuntu Trusty. > > > > Thanks, > > > > Pat > > > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From skosyrev at ptsecurity.com Tue Jun 7 12:07:55 2016 From: skosyrev at ptsecurity.com (Kosyrev Serge) Date: Tue, 7 Jun 2016 15:07:55 +0300 Subject: [Haskell-cafe] On-site GHC-related Haskell/C opportunity at Positive Technologies (Moscow) Message-ID: <874m95cick.fsf@ptsecurity.com> Good day! The Moscow office of Positive Technologies (https://www.ptsecurity.com) is looking for an experienced Haskell developer with a strong C background. You will be working in a team that develops a next generation security platform: think widely available, easy to use, dramatically enhanced security. In particular, we want you to help rewrite our core application in Haskell, which in turn requires porting GHC runtime to run on bare metal. Details can be seen in our Reddit posting: https://www.reddit.com/r/haskell/comments/4msraq/onsite_ghcrelated_haskellc_opportunity_at/ To apply, send you resume or questions to career at ptsecurity.com and CC skosyrev at ptsecurity.com. -- respectfully, Kosyrev Serge http://www.ptsecurity.com/ Habr: http://habr.ru/company/pt Twitter: @ptsecurity https://twitter.com/ptsecurity From johannes.waldmann at htwk-leipzig.de Tue Jun 7 12:41:22 2016 From: johannes.waldmann at htwk-leipzig.de (Johannes Waldmann) Date: Tue, 7 Jun 2016 14:41:22 +0200 Subject: [Haskell-cafe] New Haddock Message-ID: <6059c3c3-70dd-ae7b-2eaa-63a83e29e674@htwk-leipzig.de> > You can now document your libraries even more beautifully Yes. Formulas are nice. But the main selling point is hyperlinked source? But it's really not applicable for me at the moment, because when I build with 7.10.3, I get (conflict: haddock-api => ghc>=8.0 && <8.2) I want to use it for documenting source that's not 8-ified. Well, perhaps my source is, but it depends on other packages that currently are not. - J. From johannes.waldmann at htwk-leipzig.de Tue Jun 7 13:28:49 2016 From: johannes.waldmann at htwk-leipzig.de (Johannes Waldmann) Date: Tue, 7 Jun 2016 15:28:49 +0200 Subject: [Haskell-cafe] New Haddock Message-ID: .. is hyperlinked source active on hackage when ghc-8 is used? here it is not: http://hackage.haskell.org/package/obdd-0.3.3/reports/1 - J. From benl at ouroborus.net Tue Jun 7 13:37:31 2016 From: benl at ouroborus.net (Ben Lippmeier) Date: Tue, 7 Jun 2016 23:37:31 +1000 Subject: [Haskell-cafe] On-site GHC-related Haskell/C opportunity at Positive Technologies (Moscow) In-Reply-To: <874m95cick.fsf@ptsecurity.com> References: <874m95cick.fsf@ptsecurity.com> Message-ID: <7BDE0DA1-88D9-41E2-A92D-6273BEED7086@ouroborus.net> > On 7 Jun 2016, at 10:07 pm, Kosyrev Serge wrote: > > In particular, we want you to help rewrite our core application in > Haskell, which in turn requires porting GHC runtime to run on bare metal. > Galois has already done work like this, which might help. https://github.com/GaloisInc/HaLVM Ben. -------------- next part -------------- An HTML attachment was scrubbed... URL: From J.T.Jeuring at uu.nl Tue Jun 7 16:08:44 2016 From: J.T.Jeuring at uu.nl (Johan Jeuring) Date: Tue, 7 Jun 2016 18:08:44 +0200 Subject: [Haskell-cafe] Vacancy: Professor Software technology at Utrecht University Message-ID: <6D21F286-84F8-46F2-840D-BCD3937FA832@uu.nl> The Faculty of Science at Utrecht University is seeking to appoint a Full Professor in Software Technology to lead, alongside the other two chairs, the division of Software Systems within the Faculty. The full Professor directs and supervises research in the field of software technology, specifically in the design and development of formalisms and methodologies for effective program construction and program analysis. She/he develops new initiatives, aiming at research programs in software technology. This includes the acquisition of external research funds, both at the national and international levels, and the dissemination of research results and its applications to the relevant research communities. The full professor has a leading role in teaching and supervision. She or he contributes to the department?s curriculum development at BSc, MSc and PhD levels. The full professor plays an active role in the leadership and administrative duties of the Department and/or Faculty. For more information about this vacancy, go to http://goo.gl/1vLeVc ??????? Johan Jeuring Department of Information and Computing Sciences Utrecht University The Netherlands http://www.jeuring.net/ From agrambot at gmail.com Tue Jun 7 18:02:19 2016 From: agrambot at gmail.com (Alex) Date: Tue, 07 Jun 2016 12:02:19 -0600 Subject: [Haskell-cafe] How to capture the output of GHCi :show command Message-ID: <87oa7cop1w.fsf@gmail.com> I would like to be able to bind the output of GHCi's :show to a variable, but I don't see a nice way to do so. Is it possible to do this directly in GHCi? My specific use for this is appending to the current prompt. From jgbailey at gmail.com Tue Jun 7 20:47:15 2016 From: jgbailey at gmail.com (Justin Bailey) Date: Tue, 7 Jun 2016 12:47:15 -0800 Subject: [Haskell-cafe] How to capture the output of GHCi :show command In-Reply-To: <87oa7cop1w.fsf@gmail.com> References: <87oa7cop1w.fsf@gmail.com> Message-ID: Alex, See "a hammer for many nails: capturing ghci command output" in the mail message "getting more out of ghci" sent by Claus Reinke on Sept 25th, 2007 to the Haskell Cafe list: https://mail.haskell.org/pipermail/haskell-cafe/2007-September/032260.html On Tue, Jun 7, 2016 at 10:02 AM, Alex wrote: > > I would like to be able to bind the output of GHCi's :show to a > variable, but I don't see a nice way to do so. Is it possible to do this > directly in GHCi? > > My specific use for this is appending to the current prompt. > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe From kai at kzhang.org Tue Jun 7 21:48:59 2016 From: kai at kzhang.org (Kai Zhang) Date: Tue, 7 Jun 2016 14:48:59 -0700 Subject: [Haskell-cafe] ANN: SciFlow-0.5.0 Message-ID: Hi Cafe, I've been working on a package to manage data analysis pipelines, mainly for personal use. But I feel there may be others who are interested in this as well, so I just published an up-to-date version to hackage. Briefly, this package help you design and manage data analysis pipelines written in Haskell, with computation steps being just Haskell functions with type: a -> IO b. I use template Haskell to construct the dependency graph, and computation steps are assembled according to the graph and type checked at compile time. Each step can be configured to run either locally or on a remote machine. Concurrency is also supported. Independent steps will run simultaneously. Take a look at https://github.com/kaizhang/SciFlow for breif introduction and some examples. This package is still under heavy development, but it is quite stable otherwise as I've been using it on our cluster for some time. I hope you would find it useful and any feedback is welcome! -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.sorokin at gmail.com Wed Jun 8 08:37:17 2016 From: david.sorokin at gmail.com (David Sorokin) Date: Wed, 8 Jun 2016 11:37:17 +0300 Subject: [Haskell-cafe] [ANN] New docs for the Aivika simulation platform Message-ID: <53B33FBB-28BA-45DB-A5E9-3B3ABFB3BB7A@gmail.com> Hi Cafe, I wrote a new article "Aivika - A Constructor of General-Purpose Simulation Libraries" [1]. It uncovers key ideas of that how I implemented nested simulation and parallel distributed simulation in the Aivika platform [2]. Monads, immutable data structures, managed side effects, continuations, streams, recursive computations are all those things that are widely used in Aivika. The article can be useful for those who will have a willingness to use my simulation libraries for nested simulation, or distributed simulation, or some other field I cannot still imagine. Finally, I wrote a small tutorial for beginners [3]. It takes a simple discrete event simulation model and shows how we can add a Monte-Carlo experiment, save the results in the CSV files, plot histograms and charts, for the example, the deviation chart with a trend and confidence interval using rule 3-sigma. This tutorial can be used for quick diving into Aivika. All the programming code is written in Haskell. Best regards, David Sorokin Yoshkar-Ola, Russia [1] http://www.aivikasoft.com/en/tutorials/constructor/aivika-constructor.html [2] http://www.aivikasoft.com/en/products/aivika.html [3] http://www.aivikasoft.com/en/tutorials/beginners/aivika-tutorial-for-beginners.html From dek5 at yandex.ru Wed Jun 8 10:07:10 2016 From: dek5 at yandex.ru (dek5 at yandex.ru) Date: Wed, 8 Jun 2016 13:07:10 +0300 Subject: [Haskell-cafe] so strange but interesting Message-ID: <0000ae9949e0$3f831e5c$8212ddd2$@yandex.ru> Hi, I know it might be something strange, but still so interesting, you have to see it here Warmest, dek5 at yandex.ru -------------- next part -------------- An HTML attachment was scrubbed... URL: From chrisdone at gmail.com Wed Jun 8 12:01:57 2016 From: chrisdone at gmail.com (Christopher Done) Date: Wed, 8 Jun 2016 14:01:57 +0200 Subject: [Haskell-cafe] ANN: Intero for Emacs Message-ID: Here is a new Emacs package providing *very basic* Haskell programmer needs: - Type checking - Autocompletion - Go to definition - Type of selection - A basic REPL support It?s very simple, tries to *just work*, is based on Stack (required), the Emacs package auto-installs the correct version of its backend within your Stack working directory, supports the recently released GHC 8 all the way back to GHC 7.8.3. Having to configure anything to get basic functionality is considered a bug. The home page is here with details and demonstrations: http://commercialhaskell.github.io/intero/ The GitHub project where you can submit feature requests or bug reports: https://github.com/commercialhaskell/intero Thanks for reading! ? -------------- next part -------------- An HTML attachment was scrubbed... URL: From ezyang at mit.edu Thu Jun 9 07:14:53 2016 From: ezyang at mit.edu (Edward Z. Yang) Date: Thu, 09 Jun 2016 00:14:53 -0700 Subject: [Haskell-cafe] Call for talks: Haskell Implementors Workshop 2016, Aug 24, Nara Message-ID: <1465456335-sup-6629@sabre> Call for Contributions ACM SIGPLAN Haskell Implementors' Workshop http://haskell.org/haskellwiki/HaskellImplementorsWorkshop/2016 Nara, Japan, 24 September, 2016 Co-located with ICFP 2016 http://www.icfpconference.org/icfp2016/ Important dates --------------- Proposal Deadline: Monday, 8 August, 2016 Notification: Monday, 22 August, 2016 Workshop: Saturday, 24 September, 2016 The 8th Haskell Implementors' Workshop is to be held alongside ICFP 2016 this year in Nara. It is a forum for people involved in the design and development of Haskell implementations, tools, libraries, and supporting infrastructure, to share their work and discuss future directions and collaborations with others. Talks and/or demos are proposed by submitting an abstract, and selected by a small program committee. There will be no published proceedings; the workshop will be informal and interactive, with a flexible timetable and plenty of room for ad-hoc discussion, demos, and impromptu short talks. Scope and target audience ------------------------- It is important to distinguish the Haskell Implementors' Workshop from the Haskell Symposium which is also co-located with ICFP 2016. The Haskell Symposium is for the publication of Haskell-related research. In contrast, the Haskell Implementors' Workshop will have no proceedings -- although we will aim to make talk videos, slides and presented data available with the consent of the speakers. In the Haskell Implementors' Workshop, we hope to study the underlying technology. We want to bring together anyone interested in the nitty-gritty details behind turning plain-text source code into a deployed product. Having said that, members of the wider Haskell community are more than welcome to attend the workshop -- we need your feedback to keep the Haskell ecosystem thriving. The scope covers any of the following topics. There may be some topics that people feel we've missed, so by all means submit a proposal even if it doesn't fit exactly into one of these buckets: * Compilation techniques * Language features and extensions * Type system implementation * Concurrency and parallelism: language design and implementation * Performance, optimisation and benchmarking * Virtual machines and run-time systems * Libraries and tools for development or deployment Talks ----- At this stage we would like to invite proposals from potential speakers for talks and demonstrations. We are aiming for 20 minute talks with 10 minutes for questions and changeovers. We want to hear from people writing compilers, tools, or libraries, people with cool ideas for directions in which we should take the platform, proposals for new features to be implemented, and half-baked crazy ideas. Please submit a talk title and abstract of no more than 300 words. Submissions should be made via HotCRP. The website is: https://icfp-hiw16.hotcrp.com/ We will also have a lightning talks session which will be organised on the day. These talks will be 5-10 minutes, depending on available time. Suggested topics for lightning talks are to present a single idea, a work-in-progress project, a problem to intrigue and perplex Haskell implementors, or simply to ask for feedback and collaborators. Organisers ---------- * Joachim Breitner (Karlsruhe Institut f?r Technologie) * Duncan Coutts (Well Typed) * Michael Snoyman (FP Complete) * Luite Stegeman (ghcjs) * Niki Vazou (UCSD) * Stephanie Weirich (University of Pennsylvania) * Edward Z. Yang - chair (Stanford University) From ezyang at mit.edu Thu Jun 9 07:17:18 2016 From: ezyang at mit.edu (Edward Z. Yang) Date: Thu, 09 Jun 2016 00:17:18 -0700 Subject: [Haskell-cafe] Call for talks: Haskell Implementors Workshop 2016, Sep 24 (FIXED), Nara Message-ID: <1465456550-sup-6234@sabre> (...and now with the right date in the subject line!) Call for Contributions ACM SIGPLAN Haskell Implementors' Workshop http://haskell.org/haskellwiki/HaskellImplementorsWorkshop/2016 Nara, Japan, 24 September, 2016 Co-located with ICFP 2016 http://www.icfpconference.org/icfp2016/ Important dates --------------- Proposal Deadline: Monday, 8 August, 2016 Notification: Monday, 22 August, 2016 Workshop: Saturday, 24 September, 2016 The 8th Haskell Implementors' Workshop is to be held alongside ICFP 2016 this year in Nara. It is a forum for people involved in the design and development of Haskell implementations, tools, libraries, and supporting infrastructure, to share their work and discuss future directions and collaborations with others. Talks and/or demos are proposed by submitting an abstract, and selected by a small program committee. There will be no published proceedings; the workshop will be informal and interactive, with a flexible timetable and plenty of room for ad-hoc discussion, demos, and impromptu short talks. Scope and target audience ------------------------- It is important to distinguish the Haskell Implementors' Workshop from the Haskell Symposium which is also co-located with ICFP 2016. The Haskell Symposium is for the publication of Haskell-related research. In contrast, the Haskell Implementors' Workshop will have no proceedings -- although we will aim to make talk videos, slides and presented data available with the consent of the speakers. In the Haskell Implementors' Workshop, we hope to study the underlying technology. We want to bring together anyone interested in the nitty-gritty details behind turning plain-text source code into a deployed product. Having said that, members of the wider Haskell community are more than welcome to attend the workshop -- we need your feedback to keep the Haskell ecosystem thriving. The scope covers any of the following topics. There may be some topics that people feel we've missed, so by all means submit a proposal even if it doesn't fit exactly into one of these buckets: * Compilation techniques * Language features and extensions * Type system implementation * Concurrency and parallelism: language design and implementation * Performance, optimisation and benchmarking * Virtual machines and run-time systems * Libraries and tools for development or deployment Talks ----- At this stage we would like to invite proposals from potential speakers for talks and demonstrations. We are aiming for 20 minute talks with 10 minutes for questions and changeovers. We want to hear from people writing compilers, tools, or libraries, people with cool ideas for directions in which we should take the platform, proposals for new features to be implemented, and half-baked crazy ideas. Please submit a talk title and abstract of no more than 300 words. Submissions should be made via HotCRP. The website is: https://icfp-hiw16.hotcrp.com/ We will also have a lightning talks session which will be organised on the day. These talks will be 5-10 minutes, depending on available time. Suggested topics for lightning talks are to present a single idea, a work-in-progress project, a problem to intrigue and perplex Haskell implementors, or simply to ask for feedback and collaborators. Organisers ---------- * Joachim Breitner (Karlsruhe Institut f?r Technologie) * Duncan Coutts (Well Typed) * Michael Snoyman (FP Complete) * Luite Stegeman (ghcjs) * Niki Vazou (UCSD) * Stephanie Weirich (University of Pennsylvania) * Edward Z. Yang - chair (Stanford University) From breitner at kit.edu Thu Jun 9 08:29:51 2016 From: breitner at kit.edu (Joachim Breitner) Date: Thu, 09 Jun 2016 10:29:51 +0200 Subject: [Haskell-cafe] Haskell in Leipzig 2016: Second Call for Papers Message-ID: <1465460991.1667.7.camel@kit.edu> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Haskell in Leipzig ????????????????????????????September 14-15, 2016 ????????????????????????????HTKW Leipzig, Germany ?????????????????????????http://hal2016.haskell.org/ Allow me to remind everyone of the opportunity to talk about your research, projects or ideas at this year?s Haskell in Leipzig. The deadline is three weeks from now. == News == Unsure about whether HaL is interesting to you? No need to worry: Alejandro Russo (from Chalmers) is our keynote speaker and will talk about his work on information-flow control (i.e. SecLib, LIO, MAC, HLIO) ? a great topic that is of interest to researchers, practitioners and beginners alike.? == About HaL == The workshop series ?Haskell in Leipzig?, now in its 11th year, brings together Haskell developers, Haskell researchers, Haskell enthusiasts and Haskell beginners to listen to talks, take part in tutorials, and join in interesting conversations. Everything related to Haskell is on topic, whether it is about current research, practical applications, interesting ideas off the beaten track, education, or art, and topics may extend to functional programming in general and its connections to other programming paradigms as well. This year, HaL is colocated with two related conferences, ?* the Workshop on Functional and (Constraint) Logic Programming (WFLP) and ?* the Workshop on (Constraint) Logic Programming (WLP), to form the Leipzig Week of Declarative Programming (L-DEC): ????http://nfa.imn.htwk-leipzig.de/LDEC2016/ In order to accommodate and welcome a more international audience, this year?s HaL will be held in English. == Submissions == Contributions can take the form of ?* talks (about 30 minutes), ?* tutorials (about 90 minutes), ?* demonstrations, artistic performances, or other extraordinary? ? ?things. Please submit an abstract that describes the content and form of your presentation, the intended audience, and required previous knowledge. We recommend a length of 2 pages, so that the PC and the audience get a good idea of your submission, but this is not a hard requirement. You can submit your abstract, as an PDF document, at ???https://easychair.org/conferences/?conf=hal2016 until Friday, July 1, 2016. You will be notified by July 15, 2016. == Program committee == ?* Andreas Abel, Chalmers and Gothenburg University, Sweden ?* Heinrich Apfelmus, Leipzig, Germany ?* Joachim Breitner, Karlsruhe Institute of Technology, Germany (Chair) ?* Matthias Fischmann, Zerobuzz, Germany ?* Petra Hofstedt, BTU Cottbus-Senftenberg, Germany ?* Wolfgang Jeltsch, Institute of Cybernetics at Tallinn University of Technology, Estonia ?* Andres L?h, Well-Typed LLP, Germany ?* Alejandro Serrano Mena, Universiteit Utrecht, Netherlands ?* Neil Mitchell, Standard Chartered Bank, UK ?* Katie Ots, Facebook, UK ?* Peter Stadler, University of Leipzig, Germany ?* Henning Thielemann, Freelancer, Germany ?* Niki Vazou, University of California, San Diego, USA If you have any questions, please do not hesitate to contact Joachim Breitner . -- Dr. rer. nat. Joachim Breitner Wissenschaftlicher Mitarbeiter http://pp.ipd.kit.edu/~breitner -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: This is a digitally signed message part URL: From D.J.Duke at leeds.ac.uk Thu Jun 9 09:14:46 2016 From: D.J.Duke at leeds.ac.uk (David Duke) Date: Thu, 9 Jun 2016 10:14:46 +0100 Subject: [Haskell-cafe] FHPC'16 - deadline extension to 14th June Message-ID: <02B73C42-D378-487A-B192-5C79E3F79BAC@leeds.ac.uk> Dear colleagues, Following several requests for an extension, the submission deadline for FHPC'16 has been extended by 5 days to 15th June. ====================================================================== CALL FOR PAPERS FHPC 2016 The 5th ACM SIGPLAN Workshop on Functional High-Performance Computing Nara, Japan September 22, 2016 https://sites.google.com/site/fhpcworkshops/ Co-located with the International Conference on Functional Programming (ICFP 2016) Submission Deadline: Wednesday, 15 June, 2016 (anywhere on earth) ====================================================================== The FHPC workshop aims at bringing together researchers exploring uses of functional (or more generally, declarative or high-level) programming technology in application domains where high performance is essential. The aim of the meeting is to enable sharing of results, experiences, and novel ideas about how high-level, declarative specifications of computationally challenging problems can serve as maintainable and portable code that approaches (or even exceeds) the performance of machine-oriented imperative implementations. All aspects of performance critical programming and parallel programming are in-scope for the workshop, irrespective of hardware target. This includes both traditional large-scale scientific computing (HPC), as well as work targeting single node systems with SMPs, GPUs, FPGAs, or embedded processors. It is becoming apparent that radically new and well founded methodologies for programming such systems are required to address their inherent complexity and to reconcile execution performance with programming productivity. Experience reports are also welcome. Proceedings: ============ FHPC 2016 seeks to encourage a range of submissions, focussing on work in progress and facilitating early exchange of ideas and open discussion on innovative and/or emerging results. To this end submissions should take the form of short (maximum 6 page) papers. Accepted papers will be published by the ACM and will appear in the ACM Digital Library. * Submissions due: Wednesday 15 June, 2016 (anywhere on earth) * Author notification: Friday, 8 July, 2016 * Final copy due: Sunday, 31 July, 2016 Submitted papers must be in portable document format (PDF), formatted according to the ACM SIGPLAN style guidelines (2 column, 9pt format). See http://www.sigplan.org/authorInformation.htm for more information and style files. Papers should be no longer than 6 pages. Contributions to FHPC 2016 should be submitted via Easychair, at the following URL: * https://www.easychair.org/conferences/?conf=fhpc16 The FHPC workshops adhere to the ACM SIGPLAN policies regarding programme committee contributions and republication. Any paper submitted must adhere to ACM SIGPLAN's republication policy. PC member submissions are welcome, but will be reviewed to a higher standard. http://www.sigplan.org/Resources/Policies/Review http://www.sigplan.org/Resources/Policies/Republication Travel Support: =============== Student attendees with accepted papers can apply for a SIGPLAN PAC grant to help cover travel expenses. PAC also offers other support, such as for child-care expenses during the meeting or for travel costs for companions of SIGPLAN members with physical disabilities, as well as for travel from locations outside of North America and Europe. For details on the PAC programme, see its web page (http://www.sigplan.org/PAC.htm). Programme Committee: ==================== David Duke (co-chair) University of Leeds, UK Yukiyoshi Kameyama (co-chair) University of Tsukuba, Japan Baris Aktemur ?zye?in University, Turkey Marco Aldinucci University of Torino, Italy Jost Berthold Commonwealth Bank, Australia Kei Davis Los Alamos National Laboratory, USA Kento Emoto Kyushu Institute of Technology, Japan Zhenjiang Hu National Institute of Informatics, Japan Ben Lippmeier University of New South Wales, Australia Rita Loogen University of Marburg, Germany Geoffrey Mainland Drexel University, USA Mike Rainey INRIA, France Mary Sheeran Chalmers University of Technology, Sweden Satnam Singh Facebook, UK --- David Duke T: +44 113 3436800 Professor of Computer Science E: D.J.Duke at leeds.ac.uk Head, School of Computing W: www.comp.leeds.ac.uk/scsdjd/ PA: Gaynor Butterwick, E: G.Butterwick at leeds.ac.uk T: +44 113 3435767 From cepete02 at gmail.com Thu Jun 9 12:07:46 2016 From: cepete02 at gmail.com (Carl Petersen) Date: Thu, 9 Jun 2016 05:07:46 -0700 (PDT) Subject: [Haskell-cafe] couldn't match expected type ByteString with actual type IO ByteString Message-ID: Hello All, I'm getting the following error: /apps/workspace/hade/src/Step/ReadExcel.hs:39:23: Couldn't match expected type ?L.ByteString? with actual type ?IO L.ByteString? In the first argument of ?IBuf?, namely ?j? In the second argument of ?sendChan?, namely ?(IBuf j)? when I compile the following code: data Buf = IChan (SendPort Buf) | IBuf (L.ByteString) deriving (Show,Generic,Typeable) instance Binary Buf readExcel :: Process() readExcel = do sendChan chan (IBuf j) where IChan chan = expect j = do r <- toTableRowsFromFile 8 "final-project.xlsx" let b = A.encode r return b remotable ['readExcel] Any ideas as to what I'm doing wrong? Carl -------------- next part -------------- An HTML attachment was scrubbed... URL: From mitchellwrosen at gmail.com Thu Jun 9 14:33:18 2016 From: mitchellwrosen at gmail.com (Mitchell Rosen) Date: Thu, 9 Jun 2016 07:33:18 -0700 (PDT) Subject: [Haskell-cafe] couldn't match expected type ByteString with actual type IO ByteString In-Reply-To: References: Message-ID: <9fa971c3-f865-4f8a-9503-db6cbdea1760@googlegroups.com> The error message is really all you need. You are passing a value of type *IO ByteString* to *IBuf* which expects a value of type *ByteString*. -------------- next part -------------- An HTML attachment was scrubbed... URL: From Coeus at gmx.de Thu Jun 9 18:52:27 2016 From: Coeus at gmx.de (Marc Ziegert) Date: Thu, 9 Jun 2016 20:52:27 +0200 Subject: [Haskell-cafe] couldn't match expected type ByteString with actual type IO ByteString In-Reply-To: References: Message-ID: An HTML attachment was scrubbed... URL: From brendan.g.hay at gmail.com Fri Jun 10 08:59:51 2016 From: brendan.g.hay at gmail.com (Brendan Hay) Date: Fri, 10 Jun 2016 10:59:51 +0200 Subject: [Haskell-cafe] GHC 8 + ImpredictiveTypes + $ Message-ID: Hi, I have had a number of trivial compilation failures in many of my projects that contain instances for MonadBaseControl (from monad-control) since upgrading to GHC 8. Now, I say 'trivial' since the actual fix is incredibly minor - a change of compose (.) to apply ($). What was less trivial was the (additional) hair loss arriving at the fix. I've put together a minimal example that demonstrates both the failing (pre-GHC8) and the fixed (GHC8) instances here: https://gist.github.com/brendanhay/e6f2501c15ac5160ca7dbb6ada6777f0 Since I found the error message somewhat directionless, I'd like some help actually understanding the root cause and why the 'fix' works: * I assume previously GHC did not fully check type aliases that were impredictive prior to GHC 8? * What does this imply for a type alias such as for the alias RunInBase used in monad-control that contains RankNTypes: http://hackage.haskell.org/package/monad-control-1.0.1.0/docs/Control-Monad-Trans-Control.html#t:RunInBase - Is such an alias not safe in some sense? (Was it never safe?) * How does the use of ($) vs (.) fix this particular issue? (I'd naively assume the usage here would be equivalent.) I recall reading about ($)'s magical type alias somewhere - is this related? Cheers, Brendan -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at nh2.me Fri Jun 10 09:23:03 2016 From: mail at nh2.me (=?UTF-8?Q?Niklas_Hamb=c3=bcchen?=) Date: Fri, 10 Jun 2016 11:23:03 +0200 Subject: [Haskell-cafe] GHC 8 + ImpredictiveTypes + $ In-Reply-To: References: Message-ID: <575A86F7.4050904@nh2.me> > Now, I say 'trivial' since the actual fix is incredibly minor - a change > of compose (.) to apply ($). What was less trivial was the (additional) > hair loss arriving at the fix Tell me about it - when experimentally making a larger project work with GHC 8, I spent a lot of time trying to understand the problem and was rather disappointed that the climax of this effort was to replace `a = f . g` by `a x = f (g x)` in two places. The 8.0 migration guide https://ghc.haskell.org/trac/ghc/wiki/Migration/8.0 already has a section about "Impredicative types brokenness" - I would have appreciated if it contained the simple sentence "In many cases, this can be fixed by rewriting `a = f . g` to `a x = f (g x)`." Maybe somebody can add it. > * I assume previously GHC did not fully check type aliases that were > impredictive prior to GHC 8? Yes, https://ghc.haskell.org/trac/ghc/wiki/Migration/8.0#Requirementforimpredicativetypes: "In previous versions of GHC, it was possible to hide an impredicative type behind a type synonym, because GHC did not always expand type synonyms when checking for impredicativity." > * What does this imply for a type alias such as for the alias RunInBase > used in monad-control that contains RankNTypes: > http://hackage.haskell.org/package/monad-control-1.0.1.0/docs/Control-Monad-Trans-Control.html#t:RunInBase - > Is such an alias not safe in some sense? (Was it never safe?) I'll let others answer this one. > * How does the use of ($) vs (.) fix this particular issue? (I'd naively > assume the usage here would be equivalent.) I recall reading about ($)'s > magical type alias somewhere - is this related? This page (I'm not sure if you already knew it before asking the question) https://ghc.haskell.org/trac/ghc/wiki/ImpredicativePolymorphism describes the difference between `test1 x = foo (bar x)` and `test2 = foo . bar`; it also has a "Special case for ($)" section which I believe is the answer to your question. The summary is: " But Haskell programmers use ($) so much, to avoid writing parentheses, that GHC's type inference has an ad-hoc special case for ($) that allows it to do type inference for (e1 $ e2), even when impredicative polymorphism is needed. " Niklas From adam at well-typed.com Fri Jun 10 10:03:39 2016 From: adam at well-typed.com (Adam Gundry) Date: Fri, 10 Jun 2016 11:03:39 +0100 Subject: [Haskell-cafe] GHC 8 + ImpredictiveTypes + $ In-Reply-To: <575A86F7.4050904@nh2.me> References: <575A86F7.4050904@nh2.me> Message-ID: <8121503d-39aa-6883-d5c7-4907c80469e2@well-typed.com> On 10/06/16 10:23, Niklas Hamb?chen wrote: >> Now, I say 'trivial' since the actual fix is incredibly minor - a change >> of compose (.) to apply ($). What was less trivial was the (additional) >> hair loss arriving at the fix > > Tell me about it - when experimentally making a larger project work with > GHC 8, I spent a lot of time trying to understand the problem and was > rather disappointed that the climax of this effort was to replace `a = f > . g` by `a x = f (g x)` in two places. > > The 8.0 migration guide > https://ghc.haskell.org/trac/ghc/wiki/Migration/8.0 already has a > section about "Impredicative types brokenness" - I would have > appreciated if it contained the simple sentence "In many cases, this can > be fixed by rewriting `a = f . g` to `a x = f (g x)`." > > Maybe somebody can add it. I've done so. Thanks for the suggestion! >> * I assume previously GHC did not fully check type aliases that were >> impredictive prior to GHC 8? > > Yes, > https://ghc.haskell.org/trac/ghc/wiki/Migration/8.0#Requirementforimpredicativetypes: > "In previous versions of GHC, it was possible to hide an impredicative > type behind a type synonym, because GHC did not always expand type > synonyms when checking for impredicativity." > >> * What does this imply for a type alias such as for the alias RunInBase >> used in monad-control that contains RankNTypes: >> http://hackage.haskell.org/package/monad-control-1.0.1.0/docs/Control-Monad-Trans-Control.html#t:RunInBase - >> Is such an alias not safe in some sense? (Was it never safe?) > > I'll let others answer this one. The required extensions will depend on the use site. If RunInBase is used at the top level, no extensions should be needed. If it is used on the left-hand side of an arrow, RankNTypes will be required. If it is used as an argument to a type constructor (e.g. Maybe (RunInBase m b)) then ImpredicativeTypes will be required. For example: foo :: RunInBase m b -- rank-1 bar :: RunInBase m b -> Bool -- rank-2, needs RankNTypes baz :: Maybe (RunInBase m b) -- needs ImpredicativeTypes Previous versions of GHC may have accepted the third case without requiring ImpredicativeTypes in some circumstances, but this was a bug that made typechecking unpredictably dependent on when type synonyms get expanded (https://ghc.haskell.org/trac/ghc/ticket/10194). In general, RankNTypes is fairly safe in that its typing rules are fairly stable and well-understood. ImpredicativeTypes, on the other hand, is basically broken and should be avoided as far as possible. Hope this helps, Adam -- Adam Gundry, Haskell Consultant Well-Typed LLP, http://www.well-typed.com/ From brendan.g.hay at gmail.com Fri Jun 10 11:12:45 2016 From: brendan.g.hay at gmail.com (Brendan Hay) Date: Fri, 10 Jun 2016 13:12:45 +0200 Subject: [Haskell-cafe] GHC 8 + ImpredictiveTypes + $ In-Reply-To: <8121503d-39aa-6883-d5c7-4907c80469e2@well-typed.com> References: <575A86F7.4050904@nh2.me> <8121503d-39aa-6883-d5c7-4907c80469e2@well-typed.com> Message-ID: Thank you both! On 10 June 2016 at 12:03, Adam Gundry wrote: > On 10/06/16 10:23, Niklas Hamb?chen wrote: > >> Now, I say 'trivial' since the actual fix is incredibly minor - a change > >> of compose (.) to apply ($). What was less trivial was the (additional) > >> hair loss arriving at the fix > > > > Tell me about it - when experimentally making a larger project work with > > GHC 8, I spent a lot of time trying to understand the problem and was > > rather disappointed that the climax of this effort was to replace `a = f > > . g` by `a x = f (g x)` in two places. > > > > The 8.0 migration guide > > https://ghc.haskell.org/trac/ghc/wiki/Migration/8.0 already has a > > section about "Impredicative types brokenness" - I would have > > appreciated if it contained the simple sentence "In many cases, this can > > be fixed by rewriting `a = f . g` to `a x = f (g x)`." > > > > Maybe somebody can add it. > > I've done so. Thanks for the suggestion! > > > >> * I assume previously GHC did not fully check type aliases that were > >> impredictive prior to GHC 8? > > > > Yes, > > > https://ghc.haskell.org/trac/ghc/wiki/Migration/8.0#Requirementforimpredicativetypes > : > > "In previous versions of GHC, it was possible to hide an impredicative > > type behind a type synonym, because GHC did not always expand type > > synonyms when checking for impredicativity." > > > >> * What does this imply for a type alias such as for the alias RunInBase > >> used in monad-control that contains RankNTypes: > >> > http://hackage.haskell.org/package/monad-control-1.0.1.0/docs/Control-Monad-Trans-Control.html#t:RunInBase > - > >> Is such an alias not safe in some sense? (Was it never safe?) > > > > I'll let others answer this one. > > The required extensions will depend on the use site. If RunInBase is > used at the top level, no extensions should be needed. If it is used on > the left-hand side of an arrow, RankNTypes will be required. If it is > used as an argument to a type constructor (e.g. Maybe (RunInBase m b)) > then ImpredicativeTypes will be required. For example: > > foo :: RunInBase m b -- rank-1 > bar :: RunInBase m b -> Bool -- rank-2, needs RankNTypes > baz :: Maybe (RunInBase m b) -- needs ImpredicativeTypes > > Previous versions of GHC may have accepted the third case without > requiring ImpredicativeTypes in some circumstances, but this was a bug > that made typechecking unpredictably dependent on when type synonyms get > expanded (https://ghc.haskell.org/trac/ghc/ticket/10194). > > In general, RankNTypes is fairly safe in that its typing rules are > fairly stable and well-understood. ImpredicativeTypes, on the other > hand, is basically broken and should be avoided as far as possible. > > Hope this helps, > > Adam > > -- > Adam Gundry, Haskell Consultant > Well-Typed LLP, http://www.well-typed.com/ > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cblp at cblp.su Fri Jun 10 14:37:41 2016 From: cblp at cblp.su (=?UTF-8?B?0K7RgNC40Lkg0KHRi9GA0L7QstC10YbQutC40LkgKFl1cml5IFN5cm92ZXRza2l5KQ==?=) Date: Fri, 10 Jun 2016 17:37:41 +0300 Subject: [Haskell-cafe] All-fail case in asum Message-ID: Hello I want to define some parser such way: myParser = tryA <|> tryB <|> fail "input must be either A or B" It works. But then I want to rewrite it with asum: myParser = asum [tryA, tryB, fail "must be A or B"] It works, but the wrong way. Instead of my error it writes "empty". Just "empty". It is so because in base library asum = foldr (<|>) empty What if it was defined asum [] = empty asum [x:xs] = x <|> asum xs It would help me with my parser. But what can this break? Why isn't this done yet? -- Yuriy Syrovetskiy, http://cblp.su From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Fri Jun 10 14:57:23 2016 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Fri, 10 Jun 2016 15:57:23 +0100 Subject: [Haskell-cafe] All-fail case in asum In-Reply-To: References: Message-ID: <20160610145723.GI23915@weber> On Fri, Jun 10, 2016 at 05:37:41PM +0300, ???? ?????????? (Yuriy Syrovetskiy) wrote: > It is so because in base library > > asum = foldr (<|>) empty > > What if it was defined > > asum [] = empty > asum [x:xs] = x <|> asum xs Those are the same (assuming you mean (x:xs) instead of [x:xs]). Tom From danburton.email at gmail.com Fri Jun 10 15:09:41 2016 From: danburton.email at gmail.com (Dan Burton) Date: Fri, 10 Jun 2016 08:09:41 -0700 Subject: [Haskell-cafe] All-fail case in asum In-Reply-To: <20160610145723.GI23915@weber> References: <20160610145723.GI23915@weber> Message-ID: Add a pattern match for the single-element list to stop it from hitting the empty list base case. asum [] = empty asum [x] = x asum (x:xs) = x <|> asum xs On Friday, June 10, 2016, Tom Ellis < tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk> wrote: > On Fri, Jun 10, 2016 at 05:37:41PM +0300, ???? ?????????? (Yuriy > Syrovetskiy) wrote: > > It is so because in base library > > > > asum = foldr (<|>) empty > > > > What if it was defined > > > > asum [] = empty > > asum [x:xs] = x <|> asum xs > > Those are the same (assuming you mean (x:xs) instead of [x:xs]). > > Tom > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -- -- Dan Burton -------------- next part -------------- An HTML attachment was scrubbed... URL: From ezyang at mit.edu Fri Jun 10 15:12:52 2016 From: ezyang at mit.edu (Edward Z. Yang) Date: Fri, 10 Jun 2016 08:12:52 -0700 Subject: [Haskell-cafe] GHC 8 + ImpredictiveTypes + $ In-Reply-To: References: Message-ID: <1465571294-sup-9180@sabre> Excerpts from Brendan Hay's message of 2016-06-10 01:59:51 -0700: > * How does the use of ($) vs (.) fix this particular issue? (I'd naively > assume the usage here would be equivalent.) I recall reading about ($)'s > magical type alias somewhere - is this related? When you say f $ a, where a is a polymorphic variable, we need to instantiate the type variables in ($) :: (a -> b) -> a -> b with quantified types; i.e., do an impredicative instantiation. GHC has never been able to do this, so there's a hack for the typechecker to treat 'f $ a' as if it were just 'f a' (no more impredicative instantiation). (.) is not special cased similarly, which is why it doesn't work. I don't know if we could special case it to solve this problem. Edward From david.feuer at gmail.com Fri Jun 10 15:21:31 2016 From: david.feuer at gmail.com (David Feuer) Date: Fri, 10 Jun 2016 11:21:31 -0400 Subject: [Haskell-cafe] GHC 8 + ImpredictiveTypes + $ In-Reply-To: <1465571294-sup-9180@sabre> References: <1465571294-sup-9180@sabre> Message-ID: I'm pretty sure we *could*, but special case hacks in the type checker are horrible. So we shouldn't. On Jun 10, 2016 11:13 AM, "Edward Z. Yang" wrote: > Excerpts from Brendan Hay's message of 2016-06-10 01:59:51 -0700: > > * How does the use of ($) vs (.) fix this particular issue? (I'd naively > > assume the usage here would be equivalent.) I recall reading about ($)'s > > magical type alias somewhere - is this related? > > When you say f $ a, where a is a polymorphic variable, we need to > instantiate the type variables in ($) :: (a -> b) -> a -> b with > quantified types; i.e., do an impredicative instantiation. GHC has > never been able to do this, so there's a hack for the typechecker > to treat 'f $ a' as if it were just 'f a' (no more impredicative > instantiation). > > (.) is not special cased similarly, which is why it doesn't work. > I don't know if we could special case it to solve this problem. > > Edward > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ezyang at mit.edu Fri Jun 10 15:29:05 2016 From: ezyang at mit.edu (Edward Z. Yang) Date: Fri, 10 Jun 2016 08:29:05 -0700 Subject: [Haskell-cafe] GHC 8 + ImpredictiveTypes + $ In-Reply-To: References: <1465571294-sup-9180@sabre> Message-ID: <1465572304-sup-9937@sabre> But I feel there ought to be a way to apply this hack systematically, so that we can handle these cases, which are "easier" than full impredicativity. For example, as a dumb proposal, if we treated ($) and (.) as macros (inline before typechecking), that would give us correct typechecking for both these cases. So maybe some sort of stratification would solve our problem. Edward Excerpts from David Feuer's message of 2016-06-10 08:21:31 -0700: > I'm pretty sure we *could*, but special case hacks in the type checker are > horrible. So we shouldn't. > On Jun 10, 2016 11:13 AM, "Edward Z. Yang" wrote: > > > Excerpts from Brendan Hay's message of 2016-06-10 01:59:51 -0700: > > > * How does the use of ($) vs (.) fix this particular issue? (I'd naively > > > assume the usage here would be equivalent.) I recall reading about ($)'s > > > magical type alias somewhere - is this related? > > > > When you say f $ a, where a is a polymorphic variable, we need to > > instantiate the type variables in ($) :: (a -> b) -> a -> b with > > quantified types; i.e., do an impredicative instantiation. GHC has > > never been able to do this, so there's a hack for the typechecker > > to treat 'f $ a' as if it were just 'f a' (no more impredicative > > instantiation). > > > > (.) is not special cased similarly, which is why it doesn't work. > > I don't know if we could special case it to solve this problem. > > > > Edward > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > From david.feuer at gmail.com Fri Jun 10 15:32:45 2016 From: david.feuer at gmail.com (David Feuer) Date: Fri, 10 Jun 2016 11:32:45 -0400 Subject: [Haskell-cafe] All-fail case in asum In-Reply-To: References: <20160610145723.GI23915@weber> Message-ID: Or, to keep it a fold, asum xs = foldr go (fromMaybe empty) xs Nothing where go x r Nothing = r (Just x) go x r (Just prev) = prev <|> r (Just x) On Jun 10, 2016 11:09 AM, "Dan Burton" wrote: Add a pattern match for the single-element list to stop it from hitting the empty list base case. asum [] = empty asum [x] = x asum (x:xs) = x <|> asum xs On Friday, June 10, 2016, Tom Ellis < tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk> wrote: > On Fri, Jun 10, 2016 at 05:37:41PM +0300, ???? ?????????? (Yuriy > Syrovetskiy) wrote: > > It is so because in base library > > > > asum = foldr (<|>) empty > > > > What if it was defined > > > > asum [] = empty > > asum [x:xs] = x <|> asum xs > > Those are the same (assuming you mean (x:xs) instead of [x:xs]). > > Tom > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -- -- Dan Burton _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe at haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe -------------- next part -------------- An HTML attachment was scrubbed... URL: From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Fri Jun 10 15:39:27 2016 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Fri, 10 Jun 2016 16:39:27 +0100 Subject: [Haskell-cafe] All-fail case in asum In-Reply-To: References: <20160610145723.GI23915@weber> Message-ID: <20160610153927.GJ23915@weber> I think we're getting a little off track. The point is that the behaviour Yuriy is seeing is inconsistent. Yuriy, can you please post some complete code demonstrating your problem? I have not been able to replicate it. Tom On Fri, Jun 10, 2016 at 11:32:45AM -0400, David Feuer wrote: > Or, to keep it a fold, > > asum xs = foldr go (fromMaybe empty) xs Nothing where > go x r Nothing = r (Just x) > go x r (Just prev) = prev <|> r (Just x) > On Jun 10, 2016 11:09 AM, "Dan Burton" wrote: > > Add a pattern match for the single-element list to stop it from hitting the > empty list base case. > > asum [] = empty > asum [x] = x > asum (x:xs) = x <|> asum xs From hesselink at gmail.com Fri Jun 10 16:51:13 2016 From: hesselink at gmail.com (Erik Hesselink) Date: Fri, 10 Jun 2016 18:51:13 +0200 Subject: [Haskell-cafe] All-fail case in asum In-Reply-To: References: Message-ID: Disregarding is `asum` should be changed, perhaps you could fix your issue by doing: myParser = asum [tryA, tryB] <|> fail "input must be either A or B" Erik On 10 June 2016 at 16:37, ???? ?????????? (Yuriy Syrovetskiy) wrote: > Hello > > I want to define some parser such way: > > myParser = tryA <|> tryB <|> fail "input must be either A or B" > > It works. But then I want to rewrite it with asum: > > myParser = asum [tryA, tryB, fail "must be A or B"] > > It works, but the wrong way. Instead of my error it writes "empty". > Just "empty". > > It is so because in base library > > asum = foldr (<|>) empty > > What if it was defined > > asum [] = empty > asum [x:xs] = x <|> asum xs > > It would help me with my parser. But what can this break? Why isn't > this done yet? > > -- > Yuriy Syrovetskiy, http://cblp.su > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe From cblp at cblp.su Fri Jun 10 16:56:04 2016 From: cblp at cblp.su (=?UTF-8?B?0K7RgNC40Lkg0KHRi9GA0L7QstC10YbQutC40LkgKFl1cml5IFN5cm92ZXRza2l5KQ==?=) Date: Fri, 10 Jun 2016 19:56:04 +0300 Subject: [Haskell-cafe] All-fail case in asum In-Reply-To: References: Message-ID: Of course, but I want the *perfect* solution. I think, this Parser type is not perfectly monoidal, so in general asum and (<|>) are not interchangeable. On 10 Jun 2016 19:51, "Erik Hesselink" wrote: > Disregarding is `asum` should be changed, perhaps you could fix your > issue by doing: > > myParser = asum [tryA, tryB] <|> fail "input must be either A or B" > > Erik > > On 10 June 2016 at 16:37, ???? ?????????? (Yuriy Syrovetskiy) > wrote: > > Hello > > > > I want to define some parser such way: > > > > myParser = tryA <|> tryB <|> fail "input must be either A or B" > > > > It works. But then I want to rewrite it with asum: > > > > myParser = asum [tryA, tryB, fail "must be A or B"] > > > > It works, but the wrong way. Instead of my error it writes "empty". > > Just "empty". > > > > It is so because in base library > > > > asum = foldr (<|>) empty > > > > What if it was defined > > > > asum [] = empty > > asum [x:xs] = x <|> asum xs > > > > It would help me with my parser. But what can this break? Why isn't > > this done yet? > > > > -- > > Yuriy Syrovetskiy, http://cblp.su > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From oleg.grenrus at iki.fi Fri Jun 10 17:01:58 2016 From: oleg.grenrus at iki.fi (Oleg Grenrus) Date: Fri, 10 Jun 2016 20:01:58 +0300 Subject: [Haskell-cafe] All-fail case in asum In-Reply-To: References: Message-ID: If you aren?t scared of the dependencies: semigroupoids has asum1 (yet it?s easy to write yourself) https://s3.amazonaws.com/haddock.stackage.org/lts-6.2/semigroupoids-5.0.1/Data-Semigroup-Foldable.html#v:asum1 ? Prelude Data.Semigroup.Foldable Data.List.NonEmpty > asum1 ([Right 1, Right 2, Left "error"] :: NonEmpty (Either String Int)) Right 1 ? Prelude Data.Semigroup.Foldable Data.List.NonEmpty > asum1 ([Left "error"] :: NonEmpty (Either String Int)) Left "error" - Oleg > On 10 Jun 2016, at 17:37, ???? ?????????? (Yuriy Syrovetskiy) wrote: > > Hello > > I want to define some parser such way: > > myParser = tryA <|> tryB <|> fail "input must be either A or B" > > It works. But then I want to rewrite it with asum: > > myParser = asum [tryA, tryB, fail "must be A or B"] > > It works, but the wrong way. Instead of my error it writes "empty". > Just "empty". > > It is so because in base library > > asum = foldr (<|>) empty > > What if it was defined > > asum [] = empty > asum [x:xs] = x <|> asum xs > > It would help me with my parser. But what can this break? Why isn't > this done yet? > > -- > Yuriy Syrovetskiy, http://cblp.su > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- 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 tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Fri Jun 10 17:16:26 2016 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Fri, 10 Jun 2016 18:16:26 +0100 Subject: [Haskell-cafe] All-fail case in asum In-Reply-To: References: Message-ID: <20160610171626.GL23915@weber> On Fri, Jun 10, 2016 at 07:56:04PM +0300, ???? ?????????? (Yuriy Syrovetskiy) wrote: > I think, this Parser type is not perfectly monoidal, so in general asum and > (<|>) are not interchangeable. Please can you post an example showing that? I am unable to replicate this behaviour. ghci> import Text.ParserCombinators.Parsec ghci> import Data.Foldable ghci> let ar = asum [space, space, fail "My fail"] :: Parser Char ghci> runParser ar () "" "x" Left (line 1, column 1): unexpected "x" expecting space My fail It seems that the custom fail is indeed picked up. No hint of "error" here. Tom From david.feuer at gmail.com Sat Jun 11 03:32:52 2016 From: david.feuer at gmail.com (David Feuer) Date: Fri, 10 Jun 2016 23:32:52 -0400 Subject: [Haskell-cafe] Call pattern specialization limit messages Message-ID: When I compile Data.Sequence with -dppr-debug, I get several messages about constructor specialization exceeding the call pattern limit. Things like SpecConstr Function ?$j_ssfy{v} [lid]? has four call patterns, but the limit is 3 Use -fspec-constr-count=n to set the bound Specialisations: [([sc_sAZr{v} [lid]], [sc_sAZr{v} [lid], lvl_sdmH{v} [lid]]), ([sc_sAZs{v} [lid]], [sc_sAZs{v} [lid], lvl_sw9X{v} [lid]]), ([sc_sAZt{v} [lid]], [sc_sAZt{v} [lid], lvl_swa0{v} [lid]]), ([sc_sAZu{v} [lid]], [sc_sAZu{v} [lid], lvl_swat{v} [lid]])] How can I figure out what function this sort of thing is actually talking about? I'd love to see what benchmarks say about whether tweaking -fspec-constr-count is a good idea, but I don't know what to benchmark. Thanks, David -------------- next part -------------- An HTML attachment was scrubbed... URL: From cblp at cblp.su Sat Jun 11 05:15:43 2016 From: cblp at cblp.su (=?UTF-8?B?0K7RgNC40Lkg0KHRi9GA0L7QstC10YbQutC40LkgKFl1cml5IFN5cm92ZXRza2l5KQ==?=) Date: Sat, 11 Jun 2016 08:15:43 +0300 Subject: [Haskell-cafe] All-fail case in asum In-Reply-To: References: Message-ID: ?> :show imports import Prelude -- implicit import Data.Aeson.Types import Data.Foldable import Control.Applicative ?> parse (\v -> withObject "Object" (\_ -> pure "OK") v <|> fail "Expected object") Null Error "Expected object" ?> parse (\v -> asum [withObject "Object" (\_ -> pure "OK") v, fail "Expected object"]) Null Error "empty" Maybe instance Alternative Parser should be changed to ignore "empty"? 2016-06-10 20:01 GMT+03:00 Oleg Grenrus : > If you aren?t scared of the dependencies: semigroupoids has asum1 (yet it?s easy to write yourself) > > https://s3.amazonaws.com/haddock.stackage.org/lts-6.2/semigroupoids-5.0.1/Data-Semigroup-Foldable.html#v:asum1 > > ? Prelude Data.Semigroup.Foldable Data.List.NonEmpty > asum1 ([Right 1, Right 2, Left "error"] :: NonEmpty (Either String Int)) > Right 1 > ? Prelude Data.Semigroup.Foldable Data.List.NonEmpty > asum1 ([Left "error"] :: NonEmpty (Either String Int)) > Left "error" > > - Oleg > >> On 10 Jun 2016, at 17:37, ???? ?????????? (Yuriy Syrovetskiy) wrote: >> >> Hello >> >> I want to define some parser such way: >> >> myParser = tryA <|> tryB <|> fail "input must be either A or B" >> >> It works. But then I want to rewrite it with asum: >> >> myParser = asum [tryA, tryB, fail "must be A or B"] >> >> It works, but the wrong way. Instead of my error it writes "empty". >> Just "empty". >> >> It is so because in base library >> >> asum = foldr (<|>) empty >> >> What if it was defined >> >> asum [] = empty >> asum [x:xs] = x <|> asum xs >> >> It would help me with my parser. But what can this break? Why isn't >> this done yet? >> >> -- >> Yuriy Syrovetskiy, http://cblp.su >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> > -- Yuriy Syrovetskiy, http://cblp.su From hesselink at gmail.com Sat Jun 11 07:04:07 2016 From: hesselink at gmail.com (Erik Hesselink) Date: Sat, 11 Jun 2016 09:04:07 +0200 Subject: [Haskell-cafe] All-fail case in asum In-Reply-To: References: Message-ID: OK, so you're using attoparsec (through aeson). That's valuable information would have been useful to include in your initial email. After a bit of experimenting and reading the docs, I think the problem is that attoparsec's Alternative instance isn't completely correct. >From the docs, Alternative is supposed to be "a monoid on applicative functors". The Monoid laws say, among other things, that `mappend x mempty = x`. For Applicative, this would mean `x <|> empty = x`. However, in attoparsec: ? parse (fail "boom" <|> empty) "hello" Fail "hello" [] "Failed reading: empty" In parsec, on the other hand: ? parse (fail "boom" <|> empty) "" "hello" Left (line 1, column 1): boom So I don't think changing Applicative or asum is the way to go here. Erik On 11 June 2016 at 07:15, ???? ?????????? (Yuriy Syrovetskiy) wrote: > ?> :show imports > import Prelude -- implicit > import Data.Aeson.Types > import Data.Foldable > import Control.Applicative > ?> parse (\v -> withObject "Object" (\_ -> pure "OK") v <|> fail > "Expected object") Null > Error "Expected object" > ?> parse (\v -> asum [withObject "Object" (\_ -> pure "OK") v, fail > "Expected object"]) Null > Error "empty" > > Maybe instance Alternative Parser should be changed to ignore "empty"? > > 2016-06-10 20:01 GMT+03:00 Oleg Grenrus : >> If you aren?t scared of the dependencies: semigroupoids has asum1 (yet it?s easy to write yourself) >> >> https://s3.amazonaws.com/haddock.stackage.org/lts-6.2/semigroupoids-5.0.1/Data-Semigroup-Foldable.html#v:asum1 >> >> ? Prelude Data.Semigroup.Foldable Data.List.NonEmpty > asum1 ([Right 1, Right 2, Left "error"] :: NonEmpty (Either String Int)) >> Right 1 >> ? Prelude Data.Semigroup.Foldable Data.List.NonEmpty > asum1 ([Left "error"] :: NonEmpty (Either String Int)) >> Left "error" >> >> - Oleg >> >>> On 10 Jun 2016, at 17:37, ???? ?????????? (Yuriy Syrovetskiy) wrote: >>> >>> Hello >>> >>> I want to define some parser such way: >>> >>> myParser = tryA <|> tryB <|> fail "input must be either A or B" >>> >>> It works. But then I want to rewrite it with asum: >>> >>> myParser = asum [tryA, tryB, fail "must be A or B"] >>> >>> It works, but the wrong way. Instead of my error it writes "empty". >>> Just "empty". >>> >>> It is so because in base library >>> >>> asum = foldr (<|>) empty >>> >>> What if it was defined >>> >>> asum [] = empty >>> asum [x:xs] = x <|> asum xs >>> >>> It would help me with my parser. But what can this break? Why isn't >>> this done yet? >>> >>> -- >>> Yuriy Syrovetskiy, http://cblp.su >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>> >> > > > > -- > Yuriy Syrovetskiy, http://cblp.su > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe From cblp at cblp.su Sat Jun 11 07:15:22 2016 From: cblp at cblp.su (=?UTF-8?B?0K7RgNC40Lkg0KHRi9GA0L7QstC10YbQutC40LkgKFl1cml5IFN5cm92ZXRza2l5KQ==?=) Date: Sat, 11 Jun 2016 10:15:22 +0300 Subject: [Haskell-cafe] All-fail case in asum In-Reply-To: References: Message-ID: So should we consider it a bug in attoparsec? And should somebody fix it? On 11 Jun 2016 10:04, "Erik Hesselink" wrote: > OK, so you're using attoparsec (through aeson). That's valuable > information would have been useful to include in your initial email. > > After a bit of experimenting and reading the docs, I think the problem > is that attoparsec's Alternative instance isn't completely correct. > From the docs, Alternative is supposed to be "a monoid on applicative > functors". The Monoid laws say, among other things, that `mappend x > mempty = x`. For Applicative, this would mean `x <|> empty = x`. > However, in attoparsec: > > ? parse (fail "boom" <|> empty) "hello" > Fail "hello" [] "Failed reading: empty" > > In parsec, on the other hand: > > ? parse (fail "boom" <|> empty) "" "hello" > Left (line 1, column 1): > boom > > So I don't think changing Applicative or asum is the way to go here. > > Erik > > On 11 June 2016 at 07:15, ???? ?????????? (Yuriy Syrovetskiy) > wrote: > > ?> :show imports > > import Prelude -- implicit > > import Data.Aeson.Types > > import Data.Foldable > > import Control.Applicative > > ?> parse (\v -> withObject "Object" (\_ -> pure "OK") v <|> fail > > "Expected object") Null > > Error "Expected object" > > ?> parse (\v -> asum [withObject "Object" (\_ -> pure "OK") v, fail > > "Expected object"]) Null > > Error "empty" > > > > Maybe instance Alternative Parser should be changed to ignore "empty"? > > > > 2016-06-10 20:01 GMT+03:00 Oleg Grenrus : > >> If you aren?t scared of the dependencies: semigroupoids has asum1 (yet > it?s easy to write yourself) > >> > >> > https://s3.amazonaws.com/haddock.stackage.org/lts-6.2/semigroupoids-5.0.1/Data-Semigroup-Foldable.html#v:asum1 > >> > >> ? Prelude Data.Semigroup.Foldable Data.List.NonEmpty > asum1 ([Right 1, > Right 2, Left "error"] :: NonEmpty (Either String Int)) > >> Right 1 > >> ? Prelude Data.Semigroup.Foldable Data.List.NonEmpty > asum1 ([Left > "error"] :: NonEmpty (Either String Int)) > >> Left "error" > >> > >> - Oleg > >> > >>> On 10 Jun 2016, at 17:37, ???? ?????????? (Yuriy Syrovetskiy) < > cblp at cblp.su> wrote: > >>> > >>> Hello > >>> > >>> I want to define some parser such way: > >>> > >>> myParser = tryA <|> tryB <|> fail "input must be either A or B" > >>> > >>> It works. But then I want to rewrite it with asum: > >>> > >>> myParser = asum [tryA, tryB, fail "must be A or B"] > >>> > >>> It works, but the wrong way. Instead of my error it writes "empty". > >>> Just "empty". > >>> > >>> It is so because in base library > >>> > >>> asum = foldr (<|>) empty > >>> > >>> What if it was defined > >>> > >>> asum [] = empty > >>> asum [x:xs] = x <|> asum xs > >>> > >>> It would help me with my parser. But what can this break? Why isn't > >>> this done yet? > >>> > >>> -- > >>> Yuriy Syrovetskiy, http://cblp.su > >>> _______________________________________________ > >>> Haskell-Cafe mailing list > >>> Haskell-Cafe at haskell.org > >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > >>> > >> > > > > > > > > -- > > Yuriy Syrovetskiy, http://cblp.su > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org > > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From oleg.grenrus at iki.fi Sat Jun 11 14:13:37 2016 From: oleg.grenrus at iki.fi (Oleg Grenrus) Date: Sat, 11 Jun 2016 17:13:37 +0300 Subject: [Haskell-cafe] All-fail case in asum In-Reply-To: References: Message-ID: <4DD22F03-5C8A-441A-8BC9-74C3E951CE8A@iki.fi> It depends on definition of equivalence for your Functor. When proving Alternative laws for artoparsec's Parser all errors are treated as equivalent: so no problem. Also attoparsec concentrates on the speed, not error reporting: Parsec parsers can produce more helpful error messages than attoparsec parsers. This is a matter of focus: attoparsec avoids the extra book-keeping in favour of higher performance. Sent from my iPhone > On 11 Jun 2016, at 10:15, ???? ?????????? (Yuriy Syrovetskiy) wrote: > > So should we consider it a bug in attoparsec? And should somebody fix it? > >> On 11 Jun 2016 10:04, "Erik Hesselink" wrote: >> OK, so you're using attoparsec (through aeson). That's valuable >> information would have been useful to include in your initial email. >> >> After a bit of experimenting and reading the docs, I think the problem >> is that attoparsec's Alternative instance isn't completely correct. >> From the docs, Alternative is supposed to be "a monoid on applicative >> functors". The Monoid laws say, among other things, that `mappend x >> mempty = x`. For Applicative, this would mean `x <|> empty = x`. >> However, in attoparsec: >> >> ? parse (fail "boom" <|> empty) "hello" >> Fail "hello" [] "Failed reading: empty" >> >> In parsec, on the other hand: >> >> ? parse (fail "boom" <|> empty) "" "hello" >> Left (line 1, column 1): >> boom >> >> So I don't think changing Applicative or asum is the way to go here. >> >> Erik >> >> On 11 June 2016 at 07:15, ???? ?????????? (Yuriy Syrovetskiy) >> wrote: >> > ?> :show imports >> > import Prelude -- implicit >> > import Data.Aeson.Types >> > import Data.Foldable >> > import Control.Applicative >> > ?> parse (\v -> withObject "Object" (\_ -> pure "OK") v <|> fail >> > "Expected object") Null >> > Error "Expected object" >> > ?> parse (\v -> asum [withObject "Object" (\_ -> pure "OK") v, fail >> > "Expected object"]) Null >> > Error "empty" >> > >> > Maybe instance Alternative Parser should be changed to ignore "empty"? >> > >> > 2016-06-10 20:01 GMT+03:00 Oleg Grenrus : >> >> If you aren?t scared of the dependencies: semigroupoids has asum1 (yet it?s easy to write yourself) >> >> >> >> https://s3.amazonaws.com/haddock.stackage.org/lts-6.2/semigroupoids-5.0.1/Data-Semigroup-Foldable.html#v:asum1 >> >> >> >> ? Prelude Data.Semigroup.Foldable Data.List.NonEmpty > asum1 ([Right 1, Right 2, Left "error"] :: NonEmpty (Either String Int)) >> >> Right 1 >> >> ? Prelude Data.Semigroup.Foldable Data.List.NonEmpty > asum1 ([Left "error"] :: NonEmpty (Either String Int)) >> >> Left "error" >> >> >> >> - Oleg >> >> >> >>> On 10 Jun 2016, at 17:37, ???? ?????????? (Yuriy Syrovetskiy) wrote: >> >>> >> >>> Hello >> >>> >> >>> I want to define some parser such way: >> >>> >> >>> myParser = tryA <|> tryB <|> fail "input must be either A or B" >> >>> >> >>> It works. But then I want to rewrite it with asum: >> >>> >> >>> myParser = asum [tryA, tryB, fail "must be A or B"] >> >>> >> >>> It works, but the wrong way. Instead of my error it writes "empty". >> >>> Just "empty". >> >>> >> >>> It is so because in base library >> >>> >> >>> asum = foldr (<|>) empty >> >>> >> >>> What if it was defined >> >>> >> >>> asum [] = empty >> >>> asum [x:xs] = x <|> asum xs >> >>> >> >>> It would help me with my parser. But what can this break? Why isn't >> >>> this done yet? >> >>> >> >>> -- >> >>> Yuriy Syrovetskiy, http://cblp.su >> >>> _______________________________________________ >> >>> Haskell-Cafe mailing list >> >>> Haskell-Cafe at haskell.org >> >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> >>> >> >> >> > >> > >> > >> > -- >> > Yuriy Syrovetskiy, http://cblp.su >> > _______________________________________________ >> > Haskell-Cafe mailing list >> > Haskell-Cafe at haskell.org >> > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe -------------- next part -------------- An HTML attachment was scrubbed... URL: From ch.howard at zoho.com Sun Jun 12 05:46:52 2016 From: ch.howard at zoho.com (Christopher Howard) Date: Sat, 11 Jun 2016 21:46:52 -0800 Subject: [Haskell-cafe] left to right pipeline of functions Message-ID: <575CF74C.1090103@zoho.com> Hi, I am learning about monads, and this question came to mind: is there a way to have a sequence of functions left to right like so: g = return 2 >>= \n -> return (n + 1) >>= \n -> return (n + 3) Either: some kind of generic monad that makes this legal, or some way to do this without monad (i.e., without the "returns"). -- http://justonemoremathproblem.com To protect my privacy, please use PGP encryption. It's free and easy to use! My public key ID is 0x340EA95A (pgp.mit.edu). From therealsumit at gmail.com Sun Jun 12 05:50:23 2016 From: therealsumit at gmail.com (Sumit Sahrawat) Date: Sun, 12 Jun 2016 05:50:23 +0000 Subject: [Haskell-cafe] left to right pipeline of functions In-Reply-To: <575CF74C.1090103@zoho.com> References: <575CF74C.1090103@zoho.com> Message-ID: If you're looking to do this without returns, you should take a look at the RebindableSyntax extension. [1]: https://ocharles.org.uk/blog/guest-posts/2014-12-06-rebindable-syntax.html On Sun 12 Jun, 2016, 11:17 AM Christopher Howard, wrote: > Hi, I am learning about monads, and this question came to mind: is there > a way to have a sequence of functions left to right like so: > > g = return 2 >>= \n -> return (n + 1) >>= \n -> return (n + 3) > > Either: some kind of generic monad that makes this legal, or some way to > do this without monad (i.e., without the "returns"). > > -- > http://justonemoremathproblem.com > To protect my privacy, please use PGP encryption. It's free and easy > to use! My public key ID is 0x340EA95A (pgp.mit.edu). > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -- Regards, Sumit -------------- next part -------------- An HTML attachment was scrubbed... URL: From kiss.csongor.kiss at gmail.com Sun Jun 12 06:07:08 2016 From: kiss.csongor.kiss at gmail.com (Csongor Kiss) Date: Sun, 12 Jun 2016 07:07:08 +0100 Subject: [Haskell-cafe] left to right pipeline of functions In-Reply-To: <575CF74C.1090103@zoho.com> References: <575CF74C.1090103@zoho.com> Message-ID: Hi, (>>=) :: Monad m => m a -> (a -> m b) -> m b, and if I understand correctly, what you need is a ?generic? version, that works without the returns? 'return :: a -> m a' for some monad m. This m comes from the monad instance you use, but if we want a generic one, it?s only possible by fixing a specific m. The obvious choice is to use the Identity monad and have a specialised (>>=?) :: Identity a -> (a -> Identity b) -> Identity b. For all `a`, `Identity a` is isomorphic to `a`, so with a bit of cheating, you could rewrite the above to (>>=??) :: a -> (a -> b) -> b, which starts to look really familiar, in fact, it?s just the function composition (.) with its arguments flipped, and is actually defined as (&) in Data.Function. g' = 2 & \n -> (n + 1) & \n -> (n + 3) This was obviously a really roundabout way of arriving at the result, but I think the analogy with function composition is really nice, as we can think of (a -> b) as a special case of (a -> m b), the so-called Kleisli arrow. What monads do is they compose these Kleisli arrows. --? Csongor On 12 June 2016 at 06:47:13, Christopher Howard (ch.howard at zoho.com) wrote: Hi, I am learning about monads, and this question came to mind: is there a way to have a sequence of functions left to right like so: g = return 2 >>= \n -> return (n + 1) >>= \n -> return (n + 3) Either: some kind of generic monad that makes this legal, or some way to do this without monad (i.e., without the "returns"). -- http://justonemoremathproblem.com To protect my privacy, please use PGP encryption. It's free and easy to use! My public key ID is 0x340EA95A (pgp.mit.edu). _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe at haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe -------------- next part -------------- An HTML attachment was scrubbed... URL: From tanuki at gmail.com Sun Jun 12 06:19:27 2016 From: tanuki at gmail.com (Theodore Lief Gannon) Date: Sat, 11 Jun 2016 23:19:27 -0700 Subject: [Haskell-cafe] left to right pipeline of functions In-Reply-To: References: <575CF74C.1090103@zoho.com> Message-ID: Nitpick: (&) is flipped function application ($), not composition (.) -- though the signature you gave was correct. On Jun 11, 2016 11:07 PM, "Csongor Kiss" wrote: > Hi, > > (>>=) :: Monad m => m a -> (a -> m b) -> m b, and if I understand > correctly, what you need is a ?generic? version, that works without the > returns? > > 'return :: a -> m a' for some monad m. This m comes from the monad > instance you use, but if we want a generic one, it?s only possible by > fixing a specific m. The obvious choice is to use the Identity monad and > have a specialised (>>=?) :: Identity a -> (a -> Identity b) -> Identity b. > > For all `a`, `Identity a` is isomorphic to `a`, so with a bit of cheating, > you could rewrite the above to (>>=??) :: a -> (a -> b) -> b, > which starts to look really familiar, in fact, it?s just the function > composition (.) with its arguments flipped, and is actually defined > as (&) in Data.Function. > > g' = 2 & \n -> (n + 1) & \n -> (n + 3) > > This was obviously a really roundabout way of arriving at the result, but > I think the analogy with function composition is really nice, as we can > think of (a -> b) as a special case of (a -> m b), the so-called Kleisli > arrow. What monads do is they compose these Kleisli arrows. > > -- > Csongor > > On 12 June 2016 at 06:47:13, Christopher Howard (ch.howard at zoho.com) > wrote: > > Hi, I am learning about monads, and this question came to mind: is there > a way to have a sequence of functions left to right like so: > > g = return 2 >>= \n -> return (n + 1) >>= \n -> return (n + 3) > > Either: some kind of generic monad that makes this legal, or some way to > do this without monad (i.e., without the "returns"). > > -- > http://justonemoremathproblem.com > To protect my privacy, please use PGP encryption. It's free and easy > to use! My public key ID is 0x340EA95A (pgp.mit.edu). > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kiss.csongor.kiss at gmail.com Sun Jun 12 06:22:47 2016 From: kiss.csongor.kiss at gmail.com (Csongor Kiss) Date: Sun, 12 Jun 2016 07:22:47 +0100 Subject: [Haskell-cafe] left to right pipeline of functions In-Reply-To: References: <575CF74C.1090103@zoho.com> Message-ID: Yes, my bad, thanks for pointing it out. --? Csongor On 12 June 2016 at 07:19:37, Theodore Lief Gannon (tanuki at gmail.com) wrote: Nitpick: (&) is flipped function application ($), not composition (.) -- though the signature you gave was correct. On Jun 11, 2016 11:07 PM, "Csongor Kiss" wrote: Hi, (>>=) :: Monad m => m a -> (a -> m b) -> m b, and if I understand correctly, what you need is a ?generic? version, that works without the returns? 'return :: a -> m a' for some monad m. This m comes from the monad instance you use, but if we want a generic one, it?s only possible by fixing a specific m. The obvious choice is to use the Identity monad and have a specialised (>>=?) :: Identity a -> (a -> Identity b) -> Identity b. For all `a`, `Identity a` is isomorphic to `a`, so with a bit of cheating, you could rewrite the above to (>>=??) :: a -> (a -> b) -> b, which starts to look really familiar, in fact, it?s just the function composition (.) with its arguments flipped, and is actually defined as (&) in Data.Function. g' = 2 & \n -> (n + 1) & \n -> (n + 3) This was obviously a really roundabout way of arriving at the result, but I think the analogy with function composition is really nice, as we can think of (a -> b) as a special case of (a -> m b), the so-called Kleisli arrow. What monads do is they compose these Kleisli arrows. --? Csongor On 12 June 2016 at 06:47:13, Christopher Howard (ch.howard at zoho.com) wrote: Hi, I am learning about monads, and this question came to mind: is there a way to have a sequence of functions left to right like so: g = return 2 >>= \n -> return (n + 1) >>= \n -> return (n + 3) Either: some kind of generic monad that makes this legal, or some way to do this without monad (i.e., without the "returns"). -- http://justonemoremathproblem.com To protect my privacy, please use PGP encryption. It's free and easy to use! My public key ID is 0x340EA95A (pgp.mit.edu). _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe at haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe at haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe at haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.feuer at gmail.com Sun Jun 12 06:40:49 2016 From: david.feuer at gmail.com (David Feuer) Date: Sun, 12 Jun 2016 02:40:49 -0400 Subject: [Haskell-cafe] left to right pipeline of functions In-Reply-To: <575CF74C.1090103@zoho.com> References: <575CF74C.1090103@zoho.com> Message-ID: I suspect you're looking for something simpler: >>> from Control.Category, which just composes things in reverse. Another nice function is >=> from Control.Monad. On Jun 12, 2016 1:47 AM, "Christopher Howard" wrote: > Hi, I am learning about monads, and this question came to mind: is there > a way to have a sequence of functions left to right like so: > > g = return 2 >>= \n -> return (n + 1) >>= \n -> return (n + 3) > > Either: some kind of generic monad that makes this legal, or some way to > do this without monad (i.e., without the "returns"). > > -- > http://justonemoremathproblem.com > To protect my privacy, please use PGP encryption. It's free and easy > to use! My public key ID is 0x340EA95A (pgp.mit.edu). > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.sorokin at gmail.com Sun Jun 12 13:35:21 2016 From: david.sorokin at gmail.com (David Sorokin) Date: Sun, 12 Jun 2016 16:35:21 +0300 Subject: [Haskell-cafe] [ANN] aivika-lattice-0.1 Message-ID: Hi Cafe, I?m glad to introduce a complete new module aivika-lattice [1] for the Aivika simulation library. It allows running nested discrete event simulations within lattice. If the naive approach implies that traversing the nested simulation nodes has an exponential complexity, then the lattice approach gives us a quadratical growth. This is a key feature, which makes the traversing a computationally feasible task even for a large size lattice. It can be useful for financial modeling, for instance. The model can be divided into two different parts. The first part is a discrete event simulation that branches in the lattice nodes. Within this simulation, we can update a mutable reference that can be observed in another part of the model. For example, such a reference can store a value of the modeled interest rate, or stock price, or exchange rate. It is important that the first part is forward traversing, when the time increases from the past to the future. The first part can even include discontinuous processes, resources, queues, streams of transacts if required. This is a general purpose simulation library. The second part is quite opposite. This is an estimating part. It is backward-traversing, where we estimate the past based on estimations of the future. When estimating, we can observe the mutable reference values. This is a bridge for connecting two different parts of the model. For example, we can estimate the price of the contract by the model of interest and exchange rates specified in the first part of the model. The package is quite experimental. It is mainly a proof of concept. There was no goal to achieve the highest possible speed of simulation, which is important for such tasks. Best regards, David Sorokin [1] http://hackage.haskell.org/package/aivika-lattice From roman at unbounce.com Tue Jun 14 06:50:02 2016 From: roman at unbounce.com (=?UTF-8?B?Um9tw6FuIEdvbnrDoWxleg==?=) Date: Tue, 14 Jun 2016 06:50:02 +0000 Subject: [Haskell-cafe] CUFP 2016 Call For Tutorials Message-ID: Hi all, The Commercial Users of Functional Programming (CUFP) 2016 has its Call for Tutorials open for submission. CUFP 2016 is being held in the historic city of Nara, Japan. The conference is devoted to showcase the state of the art of Functional Programming on industrial settings. This conference is co-located with the International Conference of Functional Programming (ICFP). We're looking for tutors that would like to host workshops on on the following themes: - Introductions to functional programming languages. In the past we have had sessions of Clojure, Erlang, F#, F*, Haskell, ML, OCaml, Scala, Scheme and others. - Advanced programming languages, concepts and applications (e.g. Lens, Liquid-Haskell, Agda, Idris, etc.) - Applying functional programming in particular areas, including Web, high-performance computing, finance. - Tools and techniques supporting state of the art functional programming. In the past we have had tutorials on QuickCheck, Elm and others. - Theory. Type theory, category theory, abstract algebra, ongoing or new research, and anything useful or interesting to functional programmers. If you'd like to submit a proposal, just fill this form http://goo.gl/forms/qoyK9qYPZhiDPSzO2. More info can be found at http://cufp.org/2016/call-for-tutorials.html Regards, Roman Gonzalez. -------------- next part -------------- An HTML attachment was scrubbed... URL: From esz at posteo.de Tue Jun 14 12:30:50 2016 From: esz at posteo.de (Ertugrul =?utf-8?Q?S=C3=B6ylemez?=) Date: Tue, 14 Jun 2016 14:30:50 +0200 Subject: [Haskell-cafe] Package takeover (also: the future of Netwire) Message-ID: <86twgw54w5.fsf@posteo.de> Hi everybody, I'd like to take over the following Hackage packages with my account named [esz]: * acme-schoenfinkel, * cascading, * continue, * contstuff-monads-tf, * contstuff-transformers, * contstuff, * dnscache, * fastirc, * ihttp, * instinct, * ismtp, * netlines, * netwire, * quickset, * web-page, * webwire, * yesod-tableview. These are actually already mine, but because my old account has become practically inaccessible, I'm now following the official [takeover procedure], asking myself whether I'm okay with that. =) After the takeover, I'm going to deprecate the following packages, unless someone would like to take over maintenance: * cascading: Clay is more comprehensive and easier to use. * contstuff*: Childhood experiments, because after writing a monad tutorial of course you must write an mtl replacement. * dnscache: Useful library, but needs maintenance. * fastirc: irc is reasonably efficient now (it used to be a String parser). * ihttp: use http-client. * ismtp: Useful library, but needs maintenance and should be rewritten using a modern streaming library. * netlines: use a modern streaming library. * netwire: Useful library, but needs maintenance and has high maintenance cost due to its design. I'll likely replace it by a new abstraction at some point, using a different package name. Currently I recommend using one of the following libraries for FRP: * reactive-banana: My former favourite when it comes to push/pull FRP. Well designed, clean semantics, reasonably efficient. * reflex: My current favourite when it comes to push/pull FRP. Well designed, clean semantics, reasonably efficient. * Yampa: AFRP for games, simulations and other real-time applications (for when a high and predictable framerate is more important than pushed events, same target domain as Netwire). * webwire: Experiment with FRP for handling server-side sessions in web applications. Works with some caveats, not that useful in practice. * yesod-tableview: needs maintenance, not that useful in modern web applications. That leaves the following packages for active maintenance by me, which includes making sure they compile, keeping them free of bugs and verifying/applying contributions. Most of these need maintenance right now: * acme-schoenfinkel: Surprisingly useful joke package. Needs a few adjustments to compile with modern GHC. * continue: Monad transformer for named reentry points, isomorphic to CofreeT. Ideally this should be just an interface to CofreeT from 'free', but unfortunately that one's instances are more restrictive than necessary (Alternative instead of Plus), making it useless. You couldn't use reasonable data structures like HashMap or Map. * instinct: Efficient feed-forward neural networks with backprop learning. To be replaced by a more general machine learning framework at some point, but still useful on its own. Needs maintenance. * quickset: Compact query-only binary search arrays. Needs a more comprehensive API. * web-page: Component system for web pages. Needs a more general API, because currently it makes too many assumptions on which packages you use (blaze-html, clay and jmacro). Note: do not confuse with Athan Clark's 'webpage' library. [esz]: https://hackage.haskell.org/user/esz [takeover procedure]: https://wiki.haskell.org/Taking_over_a_package Greets, Ertugrul -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 472 bytes Desc: not available URL: From me at alang.ca Tue Jun 14 15:08:09 2016 From: me at alang.ca (Alex Lang) Date: Tue, 14 Jun 2016 08:08:09 -0700 Subject: [Haskell-cafe] Reminder: 10 days to submit talks to CUFP 2016 Message-ID: This CFP and the form for submitting presentation proposals can be found at: http://cufp.org/2016/call-for-presentations.html ---------------------------------------------------------------------- 2016 Call for Presentations Workshop for Commercial Users of Functional Programming 2016 Sponsored by SIGPLAN CUFP 2016 Co-located with ICFP 2016 Nara, Japan September 22-24 Talk Proposal Submission Deadline: 24 June 2016 The annual CUFP event is a place where people can see how others are using functional programming to solve real world problems; where practitioners meet and collaborate; where language designers and users can share ideas about the future of their favorite language; and where one can learn practical techniques and approaches for putting functional programming to work. ---------------------------------------------------------------------- Giving a CUFP Talk If you have experience using functional languages in a practical setting, we invite you to submit a proposal to give a talk at the event. We're looking for two kinds of talks: Retrospective talks are typically 25 minutes long. Now that CUFP has run for more than a decade, we intend to invite past speakers to share what they?ve learned after a decade spent as commercial users of functional programming. We will favour experience reports that include technical content. Technical talks are also 25 minutes long, and should focus on teaching the audience something about a particular technique or methodology, from the point of view of someone who has seen it play out in practice. These talks could cover anything from techniques for building functional concurrent applications, to managing dynamic reconfigurations, to design recipes for using types effectively in large-scale applications. While these talks will often be based on a particular language, they should be accessible to a broad range of programmers. We strongly encourage submissions from people in communities that are underrepresented in functional programming, including but not limited to women; people of color; people in gender, sexual and romantic minorities; people with disabilities; people residing in Asia, Africa, or Latin America; and people who have never presented at a conference before. We recognize that inclusion is an important part of our mission to promote functional programming. So that CUFP can be a safe environment in which participants openly exchange ideas, we abide by the SIGPLAN Conference Anti-Harassment Policy. If you are interested in offering a talk, or nominating someone to do so, please submit your presentation before 24 June 2016 via the CUFP 2016 Presentation Submission Form You do not need to submit a paper, just a short proposal for your talk. There will be a short scribe's report of the presentations and discussions but not of the details of individual talks, as the meeting is intended to be more of a discussion forum than a technical interchange. Nevertheless, presentations will be recorded and presenters will be expected to sign an ACM copyright release form. Note that we will need all presenters to register for the CUFP workshop and travel to Japan at their own expense. There are some funds available to would-be presenters who require assistance in this respect. ---------------------------------------------------------------------- Program Committee Katie Ots (Facebook), co-chair Alex Lang (Tsuru Capital), co-chair R?nar ?li Bjarnason (Verizon Labs) Mark Hibberd (Ambiata) Mirai Ikebuchi (Nagoya University) Paul Khuong (AppNexus) Carin Meier (Cognitect) Kenji Rikitake (Kenji Rikitake Professional Engineer's Office) ---------------------------------------------------------------------- More information For more information on CUFP, including videos of presentations from previous years, take a look at the CUFP website at http://cufp.org. Note that presenters, like other attendees, will need to register for the event. Acceptance and rejection letters will be sent out by July 15th. ---------------------------------------------------------------------- Guidance on giving a great CUFP talk Focus on the interesting bits: Think about what will distinguish your talk, and what will engage the audience, and focus there. There are a number of places to look for those interesting bits. Setting: FP is pretty well-established in some areas, including formal verification, financial processing, and server-side web services. An unusual setting can be a source of interest. If you're deploying FP-based mobile UIs or building servers on oil rigs, then the challenges of that scenario are worth focusing on. Did FP help or hinder in adapting to the setting? Technology: The CUFP audience is hungry to learn about how FP techniques work in practice. What design patterns have you applied, and to what areas? Did you use functional reactive programming for user interfaces, or DSLs for playing chess, or fault-tolerant actors for large-scale geological data processing? Teach us something about the techniques you used, and why we should consider using them ourselves. Getting things done: How did you deal with large-scale software development in the absence of pre-existing support tools that are often expected in larger commercial environments (IDEs, coverage tools, debuggers, profilers) and without larger, proven bodies of libraries? Did you hit any brick walls that required support from the community? Don't just be a cheerleader: It's easy to write a rah-rah talk about how well FP worked for you, but CUFP is more interesting when the talks also cover what doesn't work. Even when the results were all great, you should spend more time on the challenges along the way than on the parts that went smoothly. ---------------------------------------------------------------------- -------------- next part -------------- An HTML attachment was scrubbed... URL: From ncrashed at gmail.com Tue Jun 14 15:08:31 2016 From: ncrashed at gmail.com (NCrashed .) Date: Tue, 14 Jun 2016 19:08:31 +0400 Subject: [Haskell-cafe] Package takeover (also: the future of Netwire) In-Reply-To: <86twgw54w5.fsf@posteo.de> References: <86twgw54w5.fsf@posteo.de> Message-ID: Hi, Ertugrul I am active user of the netwire package. I like its feature of custom monad under the arrow abstraction and an inhibithion switching. As I concern, no other FRP implementation is capable of that. At some point I forked netwire to maintain it by myself (building with modern ghc and bug fixing) and embeded into my experimental packages with full respect to your license. I am willing to handle active maintenance of netwire until its successor won't be released, if you are not against the idea, of course. The packages that use netwire a lot: gore-and-ash - https://hackage.haskell.org/package/gore-and-ash And its derivatives: https://hackage.haskell.org/packages/search?terms=Gore-and-ash+ On Jun 14, 2016 15:31, "Ertugrul S?ylemez" wrote: > Hi everybody, > > I'd like to take over the following Hackage packages with my account > named [esz]: > > * acme-schoenfinkel, > * cascading, > * continue, > * contstuff-monads-tf, > * contstuff-transformers, > * contstuff, > * dnscache, > * fastirc, > * ihttp, > * instinct, > * ismtp, > * netlines, > * netwire, > * quickset, > * web-page, > * webwire, > * yesod-tableview. > > These are actually already mine, but because my old account has become > practically inaccessible, I'm now following the official [takeover > procedure], asking myself whether I'm okay with that. =) > > After the takeover, I'm going to deprecate the following packages, > unless someone would like to take over maintenance: > > * cascading: Clay is more comprehensive and easier to use. > > * contstuff*: Childhood experiments, because after writing a > monad tutorial of course you must write an mtl replacement. > > * dnscache: Useful library, but needs maintenance. > > * fastirc: irc is reasonably efficient now (it used to be a String > parser). > > * ihttp: use http-client. > > * ismtp: Useful library, but needs maintenance and should be rewritten > using a modern streaming library. > > * netlines: use a modern streaming library. > > * netwire: Useful library, but needs maintenance and has high > maintenance cost due to its design. I'll likely replace it by a new > abstraction at some point, using a different package name. > Currently I recommend using one of the following libraries for FRP: > > * reactive-banana: My former favourite when it comes to push/pull > FRP. Well designed, clean semantics, reasonably efficient. > > * reflex: My current favourite when it comes to push/pull FRP. > Well designed, clean semantics, reasonably efficient. > > * Yampa: AFRP for games, simulations and other real-time > applications (for when a high and predictable framerate is more > important than pushed events, same target domain as Netwire). > > * webwire: Experiment with FRP for handling server-side sessions in > web applications. Works with some caveats, not that useful in > practice. > > * yesod-tableview: needs maintenance, not that useful in modern web > applications. > > That leaves the following packages for active maintenance by me, which > includes making sure they compile, keeping them free of bugs and > verifying/applying contributions. Most of these need maintenance right > now: > > * acme-schoenfinkel: Surprisingly useful joke package. Needs a few > adjustments to compile with modern GHC. > > * continue: Monad transformer for named reentry points, isomorphic to > CofreeT. > > Ideally this should be just an interface to CofreeT from 'free', but > unfortunately that one's instances are more restrictive than > necessary (Alternative instead of Plus), making it useless. You > couldn't use reasonable data structures like HashMap or Map. > > * instinct: Efficient feed-forward neural networks with backprop > learning. To be replaced by a more general machine learning > framework at some point, but still useful on its own. Needs > maintenance. > > * quickset: Compact query-only binary search arrays. Needs a more > comprehensive API. > > * web-page: Component system for web pages. Needs a more general API, > because currently it makes too many assumptions on which packages > you use (blaze-html, clay and jmacro). Note: do not confuse with > Athan Clark's 'webpage' library. > > > [esz]: https://hackage.haskell.org/user/esz > [takeover procedure]: https://wiki.haskell.org/Taking_over_a_package > > > Greets, > Ertugrul > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From daniel.berecz at gmail.com Tue Jun 14 20:00:06 2016 From: daniel.berecz at gmail.com (Gmail) Date: Tue, 14 Jun 2016 13:00:06 -0700 Subject: [Haskell-cafe] [ANN] Budapest Haskell Hackathon 2016, 6-7th Aug 2016 Message-ID: Hi everybody, I'm happy to announce that our local user group will hold a Haskell Hackathon in Budapest this year (this will be the second)! We will hold it from August 6th to the 7th (Saturday & Sunday). You can find out more on the following link: https://wiki.haskell.org/Budapest_Hackathon_2016 We will reguraly update the site with new information. If you decide to come, please fill out the following Google Form: http://goo.gl/forms/pqgh6fvK8F8a2pAg1 If you have a project, demo, or talk that you want to bring to the event please contact us, and we can talk about the details. You can find our contact info the events wiki site, or you can just contact me directly. The event will be open to people of all experience levels, from beginners to gurus. The only requisite is that you?re interested in the Haskell language, and want to hang out with us, and have a good time! Greetings from Daniel, and the other BP-HUG organizers. -------------- next part -------------- An HTML attachment was scrubbed... URL: From brucker at spamfence.net Tue Jun 14 23:54:28 2016 From: brucker at spamfence.net (Achim D. Brucker) Date: Wed, 15 Jun 2016 00:54:28 +0100 Subject: [Haskell-cafe] 2nd Call for Papers: OCL and Textual Modeling Tools and Textual Model Transformations (OCL 2016) - Submit Your Paper Until July 17, 2016 Message-ID: <20160614235428.GA6160@fujikawa.home.brucker.ch> (Apologies for duplicates) Only four weeks until the deadline! -- Dr. Achim D. Brucker | Senior Lecturer | University of Sheffield https://www.brucker.ch/ From bruno at ruomad.net Wed Jun 15 05:53:53 2016 From: bruno at ruomad.net (bruno at ruomad.net) Date: Wed, 15 Jun 2016 07:53:53 +0200 Subject: [Haskell-cafe] Help with Data.Conduit.List.mapAccum Message-ID: Hello, I'm trying to use Data.Conduit, but I get stuck with mapAccum as how to get and retrieve the result. If I use it, I get a simple conduit like : testC :: ConduitM () Int IO Int testC = Src =$= cdt where src = CL.sourceList [1..10] cdt = CL.mapAccum (\x s ->(x+s, x) 0 I can get the output with testC $$ CL.consume but how do I retrieve the accumulated sum ? Bruno -------------- next part -------------- An HTML attachment was scrubbed... URL: From wangbj at gmail.com Wed Jun 15 06:08:16 2016 From: wangbj at gmail.com (Baojun Wang) Date: Wed, 15 Jun 2016 06:08:16 +0000 Subject: [Haskell-cafe] Help with Data.Conduit.List.mapAccum In-Reply-To: References: Message-ID: Foldl from conduit combinators? On Tue, Jun 14, 2016 at 22:54 wrote: > Hello, > I'm trying to use Data.Conduit, but I get stuck with mapAccum as how to > get and retrieve the result. > If I use it, I get a simple conduit like : > > testC :: ConduitM () Int IO Int > testC = Src =$= cdt where > src = CL.sourceList [1..10] > cdt = CL.mapAccum (\x s -> (x+s, x) 0 > > I can get the output with > testC $$ CL.consume > but how do I retrieve the accumulated sum ? > > Bruno > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bruno at ruomad.net Wed Jun 15 06:14:50 2016 From: bruno at ruomad.net (bruno at ruomad.net) Date: Wed, 15 Jun 2016 08:14:50 +0200 Subject: [Haskell-cafe] Help with Data.Conduit.List.mapAccum In-Reply-To: References: Message-ID: <88919fc0-c692-484e-a541-25faa55760cd@Spark> Hello, Thanks for the answer. I could of course use fold, but that would eliminate the use of mapAccum, what's the use of it then if I cannot get the result ? It's also a broader question, how to get the result of a ConduitM i o m r ? bruno On 15 Jun 2016 08:08 +0200, Baojun Wang, wrote: > Foldl from conduit combinators? > On Tue, Jun 14, 2016 at 22:54wrote: > > Hello, > > I'm trying to use Data.Conduit, but I get stuck with mapAccum as how to get and retrieve the result. > > If I use it, I get a simple conduit like : > > > > testC :: ConduitM () Int IO Int > > testC = Src =$= cdt where > > src = CL.sourceList [1..10] > > cdt = CL.mapAccum (\x s ->(x+s, x) 0 > > > > I can get the output with > > testC $$ CL.consume > > but how do I retrieve the accumulated sum ? > > > > Bruno > > > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org(mailto:Haskell-Cafe at haskell.org) > > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at snoyman.com Wed Jun 15 06:34:29 2016 From: michael at snoyman.com (Michael Snoyman) Date: Wed, 15 Jun 2016 09:34:29 +0300 Subject: [Haskell-cafe] Help with Data.Conduit.List.mapAccum In-Reply-To: References: Message-ID: If I understand the question correctly, what you're saying is: * My upstream (testC) is both returning a result _and_ yielding a stream of values downstream * My downstream (CL.consume) is collecting those values and returning a result based on them * How can I capture both the upstream and downstream results? If so, this is the section of the docs with the relevant functions[1]. It provides a few different fusion functions to combine an upstream and downstream without throwing away the upstream result (which is the default behavior of conduit, for various design and usability reasons). In your case, this may look something like: runConduit (fuseBoth testC CL.consume) Michael [1] https://s3.amazonaws.com/haddock.stackage.org/lts-6.3/conduit-1.2.6.6/Data-Conduit.html#g:4 On Wed, Jun 15, 2016 at 8:53 AM, wrote: > Hello, > I'm trying to use Data.Conduit, but I get stuck with mapAccum as how to > get and retrieve the result. > If I use it, I get a simple conduit like : > > testC :: ConduitM () Int IO Int > testC = Src =$= cdt where > src = CL.sourceList [1..10] > cdt = CL.mapAccum (\x s -> (x+s, x) 0 > > I can get the output with > testC $$ CL.consume > but how do I retrieve the accumulated sum ? > > Bruno > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bruno at ruomad.net Wed Jun 15 06:39:12 2016 From: bruno at ruomad.net (bruno at ruomad.net) Date: Wed, 15 Jun 2016 08:39:12 +0200 Subject: [Haskell-cafe] Help with Data.Conduit.List.mapAccum In-Reply-To: References: Message-ID: <0bea3af2-9534-45b2-a0f4-d17fc8e9136e@Spark> Thanks a lot, it looks exactly what I'm trying to do ! I'll test it ASAP bruno On 15 Jun 2016 08:35 +0200, Michael Snoyman, wrote: > If I understand the question correctly, what you're saying is: > > * My upstream (testC) is both returning a result _and_ yielding a stream of values downstream > * My downstream (CL.consume) is collecting those values and returning a result based on them > * How can I capture both the upstream and downstream results? > > If so, this is the section of the docs with the relevant functions[1]. It provides a few different fusion functions to combine an upstream and downstream without throwing away the upstream result (which is the default behavior of conduit, for various design and usability reasons). In your case, this may look something like: > > runConduit (fuseBoth testC CL.consume) > > Michael > > [1]https://s3.amazonaws.com/haddock.stackage.org/lts-6.3/conduit-1.2.6.6/Data-Conduit.html#g:4 > > On Wed, Jun 15, 2016 at 8:53 AM,wrote: > > Hello, > > I'm trying to use Data.Conduit, but I get stuck with mapAccum as how to get and retrieve the result. > > If I use it, I get a simple conduit like : > > > > testC :: ConduitM () Int IO Int > > testC = Src =$= cdt where > > src = CL.sourceList [1..10] > > cdt = CL.mapAccum (\x s ->(x+s, x) 0 > > > > I can get the output with > > testC $$ CL.consume > > but how do I retrieve the accumulated sum ? > > > > Bruno > > > > > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org(mailto:Haskell-Cafe at haskell.org) > > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From daniel.Berecz at gmail.com Wed Jun 15 07:20:42 2016 From: daniel.Berecz at gmail.com (Daniel Berecz) Date: Wed, 15 Jun 2016 07:20:42 +0000 Subject: [Haskell-cafe] [ANN] Budapest Haskell Hackathon 2016, 6-7th Aug 2016 In-Reply-To: References: Message-ID: Hello again everybody, Thank you all for pointing out that my name wasn't showing up properly! I think I fixed it (I write this in a different mail client so don't judge me according to this message:D) I wished that people would notice my announcement, but hoped that it wouldn't be because of something like this. But you know the old saying, if it works, you can lie after it, and tell it was guerilla marketing all along.:) Regards, Daniel On Tue, Jun 14, 2016 at 10:00 PM Gmail wrote: > Hi everybody, > > I'm happy to announce that our local user group will hold a Haskell > Hackathon in Budapest this year (this will be the second)! We will hold it > from August 6th to the 7th (Saturday & Sunday). You can find out more on > the following link: > > https://wiki.haskell.org/Budapest_Hackathon_2016 > > We will reguraly update the site with new information. > If you decide to come, please fill out the following Google Form: > > http://goo.gl/forms/pqgh6fvK8F8a2pAg1 > > If you have a project, demo, or talk that you want to bring to the event > please contact us, and we can talk about the details. You can find our > contact info the events wiki site, or you can just contact me directly. > > The event will be open to people of all experience levels, from beginners > to gurus. The only requisite is that you?re interested in the Haskell > language, and want to hang out with us, and have a good time! > > Greetings from Daniel, and the other BP-HUG organizers. > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From haskell at marcelfourne.de Wed Jun 15 07:35:33 2016 From: haskell at marcelfourne.de (Marcel =?UTF-8?B?Rm91cm7DqQ==?=) Date: Wed, 15 Jun 2016 09:35:33 +0200 Subject: [Haskell-cafe] ANN: eccrypto, aka Hecc, hF2 Message-ID: <20160615093533.51d90b0c@rechner> Dear Haskell Community! It was a long~ish time ago I released hecc[1], which had an unfortunate but funny (to me) name, later together with hF2[2]. Since I have neither released hyperelliptic curve crypto support, nor my pairing based crypto, a generalising change in names would be in order. Today I am releasing eccrypto[3], which contains the code of both (to allow easier refactoring of new ideas) and something new: A pure Haskell, timing-attack resistant Ed25519[4] implementation! ...well, a very rough one at least. The code is not "done", gives wrong results, is _very_ slow, but it might serve as reading material as well as a primer what I plan to do in the future. I do not plan to add embedded C or assembler code, but plan to make the code comparatively fast to some common implementations as well as timing attack resistant (see: [5]), even if it will never be as fast as the best code used in contemporary benchmarks. Sadly, due to health issues, I am not able to work on said code and have not been for a time longer than I care to admit. All comments are welcome, but I will not be able to guarantee answers. ;) Best of wishes to a thriving community, Marcel Fourn? [1]: https://hackage.haskell.org/package/hecc [2]: https://hackage.haskell.org/package/hF2 [3]: https://hackage.haskell.org/package/eccrypto [4]: https://ed25519.cr.yp.to/ [5]: https://mail.haskell.org/pipermail/haskell-cafe/2015-February/118213.html -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 801 bytes Desc: OpenPGP digital signature URL: From martin.drautzburg at web.de Wed Jun 15 15:54:33 2016 From: martin.drautzburg at web.de (martin) Date: Wed, 15 Jun 2016 17:54:33 +0200 Subject: [Haskell-cafe] How to spot Monads, Applicatives ... Message-ID: <57617A39.3090905@web.de> Hello all, I am at a stage, where I can use some of the Monads and Applicatives which are out there. But I hardly ever wrote my own instances. I am curious to learn about the thought processes which lead to the insight "hey that can be written nicely as an Applicative Functor" I suppose you can write everything without these type classes. Is it a promising approach to try without and then spot an element of repetition and factoring out that naturally leads to one of these typeclasses? Paticularly I am having difficulties with the *->* instances. E.g. why is the state "s" in the state monad the fixed type and the "a" the type parameter? When I am writing state code without the State monad the two look like equal candidates. Why not have "State a" monad, which threads an a-typed value and spits out states? While we're at it: would someone be so kind and explain what exactly is meant by an "effect"? I know that in haskell this is not the same as a "side effect" as there are no side-effects in haskell. From trebla at vex.net Wed Jun 15 17:10:36 2016 From: trebla at vex.net (Albert Y. C. Lai) Date: Wed, 15 Jun 2016 13:10:36 -0400 Subject: [Haskell-cafe] How to spot Monads, Applicatives ... In-Reply-To: <57617A39.3090905@web.de> References: <57617A39.3090905@web.de> Message-ID: <57618C0C.7070900@vex.net> On 2016-06-15 11:54 AM, martin wrote: > Paticularly I am having difficulties with the *->* instances. E.g. why is the state "s" in the state monad the fixed > type and the "a" the type parameter? When I am writing state code without the State monad the two look like equal > candidates. Why not have "State a" monad, which threads an a-typed value and spits out states? You mean like this? newtype MyState a s = Mk {unMk :: a -> (s, a)} thread_a_and_spit_out_s :: MyState a s -> a -> s thread_a_and_spit_out_s (Mk h) a = case h a of (s, _) -> s instance Monad (MyState a) where -- return :: s -> MyState a s return s = Mk (\a -> (s, a)) -- (>>=) :: MyState a s -> (s -> MyState a t) -> MyState a t Mk h >>= k = Mk (\a0 -> case h a0 of (s, a1) -> unMk (k s) a1) instance Functor (MyState a) where -- fmap :: (s -> t) -> MyState a s -> MyState a t fmap f (Mk h) = Mk (\a0 -> case (h a0) of (s, a1) -> (f s, a1)) instance Applicative (MyState a) where pure = return mf <*> mx = mf >>= \f -> mx >>= \x -> return (f x) > While we're at it: would someone be so kind and explain what exactly is meant by an "effect"? I know that in haskell > this is not the same as a "side effect" as there are no side-effects in haskell. It is just a change of attitude. I say "effect" when it is a purpose of my program, in fact likely a main purpose. I say "side effect" when it is not a purpose of my program. But since I write programs by intelligent design rather than by evolution, of course everything my program does is on purpose. The name "side effect" was coined when people had dispute over whether "function" should mean inert mathematical function or interactive computational procedure. From will.yager at gmail.com Wed Jun 15 17:16:54 2016 From: will.yager at gmail.com (William Yager) Date: Wed, 15 Jun 2016 10:16:54 -0700 Subject: [Haskell-cafe] How to spot Monads, Applicatives ... In-Reply-To: <57617A39.3090905@web.de> References: <57617A39.3090905@web.de> Message-ID: I often realize that something is a Monad or an Applicative or what have you after I write out a helper function that I realize it has the same type as >>= or <*> or whatever. Monads must have the type * -> *. Otherwise you couldn't write out the signatures for >>= and return (which both have "m a" in them). To over-specify a bit, the type argument corresponds to what the monadic action "returns". So an "m Int" returns an Int. Therefore, the "a" in "State s a" certainly can't be fixed. It has to be whatever that particular state action returns. Let's pretend for a moment that it makes sense to have a non-fixed "s" parameter. For example, let's say we had foo :: State S1 Int bar :: Int -> State S2 String OK, so we can't use (>>=) :: m a -> (a -> m b) -> m b Because we can't unify "m" with both "State S1" and "State S2". No problem, let's write a new typeclass that has (>>==) :: m s1 a -> (a -> m s2 b) -> m s2 b Now, we can have foo >>== bar :: State S2 String However, how would you actually go about writing such a thing for the State Monad? The S2 has to come from somewhere, and it's not clear to me here how we're getting from an S1 to an S2. You could certainly embed such transformations (e.g. by including a function of the type S1 -> S2), but that would require an entirely different structure. As for "effect" vs "side effect", I believe it's just that some people take issue with the fact that "side effect" has the connotation of being accidental. However, most academic materials on the subject do use "side effect", presumably because there are other uses of the word "effect" (e.g. "writing the code this way has the effect of simplifying..."). --Will On Wed, Jun 15, 2016 at 8:54 AM, martin wrote: > Hello all, > > I am at a stage, where I can use some of the Monads and Applicatives which > are out there. But I hardly ever wrote my own > instances. I am curious to learn about the thought processes which lead to > the insight "hey that can be written nicely > as an Applicative Functor" > > I suppose you can write everything without these type classes. Is it a > promising approach to try without and then spot > an element of repetition and factoring out that naturally leads to one of > these typeclasses? > > Paticularly I am having difficulties with the *->* instances. E.g. why is > the state "s" in the state monad the fixed > type and the "a" the type parameter? When I am writing state code without > the State monad the two look like equal > candidates. Why not have "State a" monad, which threads an a-typed value > and spits out states? > > While we're at it: would someone be so kind and explain what exactly is > meant by an "effect"? I know that in haskell > this is not the same as a "side effect" as there are no side-effects in > haskell. > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From johnw at newartisans.com Wed Jun 15 17:29:34 2016 From: johnw at newartisans.com (John Wiegley) Date: Wed, 15 Jun 2016 10:29:34 -0700 Subject: [Haskell-cafe] How to spot Monads, Applicatives ... In-Reply-To: <57617A39.3090905@web.de> (martin's message of "Wed, 15 Jun 2016 17:54:33 +0200") References: <57617A39.3090905@web.de> Message-ID: >>>>> martin writes: > I am at a stage, where I can use some of the Monads and Applicatives which > are out there. But I hardly ever wrote my own instances. I am curious to > learn about the thought processes which lead to the insight "hey that can be > written nicely as an Applicative Functor" When I realize Monad might be useful: If it makes sense for a "Foo of Foos" (over some type) to be reduced to a Foo. When I realize Applicative might be useful: If it makes sense to apply a "Foo of functions" to a value, or a function taking two or more arguments to two or more Foos, throughout those Foos. -- John Wiegley GPG fingerprint = 4710 CF98 AF9B 327B B80F http://newartisans.com 60E1 46C4 BD1A 7AC1 4BA2 From will.yager at gmail.com Wed Jun 15 17:36:37 2016 From: will.yager at gmail.com (William Yager) Date: Wed, 15 Jun 2016 10:36:37 -0700 Subject: [Haskell-cafe] How to spot Monads, Applicatives ... In-Reply-To: References: <57617A39.3090905@web.de> Message-ID: > If it makes sense to apply a "Foo of functions" to a value, That's just a functor. "fmap ($ value) foos". But yes, if you want to do this with more than one foo (or functions inside a foo), then you need applicative. e.g. (+) <$> [1,2,3] <*> [10,20,30] On Wed, Jun 15, 2016 at 10:29 AM, John Wiegley wrote: > >>>>> martin writes: > > > I am at a stage, where I can use some of the Monads and Applicatives > which > > are out there. But I hardly ever wrote my own instances. I am curious to > > learn about the thought processes which lead to the insight "hey that > can be > > written nicely as an Applicative Functor" > > When I realize Monad might be useful: > > If it makes sense for a "Foo of Foos" (over some type) to be reduced to a > Foo. > > When I realize Applicative might be useful: > > If it makes sense to apply a "Foo of functions" to a value, or a function > taking two or more arguments to two or more Foos, throughout those Foos. > > -- > John Wiegley GPG fingerprint = 4710 CF98 AF9B 327B B80F > http://newartisans.com 60E1 46C4 BD1A 7AC1 4BA2 > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bruno at ruomad.net Wed Jun 15 18:23:59 2016 From: bruno at ruomad.net (bruno at ruomad.net) Date: Wed, 15 Jun 2016 20:23:59 +0200 Subject: [Haskell-cafe] Help with Data.Conduit.List.mapAccum In-Reply-To: References: Message-ID: Well that was exacly what I needed, thanks a lot ! I still have to understand exactly why ;-) bruno On 15 Jun 2016 08:35 +0200, Michael Snoyman, wrote: > If I understand the question correctly, what you're saying is: > > * My upstream (testC) is both returning a result _and_ yielding a stream of values downstream > * My downstream (CL.consume) is collecting those values and returning a result based on them > * How can I capture both the upstream and downstream results? > > If so, this is the section of the docs with the relevant functions[1]. It provides a few different fusion functions to combine an upstream and downstream without throwing away the upstream result (which is the default behavior of conduit, for various design and usability reasons). In your case, this may look something like: > > runConduit (fuseBoth testC CL.consume) > > Michael > > [1]https://s3.amazonaws.com/haddock.stackage.org/lts-6.3/conduit-1.2.6.6/Data-Conduit.html#g:4 > > On Wed, Jun 15, 2016 at 8:53 AM,wrote: > > Hello, > > I'm trying to use Data.Conduit, but I get stuck with mapAccum as how to get and retrieve the result. > > If I use it, I get a simple conduit like : > > > > testC :: ConduitM () Int IO Int > > testC = Src =$= cdt where > > src = CL.sourceList [1..10] > > cdt = CL.mapAccum (\x s ->(x+s, x) 0 > > > > I can get the output with > > testC $$ CL.consume > > but how do I retrieve the accumulated sum ? > > > > Bruno > > > > > > _______________________________________________ > > Haskell-Cafe mailing list > > Haskell-Cafe at haskell.org(mailto:Haskell-Cafe at haskell.org) > > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From igouy2 at yahoo.com Wed Jun 15 18:32:35 2016 From: igouy2 at yahoo.com (Isaac Gouy) Date: Wed, 15 Jun 2016 18:32:35 +0000 (UTC) Subject: [Haskell-cafe] benchmarks game -- invalid Haskell fasta programs References: <1481089731.3024462.1466015555894.JavaMail.yahoo.ref@mail.yahoo.com> Message-ID: <1481089731.3024462.1466015555894.JavaMail.yahoo@mail.yahoo.com> The guidelines for the benchmarks game "fasta" programs changed to: -- "match a random number against those cumulative probabilities to select each nucleotide (use linear search or binary search)". I'd appreciate it if someone familiar with Haskell could confirm that the old Haskell programs are not compatible with the changed guidelines. Here are those old programs: http://benchmarksgame.alioth.debian.org/u64q/program.php?test=fasta&lang=ghc&id=2 http://benchmarksgame.alioth.debian.org/u64q/program.php?test=fasta&lang=ghc&id=5 http://benchmarksgame.alioth.debian.org/u64q/program.php?test=fasta&lang=ghc&id=6 http://benchmarksgame.alioth.debian.org/u64q/program.php?test=fasta&lang=ghc&id=7 best wishes, Isaac From mitchellwrosen at gmail.com Wed Jun 15 20:33:14 2016 From: mitchellwrosen at gmail.com (Mitchell Rosen) Date: Wed, 15 Jun 2016 13:33:14 -0700 (PDT) Subject: [Haskell-cafe] This non-exhaustive pattern match seems exhaustive Message-ID: I'm emulating a "closed typeclass" using a closed type family: * {-# LANGUAGE ExistentialQuantification #-}* * {-# LANGUAGE GADTs #-}* * {-# LANGUAGE LambdaCase #-}* * {-# LANGUAGE TypeFamilies #-}* * import GHC.Exts (Constraint)* * -- This is like* * --* * -- class Thing a -- instance Thing Int --* * type family Thing a :: Constraint where* * Thing Int = ()* * data Foo = forall a. Thing a => Foo (Bar a)* * data Bar a where* * Bar1 :: Bar Int* * Bar2 :: Bar Bool* * inspectFoo :: Foo -> ()* * inspectFoo = \case* * Foo Bar1 -> ()* * Foo Bar2 -> () -- This is required to suppress a warning* Here, it's not possible to create a Foo using "Foo Bar2", because there is no "Thing Bool" constraint in scope. Yet, when picking apart a Foo, I must still pattern match on this impossible data. Is there some smarter way to write this code? I thought of using `constraints`, and adding a catch-all clause to Thing: * type family Thing a :: Constraint where Thing Int = ()* * Thing a = Bottom* This would at least allow users of a Foo to use some * absurd :: Bottom => a* thing to discharge the Bottom constraint brought in scope by pattern matching: * inspectFoo :: Foo -> () inspectFoo = \case Foo Bar1 -> () Foo Bar2 -> absurd bottom* but better still would be to avoid having to write these impossible cases. Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: From jm at memorici.de Wed Jun 15 22:18:04 2016 From: jm at memorici.de (Jonn Mostovoy) Date: Wed, 15 Jun 2016 23:18:04 +0100 Subject: [Haskell-cafe] Testing Msgpack system In-Reply-To: References: Message-ID: Dear David, we were inspired by your suggestions and our employee, Konstantin Ivanov, implemented a very elegant emulator, which we will eventually carry out into a separate library. While presenting the project at Blockchain Summer School, we have credited you for pointing us in the right direction. Konstantin, of course, was credited for implementation of the solution. In case you are interested, video of the talk will be available in late June / early July. Entire source tree is public and hosted on Github: https://github.com/input-output-hk/rscoin-haskell Thank you once again for inspiration! On Apr 1, 2016 6:57 PM, "Jonn Mostovoy" wrote: > > Dear David, > > thank you very much! Your answers were extremely insightful. > > To adapt this approach we will need to refactor our types quite a bit, but that will be well worth it. > > ? > Kindest regards, > jm > > On Mar 31, 2016 10:10 AM, "David Turner" wrote: >> >> Hi Jonn, >> >> I work on a similar-sounding system. We have arranged things so that each node is a pure state machine, with outputs that are a pure function of its inputs, with separate (and simple, obviously correct) machinery for connecting these state machines over the network. This makes it rather simple to run a bunch of these state machines in a test harness that simulates all sorts of network nastiness (disconnections, dropped or reordered messages, delays, corruption etc.) on a single thread. >> >> One trick that proved useful was to feed in the current time as an explicit input message. This makes it possible to test things like timeouts without having to actually wait for the time to pass, which speeds things up immensely. We also make use of ContT somewhere in the tests to interleave processing and assertions, and to define a 'hypothetically' operator that lets a test run a sequence of actions and then backtrack. >> >> I think this idea was inspired by https://github.com/NicolasT/paxos/blob/master/bin/synod.hs, at least the network nastiness simulator thing. He uses threads for that demo but the nodes' behaviour itself is pure: https://github.com/NicolasT/paxos/blob/master/src/Network/Paxos/Synod/Proposer.hs for example. >> >> We also have proved certain key properties of the network are implied by certain local invariants, which reduces the testing problem down to one of checking properties on each node separately. This was time consuming, but highlighted certain important corner cases that it's unlikely we would have found by random testing. >> >> If you're interested in Byzantine behaviour (the 'evil node' test) then you may enjoy reading James Mickens' article on the subject: https://www.usenix.org/publications/login-logout/may-2013/saddest-moment >> >> Hope that helps, >> >> David >> >> PS a double apology: firstly for the double message (my first attempt was sent from the wrong address) and secondly for spelling your name wrong in that message! >> >> >> On 31 March 2016 at 00:41, Jonn Mostovoy wrote: >>> >>> Dear friends, >>> >>> we have a distributed system written in Haskell, consisting of three >>> types of nodes with dozen of instances of each of two types and a >>> central node of the third type. >>> >>> Each node is started by executing a binary which sets up acid-state >>> persistence layer and sockets over which msgpack messages are sent >>> around. >>> >>> It is trivial to write low level functionality quickcheck test suites, >>> which test properties of functions. >>> >>> We would like, however, to have a quickcheck-esque suite which sets up >>> the network, then gets it to an arbitrary valid state (sending correct >>> messages between nodes), then rigorously testing it for three >>> high-level properties: >>> >>> 1. Chaos monkey test (disable random node, see if certain invariants hold); >>> 2. Evil node test (make several nodes work against the system, see if >>> certain properties hold); >>> 3. Rigorous testing of network-wide invariants, if all the nodes >>> operate correctly. >>> >>> The problem we're facing is the following ? if we want to inspect >>> state of nodes in Haskell-land, we have to write a huge machinery >>> which emulates every launch of node via thread. There will be bugs in >>> this machinery, so we won't be able to get quality testing information >>> before we fix those; if we want to run things as processes, then the >>> best thing we can do is to inspect either acid-state dbs of each node >>> (it poses resource locking problems and forces us to dump the state on >>> every change, which is undesirable), or make an observer node, which >>> dumps the consensus as Text and then parsing the data into Haskell >>> terms, making decisions about the required properties based on that >>> (so far, it feels like the best option). >>> >>> Am I missing something? How is something like this achieved in >>> culture? How would you approach such a problem? >>> >>> Links to source files of test suites which do something similar are >>> highly appreciated. >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> Haskell-Cafe at haskell.org >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> >> From dct25-561bs at mythic-beasts.com Thu Jun 16 07:21:37 2016 From: dct25-561bs at mythic-beasts.com (David Turner) Date: Thu, 16 Jun 2016 08:21:37 +0100 Subject: [Haskell-cafe] Testing Msgpack system In-Reply-To: References: Message-ID: That's very kind of you, thanks. Not sure I deserve it, but glad I could help. I'll look forward to the video. One of my colleagues stumbled across this page which also suggests injecting the current time as a periodic Tick message rather than sprinkling timeouts throughout your code: http://yager.io/Distributed/Distributed.html Cheers, David On 15 Jun 2016 23:18, "Jonn Mostovoy" wrote: > Dear David, > > we were inspired by your suggestions and our employee, Konstantin > Ivanov, implemented a very elegant emulator, which we will eventually > carry out into a separate library. > > While presenting the project at Blockchain Summer School, we have > credited you for pointing us in the right direction. Konstantin, of > course, was credited for implementation of the solution. In case you > are interested, video of the talk will be available in late June / > early July. > > Entire source tree is public and hosted on Github: > https://github.com/input-output-hk/rscoin-haskell > > Thank you once again for inspiration! > > On Apr 1, 2016 6:57 PM, "Jonn Mostovoy" wrote: > > > > Dear David, > > > > thank you very much! Your answers were extremely insightful. > > > > To adapt this approach we will need to refactor our types quite a bit, > but that will be well worth it. > > > > ? > > Kindest regards, > > jm > > > > On Mar 31, 2016 10:10 AM, "David Turner" > wrote: > >> > >> Hi Jonn, > >> > >> I work on a similar-sounding system. We have arranged things so that > each node is a pure state machine, with outputs that are a pure function of > its inputs, with separate (and simple, obviously correct) machinery for > connecting these state machines over the network. This makes it rather > simple to run a bunch of these state machines in a test harness that > simulates all sorts of network nastiness (disconnections, dropped or > reordered messages, delays, corruption etc.) on a single thread. > >> > >> One trick that proved useful was to feed in the current time as an > explicit input message. This makes it possible to test things like timeouts > without having to actually wait for the time to pass, which speeds things > up immensely. We also make use of ContT somewhere in the tests to > interleave processing and assertions, and to define a 'hypothetically' > operator that lets a test run a sequence of actions and then backtrack. > >> > >> I think this idea was inspired by > https://github.com/NicolasT/paxos/blob/master/bin/synod.hs, at least the > network nastiness simulator thing. He uses threads for that demo but the > nodes' behaviour itself is pure: > https://github.com/NicolasT/paxos/blob/master/src/Network/Paxos/Synod/Proposer.hs > for example. > >> > >> We also have proved certain key properties of the network are implied > by certain local invariants, which reduces the testing problem down to one > of checking properties on each node separately. This was time consuming, > but highlighted certain important corner cases that it's unlikely we would > have found by random testing. > >> > >> If you're interested in Byzantine behaviour (the 'evil node' test) then > you may enjoy reading James Mickens' article on the subject: > https://www.usenix.org/publications/login-logout/may-2013/saddest-moment > >> > >> Hope that helps, > >> > >> David > >> > >> PS a double apology: firstly for the double message (my first attempt > was sent from the wrong address) and secondly for spelling your name wrong > in that message! > >> > >> > >> On 31 March 2016 at 00:41, Jonn Mostovoy wrote: > >>> > >>> Dear friends, > >>> > >>> we have a distributed system written in Haskell, consisting of three > >>> types of nodes with dozen of instances of each of two types and a > >>> central node of the third type. > >>> > >>> Each node is started by executing a binary which sets up acid-state > >>> persistence layer and sockets over which msgpack messages are sent > >>> around. > >>> > >>> It is trivial to write low level functionality quickcheck test suites, > >>> which test properties of functions. > >>> > >>> We would like, however, to have a quickcheck-esque suite which sets up > >>> the network, then gets it to an arbitrary valid state (sending correct > >>> messages between nodes), then rigorously testing it for three > >>> high-level properties: > >>> > >>> 1. Chaos monkey test (disable random node, see if certain invariants > hold); > >>> 2. Evil node test (make several nodes work against the system, see if > >>> certain properties hold); > >>> 3. Rigorous testing of network-wide invariants, if all the nodes > >>> operate correctly. > >>> > >>> The problem we're facing is the following ? if we want to inspect > >>> state of nodes in Haskell-land, we have to write a huge machinery > >>> which emulates every launch of node via thread. There will be bugs in > >>> this machinery, so we won't be able to get quality testing information > >>> before we fix those; if we want to run things as processes, then the > >>> best thing we can do is to inspect either acid-state dbs of each node > >>> (it poses resource locking problems and forces us to dump the state on > >>> every change, which is undesirable), or make an observer node, which > >>> dumps the consensus as Text and then parsing the data into Haskell > >>> terms, making decisions about the required properties based on that > >>> (so far, it feels like the best option). > >>> > >>> Am I missing something? How is something like this achieved in > >>> culture? How would you approach such a problem? > >>> > >>> Links to source files of test suites which do something similar are > >>> highly appreciated. > >>> _______________________________________________ > >>> Haskell-Cafe mailing list > >>> Haskell-Cafe at haskell.org > >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > >> > >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From K.Bleijenberg at lijbrandt.nl Thu Jun 16 07:19:27 2016 From: K.Bleijenberg at lijbrandt.nl (Kees Bleijenberg) Date: Thu, 16 Jun 2016 09:19:27 +0200 Subject: [Haskell-cafe] problem installing postgreSQL-libpq on Windows Message-ID: <000001d1c79f$6adab2a0$409017e0$@lijbrandt.nl> I want to install postgreSQL-libpq on Windows 7 64 bits with ghc version 7.10.1 and cabal version 1.22.4.0 This is what I did: Installed mingw >From the msys prompt: pexports "d:\program files\postgreSQL\9.3\bin\libpq.dll" > libpq.def >From the msys prompt: dlltool -d libpq.def -l libpq.a The file libpq.a is created. I copied the file to d:\program files\postgreSQL\9.3\bin\ and then from de cmd prompt: cabal install postgreSQL-libpq --extra-include-dirs="d:\program files\postgreSQL\9.3\include" --extra-lib-dirs="d:\program files\postgreSQl\9.3\bin" I get: Resolving dependencies... Configuring postgresql-libpq-0.9.1.1... Failed to install postgresql-libpq-0.9.1.1 Build log ( C:\Users\kees\AppData\Roaming\cabal\logs\postgresql-libpq-0.9.1.1.log ): [1 of 1] Compiling Main ( D:\Temp\cabal-tmp-6140\postgresql-libpq-0.9.1.1\dist\setup\setup.hs, D:\Temp\cabal-tmp-6140\postgresql-libpq-0.9.1.1\dist\setup\Main.o ) Linking D:\Temp\cabal-tmp-6140\postgresql-libpq-0.9.1.1\dist\setup\setup.exe ... Configuring postgresql-libpq-0.9.1.1... setup.exe: Missing dependency on a foreign library: * Missing C library: pq This problem can usually be solved by installing the system package that provides this library (you may need the "-dev" version). If the library is already installed but in a non-standard location then you can use the flags --extra-include-dirs= and --extra-lib-dirs= to specify where it is. What can I do? Kees -------------- next part -------------- An HTML attachment was scrubbed... URL: From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Thu Jun 16 07:58:55 2016 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Thu, 16 Jun 2016 08:58:55 +0100 Subject: [Haskell-cafe] base version numbers Message-ID: <20160616075855.GL5680@weber> Since each version of GHC depends precisely on one version of base, would it not be more clear to name them after their version of GHC, rather than 4.x.y.z? Could this be done? Tom From ivan.miljenovic at gmail.com Thu Jun 16 08:09:51 2016 From: ivan.miljenovic at gmail.com (Ivan Lazar Miljenovic) Date: Thu, 16 Jun 2016 18:09:51 +1000 Subject: [Haskell-cafe] base version numbers In-Reply-To: <20160616075855.GL5680@weber> References: <20160616075855.GL5680@weber> Message-ID: On 16 June 2016 at 17:58, Tom Ellis wrote: > Since each version of GHC depends precisely on one version of base, would it > not be more clear to name them after their version of GHC, rather than > 4.x.y.z? Except that: * That would break the Package Versioning Policy and thus make it more difficult to determine to what extent there are any potentially breaking changes * Makes it more difficult for an alternate Haskell implementation to use the Prelude * Makes it more difficult for a potential future where versions of base are less tightly coupled to GHC and can thus be installed separately (rather than needing a new version of GHC to get a new feature from base) -- Ivan Lazar Miljenovic Ivan.Miljenovic at gmail.com http://IvanMiljenovic.wordpress.com From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Thu Jun 16 08:16:51 2016 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Thu, 16 Jun 2016 09:16:51 +0100 Subject: [Haskell-cafe] base version numbers In-Reply-To: References: <20160616075855.GL5680@weber> Message-ID: <20160616081651.GO5680@weber> On Thu, Jun 16, 2016 at 06:09:51PM +1000, Ivan Lazar Miljenovic wrote: > On 16 June 2016 at 17:58, Tom Ellis > wrote: > > Since each version of GHC depends precisely on one version of base, would it > > not be more clear to name them after their version of GHC, rather than > > 4.x.y.z? > > Except that: > > * That would break the Package Versioning Policy and thus make it more > difficult to determine to what extent there are any potentially > breaking changes Why's that? When GHC x.y.z depends on base a.b.c.d, a and b only depend on x and y, and vice versa. Seems like this condition implies that the PVP would be upheld. > * Makes it more difficult for an alternate Haskell implementation to > use the Prelude I don't understand that. Surely an alternate Haskell implementation cannot depend on base? It's far too GHC specific. > * Makes it more difficult for a potential future where versions of > base are less tightly coupled to GHC and can thus be installed > separately (rather than needing a new version of GHC to get a new > feature from base) Is that really realistic? Tom From ivan.miljenovic at gmail.com Thu Jun 16 09:11:38 2016 From: ivan.miljenovic at gmail.com (Ivan Lazar Miljenovic) Date: Thu, 16 Jun 2016 19:11:38 +1000 Subject: [Haskell-cafe] base version numbers In-Reply-To: <20160616081651.GO5680@weber> References: <20160616075855.GL5680@weber> <20160616081651.GO5680@weber> Message-ID: On 16 June 2016 at 18:16, Tom Ellis wrote: > On Thu, Jun 16, 2016 at 06:09:51PM +1000, Ivan Lazar Miljenovic wrote: >> On 16 June 2016 at 17:58, Tom Ellis >> wrote: >> > Since each version of GHC depends precisely on one version of base, would it >> > not be more clear to name them after their version of GHC, rather than >> > 4.x.y.z? >> >> Except that: >> >> * That would break the Package Versioning Policy and thus make it more >> difficult to determine to what extent there are any potentially >> breaking changes > > Why's that? > > When GHC x.y.z depends on base a.b.c.d, a and b only depend on x and y, and > vice versa. Seems like this condition implies that the PVP would be upheld. For anyone else wanting to use base as a dependency for their code (AFAIK, you have to use either base or one of the Haskell* packages). Furthermore, we might have a situation come up where we have base-5.* and have a similar situation to some of the GHC-6.* releases that shipped with two versions of base. It may also cause problems with versions for pre-releases of GHC. >> * Makes it more difficult for an alternate Haskell implementation to >> use the Prelude > > I don't understand that. Surely an alternate Haskell implementation cannot > depend on base? It's far too GHC specific. There are lots of CPP hackery in there, but it has at least in the past been also used with Hugs, NHC and I believe JHC and AHC. >> * Makes it more difficult for a potential future where versions of >> base are less tightly coupled to GHC and can thus be installed >> separately (rather than needing a new version of GHC to get a new >> feature from base) > > Is that really realistic? Probably not. Whilst in practice releases of base are coupled to releases of GHC, this might not always be the case (and I think i recall point releases of GHC in the past that didn't ship with a version of GHC). -- Ivan Lazar Miljenovic Ivan.Miljenovic at gmail.com http://IvanMiljenovic.wordpress.com From K.Bleijenberg at lijbrandt.nl Thu Jun 16 09:47:34 2016 From: K.Bleijenberg at lijbrandt.nl (Kees Bleijenberg) Date: Thu, 16 Jun 2016 11:47:34 +0200 Subject: [Haskell-cafe] partial solved problem installing postgreSQL-libpq on Windows? Message-ID: <000001d1c7b4$1be8d720$53ba8560$@lijbrandt.nl> Maybe I've found a part of the solution. I changed in postgresql-libpq.cabal Extra-Libraries: from pq to libpq. Then runHaskell xx configure -ghc, runHaskell xx build and then runHaskell xx install. No errors.. I'am happy. But. if I try to install postgresql-simple or hasql I get this error : .. : can't load .so/.DLL for: d:/PROGRA~2/POSTGR~1/9.3/lib\libpq.dll (addDLL: could not load DLL) ghc.exe: d:/PROGRA~2/POSTGR~1/9.3/lib\libpq: %1 is not a valid Win32 application. ... dir d:\PROGRA~2\POSTGR~1\9.3\lib\libpq.dll finds the dll, but d:/PROGRA~2/POSTGR~1/9.3/lib/libpq.dll gives: 'Parameter format not correct'. These mangled filenames come from pg_config.exe. Is this a filename mangling problem? Any idea what is going on? Kees --------------------------- I want to install postgreSQL-libpq on Windows 7 64 bits with ghc version 7.10.1 and cabal version 1.22.4.0 This is what I did: Installed mingw >From the msys prompt: pexports "d:\program files\postgreSQL\9.3\bin\libpq.dll" > libpq.def >From the msys prompt: dlltool -d libpq.def -l libpq.a The file libpq.a is created. I copied the file to d:\program files\postgreSQL\9.3\bin\ and then from de cmd prompt: cabal install postgreSQL-libpq --extra-include-dirs="d:\program files\postgreSQL\9.3\include" --extra-lib-dirs="d:\program files\postgreSQl\9.3\bin" I get: Resolving dependencies... Configuring postgresql-libpq-0.9.1.1... Failed to install postgresql-libpq-0.9.1.1 Build log ( C:\Users\kees\AppData\Roaming\cabal\logs\postgresql-libpq-0.9.1.1.log ): [1 of 1] Compiling Main ( D:\Temp\cabal-tmp-6140\postgresql-libpq-0.9.1.1\dist\setup\setup.hs, D:\Temp\cabal-tmp-6140\postgresql-libpq-0.9.1.1\dist\setup\Main.o ) Linking D:\Temp\cabal-tmp-6140\postgresql-libpq-0.9.1.1\dist\setup\setup.exe ... Configuring postgresql-libpq-0.9.1.1... setup.exe: Missing dependency on a foreign library: * Missing C library: pq This problem can usually be solved by installing the system package that provides this library (you may need the "-dev" version). If the library is already installed but in a non-standard location then you can use the flags --extra-include-dirs= and --extra-lib-dirs= to specify where it is. What can I do? Kees -------------- next part -------------- An HTML attachment was scrubbed... URL: From lonetiger at gmail.com Thu Jun 16 11:49:14 2016 From: lonetiger at gmail.com (Phyx) Date: Thu, 16 Jun 2016 13:49:14 +0200 Subject: [Haskell-cafe] partial solved problem installing postgreSQL-libpq on Windows? Message-ID: Hi Kees, Would It be possible for you to try with GHC 7.10.3 or 8.0.1? A bunch of things have changed with the linker in these two versions which should make linking against packages easier. : can't load .so/.DLL for: > d:/PROGRA~2/POSTGR~1/9.3/lib\libpq.dll (addDLL: could not load DLL) ghc.exe: d:/PROGRA~2/POSTGR~1/9.3/lib\libpq: %1 is not a valid Win32 > application. This seems to be coming from the runtime linker, if indeed d:/PROGRA~2/POSTGR~1/9.3/lib\libpq.dll can be found then either it's the wrong bitness/image type or libpq.dll has dependencies on other dlls. 7.10.1 is not able to load these then as the search path won't be correct. To test this you can add d:/PROGRA~2/POSTGR~1/9.3/lib\ to your path and try loading it again. If that doesn't work and you want to know what's really going on, you can enable loader snaps in gflags for GHC.exe and GHCi.exe (or runHaskell, what ever it is you're using) and attach a debugger like gdb or windbg. https://msdn.microsoft.com/en-us/library/windows/hardware/ff556886(v=vs.85).aspx You'll then be able to see the OS's trace messages for the loader and it should tell you exactly what's wrong. >From the msys prompt: pexports "d:\program > files\postgreSQL\9.3\bin\libpq.dll" > libpq.def >From the msys prompt: dlltool -d libpq.def -l libpq.a Import libraries are supported by the GHC but not ghci or any other interpreted mode (until 8.0.2) So this would only work for the compiled program without Template Haskell. Regards, Tamar -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at joachim-breitner.de Thu Jun 16 11:50:27 2016 From: mail at joachim-breitner.de (Joachim Breitner) Date: Thu, 16 Jun 2016 13:50:27 +0200 Subject: [Haskell-cafe] base version numbers In-Reply-To: <20160616081651.GO5680@weber> References: <20160616075855.GL5680@weber> <20160616081651.GO5680@weber> Message-ID: <1466077827.11991.8.camel@joachim-breitner.de> Hi, Am Donnerstag, den 16.06.2016, 09:16 +0100 schrieb Tom Ellis: > > * Makes it more difficult for a potential future where versions of > > base are less tightly coupled to GHC and can thus be installed > > separately (rather than needing a new version of GHC to get a new > > feature from base) > > Is that really realistic? maybe more than I expected; see https://groups.google.com/d/msg/haskell-core-libraries/TV0yGnfBTf4/7SJuOcfiBgAJ and the following messages for a way forward. Short summary: It is not unlikely that base could just become a "normal" package that you can upgrade. The main blocker is that in a build plan where there "ghc" library is involved this would require you to be able to recompile that library. But Herbert seems to be on that. 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: 819 bytes Desc: This is a digitally signed message part URL: From slucas at dsic.upv.es Thu Jun 16 11:44:24 2016 From: slucas at dsic.upv.es (Salvador Lucas) Date: Thu, 16 Jun 2016 13:44:24 +0200 Subject: [Haskell-cafe] WST 2016, 2nd call for papers In-Reply-To: <201606161140.u5GBeAAi015500@easychair.org> References: <201606161140.u5GBeAAi015500@easychair.org> Message-ID: ========================================================================== WST 2016 - 2nd Call for Papers 15th International Workshop on Termination September 5-7, 2016, Obergurgl, Austria http://cl-informatik.uibk.ac.at/events/wst-2016/ ========================================================================== The Workshop on Termination (WST) traditionally brings together, in an informal setting, researchers interested in all aspects of termination, whether this interest be practical or theoretical, primary or derived. The workshop also provides a ground for cross-fertilization of ideas from term rewriting and from the different programming language communities. The friendly atmosphere enables fruitful exchanges leading to joint research and subsequent publications. The event is held as part of CLA 2016 http://cl-informatik.uibk.ac.at/events/cla-2016/ IMPORTANT DATES: * submission June 22, 2016 * notification July 12, 2016 * final version August 3, 2016 * workshop September 5-7, 2016 TOPICS: The 15th International Workshop on Termination welcomes contributions on all aspects of termination and termination analysis. Contributions from the imperative, constraint, functional, and logic programming communities, and papers investigating applications of complexity or termination (for example in program transformation or theorem proving) are particularly welcome. Topics of interest include all aspects of termination. This includes (but is not limited to): * certification of termination and complexity proofs * challenging termination problems * comparison and classification of termination methods * complexity analysis in any domain * implementation of termination and complexity methods * implicit computational complexity * infinitary normalization * non-termination analysis and loop detection * normalization in lambda calculi * operational termination of conditional rewrite systems * ordinal notation and subrecursive hierarchies * SAT, SMT, and constraint solving for (non-)termination analysis * scalability and modularity of termination methods * termination analysis in any domain * well-founded relations and well-quasi-orders COMPETITION: There will be a live complexity and termination competition during the workshop, including time to present both the results and the tools of the participants. More details will be provided in a dedicated announcement on the competition. PROGRAM COMMITTEE: * Ugo Dal Lago Bologna University * J??rg Endrullis VU University Amsterdam * Yukiyoshi Kameyama University of Tsukuba * Salvador Lucas Universidad Polit??cnica de Valencia * Aart Middeldorp University of Innsbruck, co-chair * Andrey Rybalchenko Microsoft Research * Thomas Str??der RWTH Aachen * Ren?? Thiemann University of Innsbruck, co-chair * Andreas Weiermann Ghent University INVITED SPEAKERS: * Reiner H??hnle TU Darmstadt SUBMISSION: Submissions are short papers/extended abstract which should not exceed 5 pages. There will be no formal reviewing. In particular, we welcome short versions of recently published articles and papers submitted elsewhere. The program committee checks relevance and provides additional feedback for each submission. The accepted papers will be made available electronically before the workshop. Papers should be submitted electronically via the submission page: http://www.easychair.org/conferences/?conf=wst2016 Final versions should be created using LaTeX and the LIPIcs style file http://drops.dagstuhl.de/styles/lipics/lipics-authors.tgz -------------- next part -------------- ========================================================================== WST 2016 - 2nd Call for Papers 15th International Workshop on Termination September 5-7, 2016, Obergurgl, Austria http://cl-informatik.uibk.ac.at/events/wst-2016/ ========================================================================== The Workshop on Termination (WST) traditionally brings together, in an informal setting, researchers interested in all aspects of termination, whether this interest be practical or theoretical, primary or derived. The workshop also provides a ground for cross-fertilization of ideas from term rewriting and from the different programming language communities. The friendly atmosphere enables fruitful exchanges leading to joint research and subsequent publications. The event is held as part of CLA 2016 http://cl-informatik.uibk.ac.at/events/cla-2016/ IMPORTANT DATES: * submission June 22, 2016 * notification July 12, 2016 * final version August 3, 2016 * workshop September 5-7, 2016 TOPICS: The 15th International Workshop on Termination welcomes contributions on all aspects of termination and termination analysis. Contributions from the imperative, constraint, functional, and logic programming communities, and papers investigating applications of complexity or termination (for example in program transformation or theorem proving) are particularly welcome. Topics of interest include all aspects of termination. This includes (but is not limited to): * certification of termination and complexity proofs * challenging termination problems * comparison and classification of termination methods * complexity analysis in any domain * implementation of termination and complexity methods * implicit computational complexity * infinitary normalization * non-termination analysis and loop detection * normalization in lambda calculi * operational termination of conditional rewrite systems * ordinal notation and subrecursive hierarchies * SAT, SMT, and constraint solving for (non-)termination analysis * scalability and modularity of termination methods * termination analysis in any domain * well-founded relations and well-quasi-orders COMPETITION: There will be a live complexity and termination competition during the workshop, including time to present both the results and the tools of the participants. More details will be provided in a dedicated announcement on the competition. PROGRAM COMMITTEE: * Ugo Dal Lago Bologna University * J?rg Endrullis VU University Amsterdam * Yukiyoshi Kameyama University of Tsukuba * Salvador Lucas Universidad Polit?cnica de Valencia * Aart Middeldorp University of Innsbruck, co-chair * Andrey Rybalchenko Microsoft Research * Thomas Str?der RWTH Aachen * Ren? Thiemann University of Innsbruck, co-chair * Andreas Weiermann Ghent University INVITED SPEAKERS: * Reiner H?hnle TU Darmstadt SUBMISSION: Submissions are short papers/extended abstract which should not exceed 5 pages. There will be no formal reviewing. In particular, we welcome short versions of recently published articles and papers submitted elsewhere. The program committee checks relevance and provides additional feedback for each submission. The accepted papers will be made available electronically before the workshop. Papers should be submitted electronically via the submission page: http://www.easychair.org/conferences/?conf=wst2016 Final versions should be created using LaTeX and the LIPIcs style file http://drops.dagstuhl.de/styles/lipics/lipics-authors.tgz From will.yager at gmail.com Thu Jun 16 16:03:58 2016 From: will.yager at gmail.com (Will Yager) Date: Thu, 16 Jun 2016 09:03:58 -0700 Subject: [Haskell-cafe] Testing Msgpack system In-Reply-To: References: Message-ID: <7B2A1563-BED9-483C-A742-78B5FAD546C7@gmail.com> And we've come full circle! David, my vague recollection of your previous email inspired me to try some of the techniques I espoused in that article. So a thanks from me as well! Will > On Jun 16, 2016, at 00:21, David Turner wrote: > > That's very kind of you, thanks. Not sure I deserve it, but glad I could help. I'll look forward to the video. > > One of my colleagues stumbled across this page which also suggests injecting the current time as a periodic Tick message rather than sprinkling timeouts throughout your code: > > http://yager.io/Distributed/Distributed.html > > Cheers, > > David > >> On 15 Jun 2016 23:18, "Jonn Mostovoy" wrote: >> Dear David, >> >> we were inspired by your suggestions and our employee, Konstantin >> Ivanov, implemented a very elegant emulator, which we will eventually >> carry out into a separate library. >> >> While presenting the project at Blockchain Summer School, we have >> credited you for pointing us in the right direction. Konstantin, of >> course, was credited for implementation of the solution. In case you >> are interested, video of the talk will be available in late June / >> early July. >> >> Entire source tree is public and hosted on Github: >> https://github.com/input-output-hk/rscoin-haskell >> >> Thank you once again for inspiration! >> >> On Apr 1, 2016 6:57 PM, "Jonn Mostovoy" wrote: >> > >> > Dear David, >> > >> > thank you very much! Your answers were extremely insightful. >> > >> > To adapt this approach we will need to refactor our types quite a bit, but that will be well worth it. >> > >> > ? >> > Kindest regards, >> > jm >> > >> > On Mar 31, 2016 10:10 AM, "David Turner" wrote: >> >> >> >> Hi Jonn, >> >> >> >> I work on a similar-sounding system. We have arranged things so that each node is a pure state machine, with outputs that are a pure function of its inputs, with separate (and simple, obviously correct) machinery for connecting these state machines over the network. This makes it rather simple to run a bunch of these state machines in a test harness that simulates all sorts of network nastiness (disconnections, dropped or reordered messages, delays, corruption etc.) on a single thread. >> >> >> >> One trick that proved useful was to feed in the current time as an explicit input message. This makes it possible to test things like timeouts without having to actually wait for the time to pass, which speeds things up immensely. We also make use of ContT somewhere in the tests to interleave processing and assertions, and to define a 'hypothetically' operator that lets a test run a sequence of actions and then backtrack. >> >> >> >> I think this idea was inspired by https://github.com/NicolasT/paxos/blob/master/bin/synod.hs, at least the network nastiness simulator thing. He uses threads for that demo but the nodes' behaviour itself is pure: https://github.com/NicolasT/paxos/blob/master/src/Network/Paxos/Synod/Proposer.hs for example. >> >> >> >> We also have proved certain key properties of the network are implied by certain local invariants, which reduces the testing problem down to one of checking properties on each node separately. This was time consuming, but highlighted certain important corner cases that it's unlikely we would have found by random testing. >> >> >> >> If you're interested in Byzantine behaviour (the 'evil node' test) then you may enjoy reading James Mickens' article on the subject: https://www.usenix.org/publications/login-logout/may-2013/saddest-moment >> >> >> >> Hope that helps, >> >> >> >> David >> >> >> >> PS a double apology: firstly for the double message (my first attempt was sent from the wrong address) and secondly for spelling your name wrong in that message! >> >> >> >> >> >> On 31 March 2016 at 00:41, Jonn Mostovoy wrote: >> >>> >> >>> Dear friends, >> >>> >> >>> we have a distributed system written in Haskell, consisting of three >> >>> types of nodes with dozen of instances of each of two types and a >> >>> central node of the third type. >> >>> >> >>> Each node is started by executing a binary which sets up acid-state >> >>> persistence layer and sockets over which msgpack messages are sent >> >>> around. >> >>> >> >>> It is trivial to write low level functionality quickcheck test suites, >> >>> which test properties of functions. >> >>> >> >>> We would like, however, to have a quickcheck-esque suite which sets up >> >>> the network, then gets it to an arbitrary valid state (sending correct >> >>> messages between nodes), then rigorously testing it for three >> >>> high-level properties: >> >>> >> >>> 1. Chaos monkey test (disable random node, see if certain invariants hold); >> >>> 2. Evil node test (make several nodes work against the system, see if >> >>> certain properties hold); >> >>> 3. Rigorous testing of network-wide invariants, if all the nodes >> >>> operate correctly. >> >>> >> >>> The problem we're facing is the following ? if we want to inspect >> >>> state of nodes in Haskell-land, we have to write a huge machinery >> >>> which emulates every launch of node via thread. There will be bugs in >> >>> this machinery, so we won't be able to get quality testing information >> >>> before we fix those; if we want to run things as processes, then the >> >>> best thing we can do is to inspect either acid-state dbs of each node >> >>> (it poses resource locking problems and forces us to dump the state on >> >>> every change, which is undesirable), or make an observer node, which >> >>> dumps the consensus as Text and then parsing the data into Haskell >> >>> terms, making decisions about the required properties based on that >> >>> (so far, it feels like the best option). >> >>> >> >>> Am I missing something? How is something like this achieved in >> >>> culture? How would you approach such a problem? >> >>> >> >>> Links to source files of test suites which do something similar are >> >>> highly appreciated. >> >>> _______________________________________________ >> >>> Haskell-Cafe mailing list >> >>> Haskell-Cafe at haskell.org >> >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> >> >> >> > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe -------------- next part -------------- An HTML attachment was scrubbed... URL: From amindfv at gmail.com Thu Jun 16 16:08:00 2016 From: amindfv at gmail.com (amindfv at gmail.com) Date: Thu, 16 Jun 2016 12:08:00 -0400 Subject: [Haskell-cafe] ($) and ApplicativeDo Message-ID: <6BCE3D6C-631C-4283-9B7F-0E637BC6AB02@gmail.com> foo :: Applicative f => f String foo = do x <- pure "this works" pure x ... but replace "pure x" with "pure $ x" and it doesn't typecheck: a monad instance is required! Tom From amindfv at gmail.com Thu Jun 16 16:30:25 2016 From: amindfv at gmail.com (amindfv at gmail.com) Date: Thu, 16 Jun 2016 12:30:25 -0400 Subject: [Haskell-cafe] ($) and ApplicativeDo In-Reply-To: References: <6BCE3D6C-631C-4283-9B7F-0E637BC6AB02@gmail.com> Message-ID: <5AC319DA-F5D6-45C8-A3B6-C617B5768F70@gmail.com> They're the same: > :t \x -> pure x \x -> pure x :: Applicative f => a -> f a > :t \x -> pure $ x \x -> pure $ x :: Applicative f => a -> f a Tom > El 16 jun 2016, a las 12:24, KC escribi?: > > Think of the types of > > pure x > > And > > pure $ x > > -- > -- > > Sent from an expensive device which will be obsolete in a few months! :D > > Casey > > >> On Jun 16, 2016 9:06 AM, wrote: >> foo :: Applicative f => f String >> foo = do >> x <- pure "this works" >> pure x >> >> ... but replace "pure x" with "pure $ x" and it doesn't typecheck: a monad instance is required! >> >> Tom >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe -------------- next part -------------- An HTML attachment was scrubbed... URL: From kc1956 at gmail.com Thu Jun 16 16:24:33 2016 From: kc1956 at gmail.com (KC) Date: Thu, 16 Jun 2016 09:24:33 -0700 Subject: [Haskell-cafe] ($) and ApplicativeDo In-Reply-To: <6BCE3D6C-631C-4283-9B7F-0E637BC6AB02@gmail.com> References: <6BCE3D6C-631C-4283-9B7F-0E637BC6AB02@gmail.com> Message-ID: Think of the types of pure x And pure $ x -- -- Sent from an expensive device which will be obsolete in a few months! :D Casey On Jun 16, 2016 9:06 AM, wrote: > foo :: Applicative f => f String > foo = do > x <- pure "this works" > pure x > > ... but replace "pure x" with "pure $ x" and it doesn't typecheck: a monad > instance is required! > > Tom > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From headprogrammingczar at gmail.com Thu Jun 16 16:39:17 2016 From: headprogrammingczar at gmail.com (Joe Quinn) Date: Thu, 16 Jun 2016 12:39:17 -0400 Subject: [Haskell-cafe] ($) and ApplicativeDo In-Reply-To: <5AC319DA-F5D6-45C8-A3B6-C617B5768F70@gmail.com> References: <6BCE3D6C-631C-4283-9B7F-0E637BC6AB02@gmail.com> <5AC319DA-F5D6-45C8-A3B6-C617B5768F70@gmail.com> Message-ID: I expect it's that the root of the expression on the last line is ($) and not pure. ApplicativeDo has restrictions on what you can do to avoid allowing blocks that have to translate in terms of join/(>>=), and likely one of them is that the last line can't be an arbitrary thing of the right type. On 6/16/2016 12:30 PM, amindfv at gmail.com wrote: > They're the same: > > > :t \x -> pure x > \x -> pure x :: Applicative f => a -> f a > > :t \x -> pure $ x > \x -> pure $ x :: Applicative f => a -> f a > > Tom > > > El 16 jun 2016, a las 12:24, KC > escribi?: > >> Think of the types of >> >> pure x >> >> And >> >> pure $ x >> >> -- >> -- >> >> Sent from an expensive device which will be obsolete in a few months! :D >> >> Casey >> >> On Jun 16, 2016 9:06 AM, > > wrote: >> >> foo :: Applicative f => f String >> foo = do >> x <- pure "this works" >> pure x >> >> ... but replace "pure x" with "pure $ x" and it doesn't >> typecheck: a monad instance is required! >> >> Tom >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> > > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe -------------- next part -------------- An HTML attachment was scrubbed... URL: From amindfv at gmail.com Thu Jun 16 16:49:03 2016 From: amindfv at gmail.com (amindfv at gmail.com) Date: Thu, 16 Jun 2016 12:49:03 -0400 Subject: [Haskell-cafe] ($) and ApplicativeDo In-Reply-To: References: <6BCE3D6C-631C-4283-9B7F-0E637BC6AB02@gmail.com> <5AC319DA-F5D6-45C8-A3B6-C617B5768F70@gmail.com> Message-ID: <8B55A906-4464-44E7-A769-FDC170CD64BF@gmail.com> Wow, that's pretty unexpected. Another repro case: p = pure bar :: Applicative f => f a bar = do x <- pure "ok" p x ... gives the same error. So ApplicativeDo statements *must* end with exactly the statement "pure"? > El 16 jun 2016, a las 12:39, Joe Quinn escribi?: > > I expect it's that the root of the expression on the last line is ($) and not pure. ApplicativeDo has restrictions on what you can do to avoid allowing blocks that have to translate in terms of join/(>>=), and likely one of them is that the last line can't be an arbitrary thing of the right type. > >> On 6/16/2016 12:30 PM, amindfv at gmail.com wrote: >> They're the same: >> >> > :t \x -> pure x >> \x -> pure x :: Applicative f => a -> f a >> > :t \x -> pure $ x >> \x -> pure $ x :: Applicative f => a -> f a >> >> Tom >> >> >> El 16 jun 2016, a las 12:24, KC escribi?: >> >>> Think of the types of >>> >>> pure x >>> >>> And >>> >>> pure $ x >>> >>> -- >>> -- >>> >>> Sent from an expensive device which will be obsolete in a few months! :D >>> >>> Casey >>> >>> >>>> On Jun 16, 2016 9:06 AM, wrote: >>>> foo :: Applicative f => f String >>>> foo = do >>>> x <- pure "this works" >>>> pure x >>>> >>>> ... but replace "pure x" with "pure $ x" and it doesn't typecheck: a monad instance is required! >>>> >>>> Tom >>>> _______________________________________________ >>>> Haskell-Cafe mailing list >>>> Haskell-Cafe at haskell.org >>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe -------------- next part -------------- An HTML attachment was scrubbed... URL: From K.Bleijenberg at lijbrandt.nl Thu Jun 16 16:46:17 2016 From: K.Bleijenberg at lijbrandt.nl (Kees Bleijenberg) Date: Thu, 16 Jun 2016 18:46:17 +0200 Subject: [Haskell-cafe] partial solved problem installing postgreSQL-libpq on Windows? In-Reply-To: References: Message-ID: <000001d1c7ee$9aed93a0$d0c8bae0$@lijbrandt.nl> Hi Tamar, Thank you. I installed Haskell Platform 8.0.1. Now I can?t install snap any more. I want to use postgresql in snap. Grrr. If I get something working I?ll let you know. Kees Van: Phyx [mailto:lonetiger at gmail.com] Verzonden: donderdag 16 juni 2016 13:49 Aan: K.Bleijenberg at lijbrandt.nl CC: haskell-cafe at haskell.org Onderwerp: partial solved problem installing postgreSQL-libpq on Windows? Hi Kees, Would It be possible for you to try with GHC 7.10.3 or 8.0.1? A bunch of things have changed with the linker in these two versions which should make linking against packages easier. : can't load .so/.DLL for: d:/PROGRA~2/POSTGR~1/9.3/lib\libpq.dll (addDLL: could not load DLL) ghc.exe: d:/PROGRA~2/POSTGR~1/9.3/lib\libpq: %1 is not a valid Win32 application. This seems to be coming from the runtime linker, if indeed d:/PROGRA~2/POSTGR~1/9.3/lib\libpq.dll can be found then either it's the wrong bitness/image type or libpq.dll has dependencies on other dlls. 7.10.1 is not able to load these then as the search path won't be correct. To test this you can add d:/PROGRA~2/POSTGR~1/9.3/lib\ to your path and try loading it again. If that doesn't work and you want to know what's really going on, you can enable loader snaps in gflags for GHC.exe and GHCi.exe (or runHaskell, what ever it is you're using) and attach a debugger like gdb or windbg. https://msdn.microsoft.com/en-us/library/windows/hardware/ff556886(v=vs.85).aspx You'll then be able to see the OS's trace messages for the loader and it should tell you exactly what's wrong. >From the msys prompt: pexports "d:\program files\postgreSQL\9.3\bin\libpq.dll" > libpq.def >From the msys prompt: dlltool -d libpq.def -l libpq.a Import libraries are supported by the GHC but not ghci or any other interpreted mode (until 8.0.2) So this would only work for the compiled program without Template Haskell. Regards, Tamar Geen virus gevonden in dit bericht. Gecontroleerd door AVG - www.avg.com Versie: 2016.0.7640 / Virusdatabase: 4604/12430 - datum van uitgifte: 06/16/16 -------------- next part -------------- An HTML attachment was scrubbed... URL: From alexander.vershilov at gmail.com Thu Jun 16 16:49:36 2016 From: alexander.vershilov at gmail.com (Alexander V Vershilov) Date: Thu, 16 Jun 2016 19:49:36 +0300 Subject: [Haskell-cafe] ($) and ApplicativeDo In-Reply-To: <6BCE3D6C-631C-4283-9B7F-0E637BC6AB02@gmail.com> References: <6BCE3D6C-631C-4283-9B7F-0E637BC6AB02@gmail.com> Message-ID: Hello, Tom. I think you can find this ticket relevant: https://ghc.haskell.org/trac/ghc/ticket/11835 -- Alexander On 16 June 2016 at 19:08, wrote: > foo :: Applicative f => f String > foo = do > x <- pure "this works" > pure x > > ... but replace "pure x" with "pure $ x" and it doesn't typecheck: a monad instance is required! > > Tom > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe -- Alexander From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Thu Jun 16 16:56:47 2016 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Thu, 16 Jun 2016 17:56:47 +0100 Subject: [Haskell-cafe] ($) and ApplicativeDo In-Reply-To: <8B55A906-4464-44E7-A769-FDC170CD64BF@gmail.com> References: <6BCE3D6C-631C-4283-9B7F-0E637BC6AB02@gmail.com> <5AC319DA-F5D6-45C8-A3B6-C617B5768F70@gmail.com> <8B55A906-4464-44E7-A769-FDC170CD64BF@gmail.com> Message-ID: <20160616165647.GS5680@weber> On Thu, Jun 16, 2016 at 12:49:03PM -0400, amindfv at gmail.com wrote: > Wow, that's pretty unexpected. Another repro case: > > p = pure > > bar :: Applicative f => f a > bar = do > x <- pure "ok" > p x > > ... gives the same error. So ApplicativeDo statements *must* end with exactly the statement "pure"? That's pretty strange since it has a perfectly good Applicative interpretation: fmap p (pure "ok") Tom From tanuki at gmail.com Thu Jun 16 18:53:38 2016 From: tanuki at gmail.com (Theodore Lief Gannon) Date: Thu, 16 Jun 2016 11:53:38 -0700 Subject: [Haskell-cafe] partial solved problem installing postgreSQL-libpq on Windows? In-Reply-To: <000001d1c7ee$9aed93a0$d0c8bae0$@lijbrandt.nl> References: <000001d1c7ee$9aed93a0$d0c8bae0$@lijbrandt.nl> Message-ID: http://redd.it/4jpthu Replace 'SDL2' with 'postgresql' and this *should* work. You may want to axe Platform first tho, it seems to clash with stack (see comments). On Thu, Jun 16, 2016 at 9:46 AM, Kees Bleijenberg < K.Bleijenberg at lijbrandt.nl> wrote: > Hi Tamar, > > > > Thank you. > > I installed Haskell Platform 8.0.1. Now I can?t install snap any more. I > want to use postgresql in snap. Grrr. > > If I get something working I?ll let you know. > > > > Kees > > > > *Van:* Phyx [mailto:lonetiger at gmail.com] > *Ve**rzonden:* donderdag 16 juni 2016 13:49 > *Aan:* K.Bleijenberg at lijbrandt.nl > *CC:* haskell-cafe at haskell.org > *Onderwerp:* partial solved problem installing postgreSQL-libpq on > Windows? > > > > Hi Kees, > > > > Would It be possible for you to try with GHC 7.10.3 or 8.0.1? > > > > A bunch of things have changed with the linker in these two versions which > should make > > linking against packages easier. > > > > : can't load .so/.DLL for: > d:/PROGRA~2/POSTGR~1/9.3/lib\libpq.dll (addDLL: could not load DLL) > > > > ghc.exe: d:/PROGRA~2/POSTGR~1/9.3/lib\libpq: %1 is not a valid Win32 > application. > > > > This seems to be coming from the runtime linker, if indeed > d:/PROGRA~2/POSTGR~1/9.3/lib\libpq.dll > > can be found then either it's the wrong bitness/image type or libpq.dll > has dependencies on other dlls. > > > > 7.10.1 is not able to load these then as the search path won't be correct. > To test this you can add > > d:/PROGRA~2/POSTGR~1/9.3/lib\ to your path and try loading it again. > > > > If that doesn't work and you want to know what's really going on, you can > enable loader snaps > > in gflags for GHC.exe and GHCi.exe (or runHaskell, what ever it is you're > using) and attach a debugger like gdb > > or windbg. > https://msdn.microsoft.com/en-us/library/windows/hardware/ff556886(v=vs.85).aspx > > > > You'll then be able to see the OS's trace messages for the loader and it > should tell you exactly what's wrong. > > > > >From the msys prompt: pexports "d:\program > files\postgreSQL\9.3\bin\libpq.dll" > libpq.def > > >From the msys prompt: dlltool -d libpq.def -l libpq.a > > > > Import libraries are supported by the GHC but not ghci or any other > interpreted mode (until 8.0.2) > > So this would only work for the compiled program without Template Haskell. > > > > Regards, > > Tamar > > Geen virus gevonden in dit bericht. > Gecontroleerd door AVG - www.avg.com > Versie: 2016.0.7640 / Virusdatabase: 4604/12430 - datum van uitgifte: > 06/16/16 > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From capn.freako at gmail.com Fri Jun 17 03:02:05 2016 From: capn.freako at gmail.com (David Banas) Date: Thu, 16 Jun 2016 20:02:05 -0700 Subject: [Haskell-cafe] Trying to test natural transformations, in Haskell. Message-ID: <9077718F-4FDF-43F2-A8BD-E244B63BEF31@gmail.com> Hi all, In doing the challenge problems at the end of chapter 10 (Natural Transformations) in Bartosz Milewski’s “Category Theory for Programmers”, I’m trying to write a generic naturality checker: {-# LANGUAGE Rank2Types AllowAmbiguousTypes #-} type NatTran a = (Functor f, Functor f') => f a -> f' a to_assert :: (Functor f, Eq b) => (a -> b) -> NatTran a -> NatTran b -> f a -> Bool to_assert g h h' f = (fmap g . h) f == (h' . fmap g) f which is later made specific to a particular natural transformation: maybe_to_list :: Maybe a -> [a] maybe_to_list Nothing = [] maybe_to_list (Just x) = [x] test_func :: Num a => a -> (a, a) test_func x = (x, x + 1) assertions = map (to_assert test_func maybe_to_list) [Nothing, Just 1] but I’m getting this from ghc: Could not deduce (Functor f0) arising from a use of ‘fmap’ from the context (Functor f, Eq b) bound by the type signature for interactive:IHaskell465.to_assert :: (Functor f, Eq b) => (a -> b) -> interactive:IHaskell465.NatTran a -> interactive:IHaskell465.NatTran b -> f a -> Bool at :2:14-83 The type variable ‘f0’ is ambiguous Note: there are several potential instances: instance Monad m => Functor (Data.Vector.Fusion.Bundle.Monadic.Bundle m v) -- Defined in ‘Data.Vector.Fusion.Bundle.Monadic’ instance Functor Data.Vector.Fusion.Util.Box -- Defined in ‘Data.Vector.Fusion.Util’ instance Functor Data.Vector.Fusion.Util.Id -- Defined in ‘Data.Vector.Fusion.Util’ ...plus 27 others In the first argument of ‘(.)’, namely ‘fmap g’ In the expression: fmap g . h In the first argument of ‘(==)’, namely ‘(fmap g . h) f’ Can anyone offer some advice? Thanks, -db -------------- 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 capn.freako at gmail.com Fri Jun 17 03:40:28 2016 From: capn.freako at gmail.com (David Banas) Date: Thu, 16 Jun 2016 20:40:28 -0700 Subject: [Haskell-cafe] Trying to test natural transformations, in Haskell. Message-ID: <101B2C80-3072-492F-B953-9C23F581BA26@gmail.com> Got it: {-# LANGUAGE Rank2Types AllowAmbiguousTypes FlexibleContexts #-} type NatTran f f' a = (Functor f, Functor f') => f a -> f' a to_assert :: (Functor f, Functor f', Eq (f' b)) => (a -> b) -> NatTran f f' a -> NatTran f f' b -> f a -> Bool to_assert g h h' f = (fmap g . h) f == (h' . fmap g) f maybe_to_list :: NatTran Maybe [] a maybe_to_list Nothing = [] maybe_to_list (Just x) = [x] test_func :: Num a => a -> (a, a) test_func x = (x, x + 1) success = all (to_assert test_func maybe_to_list maybe_to_list) [Nothing, Just 1] main :: IO () main = do if success then print "Success!" else print "Failure." main Running this code produces: "Success!" ================================================= Hi all, In doing the challenge problems at the end of chapter 10 (Natural Transformations) in Bartosz Milewski’s “Category Theory for Programmers”, I’m trying to write a generic naturality checker: {-# LANGUAGE Rank2Types AllowAmbiguousTypes #-} type NatTran a = (Functor f, Functor f') => f a -> f' a to_assert :: (Functor f, Eq b) => (a -> b) -> NatTran a -> NatTran b -> f a -> Bool to_assert g h h' f = (fmap g . h) f == (h' . fmap g) f which is later made specific to a particular natural transformation: maybe_to_list :: Maybe a -> [a] maybe_to_list Nothing = [] maybe_to_list (Just x) = [x] test_func :: Num a => a -> (a, a) test_func x = (x, x + 1) assertions = map (to_assert test_func maybe_to_list) [Nothing, Just 1] but I’m getting this from ghc: Could not deduce (Functor f0) arising from a use of ‘fmap’ from the context (Functor f, Eq b) bound by the type signature for interactive:IHaskell465.to_assert :: (Functor f, Eq b) => (a -> b) -> interactive:IHaskell465.NatTran a -> interactive:IHaskell465.NatTran b -> f a -> Bool at :2:14-83 The type variable ‘f0’ is ambiguous Note: there are several potential instances: instance Monad m => Functor (Data.Vector.Fusion.Bundle.Monadic.Bundle m v) -- Defined in ‘Data.Vector.Fusion.Bundle.Monadic’ instance Functor Data.Vector.Fusion.Util.Box -- Defined in ‘Data.Vector.Fusion.Util’ instance Functor Data.Vector.Fusion.Util.Id -- Defined in ‘Data.Vector.Fusion.Util’ ...plus 27 others In the first argument of ‘(.)’, namely ‘fmap g’ In the expression: fmap g . h In the first argument of ‘(==)’, namely ‘(fmap g . h) f’ Can anyone offer some advice? Thanks, -db -------------- 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 lists+haskell-cafe at jimpryor.net Fri Jun 17 05:33:36 2016 From: lists+haskell-cafe at jimpryor.net (lists+haskell-cafe at jimpryor.net) Date: Fri, 17 Jun 2016 01:33:36 -0400 Subject: [Haskell-cafe] Instances for (->) a (b :: * -> *)? Message-ID: <1466141616.232314.640350793.4B6DC60C@webmail.messagingengine.com> If one wants to declare instances for a type schema `a -> _`, one writes something like this: instance Context => Class parameters ... ((->) a) where { ... } But what if you want to declare instances for a type schema `a -> b _`, that is, where the slot to be filled is not just the result of (->) a, but rather the composition of that together with another type operation b :: * -> *? I'd like to write something like this: instance Context => Class parameters ... ((->) a (b :: *->*)) where { ...} or: instance Context => Class parameters ... ((->) a (b *)) where { ...} but these don't work. Is it possible to do this? Concretely, here's what I'm trying to achieve. I wrote a typeclass for MonadReaders that are embedded inside (one level) of other MonadReaders, like this: {-# LANGUAGE FunctionalDependencies FlexibleInstances UndecidableInstances #-} class MonadReader w m => DeepMonadReader w r m | m -> r where { deepask :: m r ; deepask = deepreader id ; deeplocal :: (r -> r) -> m a -> m a ; deepreader :: (r -> a) -> m a ; deepreader f = do { r <- deepask; return (f r) } } instance MonadReader r m => DeepMonadReader w r (ReaderT w m) where { deepask = lift ask ; deeplocal = mapReaderT . local ; deepreader = lift . reader } It'd be nice to also provide an instance something like this: instance MonadReader r m => DeepMonadReader w r ((->) w (m :: * -> *)) where { deepask = \w -> ask ; deeplocal f xx = \w -> local f (xx w) ; deepreader xx = \w -> reader xx } -- Jim Pryor jim at jimpryor.net From K.Bleijenberg at lijbrandt.nl Fri Jun 17 07:33:25 2016 From: K.Bleijenberg at lijbrandt.nl (Kees Bleijenberg) Date: Fri, 17 Jun 2016 09:33:25 +0200 Subject: [Haskell-cafe] partial solved problem installing postgreSQL-libpq on Windows? In-Reply-To: References: Message-ID: <000001d1c86a$88faee50$9af0caf0$@lijbrandt.nl> Hi Tamar, I’ve installed the 8.0.1 Haskell Platform and installed postgresql-libpq. Success! Then I installed postgresql-simple. I get a lot of dialogs boxes, complaining : missing SSLEAY32.dll. But the installation works. Probably I have to install openSSL. Now I have to find out how to install snap on 8.0.1. Thanks for your help! Kees Van: Phyx [mailto:lonetiger at gmail.com] Verzonden: donderdag 16 juni 2016 13:49 Aan: K.Bleijenberg at lijbrandt.nl CC: haskell-cafe at haskell.org Onderwerp: partial solved problem installing postgreSQL-libpq on Windows? Hi Kees, Would It be possible for you to try with GHC 7.10.3 or 8.0.1? A bunch of things have changed with the linker in these two versions which should make linking against packages easier. : can't load .so/.DLL for: d:/PROGRA~2/POSTGR~1/9.3/lib\libpq.dll (addDLL: could not load DLL) ghc.exe: d:/PROGRA~2/POSTGR~1/9.3/lib\libpq: %1 is not a valid Win32 application. This seems to be coming from the runtime linker, if indeed d:/PROGRA~2/POSTGR~1/9.3/lib\libpq.dll can be found then either it's the wrong bitness/image type or libpq.dll has dependencies on other dlls. 7.10.1 is not able to load these then as the search path won't be correct. To test this you can add d:/PROGRA~2/POSTGR~1/9.3/lib\ to your path and try loading it again. If that doesn't work and you want to know what's really going on, you can enable loader snaps in gflags for GHC.exe and GHCi.exe (or runHaskell, what ever it is you're using) and attach a debugger like gdb or windbg. https://msdn.microsoft.com/en-us/library/windows/hardware/ff556886(v=vs.85).aspx You'll then be able to see the OS's trace messages for the loader and it should tell you exactly what's wrong. >From the msys prompt: pexports "d:\program files\postgreSQL\9.3\bin\libpq.dll" > libpq.def >From the msys prompt: dlltool -d libpq.def -l libpq.a Import libraries are supported by the GHC but not ghci or any other interpreted mode (until 8.0.2) So this would only work for the compiled program without Template Haskell. Regards, Tamar Geen virus gevonden in dit bericht. Gecontroleerd door AVG - www.avg.com Versie: 2016.0.7640 / Virusdatabase: 4604/12430 - datum van uitgifte: 06/16/16 -------------- next part -------------- An HTML attachment was scrubbed... URL: From jyotirmoy at jyotirmoy.net Fri Jun 17 11:01:40 2016 From: jyotirmoy at jyotirmoy.net (Jyotirmoy Bhattacharya) Date: Fri, 17 Jun 2016 16:31:40 +0530 Subject: [Haskell-cafe] INLINABLE and SPECIALIZE, GHC 8.0.1 Message-ID: I'm trying to write a mutable hash table library that would work both in the IO and ST monads, so I'm using the PrimMonad typeclass [see JmoyHash.hs in the attached archive]. For efficiency, I would like the functions to be specialized to the concrete monad at the call site. According to Section 9.31.9.2 of the GHC User's Guide The optimiser *also* considers each *imported* INLINABLE overloaded function, and specialises it for the different types at which it is called in M. So I marked all the functions in my library as INLINABLE. Yet adding a SPECIALIZE pragma in Main.hs (currently commented out) for an imported function improves runtime performance by 3x, which should not be happening since, if I understand the manual right, the function should have been specialized anyway since it is marked INLINABLE. I am writing to this list rather than filing a bug since I'm not sure if I'm reading the manual right and I have not explicitly verified that the specialization is not happening. I would greatly appreciate any help on both counts. I'm using GHC 8.0.1 with the -O2 flag. Marking the function as INLINE might solve the problem but that's something I don't want to do as it seems to me that specialization and not inlining is what's appropriate here. Regards, Jyotirmoy Bhattacharya -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: test-specialize.tar.bz2 Type: application/x-bzip2 Size: 172157 bytes Desc: not available URL: From jyotirmoy at jyotirmoy.net Fri Jun 17 13:44:43 2016 From: jyotirmoy at jyotirmoy.net (Jyotirmoy Bhattacharya) Date: Fri, 17 Jun 2016 19:14:43 +0530 Subject: [Haskell-cafe] INLINABLE and SPECIALIZE, GHC 8.0.1 In-Reply-To: References: Message-ID: Sorry, realized that attachments cannot be sent to the list. I have put the code on GitHub here https://github.com/jmoy/testing-specialize On Fri, Jun 17, 2016 at 4:31 PM, Jyotirmoy Bhattacharya < jyotirmoy at jyotirmoy.net> wrote: > I'm trying to write a mutable hash table library that would work both in > the IO and ST monads, so I'm using the PrimMonad typeclass [see > JmoyHash.hs in the attached archive]. > > For efficiency, I would like the functions to be specialized to the > concrete monad at the call site. According to Section 9.31.9.2 of the GHC > User's Guide > > > The optimiser *also* considers each *imported* INLINABLE overloaded > function, and specialises it for the different types at which it is called > in M. > > So I marked all the functions in my library as INLINABLE. Yet adding a > SPECIALIZE pragma in Main.hs (currently commented out) for an imported > function improves runtime performance by 3x, which should not be happening > since, if I understand the manual right, the function should have been > specialized anyway since it is marked INLINABLE. > > I am writing to this list rather than filing a bug since I'm not sure if > I'm reading the manual right and I have not explicitly verified that the > specialization is not happening. I would greatly appreciate any help on > both counts. > > I'm using GHC 8.0.1 with the -O2 flag. > > Marking the function as INLINE might solve the problem but that's > something I don't want to do as it seems to me that specialization and not > inlining is what's appropriate here. > > Regards, > Jyotirmoy Bhattacharya > -------------- next part -------------- An HTML attachment was scrubbed... URL: From carter.schonwald at gmail.com Fri Jun 17 15:45:53 2016 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Fri, 17 Jun 2016 11:45:53 -0400 Subject: [Haskell-cafe] INLINABLE and SPECIALIZE, GHC 8.0.1 In-Reply-To: References: Message-ID: You probably want specializable and specialize inline pragmas. On Friday, June 17, 2016, Jyotirmoy Bhattacharya wrote: > Sorry, realized that attachments cannot be sent to the list. I have put > the code on GitHub here https://github.com/jmoy/testing-specialize > > On Fri, Jun 17, 2016 at 4:31 PM, Jyotirmoy Bhattacharya < > jyotirmoy at jyotirmoy.net > > wrote: > >> I'm trying to write a mutable hash table library that would work both in >> the IO and ST monads, so I'm using the PrimMonad typeclass [see >> JmoyHash.hs in the attached archive]. >> >> For efficiency, I would like the functions to be specialized to the >> concrete monad at the call site. According to Section 9.31.9.2 of the >> GHC User's Guide >> >> >> The optimiser *also* considers each *imported* INLINABLE overloaded >> function, and specialises it for the different types at which it is called >> in M. >> >> So I marked all the functions in my library as INLINABLE. Yet adding a >> SPECIALIZE pragma in Main.hs (currently commented out) for an imported >> function improves runtime performance by 3x, which should not be happening >> since, if I understand the manual right, the function should have been >> specialized anyway since it is marked INLINABLE. >> >> I am writing to this list rather than filing a bug since I'm not sure if >> I'm reading the manual right and I have not explicitly verified that the >> specialization is not happening. I would greatly appreciate any help on >> both counts. >> >> I'm using GHC 8.0.1 with the -O2 flag. >> >> Marking the function as INLINE might solve the problem but that's >> something I don't want to do as it seems to me that specialization and not >> inlining is what's appropriate here. >> >> Regards, >> Jyotirmoy Bhattacharya >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jyotirmoy at jyotirmoy.net Fri Jun 17 16:50:07 2016 From: jyotirmoy at jyotirmoy.net (Jyotirmoy Bhattacharya) Date: Fri, 17 Jun 2016 22:20:07 +0530 Subject: [Haskell-cafe] INLINABLE and SPECIALIZE, GHC 8.0.1 In-Reply-To: References: Message-ID: Thanks! I could not find the SPECIALIZABLE pragma in the docs. Can you please give me a pointer. As to inline, while it would work, there might be a large cost in code size, if say the `insert` function of a hash table were to be inlined everywhere it is used in a program. Regards, Jyotirmoy On Fri, Jun 17, 2016 at 9:15 PM, Carter Schonwald < carter.schonwald at gmail.com> wrote: > You probably want specializable and specialize inline pragmas. > > > On Friday, June 17, 2016, Jyotirmoy Bhattacharya > wrote: > >> Sorry, realized that attachments cannot be sent to the list. I have put >> the code on GitHub here https://github.com/jmoy/testing-specialize >> >> On Fri, Jun 17, 2016 at 4:31 PM, Jyotirmoy Bhattacharya < >> jyotirmoy at jyotirmoy.net> wrote: >> >>> I'm trying to write a mutable hash table library that would work both in >>> the IO and ST monads, so I'm using the PrimMonad typeclass [see >>> JmoyHash.hs in the attached archive]. >>> >>> For efficiency, I would like the functions to be specialized to the >>> concrete monad at the call site. According to Section 9.31.9.2 of the >>> GHC User's Guide >>> >>> >>> The optimiser *also* considers each *imported* INLINABLE overloaded >>> function, and specialises it for the different types at which it is called >>> in M. >>> >>> So I marked all the functions in my library as INLINABLE. Yet adding a >>> SPECIALIZE pragma in Main.hs (currently commented out) for an imported >>> function improves runtime performance by 3x, which should not be happening >>> since, if I understand the manual right, the function should have been >>> specialized anyway since it is marked INLINABLE. >>> >>> I am writing to this list rather than filing a bug since I'm not sure if >>> I'm reading the manual right and I have not explicitly verified that the >>> specialization is not happening. I would greatly appreciate any help on >>> both counts. >>> >>> I'm using GHC 8.0.1 with the -O2 flag. >>> >>> Marking the function as INLINE might solve the problem but that's >>> something I don't want to do as it seems to me that specialization and not >>> inlining is what's appropriate here. >>> >>> Regards, >>> Jyotirmoy Bhattacharya >>> >> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From martin.drautzburg at web.de Fri Jun 17 19:04:54 2016 From: martin.drautzburg at web.de (martin) Date: Fri, 17 Jun 2016 21:04:54 +0200 Subject: [Haskell-cafe] How to spot Monads, Applicatives ... In-Reply-To: <57618C0C.7070900@vex.net> References: <57617A39.3090905@web.de> <57618C0C.7070900@vex.net> Message-ID: <576449D6.2040009@web.de> Am 06/15/2016 um 07:10 PM schrieb Albert Y. C. Lai: > On 2016-06-15 11:54 AM, martin wrote: >> Paticularly I am having difficulties with the *->* instances. E.g. why is the state "s" in the state monad the fixed >> type and the "a" the type parameter? When I am writing state code without the State monad the two look like equal >> candidates. Why not have "State a" monad, which threads an a-typed value and spits out states? > > You mean like this? > > newtype MyState a s = Mk {unMk :: a -> (s, a)} No, I meant newtype MyState a s = Mk {unMk :: s -> (s, a)} From trebla at vex.net Fri Jun 17 21:02:24 2016 From: trebla at vex.net (Albert Y. C. Lai) Date: Fri, 17 Jun 2016 17:02:24 -0400 Subject: [Haskell-cafe] How to spot Monads, Applicatives ... In-Reply-To: <576449D6.2040009@web.de> References: <57617A39.3090905@web.de> <57618C0C.7070900@vex.net> <576449D6.2040009@web.de> Message-ID: <57646560.5000609@vex.net> On 2016-06-17 03:04 PM, martin wrote: > Am 06/15/2016 um 07:10 PM schrieb Albert Y. C. Lai: >> On 2016-06-15 11:54 AM, martin wrote: >>> Paticularly I am having difficulties with the *->* instances. E.g. why is the state "s" in the state monad the fixed >>> type and the "a" the type parameter? When I am writing state code without the State monad the two look like equal >>> candidates. Why not have "State a" monad, which threads an a-typed value and spits out states? >> >> You mean like this? >> >> newtype MyState a s = Mk {unMk :: a -> (s, a)} > > No, I meant > > newtype MyState a s = Mk {unMk :: s -> (s, a)} This seems to thread s and spit out a, the opposite of what you said. So much for natural language "intuitive" "conceptual" "meaningful" descriptions. I can't write Functor, Applicative, Monad instances for it. Can you? From headprogrammingczar at gmail.com Fri Jun 17 21:44:55 2016 From: headprogrammingczar at gmail.com (Joe Quinn) Date: Fri, 17 Jun 2016 17:44:55 -0400 Subject: [Haskell-cafe] How to spot Monads, Applicatives ... In-Reply-To: <57646560.5000609@vex.net> References: <57617A39.3090905@web.de> <57618C0C.7070900@vex.net> <576449D6.2040009@web.de> <57646560.5000609@vex.net> Message-ID: <4ac6dc5d-e8b3-262b-dfe8-3ba55464c51c@gmail.com> On 6/17/2016 5:02 PM, Albert Y. C. Lai wrote: > On 2016-06-17 03:04 PM, martin wrote: >> Am 06/15/2016 um 07:10 PM schrieb Albert Y. C. Lai: >>> On 2016-06-15 11:54 AM, martin wrote: >>>> Paticularly I am having difficulties with the *->* instances. E.g. >>>> why is the state "s" in the state monad the fixed >>>> type and the "a" the type parameter? When I am writing state code >>>> without the State monad the two look like equal >>>> candidates. Why not have "State a" monad, which threads an a-typed >>>> value and spits out states? >>> >>> You mean like this? >>> >>> newtype MyState a s = Mk {unMk :: a -> (s, a)} >> >> No, I meant >> >> newtype MyState a s = Mk {unMk :: s -> (s, a)} > > This seems to thread s and spit out a, the opposite of what you said. > So much for natural language "intuitive" "conceptual" "meaningful" > descriptions. > > I can't write Functor, Applicative, Monad instances for it. Can you? > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe A Functor instance is pretty easy, but Applicative is off the table without constraints on what a can be. instance Functor (MyState a) where fmap (Mk f) g = Mk (\s -> let (s', a') = f s in (g s', a')) From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Fri Jun 17 22:16:19 2016 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Fri, 17 Jun 2016 23:16:19 +0100 Subject: [Haskell-cafe] How to spot Monads, Applicatives ... In-Reply-To: <4ac6dc5d-e8b3-262b-dfe8-3ba55464c51c@gmail.com> References: <57617A39.3090905@web.de> <57618C0C.7070900@vex.net> <576449D6.2040009@web.de> <57646560.5000609@vex.net> <4ac6dc5d-e8b3-262b-dfe8-3ba55464c51c@gmail.com> Message-ID: <20160617221618.GZ5680@weber> On Fri, Jun 17, 2016 at 05:44:55PM -0400, Joe Quinn wrote: > >>newtype MyState a s = Mk {unMk :: s -> (s, a)} > > > >I can't write Functor, Applicative, Monad instances for it. Can you? > > A Functor instance is pretty easy, but Applicative is off the table > without constraints on what a can be. > > instance Functor (MyState a) where > fmap (Mk f) g = Mk (\s -> let (s', a') = f s in (g s', a')) I suggest you try compiling it :) From aditya.siram at gmail.com Fri Jun 17 23:14:39 2016 From: aditya.siram at gmail.com (aditya siram) Date: Fri, 17 Jun 2016 18:14:39 -0500 Subject: [Haskell-cafe] Macros For Cabal Version Message-ID: Hi all, I have a non-trivial build script that I'm trying to make compatible with Cabal 1.22 and Cabal 1.24. So far the only macro I can find that helps me determine which version I'm using is __GLASGOW_HASKELL__. Is there a better one? Thanks! -deech -------------- next part -------------- An HTML attachment was scrubbed... URL: From mgsloan at gmail.com Sat Jun 18 01:54:45 2016 From: mgsloan at gmail.com (Michael Sloan) Date: Fri, 17 Jun 2016 18:54:45 -0700 Subject: [Haskell-cafe] Macros For Cabal Version In-Reply-To: References: Message-ID: If Cabal itself is a dependency, then you can use the MIN_VERSION_Cabal macro. That'll only work if your build script is built via cabal, because it generates cabal_macros.h . Another approach would be to rely on GHC_PACKAGE_PATH being accurate (or if the global db is used), and run "ghc-pkg field Cabal version". -Michael On Fri, Jun 17, 2016 at 4:14 PM, aditya siram wrote: > Hi all, > I have a non-trivial build script that I'm trying to make compatible with > Cabal 1.22 and Cabal 1.24. So far the only macro I can find that helps me > determine which version I'm using is __GLASGOW_HASKELL__. Is there a better > one? > > Thanks! > -deech > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > From headprogrammingczar at gmail.com Sat Jun 18 02:14:32 2016 From: headprogrammingczar at gmail.com (Joe Quinn) Date: Fri, 17 Jun 2016 22:14:32 -0400 Subject: [Haskell-cafe] How to spot Monads, Applicatives ... In-Reply-To: <20160617221618.GZ5680@weber> References: <57617A39.3090905@web.de> <57618C0C.7070900@vex.net> <576449D6.2040009@web.de> <57646560.5000609@vex.net> <4ac6dc5d-e8b3-262b-dfe8-3ba55464c51c@gmail.com> <20160617221618.GZ5680@weber> Message-ID: On 6/17/2016 6:16 PM, Tom Ellis wrote: > On Fri, Jun 17, 2016 at 05:44:55PM -0400, Joe Quinn wrote: >>>> newtype MyState a s = Mk {unMk :: s -> (s, a)} >>> I can't write Functor, Applicative, Monad instances for it. Can you? >> A Functor instance is pretty easy, but Applicative is off the table >> without constraints on what a can be. >> >> instance Functor (MyState a) where >> fmap (Mk f) g = Mk (\s -> let (s', a') = f s in (g s', a')) > I suggest you try compiling it :) Doh, you're right. s is in both positive and negative positions there. From carter.schonwald at gmail.com Sat Jun 18 03:51:50 2016 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Fri, 17 Jun 2016 23:51:50 -0400 Subject: [Haskell-cafe] INLINABLE and SPECIALIZE, GHC 8.0.1 In-Reply-To: References: Message-ID: Specialize inline is its own pragma. Read https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html?highlight=specialize#specialize-pragma On Friday, June 17, 2016, Jyotirmoy Bhattacharya wrote: > Thanks! I could not find the SPECIALIZABLE pragma in the docs. Can you > please give me a pointer. As to inline, while it would work, there might be > a large cost in code size, if say the `insert` function of a hash table > were to be inlined everywhere it is used in a program. > > Regards, > Jyotirmoy > > On Fri, Jun 17, 2016 at 9:15 PM, Carter Schonwald < > carter.schonwald at gmail.com > > wrote: > >> You probably want specializable and specialize inline pragmas. >> >> >> On Friday, June 17, 2016, Jyotirmoy Bhattacharya > > wrote: >> >>> Sorry, realized that attachments cannot be sent to the list. I have put >>> the code on GitHub here https://github.com/jmoy/testing-specialize >>> >>> On Fri, Jun 17, 2016 at 4:31 PM, Jyotirmoy Bhattacharya < >>> jyotirmoy at jyotirmoy.net> wrote: >>> >>>> I'm trying to write a mutable hash table library that would work both >>>> in the IO and ST monads, so I'm using the PrimMonad typeclass [see >>>> JmoyHash.hs in the attached archive]. >>>> >>>> For efficiency, I would like the functions to be specialized to the >>>> concrete monad at the call site. According to Section 9.31.9.2 of the >>>> GHC User's Guide >>>> >>>> >>>> The optimiser *also* considers each *imported* INLINABLE overloaded >>>> function, and specialises it for the different types at which it is called >>>> in M. >>>> >>>> So I marked all the functions in my library as INLINABLE. Yet adding a >>>> SPECIALIZE pragma in Main.hs (currently commented out) for an imported >>>> function improves runtime performance by 3x, which should not be happening >>>> since, if I understand the manual right, the function should have been >>>> specialized anyway since it is marked INLINABLE. >>>> >>>> I am writing to this list rather than filing a bug since I'm not sure >>>> if I'm reading the manual right and I have not explicitly verified that the >>>> specialization is not happening. I would greatly appreciate any help on >>>> both counts. >>>> >>>> I'm using GHC 8.0.1 with the -O2 flag. >>>> >>>> Marking the function as INLINE might solve the problem but that's >>>> something I don't want to do as it seems to me that specialization and not >>>> inlining is what's appropriate here. >>>> >>>> Regards, >>>> Jyotirmoy Bhattacharya >>>> >>> >>> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ch.howard at zoho.com Sat Jun 18 04:22:44 2016 From: ch.howard at zoho.com (Christopher Howard) Date: Fri, 17 Jun 2016 20:22:44 -0800 Subject: [Haskell-cafe] Monad Stack - State + Rand? Message-ID: <5764CC94.3030403@zoho.com> Hi. I'm working through "Haskell Design Patterns" and got inspired to try to create my first monad stack. What I really wanted though (not shown in the book) was to combine State and Rand. I daresay I got something to compile: walk :: RandomGen g => StateT (Float, Float) (Rand g) (Float, Float) walk = do (x, y) <- get put (x + 1, y + 1) get >>= return However, the moment I try to insert a getRandomR or something in it, I get an error Could not deduce (MonadRandom (StateT (Float, Float) (Rand g))) arising from a use of `getRandomR' <...snip...> add an instance declaration for (MonadRandom (StateT (Float, Float) (Rand g))) I see there are instances MonadRandom m => MonadRandom (StateT s m) RandomGen g => MonadRandom (Rand g) in Control.Monad.Random.Class, so I am not quite sure what is expected of me. -- http://justonemoremathproblem.com To protect my privacy, please use PGP encryption. It's free and easy to use! My public key ID is 0x340EA95A (pgp.mit.edu). From ivan.miljenovic at gmail.com Sat Jun 18 04:31:49 2016 From: ivan.miljenovic at gmail.com (Ivan Lazar Miljenovic) Date: Sat, 18 Jun 2016 14:31:49 +1000 Subject: [Haskell-cafe] Monad Stack - State + Rand? In-Reply-To: <5764CC94.3030403@zoho.com> References: <5764CC94.3030403@zoho.com> Message-ID: On 18 June 2016 at 14:22, Christopher Howard wrote: > Hi. I'm working through "Haskell Design Patterns" and got inspired to > try to create my first monad stack. What I really wanted though (not > shown in the book) was to combine State and Rand. I daresay I got > something to compile: > > walk :: RandomGen g => StateT (Float, Float) (Rand g) (Float, Float) > walk = do (x, y) <- get > put (x + 1, y + 1) > get >>= return Can you provide more details? At the minimum, what imports/packages did you use (strict or lazy State? Which MonadRand did you use?). Note also that "get >>= return" is equivalent to just "get"; you could even combine the first two lines using the "modify" function. > However, the moment I try to insert a getRandomR or something in it, I > get an error > > Could not deduce (MonadRandom (StateT (Float, Float) (Rand g))) > arising from a use of `getRandomR' <...snip...> > add an instance declaration for > (MonadRandom (StateT (Float, Float) (Rand g))) > > I see there are instances > > MonadRandom m => MonadRandom (StateT s m) > RandomGen g => MonadRandom (Rand g) > > in Control.Monad.Random.Class, so I am not quite sure what is expected > of me. Is this the MonadRandom package? If so, I don't see the StateT instance there. -- Ivan Lazar Miljenovic Ivan.Miljenovic at gmail.com http://IvanMiljenovic.wordpress.com From erantapaa at gmail.com Sat Jun 18 05:27:25 2016 From: erantapaa at gmail.com (Erik Rantapaa) Date: Fri, 17 Jun 2016 22:27:25 -0700 (PDT) Subject: [Haskell-cafe] Monad Stack - State + Rand? In-Reply-To: <5764CC94.3030403@zoho.com> References: <5764CC94.3030403@zoho.com> Message-ID: <3fb7eaa2-8bc0-4eff-bc85-12341b397382@googlegroups.com> You are likely missing a `lift` when you call the random functions. Here is an example: import Control.Monad.State import Control.Monad.Random walk :: RandomGen g => StateT (Float, Float) (Rand g) (Float, Float) walk = do (x, y) <- get put (x + 1, y + 1) get >>= return foo :: RandomGen g => StateT (Float,Float) (Rand g) () foo = do a <- lift $ getRandomR (1,6) b <- lift $ getRandomR (4,10) (x,y) <- get put (x+a, y+b) test1 = do g <- getStdGen print $ runRand (runStateT foo (0.0, 3.14)) g Because the State monad is encapsulating (transforming) the random monad, you have to `lift` operations in the random monad so that they become operations in the transformed monad. On Friday, June 17, 2016 at 11:22:57 PM UTC-5, Christopher Howard wrote: > > Hi. I'm working through "Haskell Design Patterns" and got inspired to > try to create my first monad stack. What I really wanted though (not > shown in the book) was to combine State and Rand. I daresay I got > something to compile: > > walk :: RandomGen g => StateT (Float, Float) (Rand g) (Float, Float) > walk = do (x, y) <- get > put (x + 1, y + 1) > get >>= return > > However, the moment I try to insert a getRandomR or something in it, I > get an error > > Could not deduce (MonadRandom (StateT (Float, Float) (Rand g))) > arising from a use of `getRandomR' <...snip...> > add an instance declaration for > (MonadRandom (StateT (Float, Float) (Rand g))) > > I see there are instances > > MonadRandom m => MonadRandom (StateT s m) > RandomGen g => MonadRandom (Rand g) > > in Control.Monad.Random.Class, so I am not quite sure what is expected > of me. > > -- > http://justonemoremathproblem.com > To protect my privacy, please use PGP encryption. It's free and easy > to use! My public key ID is 0x340EA95A (pgp.mit.edu). > > _______________________________________________ > Haskell-Cafe mailing list > Haskel... at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ch.howard at zoho.com Sat Jun 18 05:27:50 2016 From: ch.howard at zoho.com (Christopher Howard) Date: Fri, 17 Jun 2016 21:27:50 -0800 Subject: [Haskell-cafe] Monad Stack - State + Rand? In-Reply-To: References: <5764CC94.3030403@zoho.com> Message-ID: <5764DBD6.5050405@zoho.com> Hi, I have import Control.Monad.Random import Control.Monad.State.Lazy import Control.Monad.Random.Class Though, I think the last one is superfluous. On 06/17/2016 08:31 PM, Ivan Lazar Miljenovic wrote: > On 18 June 2016 at 14:22, Christopher Howard wrote: >> Hi. I'm working through "Haskell Design Patterns" and got inspired to >> try to create my first monad stack. What I really wanted though (not >> shown in the book) was to combine State and Rand. I daresay I got >> something to compile: >> >> walk :: RandomGen g => StateT (Float, Float) (Rand g) (Float, Float) >> walk = do (x, y) <- get >> put (x + 1, y + 1) >> get >>= return > > Can you provide more details? At the minimum, what imports/packages > did you use (strict or lazy State? Which MonadRand did you use?). > > Note also that "get >>= return" is equivalent to just "get"; you could > even combine the first two lines using the "modify" function. > >> However, the moment I try to insert a getRandomR or something in it, I >> get an error >> >> Could not deduce (MonadRandom (StateT (Float, Float) (Rand g))) >> arising from a use of `getRandomR' <...snip...> >> add an instance declaration for >> (MonadRandom (StateT (Float, Float) (Rand g))) >> >> I see there are instances >> >> MonadRandom m => MonadRandom (StateT s m) >> RandomGen g => MonadRandom (Rand g) >> >> in Control.Monad.Random.Class, so I am not quite sure what is expected >> of me. > > Is this the MonadRandom package? If so, I don't see the StateT instance there. > > -- http://justonemoremathproblem.com To protect my privacy, please use PGP encryption. It's free and easy to use! My public key ID is 0x340EA95A (pgp.mit.edu). From ch.howard at zoho.com Sat Jun 18 05:30:16 2016 From: ch.howard at zoho.com (Christopher Howard) Date: Fri, 17 Jun 2016 21:30:16 -0800 Subject: [Haskell-cafe] Monad Stack - State + Rand? In-Reply-To: <3fb7eaa2-8bc0-4eff-bc85-12341b397382@googlegroups.com> References: <5764CC94.3030403@zoho.com> <3fb7eaa2-8bc0-4eff-bc85-12341b397382@googlegroups.com> Message-ID: <5764DC68.2000108@zoho.com> Thanks, that was it! On 06/17/2016 09:27 PM, Erik Rantapaa wrote: > You are likely missing a `lift` when you call the random functions. > > Here is an example: > > > import Control.Monad.State > import Control.Monad.Random > > walk :: RandomGen g => StateT (Float, Float) (Rand g) (Float, Float) > walk = do (x, y) <- get > put (x + 1, y + 1) > get >>= return > > foo :: RandomGen g => StateT (Float,Float) (Rand g) () > foo = do > a <- lift $ getRandomR (1,6) > b <- lift $ getRandomR (4,10) > (x,y) <- get > put (x+a, y+b) > > test1 = do > g <- getStdGen > print $ runRand (runStateT foo (0.0, 3.14)) g > > Because the State monad is encapsulating (transforming) the random > monad, you have to `lift` operations in the random monad so that they > become operations in the transformed monad. > > On Friday, June 17, 2016 at 11:22:57 PM UTC-5, Christopher Howard wrote: > > Hi. I'm working through "Haskell Design Patterns" and got inspired to > try to create my first monad stack. What I really wanted though (not > shown in the book) was to combine State and Rand. I daresay I got > something to compile: > > walk :: RandomGen g => StateT (Float, Float) (Rand g) (Float, Float) > walk = do (x, y) <- get > put (x + 1, y + 1) > get >>= return > > However, the moment I try to insert a getRandomR or something in it, I > get an error > > Could not deduce (MonadRandom (StateT (Float, Float) (Rand g))) > arising from a use of `getRandomR' <...snip...> > add an instance declaration for > (MonadRandom (StateT (Float, Float) (Rand g))) > > I see there are instances > > MonadRandom m => MonadRandom (StateT s m) > RandomGen g => MonadRandom (Rand g) > > in Control.Monad.Random.Class, so I am not quite sure what is expected > of me. > > -- > http://justonemoremathproblem.com > To protect my privacy, please use PGP encryption. It's free and easy > to use! My public key ID is 0x340EA95A (pgp.mit.edu > ). > > _______________________________________________ > Haskell-Cafe mailing list > Haskel... at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > -- http://justonemoremathproblem.com To protect my privacy, please use PGP encryption. It's free and easy to use! My public key ID is 0x340EA95A (pgp.mit.edu). From martin.drautzburg at web.de Sat Jun 18 08:31:54 2016 From: martin.drautzburg at web.de (martin) Date: Sat, 18 Jun 2016 10:31:54 +0200 Subject: [Haskell-cafe] How to spot Monads, Applicatives ... In-Reply-To: <4ac6dc5d-e8b3-262b-dfe8-3ba55464c51c@gmail.com> References: <57617A39.3090905@web.de> <57618C0C.7070900@vex.net> <576449D6.2040009@web.de> <57646560.5000609@vex.net> <4ac6dc5d-e8b3-262b-dfe8-3ba55464c51c@gmail.com> Message-ID: <576506FA.7000902@web.de> Am 06/17/2016 um 11:44 PM schrieb Joe Quinn: >>>> On 2016-06-15 11:54 AM, martin wrote: >>>>> why is the state "s" in the state monad the fixed >>>>> type and the "a" the type parameter? When I am writing state code without the State monad the two look like equal >>>>> candidates. Why not have "State a" monad, which threads an a-typed value and spits out states? >>>> >>>> You mean like this? >>>> >>>> newtype MyState a s = Mk {unMk :: a -> (s, a)} >>> >>> No, I meant >>> >>> newtype MyState a s = Mk {unMk :: s -> (s, a)} >> >> I can't write Functor, Applicative, Monad instances for it. Can you? No I can't. But what is the correct train of thought here? Suppose I came to the conclusion that "s->(s,a)" is useful to model stateful computations. Next I want want to make it a Functor. This raises two questions: (1) Why do I want to do this in the first place? (2) What keeps me from trying "instance Functor (MyState a)" instead of "instance Functor (MyState s)? Is trying it the wrong way and failing the only way to make that choice? I suppose there must be some reasoning which is closer to the problem. From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Sat Jun 18 08:37:56 2016 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Sat, 18 Jun 2016 09:37:56 +0100 Subject: [Haskell-cafe] How to spot Monads, Applicatives ... In-Reply-To: <576506FA.7000902@web.de> References: <57617A39.3090905@web.de> <57618C0C.7070900@vex.net> <576449D6.2040009@web.de> <57646560.5000609@vex.net> <4ac6dc5d-e8b3-262b-dfe8-3ba55464c51c@gmail.com> <576506FA.7000902@web.de> Message-ID: <20160618083755.GB5680@weber> On Sat, Jun 18, 2016 at 10:31:54AM +0200, martin wrote: > Suppose I came to the conclusion that "s->(s,a)" is useful to model > stateful computations. Next I want want to make it a Functor. This > raises two questions: > > (1) Why do I want to do this in the first place? "s -> (s, a)" simply *is* functorial in 'a'. There's no "want" about that part. From that point on it's just a minor question of whether you want to write out a Functor instance so you can conveniently use that fact as part of the programs you write. > (2) What keeps me from trying "instance Functor (MyState a)" instead of > "instance Functor (MyState s)? Is trying it the wrong way and failing the > only way to make that choice? I suppose there must be some reasoning > which is closer to the problem. You mean 'instead of "instance Functor (State s)"'. The answer is that 's' appears on the left hand side of the arrow in "s -> (s, a)" so there's no way the 's' type parameter can be functorial. Tom From carter.schonwald at gmail.com Sat Jun 18 15:18:33 2016 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Sat, 18 Jun 2016 11:18:33 -0400 Subject: [Haskell-cafe] Trying to test natural transformations, in Haskell. In-Reply-To: <101B2C80-3072-492F-B953-9C23F581BA26@gmail.com> References: <101B2C80-3072-492F-B953-9C23F581BA26@gmail.com> Message-ID: My rule of thumb is to also always have scoped type variables enabled in my own code. I also strongly advise against allow ambiguous types, it's seldom what you want. On Thursday, June 16, 2016, David Banas wrote: > Got it: > > {-# LANGUAGE Rank2Types > AllowAmbiguousTypes > FlexibleContexts > #-} > > type NatTran f f' a = (Functor f, Functor f') => f a -> f' a > > to_assert :: (Functor f, Functor f', Eq (f' b)) => (a -> b) -> NatTran f > f' a -> NatTran f f' b -> f a -> Bool > to_assert g h h' f = (fmap g . h) f == (h' . fmap g) f > > maybe_to_list :: NatTran Maybe [] a > maybe_to_list Nothing = [] > maybe_to_list (Just x) = [x] > > test_func :: Num a => a -> (a, a) > test_func x = (x, x + 1) > > success = all (to_assert test_func maybe_to_list maybe_to_list) [Nothing, > Just 1] > > main :: IO () > main = do > if success then print "Success!" else print "Failure." > > main > > > Running this code produces: > > "Success!" > > > ================================================= > > Hi all, > > In doing the challenge problems at the end of chapter 10 (*Natural > Transformations*) in Bartosz Milewski’s “Category Theory for > Programmers”, I’m trying to write a generic naturality checker: > > {-# LANGUAGE Rank2Types > AllowAmbiguousTypes > #-} > > type NatTran a = (Functor f, Functor f') => f a -> f' a > > to_assert :: (Functor f, Eq b) => (a -> b) -> NatTran a -> NatTran b -> f > a -> Bool > to_assert g h h' f = (fmap g . h) f == (h' . fmap g) f > > > which is later made specific to a particular natural transformation: > > maybe_to_list :: Maybe a -> [a] > maybe_to_list Nothing = [] > maybe_to_list (Just x) = [x] > > test_func :: Num a => a -> (a, a) > test_func x = (x, x + 1) > > assertions = map (to_assert test_func maybe_to_list) [Nothing, Just 1] > > > but I’m getting this from ghc: > > Could not deduce (Functor f0) arising from a use of ‘fmap’ > from the context (Functor f, Eq b) > bound by the type signature for interactive:IHaskell465.to_assert :: > (Functor f, Eq b) => (a -> b) -> interactive:IHaskell465.NatTran a -> > interactive:IHaskell465.NatTran b -> f a -> Bool at :2:14-83 > The type variable ‘f0’ is ambiguous > Note: there are several potential instances: > instance Monad m => Functor (Data.Vector.Fusion.Bundle.Monadic.Bundle m v) > -- Defined in ‘Data.Vector.Fusion.Bundle.Monadic’ > instance Functor Data.Vector.Fusion.Util.Box -- Defined in > ‘Data.Vector.Fusion.Util’ > instance Functor Data.Vector.Fusion.Util.Id -- Defined in > ‘Data.Vector.Fusion.Util’ > ...plus 27 others > In the first argument of ‘(.)’, namely ‘fmap g’ > In the expression: fmap g . h > In the first argument of ‘(==)’, namely ‘(fmap g . h) f’ > > Can anyone offer some advice? > > Thanks, > -db > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From guillaum.bouchard+haskell at gmail.com Sat Jun 18 20:37:52 2016 From: guillaum.bouchard+haskell at gmail.com (Guillaume Bouchard) Date: Sat, 18 Jun 2016 22:37:52 +0200 Subject: [Haskell-cafe] ST Vector / STRef -- Performances and allocation Message-ID: Hello. I read a reddit post [0] which ends in a debate about haskell performances. Someone gives a C implementation which runs in 15ms on some dataset. I wanted to learn about mutable vector and ST and got something in haskell which runs in 50ms. Code is here [1]. [0] https://www.reddit.com/r/haskell/comments/4ojsn0/counting_inversions_haskell/ [1] https://github.com/guibou/inversionsCount/blob/syntax/inversions.hs When I'm profiling the code, I'm surprised to see more than 50% of the %alloc in function which, from my point of view, must not allocate. For example, this function : inc :: forall s. STRef s Int -> ST s () inc v = modifySTRef' v (+1) Is responsible for 10% of the allocation in this program. I was hoping that the "unboxing magic" of GHC may have replaced my Int somewhere by an unboxed one, but I guess the allocation means that the STRef is somehow pointing to a heap allocated Int. Do you know a way to remove theses allocations? As a second question, if you see any other way to improve this implementation, I'll be happy to learn something new ;) Finally, if you read my code, you'll see that I implemented a small DSL around ST / STRef / MVector to make my main function more readable. How do people write readable code in real life ? Especially, I was annoyed when I tried to convert this piece of C code : if (x1 < mid && (x2 == sz || tmp[x1] <= p[x2])) { a; } else { b; } In my haskell code, x1, x2 are STRef, and tmp and p are MVector. This was highly painful to write in haskell and I had to write something such as: x1 <- readSTRef x1' x2 <- readSTRef x2' cond <- if x1 < mid then if x2 == sz then return True else do tmp_x1 <- Vector.read tmp x1 p_x2 <_ Vector.read p x2 return (tmp_x1 <= p_x2) else return False if cond then a else b This is painful, complex and error prone, so is there another solution ? Thank you. From carter.schonwald at gmail.com Sat Jun 18 22:57:40 2016 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Sat, 18 Jun 2016 18:57:40 -0400 Subject: [Haskell-cafe] ST Vector / STRef -- Performances and allocation In-Reply-To: References: Message-ID: StRef is a boxed heap value. If you use a single element Unboxed Mutable vector you may find there's less boxing :) On Saturday, June 18, 2016, Guillaume Bouchard < guillaum.bouchard+haskell at gmail.com> wrote: > Hello. > > I read a reddit post [0] which ends in a debate about haskell > performances. Someone gives a C implementation which runs in 15ms on > some dataset. I wanted to learn about mutable vector and ST and got > something in haskell which runs in 50ms. Code is here [1]. > > [0] > https://www.reddit.com/r/haskell/comments/4ojsn0/counting_inversions_haskell/ > [1] https://github.com/guibou/inversionsCount/blob/syntax/inversions.hs > > When I'm profiling the code, I'm surprised to see more than 50% of the > %alloc in function which, from my point of view, must not allocate. > > For example, this function : > > inc :: forall s. STRef s Int -> ST s () > inc v = modifySTRef' v (+1) > > Is responsible for 10% of the allocation in this program. I was hoping > that the "unboxing magic" of GHC may have replaced my Int somewhere by > an unboxed one, but I guess the allocation means that the STRef is > somehow pointing to a heap allocated Int. > > Do you know a way to remove theses allocations? > > As a second question, if you see any other way to improve this > implementation, I'll be happy to learn something new ;) > > Finally, if you read my code, you'll see that I implemented a small > DSL around ST / STRef / MVector to make my main function more > readable. How do people write readable code in real life ? > > Especially, I was annoyed when I tried to convert this piece of C code : > > if (x1 < mid && (x2 == sz || tmp[x1] <= p[x2])) { > a; > } else { > b; > } > > In my haskell code, x1, x2 are STRef, and tmp and p are MVector. This > was highly painful to write in haskell and I had to write something > such as: > > x1 <- readSTRef x1' > x2 <- readSTRef x2' > > cond <- if x1 < mid > then if x2 == sz > then return True > else do > tmp_x1 <- Vector.read tmp x1 > p_x2 <_ Vector.read p x2 > return (tmp_x1 <= p_x2) > else return False > if cond > then a > else b > > This is painful, complex and error prone, so is there another solution ? > > Thank you. > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From capn.freako at gmail.com Sat Jun 18 23:03:20 2016 From: capn.freako at gmail.com (David Banas) Date: Sat, 18 Jun 2016 16:03:20 -0700 Subject: [Haskell-cafe] My responses to challenge problems in Bartosz Milewski's "Category Theory for Programmers", thru Ch. 10. Message-ID: <68E43A1F-DA09-4F5D-9BE0-3117A48036D2@gmail.com> Hi all, I just finished chapter 10 in Bartosz Milewski’s “Category Theory for Programmers”, and thought I’d share my responses to his challenge problems: https://htmlpreview.github.io/?https://github.com/capn-freako/Haskell_Misc/blob/master/Bartosz_Milewski_Functors.html I’d love to hear anyone’s feedback. Cheers, -db -------------- 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 amos.robinson at gmail.com Sat Jun 18 23:08:26 2016 From: amos.robinson at gmail.com (Amos Robinson) Date: Sat, 18 Jun 2016 23:08:26 +0000 Subject: [Haskell-cafe] ST Vector / STRef -- Performances and allocation In-Reply-To: References: Message-ID: Hi, You might want to add inline pragmas to "inc" and so on. STRef is boxed, so it will allocate. The 'URef' type here might be useful: http://hackage.haskell.org/package/mutable-containers-0.3.2.1/docs/Data-Mutable.html It is just a wrapper around unboxed mutable vector, as Carter suggests. The sad story is that in my experience, if you really want decent performance you will have to dump the Core and inspect it by hand. You'd then add inline and bang patterns based on the Core. I do not recommend it as a relaxing weekend exercise. I usually use an invocation something like: > ghc -ddump-prep -dppr-case-as-let -dsuppress-all -fforce-recomp inversions.hs > inversions.hscore On Sun, 19 Jun 2016 at 06:38 Guillaume Bouchard < guillaum.bouchard+haskell at gmail.com> wrote: > Hello. > > I read a reddit post [0] which ends in a debate about haskell > performances. Someone gives a C implementation which runs in 15ms on > some dataset. I wanted to learn about mutable vector and ST and got > something in haskell which runs in 50ms. Code is here [1]. > > [0] > https://www.reddit.com/r/haskell/comments/4ojsn0/counting_inversions_haskell/ > [1] https://github.com/guibou/inversionsCount/blob/syntax/inversions.hs > > When I'm profiling the code, I'm surprised to see more than 50% of the > %alloc in function which, from my point of view, must not allocate. > > For example, this function : > > inc :: forall s. STRef s Int -> ST s () > inc v = modifySTRef' v (+1) > > Is responsible for 10% of the allocation in this program. I was hoping > that the "unboxing magic" of GHC may have replaced my Int somewhere by > an unboxed one, but I guess the allocation means that the STRef is > somehow pointing to a heap allocated Int. > > Do you know a way to remove theses allocations? > > As a second question, if you see any other way to improve this > implementation, I'll be happy to learn something new ;) > > Finally, if you read my code, you'll see that I implemented a small > DSL around ST / STRef / MVector to make my main function more > readable. How do people write readable code in real life ? > > Especially, I was annoyed when I tried to convert this piece of C code : > > if (x1 < mid && (x2 == sz || tmp[x1] <= p[x2])) { > a; > } else { > b; > } > > In my haskell code, x1, x2 are STRef, and tmp and p are MVector. This > was highly painful to write in haskell and I had to write something > such as: > > x1 <- readSTRef x1' > x2 <- readSTRef x2' > > cond <- if x1 < mid > then if x2 == sz > then return True > else do > tmp_x1 <- Vector.read tmp x1 > p_x2 <_ Vector.read p x2 > return (tmp_x1 <= p_x2) > else return False > if cond > then a > else b > > This is painful, complex and error prone, so is there another solution ? > > Thank you. > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > -------------- next part -------------- An HTML attachment was scrubbed... URL: From noonslists at gmail.com Sun Jun 19 02:10:32 2016 From: noonslists at gmail.com (Noon van der Silk) Date: Sun, 19 Jun 2016 12:10:32 +1000 Subject: [Haskell-cafe] Compose :: Conference, Melbourne, 2016, Call for Presentations! Message-ID: (Web version: http://www.composeconference.org/2016-melbourne/cfp/) # Call for Presentations Compose Melbourne - http://www.composeconference.org/ - is pleased to announce its call for presentations. Compose Melbourne is a new functional programming conference focused on developing the community and bringing typed functional programming to a wider audience. It is a 2-day event being held in Melbourne, Australia on the 29th and 30th of August 2016. The first day features a single track of presentations followed by a second day of workshops and an unconference. It is the new sister-conference of the NY based Compose Conference. Submit your presentation proposal here: https://easychair.org/conferences/?conf=cmc2016 # Important Dates - CFP Launch Party - 19th May - CFP Opens - 19th May - CFP Closes - June 30th - Notify Presenters - July 15th - Conference Day 1: Presentations - Monday, 29-Aug-2016 - Conference Day 2: Unconference - Tuesday, 30-Aug-2016 # Talk and Workshop Submission ## Day 1 - Presentations Submit a Presentation Proposal via Easy Chair: https://easychair.org/conferences/?conf=cmc2016. ## Day 2 - Unconference and Workshops Contact us (composemel-admin at googlegroups.com) with your workshop proposals. # Submission Guidelines Talk slots will be 30 minutes: 25 minute talk and 5 minutes for questions. Provide sufficient detail in your submission to enable the reviewers to understand your proposal and clearly identify what an attendee will gain from attending your session. You should include the following information in the submission system: - Authors - The details of each of the presenters - Title - Title of the presentation (please keep it brief and specific) - Abstract - A 300-500 word description of your presentation, ideally including... - Description of the content - Goal - Keywords - List any keywords that will help the program committee and attendees categorise your presentation. Also indicate the functional programming languages that you will be targeting. Nothing upsets an audience more than a speaker that stands on stage blatantly promoting his or her company, product or achievements. Please keep the content of your talk on-topic and do not use this speaking opportunity as a sales pitch. # Feel We want Compose Melbourne to be all about the community. We're aiming to help foster the growth of Functional Programming in Melbourne and unite all interested parties to spark a unified presence and a feeling of camaraderie amongst FP and Theory proponents in this wonderful city! # Audience Functional-Programming and Programming-Language-Theory professionals and enthusiasts. Newcomers, experts, anyone from other disciplines of fields who is interested in what FP is or how it could help them with their work, or simply make life more enjoyable! # Diversity Just like Compose-Conference, we would also like to put an emphasis on soliciting a diverse set of speakers - anything you can do to distribute information about this CFP and encourage submissions from under-represented groups would be greatly appreciated. We welcome *all* (new and established) contributions and encourage you to apply! # Day One All topics for proposals for presentations are invited, but not limited to explore the following topics: ## New Languages The development of new and emerging Functional Languages, and the toolsets around them. ## Libraries and Tools Exploring the use and development of new and underrepresented tools and libraries. ## Production Systems 2016 has seen many previously undeployed languages and systems break through into production. We're looking for war-stories, success-stories and sob-stories! ## Theory Theory is the cutting edge of new functional programming. Show the world what is rising over the horizon. ## Art and Music Exciting and innovative usage of functional programming language in the arts! # Day Two The second day will be dedicated to workshops and unconferences. ## Workshops We will be running a beginners Haskell workshop. If you wish to run a workshop on the second day of the conference, then please let us know. Alternatively, if there is a workshop that would interest you as an attendee, then please also let us know. ## Unconference Got something random you want to talk about? The unconference will run the second day. There will be a whiteboard with spaces where anyone can write their name down to speak. There's no need to bring anything but yourself and your ideas and speaking voice. # Sponsors We are seeking sponsors to support us in putting on this conference. If you or your company would like to sponsor us, please get in contact via composemel-admin at googlegroups.com. You can find our prospectus here: https://github.com/composeconference/Compose-Melbourne/blob/master/ComposeMelbourneSponsorshipProspectus.pdf . -- Compose Conference Melbourne Organising Committee http://www.composeconference.org/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From guillaum.bouchard+haskell at gmail.com Sun Jun 19 10:37:24 2016 From: guillaum.bouchard+haskell at gmail.com (Guillaume Bouchard) Date: Sun, 19 Jun 2016 12:37:24 +0200 Subject: [Haskell-cafe] ST Vector / STRef -- Performances and allocation In-Reply-To: References: Message-ID: Thank you for this answer. On Sun, Jun 19, 2016 at 1:08 AM, Amos Robinson wrote: > Hi, > You might want to add inline pragmas to "inc" and so on. > STRef is boxed, so it will allocate. The 'URef' type here might be useful: > http://hackage.haskell.org/package/mutable-containers-0.3.2.1/docs/Data-Mutable.html > It is just a wrapper around unboxed mutable vector, as Carter suggests. I added INLINE pragma on all my functions and it does not change anything unfortunately. I tried the package mutable-containers and the Api is really great, but I'm surprised by the results : - PRef (Unboxed bytearray of size 1, the closest thing to an unboxed stack allocation) : 86ms - URef (Unboxed vector of size 1) : 130ms - SRef (Storable vector of size 1) : 43ms (This is an improvement !) - BRef (Boxed ref) : 137ms - STRef : 54ms (this was my baseline) This is based on the creation of the Ref using a "mutable" function such as : mutable v = asF <$> newRef v (with asF == asPRef, asURef, ...) However, if I'm providing a type signature for mutable, I got totally different results : mutable :: forall (f :: * -> *) a. (Prim a, PrimMonad f) => a -> f (MyRef (PrimState f) a) mutable v = asF <$> newRef v (with type MyRef = PRef, URef, ...) - PRef: 39ms (huge improvement, and winner as expected) - URef: 45ms - SRef: 43ms - BRef: 84ms - STRef: 54ms I don't understand the speed difference which is only impacted by the availability of a signature for mutable. Now much of the allocation due to STRef have disappears. There is still some which annoys me. Most of the allocations comes from that line : https://github.com/guibou/inversionsCount/blob/syntax/inversions.hs#L35 Which is nothing more that a boolean expression between different ST action which are reading from unboxed Vector or PRef. So I was expecting without allocation. Perhaps the fact that it uses "high level" combinators such as "<$>", "<*>" and "=<<" is responsible ? > The sad story is that in my experience, if you really want decent > performance you will have to dump the Core and inspect it by hand. You'd > then add inline and bang patterns based on the Core. I do not recommend it > as a relaxing weekend exercise. I usually use an invocation something like: >> ghc -ddump-prep -dppr-case-as-let -dsuppress-all -fforce-recomp >> inversions.hs > inversions.hscore Thank you ;) For now I rather prefer reading intel x86 assembler than GHC core, but today is a rainy day, so I'll use it to start my understanding of the GHC core ;) -- G. From bertram.felgenhauer at googlemail.com Sun Jun 19 13:12:42 2016 From: bertram.felgenhauer at googlemail.com (Bertram Felgenhauer) Date: Sun, 19 Jun 2016 15:12:42 +0200 Subject: [Haskell-cafe] ST Vector / STRef -- Performances and allocation In-Reply-To: References: Message-ID: <20160619131242.GA25445@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> Guillaume Bouchard wrote: > - PRef (Unboxed bytearray of size 1, the closest thing to an unboxed > stack allocation) : 86ms > - URef (Unboxed vector of size 1) : 130ms > - SRef (Storable vector of size 1) : 43ms (This is an improvement !) > - BRef (Boxed ref) : 137ms > - STRef : 54ms (this was my baseline) You really shouldn't use any mutable variable at all for this, but pass the values around as function arguments instead: count_inv' :: V2.MVector s Int32 -> V2.MVector s Int32 -> ST s Int count_inv' a buf | V.length a <= 1 = return 0 | otherwise = do let len = V.length a mid = len `div` 2 counta <- count_inv' (V.slice 0 mid a) buf countb <- count_inv' (V.slice mid (len - mid) a) buf V.unsafeCopy (V.slice 0 mid buf) (V.slice 0 mid a) let go idx1 idx2 count i = if i == len then return count else do cond <- return (idx1 < mid) .&&. (return (idx2 == len) .||. (V.unsafeRead buf idx1 .<=. V.unsafeRead a idx2)) if cond then do V.unsafeRead buf idx1 >>= V.unsafeWrite a i go (idx1 + 1) idx2 (count + idx2 - mid) (i+1) else do V.unsafeRead a idx2 >>= V.unsafeWrite a i go idx1 (idx2 + 1) count (i+1) go 0 mid (counta + countb) (0 :: Int) Besides, the code spends most of its time on parsing the input. The following more low-level code does the job far more quickly: import Data.ByteString.Char8 as B parse' :: IO [Int32] parse' = do content <- B.getContents return $ map fromIntegral $ unfoldr (B.readInt . B.dropWhile (=='\n')) $ content It's possible to improve this slightly by implementing the code from scratch: parse'' :: IO [Int32] parse'' = do content <- B.getContents return $ go content where go b = case B.uncons b of Nothing -> [] Just ('\n',b) -> go b Just ('-',b) -> go'' 0 b Just (d,b) -> go' (fromIntegral (ord d - 48)) b go' v b = case B.uncons b of Nothing -> [v] Just ('\n',b) -> v : go b Just (d,b) -> go' (v*10 + fromIntegral (ord d - 48)) b go'' v b = case B.uncons b of Nothing -> [v] Just ('\n',b) -> v : go b Just (d,b) -> go' (v*10 - fromIntegral (ord d - 48)) b Taken together these changes improve the runtime from 79ms to 21ms here. Cheers, Bertram From bertram.felgenhauer at googlemail.com Sun Jun 19 13:44:07 2016 From: bertram.felgenhauer at googlemail.com (Bertram Felgenhauer) Date: Sun, 19 Jun 2016 15:44:07 +0200 Subject: [Haskell-cafe] ST Vector / STRef -- Performances and allocation In-Reply-To: <20160619131242.GA25445@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> References: <20160619131242.GA25445@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> Message-ID: <20160619134407.GB25445@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> Bertram Felgenhauer via Haskell-Cafe wrote: > Guillaume Bouchard wrote: > > - PRef (Unboxed bytearray of size 1, the closest thing to an unboxed > > stack allocation) : 86ms > > - URef (Unboxed vector of size 1) : 130ms > > - SRef (Storable vector of size 1) : 43ms (This is an improvement !) > > - BRef (Boxed ref) : 137ms > > - STRef : 54ms (this was my baseline) > > You really shouldn't use any mutable variable at all for this, but pass > the values around as function arguments instead [...] As to why, the reason is that to get good performance, these variables should end up in registers. But the mutable variables in Haskell are all heap-allocated objects, and afaik the compiler has no way of allocating them elsewhere (on the stack, or in a register). So the only way to get good code is to not use Haskell's mutable variables at all. All this is specific to ghc, obviously. Cheers, Bertram From nek0 at nek0.eu Sun Jun 19 13:48:10 2016 From: nek0 at nek0.eu (nek0) Date: Sun, 19 Jun 2016 15:48:10 +0200 Subject: [Haskell-cafe] Problem binding GEGL library Message-ID: <854a3f80-9e0b-47c2-13a5-0006883a0be9@nek0.eu> Hello fellow haskellers, I am currently working on Haskell bindings to the GEGL [0] library. Since it's my first time working with the FFI and the whole idea of binding a library into Haskell, I have now run into a problem I can't resolve myself. The GEGL headers expose a function "gegl_buffer_iterator_new" which returns an iterator over a selected area in a buffer. This iterator contains a float pointer with pixel data. My problem is to make the iterator and the data it contains accessible to Haskell and to iterate over it. Can someone of you please help me with this problem? One of my initial thoughts was to wrap it into a monad, but I am totally inexperienced with that. My project can be found on my Github profile [1]. Many thanks in advance, nek0 links: [0]: http://www.gegl.org/ [1]: https://github.com/nek0/gegl -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: OpenPGP digital signature URL: From guillaum.bouchard+haskell at gmail.com Sun Jun 19 14:10:53 2016 From: guillaum.bouchard+haskell at gmail.com (Guillaume Bouchard) Date: Sun, 19 Jun 2016 16:10:53 +0200 Subject: [Haskell-cafe] ST Vector / STRef -- Performances and allocation In-Reply-To: <20160619131242.GA25445@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> References: <20160619131242.GA25445@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> Message-ID: Thank you ! I'm now in an equal time with the C code ;) On Sun, Jun 19, 2016 at 3:12 PM, Bertram Felgenhauer via Haskell-Cafe wrote: > Guillaume Bouchard wrote: >> - PRef (Unboxed bytearray of size 1, the closest thing to an unboxed >> stack allocation) : 86ms >> - URef (Unboxed vector of size 1) : 130ms >> - SRef (Storable vector of size 1) : 43ms (This is an improvement !) >> - BRef (Boxed ref) : 137ms >> - STRef : 54ms (this was my baseline) > > You really shouldn't use any mutable variable at all for this, but pass > the values around as function arguments instead: Nice ! This is so obvious that I did not thought about it. Thank you. (Thank you for the followup-mail, it is clear that it may be easier for GHC to unbox / put in register "normal variable" than more complex type such as the one involved in PRef). > Besides, the code spends most of its time on parsing the input. The > following more low-level code does the job far more quickly: Impressive. On the profiling the parsing was accounting only for 10% of the running time. Perhaps the profiler introduces more overhead on the vector part than on the parsing. > import Data.ByteString.Char8 as B > > parse' :: IO [Int32] > parse' = do > content <- B.getContents > return $ map fromIntegral $ unfoldr (B.readInt . B.dropWhile (=='\n')) $ content This is in part with the C code. ~16ms > It's possible to improve this slightly by implementing the code from scratch: > > parse'' :: IO [Int32] > parse'' = do > content <- B.getContents > return $ go content > where > go b = case B.uncons b of > Nothing -> [] > Just ('\n',b) -> go b > Just ('-',b) -> go'' 0 b > Just (d,b) -> go' (fromIntegral (ord d - 48)) b > go' v b = case B.uncons b of > Nothing -> [v] > Just ('\n',b) -> v : go b > Just (d,b) -> go' (v*10 + fromIntegral (ord d - 48)) b > go'' v b = case B.uncons b of > Nothing -> [v] > Just ('\n',b) -> v : go b > Just (d,b) -> go' (v*10 - fromIntegral (ord d - 48)) b > > Taken together these changes improve the runtime from 79ms to 21ms here. This is better than the C code ;) Thank you. I learned a few thing today. -- Guillaume From bertram.felgenhauer at googlemail.com Sun Jun 19 15:35:58 2016 From: bertram.felgenhauer at googlemail.com (Bertram Felgenhauer) Date: Sun, 19 Jun 2016 17:35:58 +0200 Subject: [Haskell-cafe] ST Vector / STRef -- Performances and allocation In-Reply-To: References: <20160619131242.GA25445@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> Message-ID: <20160619153051.GC25445@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> Guillaume Bouchard wrote: > Thank you ! I'm now in an equal time with the C code ;) > > On Sun, Jun 19, 2016 at 3:12 PM, Bertram Felgenhauer via Haskell-Cafe > wrote: > > Guillaume Bouchard wrote: > >> - PRef (Unboxed bytearray of size 1, the closest thing to an unboxed > >> stack allocation) : 86ms > >> - URef (Unboxed vector of size 1) : 130ms > >> - SRef (Storable vector of size 1) : 43ms (This is an improvement !) > >> - BRef (Boxed ref) : 137ms > >> - STRef : 54ms (this was my baseline) > > > > You really shouldn't use any mutable variable at all for this, but pass > > the values around as function arguments instead: > > Nice ! This is so obvious that I did not thought about it. Thank you. > (Thank you for the followup-mail, it is clear that it may be easier > for GHC to unbox / put in register "normal variable" than more complex > type such as the one involved in PRef). I'd say that the complexity of the type isn't the main obstacle here, but mutability. The point is that when a value is unboxed, one essentially creates a copy of it (on the stack, and possibly on the heap if one ends up re-boxing the value later on). For ordinary Haskell values that is not a problem; they are immutable and a copy is identical, for all purposes, to the original. The only potential downside to unboxing is that some memory may be wasted. With mutable data, however, copies cannot track updates to the original, so unboxing is no longer safe unconditionally. It still could be done if the mutable structure is never shared, but it requires a precise non-sharing analysis. I suspect that this kind of analysis does not (yet?) exist in ghc, because it would not benefit pure code. Cheers, Bertram From tanuki at gmail.com Sun Jun 19 21:38:42 2016 From: tanuki at gmail.com (Theodore Lief Gannon) Date: Sun, 19 Jun 2016 14:38:42 -0700 Subject: [Haskell-cafe] Problem binding GEGL library In-Reply-To: <854a3f80-9e0b-47c2-13a5-0006883a0be9@nek0.eu> References: <854a3f80-9e0b-47c2-13a5-0006883a0be9@nek0.eu> Message-ID: I have no experience with the FFI, but conceptually that sounds like a Traversable, not necessarily a Monad. I'd start small, with the simplest superclass, Functor -- so, implement fmap, then move on from there. On Jun 19, 2016 6:48 AM, "nek0" wrote: > Hello fellow haskellers, > > I am currently working on Haskell bindings to the GEGL [0] library. > Since it's my first time working with the FFI and the whole idea of > binding a library into Haskell, I have now run into a problem I can't > resolve myself. > The GEGL headers expose a function "gegl_buffer_iterator_new" which > returns an iterator over a selected area in a buffer. This iterator > contains a float pointer with pixel data. My problem is to make the > iterator and the data it contains accessible to Haskell and to iterate > over it. > Can someone of you please help me with this problem? One of my initial > thoughts was to wrap it into a monad, but I am totally inexperienced > with that. > My project can be found on my Github profile [1]. > > Many thanks in advance, > > nek0 > > links: > > [0]: http://www.gegl.org/ > [1]: https://github.com/nek0/gegl > > > _______________________________________________ > 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 dsf at seereason.com Sun Jun 19 23:01:01 2016 From: dsf at seereason.com (David Fox) Date: Sun, 19 Jun 2016 16:01:01 -0700 Subject: [Haskell-cafe] How to avoid expensive and unnecessary type conversions? Message-ID: Suppose you have a class ListLike (which you do have, actually) and it has methods for operations on types that are like lists, and in particular it has a method fromListLike which converts any ListLike value to any other: fromListLike :: ListLike full' item => full' -> full the default implementation of this is simply fromListLike = fromList . toList but this means that if you happen to apply fromListLike to a value which is already the desired type, two unnecessary and possibly expensive conversions take place. My question is, how can one write code that implements fromListLike in such a way that when the two type parameters are the same type it just uses fromListLike = id I've thought about using a class Convert a b class and writing an instance for every pair of ListLike instances. I haven't convinced myself this would work, and if it does it means that adding a new instance involves writing a bunch of Convert instances. Maybe one could somehow have a default implementation (fromList . toList) but then you run into overlapping instances. Anyone have better ideas about any of this? Hopefully I'm missing something dead simple... -------------- next part -------------- An HTML attachment was scrubbed... URL: From ezyang at mit.edu Sun Jun 19 23:23:27 2016 From: ezyang at mit.edu (Edward Z. Yang) Date: Sun, 19 Jun 2016 16:23:27 -0700 Subject: [Haskell-cafe] How to avoid expensive and unnecessary type conversions? In-Reply-To: References: Message-ID: <1466378572-sup-4573@sabre> A RULE could work. Assuming fromListLike is inlined, a rule can detect when (fromList . toList :: a -> a) and then replace it with id. edward Excerpts from David Fox's message of 2016-06-19 16:01:01 -0700: > Suppose you have a class ListLike (which you do have, actually) and it has > methods for operations on types that are like lists, and in particular it > has a method fromListLike which converts any ListLike value to any other: > > fromListLike :: ListLike full' item => full' -> full > > the default implementation of this is simply > > fromListLike = fromList . toList > > but this means that if you happen to apply fromListLike to a value which is > already the desired type, two unnecessary and possibly expensive > conversions take place. My question is, how can one write code that > implements fromListLike in such a way that when the two type parameters are > the same type it just uses > > fromListLike = id > > I've thought about using a class Convert a b class and writing an instance > for every pair of ListLike instances. I haven't convinced myself this > would work, and if it does it means that adding a new instance involves > writing a bunch of Convert instances. Maybe one could somehow have a > default implementation (fromList . toList) but then you run into > overlapping instances. Anyone have better ideas about any of this? > Hopefully I'm missing something dead simple... From monnier at iro.umontreal.ca Mon Jun 20 02:31:09 2016 From: monnier at iro.umontreal.ca (Stefan Monnier) Date: Sun, 19 Jun 2016 22:31:09 -0400 Subject: [Haskell-cafe] ST Vector / STRef -- Performances and allocation References: <20160619131242.GA25445@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> <20160619153051.GC25445@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> Message-ID: > unconditionally. It still could be done if the mutable structure is > never shared, but it requires a precise non-sharing analysis. I suspect > that this kind of analysis does not (yet?) exist in ghc, because it > would not benefit pure code. Since these mutable boxes seem to mimick plain C variables, it's indeed better to map them to immutable Haskell variables. After all, that's exactly what the C compiler will do via SSA. GHC could try to do the same with Refs, but it would only be beneficial on "C-style Haskell code": usually when Refs are used, it's precisely because SSA doesn't work for that variable, such as when the equivalent C code would use & on it. Stefan From martin.drautzburg at web.de Mon Jun 20 10:42:52 2016 From: martin.drautzburg at web.de (martin) Date: Mon, 20 Jun 2016 12:42:52 +0200 Subject: [Haskell-cafe] Resumable applicative parsing from tail end? Message-ID: <5767C8AC.4070106@web.de> Hello all, in my attempt to write a simulation program, I am facing the following problem: as the simulation progresses, I collect "primary" log entries, each one associated with a timestamp. These entries carry the information I am interested in (and not so much the final state). Currently I am using a simple list to collect log entries. Since (:) is so much easier than (++) I prepend new entries to the head of the list. So my log runs backwards in time with the oldest entries at the tail end. Because the log-entries are typically too fine-grained to be useful, I want to aggregate several of them into a single log entry in a secondary log. I want to do this "as I go" and discard primary log entries which are already aggregated. Thus I can keep the primary log reasonably small. I thought that aggregation is just a special case of parsing. And indeed, I could write an applicative parser PrimaryLog -> (PrimaryLog, SecondaryLog) which does the trick, except I had to reverse the ordering of the primary log. This is because the parser/aggregator must parse from past to future, because there may be new log entries coming up in the future. I need to be able to resume parsing where I left off whenever new primary log entries are entered, becuase I may then have just enough unconsumed primary log entries to create another secondary entry. Currently I'm trying Data.Sequence to let the primary log grow to the left and let parsing to begin at the far-right. But I have a bad feeling about it. Particularly, I don't have any hard reasons why a simple List wouldn't be sufficient. But I just wasn't able to write the code. What do you think? How would you parse a list from the tail end? Or how else would you deal with this problem? From dsf at seereason.com Mon Jun 20 13:04:09 2016 From: dsf at seereason.com (David Fox) Date: Mon, 20 Jun 2016 06:04:09 -0700 Subject: [Haskell-cafe] How to avoid expensive and unnecessary type conversions? In-Reply-To: <1466378572-sup-4573@sabre> References: <1466378572-sup-4573@sabre> Message-ID: Wow, I had no idea that existed! On Sun, Jun 19, 2016 at 4:23 PM, Edward Z. Yang wrote: > A RULE could work. Assuming fromListLike is inlined, a rule can > detect when (fromList . toList :: a -> a) and then replace it with id. > > edward > > Excerpts from David Fox's message of 2016-06-19 16:01:01 -0700: > > Suppose you have a class ListLike (which you do have, actually) and it > has > > methods for operations on types that are like lists, and in particular it > > has a method fromListLike which converts any ListLike value to any other: > > > > fromListLike :: ListLike full' item => full' -> full > > > > the default implementation of this is simply > > > > fromListLike = fromList . toList > > > > but this means that if you happen to apply fromListLike to a value which > is > > already the desired type, two unnecessary and possibly expensive > > conversions take place. My question is, how can one write code that > > implements fromListLike in such a way that when the two type parameters > are > > the same type it just uses > > > > fromListLike = id > > > > I've thought about using a class Convert a b class and writing an > instance > > for every pair of ListLike instances. I haven't convinced myself this > > would work, and if it does it means that adding a new instance involves > > writing a bunch of Convert instances. Maybe one could somehow have a > > default implementation (fromList . toList) but then you run into > > overlapping instances. Anyone have better ideas about any of this? > > Hopefully I'm missing something dead simple... > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Mon Jun 20 15:03:56 2016 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Mon, 20 Jun 2016 16:03:56 +0100 Subject: [Haskell-cafe] Source code location in IO? Message-ID: <20160620150356.GB16525@weber> Is it compatible with the semantics of Haskell to have a function sourceLocation :: IO String which when run returns the source file location at which it is used? For example, suppose Main.hs is module Main where main = do putStrLn =<< sourceLocation putStrLn "Hello" putStrLn =<< sourceLocation It would print the following when run Main.hs:4 Hello Main.hs:6 and module Main where main = do let s = sourceLocation putStrLn =<< s putStrLn "Hello" putStrLn =<< s It would print the following when run Main.hs:4 Hello Main.hs:4 If this is not compatible with the semantics of Haskell, why not? I agree that the two programs must have the same denotation, but is there anything that requires them to have the same output when run? Tom From hesselink at gmail.com Mon Jun 20 15:14:45 2016 From: hesselink at gmail.com (Erik Hesselink) Date: Mon, 20 Jun 2016 17:14:45 +0200 Subject: [Haskell-cafe] Source code location in IO? In-Reply-To: <20160620150356.GB16525@weber> References: <20160620150356.GB16525@weber> Message-ID: It feels weird to me that this program transformation produces different output, and I can't seem to think of another IO action that behaves this way. Essentially, you'd want `IO a` to have different semantics from other `a`s, in that let binding it changes what it does. However, you can do this with the `qLocation` Template Haskell function in Language.Haskell.TH.Syntax. Does that help? Erik On 20 June 2016 at 17:03, Tom Ellis wrote: > Is it compatible with the semantics of Haskell to have a function > > sourceLocation :: IO String > > which when run returns the source file location at which it is used? For > example, suppose Main.hs is > > module Main where > > main = do > putStrLn =<< sourceLocation > putStrLn "Hello" > putStrLn =<< sourceLocation > > It would print the following when run > > Main.hs:4 > Hello > Main.hs:6 > > and > > module Main where > > main = do > let s = sourceLocation > putStrLn =<< s > putStrLn "Hello" > putStrLn =<< s > > It would print the following when run > > Main.hs:4 > Hello > Main.hs:4 > > If this is not compatible with the semantics of Haskell, why not? I agree > that the two programs must have the same denotation, but is there anything > that requires them to have the same output when run? > > 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 tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Mon Jun 20 15:20:48 2016 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Mon, 20 Jun 2016 16:20:48 +0100 Subject: [Haskell-cafe] Source code location in IO? In-Reply-To: References: <20160620150356.GB16525@weber> Message-ID: <20160620152048.GC16525@weber> On Mon, Jun 20, 2016 at 05:14:45PM +0200, Erik Hesselink wrote: > It feels weird to me that this program transformation produces > different output, and I can't seem to think of another IO action that > behaves this way. Essentially, you'd want `IO a` to have different > semantics from other `a`s, in that let binding it changes what it > does. It's definitely weird, but it seems consistent with some behaviour we see around lazy IO, Cf these threads https://mail.haskell.org/pipermail/haskell/2009-March/021064.html https://mail.haskell.org/pipermail/haskell/2009-March/021071.html > However, you can do this with the `qLocation` Template Haskell > function in Language.Haskell.TH.Syntax. Does that help? I meant it more as a sort of theoretical question. > On 20 June 2016 at 17:03, Tom Ellis > wrote: > > Is it compatible with the semantics of Haskell to have a function > > > > sourceLocation :: IO String > > > > which when run returns the source file location at which it is used? For > > example, suppose Main.hs is > > > > module Main where > > > > main = do > > putStrLn =<< sourceLocation > > putStrLn "Hello" > > putStrLn =<< sourceLocation > > > > It would print the following when run > > > > Main.hs:4 > > Hello > > Main.hs:6 > > > > and > > > > module Main where > > > > main = do > > let s = sourceLocation > > putStrLn =<< s > > putStrLn "Hello" > > putStrLn =<< s > > > > It would print the following when run > > > > Main.hs:4 > > Hello > > Main.hs:4 > > > > If this is not compatible with the semantics of Haskell, why not? I agree > > that the two programs must have the same denotation, but is there anything > > that requires them to have the same output when run? From aeyakovenko at gmail.com Mon Jun 20 18:14:00 2016 From: aeyakovenko at gmail.com (Anatoly Yakovenko) Date: Mon, 20 Jun 2016 18:14:00 +0000 Subject: [Haskell-cafe] Source code location in IO? In-Reply-To: <20160620152048.GC16525@weber> References: <20160620150356.GB16525@weber> <20160620152048.GC16525@weber> Message-ID: Source location is typically a preprocessor macro. So it could have the same semantics as a pure Template Haskell function. On Mon, Jun 20, 2016 at 10:20 AM Tom Ellis < tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk> wrote: > On Mon, Jun 20, 2016 at 05:14:45PM +0200, Erik Hesselink wrote: > > It feels weird to me that this program transformation produces > > different output, and I can't seem to think of another IO action that > > behaves this way. Essentially, you'd want `IO a` to have different > > semantics from other `a`s, in that let binding it changes what it > > does. > > It's definitely weird, but it seems consistent with some behaviour we see > around lazy IO, Cf these threads > > https://mail.haskell.org/pipermail/haskell/2009-March/021064.html > https://mail.haskell.org/pipermail/haskell/2009-March/021071.html > > > However, you can do this with the `qLocation` Template Haskell > > function in Language.Haskell.TH.Syntax. Does that help? > > I meant it more as a sort of theoretical question. > > > On 20 June 2016 at 17:03, Tom Ellis > > wrote: > > > Is it compatible with the semantics of Haskell to have a function > > > > > > sourceLocation :: IO String > > > > > > which when run returns the source file location at which it is used? > For > > > example, suppose Main.hs is > > > > > > module Main where > > > > > > main = do > > > putStrLn =<< sourceLocation > > > putStrLn "Hello" > > > putStrLn =<< sourceLocation > > > > > > It would print the following when run > > > > > > Main.hs:4 > > > Hello > > > Main.hs:6 > > > > > > and > > > > > > module Main where > > > > > > main = do > > > let s = sourceLocation > > > putStrLn =<< s > > > putStrLn "Hello" > > > putStrLn =<< s > > > > > > It would print the following when run > > > > > > Main.hs:4 > > > Hello > > > Main.hs:4 > > > > > > If this is not compatible with the semantics of Haskell, why not? I > agree > > > that the two programs must have the same denotation, but is there > anything > > > that requires them to have the same output when run? > _______________________________________________ > 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 gtener at gmail.com Mon Jun 20 18:20:22 2016 From: gtener at gmail.com (=?UTF-8?Q?Krzysztof_Skrz=C4=99tnicki?=) Date: Mon, 20 Jun 2016 20:20:22 +0200 Subject: [Haskell-cafe] AFL + Haskell Message-ID: Hello, There was an interesting post today [1] on Hacker News about fuzzing Rust with american-fuzzy-lop (AFL). Interestingly the AFL instrumentation gets applied as LLVM pass. I started to wonder if it would be possible to do the same with Haskell binaries? I know there are plenty of tools designed specifically for Haskell but still it might be interesting to see how AFL performs in this setting. Cheers, Krzysztof Skrzętnicki [1] https://news.ycombinator.com/item?id=11936983 -------------- next part -------------- An HTML attachment was scrubbed... URL: From qdunkan at gmail.com Mon Jun 20 20:15:19 2016 From: qdunkan at gmail.com (Evan Laforge) Date: Mon, 20 Jun 2016 13:15:19 -0700 Subject: [Haskell-cafe] Source code location in IO? In-Reply-To: <20160620150356.GB16525@weber> References: <20160620150356.GB16525@weber> Message-ID: If it's a practical question, rather than a theoretical one, I use this: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#hascallstack On Mon, Jun 20, 2016 at 8:03 AM, Tom Ellis wrote: > Is it compatible with the semantics of Haskell to have a function > > sourceLocation :: IO String > > which when run returns the source file location at which it is used? For > example, suppose Main.hs is > > module Main where > > main = do > putStrLn =<< sourceLocation > putStrLn "Hello" > putStrLn =<< sourceLocation > > It would print the following when run > > Main.hs:4 > Hello > Main.hs:6 > > and > > module Main where > > main = do > let s = sourceLocation > putStrLn =<< s > putStrLn "Hello" > putStrLn =<< s > > It would print the following when run > > Main.hs:4 > Hello > Main.hs:4 > > If this is not compatible with the semantics of Haskell, why not? I agree > that the two programs must have the same denotation, but is there anything > that requires them to have the same output when run? > > 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 michael at schmong.org Mon Jun 20 21:52:32 2016 From: michael at schmong.org (Michael Litchard) Date: Mon, 20 Jun 2016 14:52:32 -0700 Subject: [Haskell-cafe] Where am I going wrong with my bounding box function? Message-ID: I am writing a bounding box module for the octree library. You can find my branch here . In the function below, I try to make explicit the implicit bounding boxes of an Octree. The problem is, not all bounding boxes are valid. This is the function in question, followed by a way to replicate the problem in ghci. explicateMBB :: (BBox3, Octree a) -> [BBox3] explicateMBB (mbb, (Leaf _)) = [mbb] explicateMBB (mbb, (Node { split = split', nwu = nwu', nwd = nwd', neu = neu', ned = ned', swu = swu', swd = swd', seu = seu', sed = sed' })) = mbb:concatMap explicateMBB octList where octList = zip boxList children boxList = [swdBox, sedBox, nwdBox, nedBox, swuBox, seuBox, nwuBox, neuBox] children = [swd',sed',nwd',ned',swu',seu',nwu',neu'] swdBox = bound_corners swdCorner neuCorner where swdCorner = Vector3 (minX mbb) (minY mbb) (minZ mbb) neuCorner = Vector3 (v3x split') (v3y split') (v3z split') sedBox = bound_corners swdCorner neuCorner where swdCorner = Vector3 (v3x split') (minY mbb) (minZ mbb) neuCorner = Vector3 (maxX mbb) (v3y split') (minZ mbb) nwdBox = bound_corners swdCorner neuCorner where swdCorner = Vector3 (minX mbb) (v3y split') (minZ mbb) neuCorner = Vector3 (v3x split') (maxY mbb) (v3z split') nedBox = bound_corners swdCorner neuCorner where swdCorner = Vector3 (v3x split') (v3y split') (minZ mbb) neuCorner = Vector3 (maxX mbb) (maxY mbb) (v3z split') swuBox = bound_corners swdCorner neuCorner where swdCorner = Vector3 (minX mbb) (minY mbb) (v3z split') neuCorner = Vector3 (v3x split') (v3y split') (maxZ mbb) seuBox = bound_corners swdCorner neuCorner where swdCorner = Vector3 (v3x split') (minY mbb) (v3z split') neuCorner = Vector3 (maxX mbb) (v3y split') (maxZ mbb) nwuBox = bound_corners swdCorner neuCorner where swdCorner = Vector3 (minX mbb) (v3y split') (v3z split') neuCorner = Vector3 (v3x split') (maxY mbb) (maxZ mbb) neuBox = bound_corners swdCorner neuCorner where swdCorner = Vector3 (v3x split') (v3y split') (v3z split') neuCorner = Vector3 (maxX mbb) (maxY mbb) (maxZ mbb) To replicate problem: git clone https://github.com/mlitchard/octree.git git checkout MBB stack ghci In ghci, do the following : :m + Data.List Data.Vector.Class System.Random System.Random.Shuffle Data.BoundingBox.B3 let infinity = (read "Infinity") :: Double let swdCorner = Vector3 (-infinity) (-infinity) (-infinity) let neuCorner = Vector3 (infinity) (infinity) (infinity) let rbb = bound_corners swdCorner neuCorner xGen <- getStdGen yGen <- newStdGen zGen <- newStdGen let xPoints = shuffle' [-256 .. 256] 513 xGen let yPoints = shuffle' [-256 .. 256] 513 yGen let zPoints = shuffle' [-256 .. 256] 513 zGen let xPoints' = map fromInteger xPoints :: [Double] let yPoints' = map fromInteger yPoints :: [Double] let zPoints' = map fromInteger zPoints :: [Double] let tup513 = zip3 xPoints' yPoints' zPoints' let construct_vect = (\(x,y,z) -> Vector3 x y z) let vect513 = map construct_vect tup513 let pre_oct513 = zip vect513 [1 .. 513] let octree513 = fromList pre_oct513 length $ filter (== False) $ map isValidMBB $ explicateMBB (rbb,octree513) The answer will be 9, but should be 0. I feel like one of the fooBox where clauses is wrong, but I have gone over each one several times, and I am not seeing which one it is. If you needed a visual aid like I did, I found this pic to be helpful. My sample does 2 subdivisions. Any insight into what is going wrong would be appreciated. -------------- next part -------------- An HTML attachment was scrubbed... URL: From schernichkin at gmail.com Mon Jun 20 23:37:24 2016 From: schernichkin at gmail.com (=?UTF-8?B?0KHRgtCw0L3QuNGB0LvQsNCyINCn0LXRgNC90LjRh9C60LjQvQ==?=) Date: Tue, 21 Jun 2016 02:37:24 +0300 Subject: [Haskell-cafe] Easy type-level math Message-ID: With DataKinds and TypeOperators and GHC.TypeLits and, probably, KindSignatures I have: test :: (KnownNat i, KnownNat (i + 4)) => MyType i ((i + 4) + 4) and it's typecheck perfectly. But what I really want to have is: test :: (KnownNat i) => MyType i (i +8) and it does not typecheck. Does not ((i + 4) + 4) == (i +8)? Does not (KnownNat i) implies (KnownNat (i + 4))? Did I miss something about Haskell? -- Thanks, Stanislav Chernichkin. -------------- next part -------------- An HTML attachment was scrubbed... URL: From lanablack at amok.cc Tue Jun 21 00:12:19 2016 From: lanablack at amok.cc (Lana Black) Date: Tue, 21 Jun 2016 00:12:19 +0000 Subject: [Haskell-cafe] Easy type-level math In-Reply-To: References: Message-ID: <20160621001219.4378706.87956.3999@amok.cc> An HTML attachment was scrubbed... URL: From Lennart.Augustsson at sc.com Tue Jun 21 01:45:13 2016 From: Lennart.Augustsson at sc.com (Augustsson, Lennart) Date: Tue, 21 Jun 2016 01:45:13 +0000 Subject: [Haskell-cafe] Source code location in IO? In-Reply-To: <20160620150356.GB16525@weber> References: <20160620150356.GB16525@weber> Message-ID: <22B950C955F8AB4196E72698FBD00002D03349D2@UKWPISXMB01B.zone1.scb.net> It's totally compatible with Haskell semantics, since Haskell does not give any semantics to IO. Anything can happen when you do IO. But it's still a bit weird. :) -----Original Message----- From: Haskell-Cafe [mailto:haskell-cafe-bounces at haskell.org] On Behalf Of Tom Ellis Sent: 20 June 2016 16:04 To: haskell-cafe at haskell.org Subject: [Haskell-cafe] Source code location in IO? Is it compatible with the semantics of Haskell to have a function sourceLocation :: IO String which when run returns the source file location at which it is used? For example, suppose Main.hs is module Main where main = do putStrLn =<< sourceLocation putStrLn "Hello" putStrLn =<< sourceLocation It would print the following when run Main.hs:4 Hello Main.hs:6 and module Main where main = do let s = sourceLocation putStrLn =<< s putStrLn "Hello" putStrLn =<< s It would print the following when run Main.hs:4 Hello Main.hs:4 If this is not compatible with the semantics of Haskell, why not? I agree that the two programs must have the same denotation, but is there anything that requires them to have the same output when run? 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. This email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please delete all copies and notify the sender immediately. You may wish to refer to the incorporation details of Standard Chartered PLC, Standard Chartered Bank and their subsidiaries at http://www.standardchartered.com/en/incorporation-details.html Insofar as this communication contains any market commentary, the market commentary has been prepared by sales and/or trading desk of Standard Chartered Bank or its affiliate. It is not and does not constitute research material, independent research, recommendation or financial advice. Any market commentary is for information purpose only and shall not be relied for any other purpose, and is subject to the relevant disclaimers available at http://wholesalebanking.standardchartered.com/en/utility/Pages/d-mkt.aspx Insofar as this e-mail contains the term sheet for a proposed transaction, by responding affirmatively to this e-mail, you agree that you have understood the terms and conditions in the attached term sheet and evaluated the merits and risks of the transaction. We may at times also request you to sign on the term sheet to acknowledge in respect of the same. Please visit http://wholesalebanking.standardchartered.com/en/capabilities/financialmarkets/Pages/doddfrankdisclosures.aspx for important information with respect to derivative products. From ch.howard at zoho.com Tue Jun 21 06:12:54 2016 From: ch.howard at zoho.com (Christopher Howard) Date: Mon, 20 Jun 2016 22:12:54 -0800 Subject: [Haskell-cafe] Help with triple stack monad Message-ID: <5768DAE6.6000907@zoho.com> Hi, I was expanding on my earlier learning, to try a triple monad stack: {-# LANGUAGE GeneralizedNewtypeDeriving #-} <...snip...> import System.Random import Control.Monad.Random import Control.Monad.State.Lazy import Control.Monad.Reader newtype ReaderStateRandom r s g a = RSR { rSR :: ReaderT r (StateT s (Rand g)) a } deriving (Monad, MonadReader r, MonadState s) However, it seems that I must implement MonadRandom myself, as there is no instance for this sort of arrangement already. Probably this is trivial, but I'm having trouble wrapping my mind around how to do it. Would anybody perhaps assist me in implementing one function, to help guide me in the correct direction? instance MonadRandom (ReaderStateRandom r s g) where getRandom = ...? -- http://justonemoremathproblem.com To protect my privacy, please use PGP encryption. It's free and easy to use! My public key ID is 0x340EA95A (pgp.mit.edu). From will.yager at gmail.com Tue Jun 21 07:00:05 2016 From: will.yager at gmail.com (William Yager) Date: Tue, 21 Jun 2016 00:00:05 -0700 Subject: [Haskell-cafe] Help with triple stack monad In-Reply-To: <5768DAE6.6000907@zoho.com> References: <5768DAE6.6000907@zoho.com> Message-ID: Just manually unrolling the definitions for ReaterT and StateT, I think this is correct. instance RandomGen g => MonadRandom (ReaderStateRandom r s g) where getRandom = RSR (ReaderT (\r -> StateT (\s -> getRandom >>= (\random -> return (random,s))))) Or, using TupleSelections, RSR (ReaderT (\r -> StateT (\s -> (,s) <$> getRandom))) You could also write this out in terms of execReaderT, execStateT, etc. but I couldn't be arsed. You also have to add Applicative and Functor instances to RSR. Cheers, Will On Mon, Jun 20, 2016 at 11:12 PM, Christopher Howard wrote: > Hi, I was expanding on my earlier learning, to try a triple monad stack: > > {-# LANGUAGE GeneralizedNewtypeDeriving #-} > > <...snip...> > > import System.Random > import Control.Monad.Random > import Control.Monad.State.Lazy > import Control.Monad.Reader > > newtype ReaderStateRandom r s g a = RSR { > rSR :: ReaderT r (StateT s (Rand g)) a > } deriving (Monad, MonadReader r, MonadState s) > > However, it seems that I must implement MonadRandom myself, as there is > no instance for this sort of arrangement already. Probably this is > trivial, but I'm having trouble wrapping my mind around how to do it. > Would anybody perhaps assist me in implementing one function, to help > guide me in the correct direction? > > instance MonadRandom (ReaderStateRandom r s g) where > > getRandom = ...? > > > -- > http://justonemoremathproblem.com > To protect my privacy, please use PGP encryption. It's free and easy > to use! My public key ID is 0x340EA95A (pgp.mit.edu). > > _______________________________________________ > 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 lambda.fairy at gmail.com Tue Jun 21 09:57:57 2016 From: lambda.fairy at gmail.com (Chris Wong) Date: Tue, 21 Jun 2016 21:57:57 +1200 Subject: [Haskell-cafe] Help with triple stack monad In-Reply-To: <5768DAE6.6000907@zoho.com> References: <5768DAE6.6000907@zoho.com> Message-ID: Since the monad type `m` only appears to the right of the arrow, we can write the instance using `lift`: instance RandomGen g => MonadRandom (ReaderStateRandom r s g) where getRandom = RSR . lift . lift $ getRandom On Tue, Jun 21, 2016 at 6:12 PM, Christopher Howard wrote: > Hi, I was expanding on my earlier learning, to try a triple monad stack: > > {-# LANGUAGE GeneralizedNewtypeDeriving #-} > > <...snip...> > > import System.Random > import Control.Monad.Random > import Control.Monad.State.Lazy > import Control.Monad.Reader > > newtype ReaderStateRandom r s g a = RSR { > rSR :: ReaderT r (StateT s (Rand g)) a > } deriving (Monad, MonadReader r, MonadState s) > > However, it seems that I must implement MonadRandom myself, as there is > no instance for this sort of arrangement already. Probably this is > trivial, but I'm having trouble wrapping my mind around how to do it. > Would anybody perhaps assist me in implementing one function, to help > guide me in the correct direction? > > instance MonadRandom (ReaderStateRandom r s g) where > > getRandom = ...? > > > -- > http://justonemoremathproblem.com > To protect my privacy, please use PGP encryption. It's free and easy > to use! My public key ID is 0x340EA95A (pgp.mit.edu). > > _______________________________________________ > 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 Graham.Hutton at nottingham.ac.uk Tue Jun 21 14:05:06 2016 From: Graham.Hutton at nottingham.ac.uk (Graham Hutton) Date: Tue, 21 Jun 2016 14:05:06 +0000 Subject: [Haskell-cafe] Programming in Haskell - 2nd Edition Message-ID: <2EA1E0C9-B47E-4B0F-8FB5-03613C06B3E7@exmail.nottingham.ac.uk> Dear all, I'm delighted to announce that the 2nd edition of Programming in Haskell will be published in August 2016! The new edition has been extensively updated and expanded to include recent and more advanced features of Haskell, new examples and exercises, selected solutions, and freely downloadable lecture slides and example code. Further details, including how to preorder and obtain inspection copies, are provided below. Best wishes, Graham ================================================================= *** BOOK ANNOUNCEMENT *** Programming in Haskell - 2nd Edition Graham Hutton, University of Nottingham Cambridge University Press, August 2016 320 pages, 120 exercises, ISBN 9781316626221 http://tinyurl.com/PIH-2e ================================================================= DESCRIPTION: Haskell is a purely functional language that allows programmers to rapidly develop clear, concise, and correct software. The language has grown in popularity in recent years, both in teaching and in industry. This book is based on the author's experience of teaching Haskell for more than twenty years. All concepts are explained from first principles and no programming experience is required, making this book accessible to a broad spectrum of readers. While Part I focuses on basic concepts, Part II introduces the reader to more advanced topics. This new edition has been extensively updated and expanded to include recent and more advanced features of Haskell, new examples and exercises, selected solutions, and freely downloadable lecture slides and example code. The presentation is clean and simple, while also being fully compliant with the latest version of the language, including recent changes concerning applicative, monadic, foldable, and traversable types. ================================================================= CONTENTS: Foreword Preface Part I. Basic Concepts: 1. Introduction 2. First steps 3. Types and classes 4. Defining functions 5. List comprehensions 6. Recursive functions 7. Higher-order functions 8. Declaring types and classes 9. The countdown problem Part II. Going Further: 10. Interactive programming 11. Unbeatable tic-tac-toe 12. Monads and more 13. Monadic parsing 14. Foldables and friends 15. Lazy evaluation 16. Reasoning about programs 17. Calculating compilers Appendix A. Selected solutions Appendix B. Standard prelude Bibliography Index ================================================================= AUTHOR: Graham Hutton is Professor of Computer Science at the University of Nottingham. He has taught Haskell to thousands of students and received numerous best lecturer awards. Hutton has served as an editor of the Journal of Functional Programming, Chair of the Haskell Symposium and the International Conference on Functional Programming, and Vice-Chair of the ACM Special Interest Group on Programming Languages, and he is an ACM Distinguished Scientist. ================================================================= FURTHER DETAILS: The following web page includes details for how the book can be preordered, and how lecturers can obtain inspection copies: http://tinyurl.com/PIH-2e ================================================================= This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham. This message has been checked for viruses but the contents of an attachment may still contain software viruses which could damage your computer system, you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation. From bergey at teallabs.org Tue Jun 21 17:33:25 2016 From: bergey at teallabs.org (Daniel Bergey) Date: Tue, 21 Jun 2016 13:33:25 -0400 Subject: [Haskell-cafe] Help with triple stack monad In-Reply-To: <5768DAE6.6000907@zoho.com> References: <5768DAE6.6000907@zoho.com> Message-ID: <87ziqe4fbu.fsf@chladni.i-did-not-set--mail-host-address--so-tickle-me> On 2016-06-21 at 02:12, Christopher Howard wrote: > However, it seems that I must implement MonadRandom myself, as there is > no instance for this sort of arrangement already. Deriving the class also works, at least with GHC-7.10.3: newtype ReaderStateRandom r s g a = RSR { rSR :: ReaderT r (StateT s (Rand g)) a } deriving (Functor, Applicative, Monad, MonadReader r, MonadState s, MonadRandom) bergey From monkleyon at googlemail.com Tue Jun 21 18:27:17 2016 From: monkleyon at googlemail.com (MarLinn) Date: Tue, 21 Jun 2016 20:27:17 +0200 Subject: [Haskell-cafe] Source code location in IO? In-Reply-To: <22B950C955F8AB4196E72698FBD00002D03349D2@UKWPISXMB01B.zone1.scb.net> References: <20160620150356.GB16525@weber> <22B950C955F8AB4196E72698FBD00002D03349D2@UKWPISXMB01B.zone1.scb.net> Message-ID: >> Is it compatible with the semantics of Haskell to have a function >> sourceLocation :: IO String which when run returns the source file >> location at which it is used? > It's totally compatible with Haskell semantics, since Haskell does not > give any semantics to IO. Anything can happen when you do IO. But it's > still a bit weird. :) I think the weird feeling stems exactly from the fact that IO has no well-defined syntax. It's our convenient catch-all for anything remotely un-pure. Nondeterminism? Put it in IO! (Instead of a purely nondeterministic context) Non-destructive read access to a file? Put it in IO! (instead of adding Maybe to a nondeterministic context) Deterministic fire-and-forget write access to a log file? Put it in IO! (instead of a context that just provides an ordering) Firing missiles or calling the system to do an "rm -rf /"? Put it in IO! (instead of a System.Unsafe.Extras.Hidden.Unsafe.Very.WarningUnsafeDontTouchWhyDoWeEvenHaveThisOMGGetAwayFromMe) So let's just view IO as a shorthand for some unknown as-yet unspecified monad stack. (But note that most of the contexts I mentioned don't even need to be monadic) This is not to say IO is not good to have in this form. It's just not a helpful context to answer this question. From this vantage point a possibly better form of the question would be: Could we define a context which contains the required semantics that is consistent with Haskell syntax? Something like thisLine :: SourceInfo Int Of course once you have such a context you can just assume it's part of IO because everything is part of IO. To answer the modified question just think about these facts: 1. We can define contexts with 100% determinism across almost any transformation including changing all the source code around it, the compiler, the language version, and all optimizations. (pure functions, i.e. the Identity context) 2. We can also define contexts with almost 100% non-determinism even across two consecutive invocations with nothing else changed. (calls to external random number generators) 3. The context we are searching for would be deterministic across an intermediate subset of meta-transformations. So if these special semantics were not allowed we would have an inconsistent scale of determinism across meta-transformations, and that would need some serious explaining. Ergo it should be allowed. This trail of thought does bring up two interesting follow-up questions though: Is the hidden structure of the IO stack tightly bound to a theory of consistency across meta-transformations? And do we even have a suitable theory of such transformations if we would want to refine IO? I have no idea. MarLinn From schernichkin at gmail.com Tue Jun 21 21:45:17 2016 From: schernichkin at gmail.com (=?UTF-8?B?0KHRgtCw0L3QuNGB0LvQsNCyINCn0LXRgNC90LjRh9C60LjQvQ==?=) Date: Wed, 22 Jun 2016 00:45:17 +0300 Subject: [Haskell-cafe] Easy type-level math In-Reply-To: <20160621001219.4378706.87956.3999@amok.cc> References: <20160621001219.4378706.87956.3999@amok.cc> Message-ID: Thanks, that looks promising. I've also discovered some tricks: 1. With TypeFamilies and PartialTypeSignatures one can write: test :: _ => FixedGetter i j (Int32, Int32, Int32, Int32) where test's body is: int32Host >>>= \a -> int32Host >>>= \b -> int32Host >>>= \c -> int32Host >>>= \d -> ireturn (a, b, c, d). Haskell will infer that "_" (skipped type context with some type-level math on i and j) is a (KnownNat i), ((KnownNat (i + 4)), (KnownNat (i + 4) + 4) and so on freeing the programmer from declaring all of this manually. 2. One can specify types explicitly. For example test :: FixedGetter 0 16 (Int32, Int32, Int32, Int32) works, unexpectedly. 2016-06-21 3:12 GMT+03:00 Lana Black : > GHC currently lacks an ability to normalize type level arithmetic > equations. There is a plugin however [1] that implements this feature. I > believe that's what you are looking for. > > [1] ‎https://hackage.haskell.org/package/ghc-typelits-natnormalise > > *From: *Станислав Черничкин > *Sent: *Monday, June 20, 2016 11:37 PM > *To: *haskell-cafe at haskell.org > *Subject: *[Haskell-cafe] Easy type-level math > > With DataKinds and TypeOperators and GHC.TypeLits and, probably, > KindSignatures I have: > > test :: (KnownNat i, KnownNat (i + 4)) => MyType i ((i + 4) + 4) > > and it's typecheck perfectly. > > But what I really want to have is: > > test :: (KnownNat i) => MyType i (i +8) > > and it does not typecheck. > > Does not ((i + 4) + 4) == (i +8)? > > Does not (KnownNat i) implies (KnownNat (i + 4))? > > Did I miss something about Haskell? > > -- > Thanks, Stanislav Chernichkin. > > -- Sincerely, Stanislav Chernichkin. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ch.howard at zoho.com Wed Jun 22 01:12:19 2016 From: ch.howard at zoho.com (Christopher Howard) Date: Tue, 21 Jun 2016 17:12:19 -0800 Subject: [Haskell-cafe] Help with triple stack monad In-Reply-To: <87ziqe4fbu.fsf@chladni.i-did-not-set--mail-host-address--so-tickle-me> References: <5768DAE6.6000907@zoho.com> <87ziqe4fbu.fsf@chladni.i-did-not-set--mail-host-address--so-tickle-me> Message-ID: <5769E5F3.5010100@zoho.com> This doesn't seem to work for me, but I'm using 7.6.3 from Debian Jessie. I'm curious what the difference is. What extensions and modules do you import? I get error ReaderStateRandom.hs:19:73: No instance for (MonadRandom (ReaderT r (StateT s (Rand g)))) arising from the 'deriving' clause of a data type declaration Possible fix: add an instance declaration for (MonadRandom (ReaderT r (StateT s (Rand g)))) or use a standalone 'deriving instance' declaration, so you can specify the instance context yourself When deriving the instance for (MonadRandom (ReaderStateRandom r s g)) On 06/21/2016 09:33 AM, Daniel Bergey wrote: > On 2016-06-21 at 02:12, Christopher Howard wrote: >> However, it seems that I must implement MonadRandom myself, as there is >> no instance for this sort of arrangement already. > > Deriving the class also works, at least with GHC-7.10.3: > > newtype ReaderStateRandom r s g a = RSR { > rSR :: ReaderT r (StateT s (Rand g)) a > } deriving (Functor, Applicative, Monad, MonadReader r, MonadState s, > MonadRandom) > > bergey > -- http://justonemoremathproblem.com To protect my privacy, please use PGP encryption. It's free and easy to use! My public key ID is 0x340EA95A (pgp.mit.edu). From kkchensheng at gmail.com Wed Jun 22 05:31:15 2016 From: kkchensheng at gmail.com (sheng chen) Date: Wed, 22 Jun 2016 00:31:15 -0500 Subject: [Haskell-cafe] Type-class predicates head-normal forms Message-ID: Hello, I got a question about what the form of types in Haskell are allowed. Specifically, what are the requirements of the context of a type? The paper Typing Haskell in Haskell required the type to be in the form P => t, where P to be in head-normal form or in other words shouldn't be something like Num Bool. Now what about multi-parameter classes? The paper Type classes: an exploration of the design space listed several potential choices but didn't say exactly what. The Haskell 2010 report covered single-parameter type classes only. Given the following definition. class Collects ce e | ce -> e where empty :: ce insert :: e -> ce -> ce insert2 c = insert True (insert False c) The function insert2 has the following type insert2 :: Collects ce Bool => ce -> ce This shows that the definition of head-normal forms for multi-parameter class differs from that for single-parameter classes. Is there any definite specification about the context of Haskell types? Thank you, Sheng -------------- next part -------------- An HTML attachment was scrubbed... URL: From bergey at teallabs.org Wed Jun 22 11:08:36 2016 From: bergey at teallabs.org (Daniel Bergey) Date: Wed, 22 Jun 2016 07:08:36 -0400 Subject: [Haskell-cafe] Help with triple stack monad In-Reply-To: <5769E5F3.5010100@zoho.com> References: <5768DAE6.6000907@zoho.com> <87ziqe4fbu.fsf@chladni.i-did-not-set--mail-host-address--so-tickle-me> <5769E5F3.5010100@zoho.com> Message-ID: <87r3bp4h1n.fsf@chladni.i-did-not-set--mail-host-address--so-tickle-me> On 2016-06-21 at 21:12, Christopher Howard wrote: > This doesn't seem to work for me, but I'm using 7.6.3 from Debian > Jessie. I'm curious what the difference is. What extensions and modules > do you import? I get error That's very interesting. Here's my full code. I needed to add the `Control.Applicative` import for GHC-7.6. In GHC-7.10, Applicative is in Prelude. {-# LANGUAGE GeneralizedNewtypeDeriving #-} module Test where import Control.Applicative import Control.Monad.Random import Control.Monad.Reader import Control.Monad.State.Lazy newtype ReaderStateRandom r s g a = RSR { rSR :: ReaderT r (StateT s (Rand g)) a } deriving (Functor, Applicative, Monad, MonadReader r, MonadState s, MonadRandom) From lanablack at amok.cc Wed Jun 22 18:28:10 2016 From: lanablack at amok.cc (Lana Black) Date: Wed, 22 Jun 2016 18:28:10 +0000 Subject: [Haskell-cafe] [oleg.grenrus@iki.fi: Re: Easy type-level math] Message-ID: <20160622182810.GA25667@glow> Forwarding Oleg's message to the list. ----- Forwarded message from Oleg Grenrus ----- Date: Tue, 21 Jun 2016 05:27:13 +0300 From: Oleg Grenrus To: Lana Black Subject: Re: [Haskell-cafe] Easy type-level math X-Mailer: iPhone Mail (13F69) ghc-typelits-natnormalise can dismiss equality constraints, like `n + m ~ m + n`. OP needs to conjure KnownNat dictionary though, and that plugin cannot do. You can do it unsafely and manually with `reifyNat` from `reflections`: http://hackage.haskell.org/package/reflection-2.1.2/docs/Data-Reflection.html - Oleg > On 21 Jun 2016, at 03:12, Lana Black wrote: > > GHC currently lacks an ability to normalize type level arithmetic equations. There is a plugin however [1] that implements this feature. I believe that's what you are looking for. > > [1] ‎https://hackage.haskell.org/package/ghc-typelits-natnormalise > > From: Станислав Черничкин > Sent: Monday, June 20, 2016 11:37 PM > To: haskell-cafe at haskell.org > Subject: [Haskell-cafe] Easy type-level math > > With DataKinds and TypeOperators and GHC.TypeLits and, probably, KindSignatures I have: > > test :: (KnownNat i, KnownNat (i + 4)) => MyType i ((i + 4) + 4) > > and it's typecheck perfectly. > > But what I really want to have is: > > test :: (KnownNat i) => MyType i (i +8) > > and it does not typecheck. > > Does not ((i + 4) + 4) == (i +8)? > > Does not (KnownNat i) implies (KnownNat (i + 4))? > > Did I miss something about Haskell? > > -- > Thanks, Stanislav Chernichkin. > > _______________________________________________ > 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. ----- End forwarded message ----- From yallop at gmail.com Thu Jun 23 08:16:50 2016 From: yallop at gmail.com (Jeremy Yallop) Date: Thu, 23 Jun 2016 09:16:50 +0100 Subject: [Haskell-cafe] PEPM 2017 Call for Papers Message-ID: CALL FOR PAPERS Workshop on PARTIAL EVALUATION AND PROGRAM MANIPULATION (PEPM 2017) http://conf.researchr.org/home/PEPM-2017 Paris, France, January 16th - 17th, 2017 (co-located with POPL 2017) PEPM is the premier forum for discussion of semantics-based program manipulation. The first ACM SIGPLAN PEPM symposium took place in 1991, and meetings have been held in affiliation with POPL every year since 2006. PEPM 2017 will be based on a broad interpretation of semantics-based program manipulation, reflecting the expanded scope of PEPM in recent years beyond the traditionally covered areas of partial evaluation and specialization. Specifically, PEPM 2017 will include practical applications of program transformations such as refactoring tools, and practical implementation techniques such as rule-based transformation systems. In addition, the scope of PEPM covers manipulation and transformations of program and system representations such as structural and semantic models that occur in the context of model-driven development. In order to maintain the dynamic and interactive nature of PEPM and to encourage participation by practitioners, we also solicit submissions of short papers, including tool demonstrations, and of posters. Scope ----- Topics of interest for PEPM 2017 include, but are not limited to: * Program and model manipulation techniques such as: supercompilation, partial evaluation, fusion, on-the-fly program adaptation, active libraries, program inversion, slicing, symbolic execution, refactoring, decompilation, and obfuscation. * Program analysis techniques that are used to drive program/model manipulation such as: abstract interpretation, termination checking, binding-time analysis, constraint solving, type systems, automated testing and test case generation. * Techniques that treat programs/models as data objects including metaprogramming, generative programming, embedded domain-specific languages, program synthesis by sketching and inductive programming, staged computation, and model-driven program generation and transformation. * Application of the above techniques including case studies of program manipulation in real-world (industrial, open-source) projects and software development processes, descriptions of robust tools capable of effectively handling realistic applications, benchmarking. Examples of application domains include legacy program understanding and transformation, DSL implementations, visual languages and end-user programming, scientific computing, middleware frameworks and infrastructure needed for distributed and web-based applications, embedded and resource-limited computation, and security. This list of categories is not exhaustive, and we encourage submissions describing applications of semantics-based program manipulation techniques in new domains. If you have a question as to whether a potential submission is within the scope of the workshop, please contact the programme chairs. Submission categories and guidelines ------------------------------------ Three kinds of submissions will be accepted: Regular Research Papers, Short Papers and Posters. * Regular Research Papers should describe new results, and will be judged on originality, correctness, significance and clarity. Regular research papers must not exceed 12 pages in ACM Proceedings style (including appendix). * Short Papers may include tool demonstrations and presentations of exciting if not fully polished research, and of interesting academic, industrial and open-source applications that are new or unfamiliar. Short papers must not exceed 6 pages in ACM Proceedings style (including appendix). * Posters should describe work relevant to the PEPM community, and must not exceed 2 pages in ACM Proceedings style. We invite poster submissions that present early work not yet ready for submission to a conference or journal, identify new research problems, showcase tools and technologies developed by the author(s), or describe student research projects. At least one author of each accepted contribution must attend the workshop and present the work. In the case of tool demonstration papers, a live demonstration of the described tool is expected. Suggested topics, evaluation criteria, and writing guidelines for both research tool demonstration papers will be made available on the PEPM 2017 web site. Student participants with accepted papers can apply for a SIGPLAN PAC grant to help cover travel expenses and other support. PAC also offers other support, such as for child-care expenses during the meeting or for travel costs for companions of SIGPLAN members with physical disabilities, as well as for travel from locations outside of North America and Europe. For details on the PAC programme, see its web page. Publication and special issue ----------------------------- All accepted papers, short papers and posters included, will appear in formal proceedings published by ACM Press. Accepted papers will be included in the ACM Digital Library. Authors of selected papers from PEPM 2016 and PEPM 2017 will also be invited to expand their papers for publication in a special issue of the journal Computer Languages, Systems and Structures (COMLAN, Elsevier). Best paper award ---------------- PEPM 2017 continues the tradition of a Best Paper award. The winner will be announced at the workshop. Submission ---------- Papers should be submitted electronically via HotCRP. https://pepm17.hotcrp.com/ Authors using LaTeX to prepare their submissions should use the new improved SIGPLAN proceedings style, and specifically the sigplanconf.cls 9pt template. Important Dates --------------- For Regular Research Papers and Short Papers: * Abstract submission : Tuesday 13th September 2016 * Paper submission : Friday 16th September 2016 * Author notification : Monday 24th October 2016 * Camera ready : Monday 28th November 2016 For Posters: * Poster submission : Sunday 30th October 2016 * Author notification : Friday 10th November 2016 * Camera ready : Monday 28th November 2016 PEPM workshop: * Workshop : Monday 16th - Tuesday 17th January 2017 The proceedings will be published 2 weeks pre-conference. AUTHORS TAKE NOTE: The official publication date is the date the proceedings are made available in the ACM Digital Library. This date may be up to two weeks prior to the first day of your conference. The official publication date affects the deadline for any patent filings related to published work. (For those rare conferences whose proceedings are published in the ACM Digital Library after the conference is over, the official publication date remains the first day of the conference.). PEPM'17 Programme Co-Chairs ------------------- Ulrik Schultz (University of Southern Denmark), ups at mmmi.sdu.dk Jeremy Yallop (University of Cambridge), jeremy.yallop at cl.cam.ac.uk From breitner at kit.edu Thu Jun 23 16:00:09 2016 From: breitner at kit.edu (Joachim Breitner) Date: Thu, 23 Jun 2016 17:00:09 +0100 Subject: [Haskell-cafe] Haskell in Leipzig 2016: Final Call for Papers Message-ID: <1466697609.16347.9.camel@kit.edu>                              Haskell in Leipzig                             September 14-15, 2016                             HTKW Leipzig, Germany                          http://hal2016.haskell.org/ This is the third and last call for submissions for the Haskell in Leipzig workshop. In case you were hesitating whether you want to submit something, the answer is „Yes!“. I’m looking forward to receiving your contribution on July 1st (next Friday). == About HaL == The workshop series “Haskell in Leipzig”, now in its 11th year, brings together Haskell developers, Haskell researchers, Haskell enthusiasts and Haskell beginners to listen to talks, take part in tutorials, and join in interesting conversations. Everything related to Haskell is on topic, whether it is about current research, practical applications, interesting ideas off the beaten track, education, or art, and topics may extend to functional programming in general and its connections to other programming paradigms as well. This year, HaL is colocated with two related conferences,  * the Workshop on Functional and (Constraint) Logic Programming (WFLP) and  * the Workshop on (Constraint) Logic Programming (WLP), to form the Leipzig Week of Declarative Programming (L-DEC):     http://nfa.imn.htwk-leipzig.de/LDEC2016/ In order to accommodate and welcome a more international audience, this year’s HaL will be held in English. == Invited Speaker == Unsure about whether HaL is interesting to you? No need to worry:                             Alejandro Russo (from Chalmers) is our keynote speaker and will talk about his work on information-flow control (i.e. SecLib, LIO, MAC, HLIO) – a great topic that is of interest to researchers, practitioners and beginners alike.  == Submissions == Contributions can take the form of  * talks (about 30 minutes),  * tutorials (about 90 minutes),  * demonstrations, artistic performances, or other extraordinary     things. Please submit an abstract that describes the content and form of your presentation, the intended audience, and required previous knowledge. We recommend a length of 2 pages, so that the PC and the audience get a good idea of your submission, but this is not a hard requirement. You can submit your abstract, as an PDF document, at    https://easychair.org/conferences/?conf=hal2016 until Friday, July 1, 2016. You will be notified by July 15, 2016. == Program committee ==  * Andreas Abel, Chalmers and Gothenburg University, Sweden  * Heinrich Apfelmus, Leipzig, Germany  * Joachim Breitner, Karlsruhe Institute of Technology, Germany (Chair)  * Matthias Fischmann, Zerobuzz, Germany  * Petra Hofstedt, BTU Cottbus-Senftenberg, Germany  * Wolfgang Jeltsch, Institute of Cybernetics at Tallinn University of     Technology, Estonia  * Andres Löh, Well-Typed LLP, Germany  * Alejandro Serrano Mena, Universiteit Utrecht, Netherlands  * Neil Mitchell, Standard Chartered Bank, UK  * Katie Ots, Facebook, UK  * Peter Stadler, University of Leipzig, Germany  * Henning Thielemann, Freelancer, Germany  * Niki Vazou, University of California, San Diego, USA If you have any questions, please do not hesitate to contact Joachim Breitner . -- Dr. rer. nat. Joachim Breitner Wissenschaftlicher Mitarbeiter http://pp.ipd.kit.edu/~breitner -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: This is a digitally signed message part URL: From briand at aracnet.com Thu Jun 23 20:02:51 2016 From: briand at aracnet.com (briand at aracnet.com) Date: Thu, 23 Jun 2016 13:02:51 -0700 Subject: [Haskell-cafe] up-to-date glfw examples Message-ID: <20160623130251.5ccca3b7@basalt.deldotd.com> Hi, I've been looking but the examples are all fairly old and are broken in both imports from glfw and opengl. Just looking for very basic examples that work with the current versions of glfw-b and opengl. Thank you, Brian From acowley at seas.upenn.edu Fri Jun 24 04:27:23 2016 From: acowley at seas.upenn.edu (Anthony Cowley) Date: Fri, 24 Jun 2016 00:27:23 -0400 Subject: [Haskell-cafe] up-to-date glfw examples In-Reply-To: <20160623130251.5ccca3b7@basalt.deldotd.com> References: <20160623130251.5ccca3b7@basalt.deldotd.com> Message-ID: briand at aracnet.com writes: > Hi, > > I've been looking but the examples are all fairly old and are broken in both imports from glfw and opengl. > > Just looking for very basic examples that work with the current versions of glfw-b and opengl. > > Thank you, > > Brian They're not entirely minimal, but the vinyl-gl repo [1] includes two example programs that can get you going with both glfw-b and opengl. I added a stack file, so you should be able to clone the repo, then, ``` stack build cd examples stack exec game2d stack exec demo3d ``` Anthony Footnotes: [1] https://github.com/acowley/vinyl-gl From briand at aracnet.com Fri Jun 24 05:32:30 2016 From: briand at aracnet.com (briand at aracnet.com) Date: Thu, 23 Jun 2016 22:32:30 -0700 Subject: [Haskell-cafe] up-to-date glfw examples In-Reply-To: References: <20160623130251.5ccca3b7@basalt.deldotd.com> Message-ID: <20160623223230.6c9db1bc@basalt.deldotd.com> On Fri, 24 Jun 2016 00:27:23 -0400 Anthony Cowley wrote: > > briand at aracnet.com writes: > > > Hi, > > > > I've been looking but the examples are all fairly old and are broken in both imports from glfw and opengl. > > > > Just looking for very basic examples that work with the current versions of glfw-b and opengl. > > That's very useful. Thanks! I also noticed that the glfw-b package has a gears demo which is very good. The only drawback is that it uses "old style" opengl calls. Brian From dct25-561bs at mythic-beasts.com Fri Jun 24 09:23:02 2016 From: dct25-561bs at mythic-beasts.com (David Turner) Date: Fri, 24 Jun 2016 10:23:02 +0100 Subject: [Haskell-cafe] Backtracking when building a bytestring Message-ID: Hi, I'm working on a network protocol that involves sending frames of data prefixed by their length and a checksum. The only realistic way to work out the length of a frame is to actually write the bytes out, although the length and checksum take up a fixed number of bytes. If I were working in C I'd be filling a buffer, leaving space for the length/checksum, and then go back and fill them in at the end. So this is _almost_ what ByteString.Builder does except for the backtracking bit. Does anyone know if there's an implementation of a thing that's a bit like ByteString.Builder but also allows for this kind of backtracking? Ideally I want to be able to batch up a number of frames into a single buffer, and deal gracefully with overflowing the buffer by allocating some more, much as Builder does. I can't think of a terribly good way of doing this using the existing Builder implementation as it stands, although it looks quite easy to modify it to add this functionality so I might just do that locally if needs be. Cheers, David -------------- next part -------------- An HTML attachment was scrubbed... URL: From axel.mannhardt at freiheit.com Fri Jun 24 09:39:50 2016 From: axel.mannhardt at freiheit.com (Axel Mannhardt) Date: Fri, 24 Jun 2016 11:39:50 +0200 Subject: [Haskell-cafe] Backtracking when building a bytestring In-Reply-To: References: Message-ID: <1466761190.11036.54.camel@methylbromid> Hi, On Fr, 2016-06-24 at 10:23 +0100, David Turner wrote: > I'm working on a network protocol that involves sending frames of data > prefixed by their length and a checksum. The only realistic way to work out > the length of a frame is to actually write the bytes out, although the > length and checksum take up a fixed number of bytes. this might be of interest to you - the explanation is in German though: http://nfa.imn.htwk-leipzig.de/HAL2015/programm/slides/breitner.pdf Cheers, Axel -- Axel Mannhardt Master of Science (M.Sc.) freiheit.com technologies gmbh Budapester Straße 45 20359 Hamburg / Germany fon +49 40 / 890584-0 fax +49 40 / 890584-20 Hamburg HRB 70814 https://twitter.com/freiheit_com 35AB AE2D 4002 DE31 C7E2 CC21 4D3F 9E9C 5EE9 B3B3 Geschäftsführer: Claudia Dietze, Stefan Richter From shumovichy at gmail.com Fri Jun 24 10:41:26 2016 From: shumovichy at gmail.com (Yuras Shumovich) Date: Fri, 24 Jun 2016 13:41:26 +0300 Subject: [Haskell-cafe] Backtracking when building a bytestring In-Reply-To: References: Message-ID: <1466764886.2831.5.camel@gmail.com> I think it is possible (and easy) to implement with Data.ByteString.Builder. Just use the low-level interface: http://hacka ge.haskell.org/package/bytestring-0.10.8.1/docs/Data-ByteString- Builder-Extra.html#v:runBuilder BufferWriter takes a buffer to write to and returns a continuation to be called in case the buffer is too small. The idea is to allocate a buffer, but reserve necessary space for length and checksum. Then run the builder, get the resulting ByteString (or work directly with `Ptr Word8`), calculate length and check sum and write then into the reserved space. Just be careful when using the low level API, and read the docs carefully. Thanks, Yuras. On Fri, 2016-06-24 at 10:23 +0100, David Turner wrote: > Hi, > > I'm working on a network protocol that involves sending frames of > data > prefixed by their length and a checksum. The only realistic way to > work out > the length of a frame is to actually write the bytes out, although > the > length and checksum take up a fixed number of bytes. > > If I were working in C I'd be filling a buffer, leaving space for the > length/checksum, and then go back and fill them in at the end. So > this is > _almost_ what ByteString.Builder does except for the backtracking > bit. > > Does anyone know if there's an implementation of a thing that's a bit > like > ByteString.Builder but also allows for this kind of backtracking? > Ideally I > want to be able to batch up a number of frames into a single buffer, > and > deal gracefully with overflowing the buffer by allocating some more, > much > as Builder does. > > I can't think of a terribly good way of doing this using the existing > Builder implementation as it stands, although it looks quite easy to > modify > it to add this functionality so I might just do that locally if needs > be. > > Cheers, > > David > _______________________________________________ > 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 dct25-561bs at mythic-beasts.com Fri Jun 24 13:28:47 2016 From: dct25-561bs at mythic-beasts.com (David Turner) Date: Fri, 24 Jun 2016 14:28:47 +0100 Subject: [Haskell-cafe] Backtracking when building a bytestring In-Reply-To: <1466764886.2831.5.camel@gmail.com> References: <1466764886.2831.5.camel@gmail.com> Message-ID: On 24 June 2016 at 11:41, Yuras Shumovich wrote: > > I think it is possible (and easy) to implement with > Data.ByteString.Builder. Just use the low-level interface: http://hacka > ge.haskell.org/package/bytestring-0.10.8.1/docs/Data-ByteString- > Builder-Extra.html#v:runBuilder > > BufferWriter takes a buffer to write to and returns a continuation to > be called in case the buffer is too small. The idea is to allocate a > buffer, but reserve necessary space for length and checksum. Then run > the builder, get the resulting ByteString (or work directly with `Ptr > Word8`), calculate length and check sum and write then into the > reserved space. > > Just be careful when using the low level API, and read the docs > carefully. > Aha, thanks, that looks like just what I'm after! Great. On 24 June 2016 at 10:39, Axel Mannhardt wrote: > > this might be of interest to you - the explanation is in German though: > > http://nfa.imn.htwk-leipzig.de/HAL2015/programm/slides/breitner.pdf > > Cheers, > Axel My German is nonexistent but fortunately the code is English enough to read, thanks. Unfortunately, > type ByteString = [Word8] This is not the ByteString I'm looking for! Cheers, David -------------- next part -------------- An HTML attachment was scrubbed... URL: From bergey at teallabs.org Fri Jun 24 14:35:29 2016 From: bergey at teallabs.org (Daniel Bergey) Date: Fri, 24 Jun 2016 10:35:29 -0400 Subject: [Haskell-cafe] up-to-date glfw examples In-Reply-To: <20160623130251.5ccca3b7@basalt.deldotd.com> References: <20160623130251.5ccca3b7@basalt.deldotd.com> Message-ID: <877fde4pu6.fsf@chladni.i-did-not-set--mail-host-address--so-tickle-me> The link below has introductory examples using GLFW-b and modern (VBO) OpenGL. They build with the 2-month-ago current versions of libraries, and probably also with the today-current versions. https://github.com/bergey/haskell-OpenGL-examples/tree/master/wikibook bergey On 2016-06-23 at 16:02, briand at aracnet.com wrote: > Hi, > > I've been looking but the examples are all fairly old and are broken in both imports from glfw and opengl. > > Just looking for very basic examples that work with the current versions of glfw-b and opengl. > > Thank you, > > Brian > _______________________________________________ > 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 briand at aracnet.com Fri Jun 24 15:52:46 2016 From: briand at aracnet.com (briand at aracnet.com) Date: Fri, 24 Jun 2016 08:52:46 -0700 Subject: [Haskell-cafe] up-to-date glfw examples In-Reply-To: <877fde4pu6.fsf@chladni.i-did-not-set--mail-host-address--so-tickle-me> References: <20160623130251.5ccca3b7@basalt.deldotd.com> <877fde4pu6.fsf@chladni.i-did-not-set--mail-host-address--so-tickle-me> Message-ID: <20160624085246.2eac593a@basalt.deldotd.com> On Fri, 24 Jun 2016 10:35:29 -0400 Daniel Bergey wrote: > The link below has introductory examples using GLFW-b and modern (VBO) > OpenGL. They build with the 2-month-ago current versions of libraries, > and probably also with the today-current versions. > > https://github.com/bergey/haskell-OpenGL-examples/tree/master/wikibook > Hi Daniel, This looks really good. Couple of issues I had when trying to build on my system cabal: At least the following dependencies are missing: OpenGLRaw >=3 && <3.2, singletons >=1.0 && <2.1 I have OpenGLRaw-3.2.0.0 singletons-2.1 However when I went into the cabal file and replaced "<" with "<=" that didn't seem to make the build happy. Also, since you used "<" specifically I thought there might be a good reason for that. Brian From joie.murphy at nist.gov Fri Jun 24 15:54:05 2016 From: joie.murphy at nist.gov (Murphy, Joie R. (Assoc)) Date: Fri, 24 Jun 2016 15:54:05 +0000 Subject: [Haskell-cafe] User Requirements Survey for CT Software (Beta) Message-ID: Hello, My name is Joie Murphy and I am a Summer Research Student at the US National Institute of Standards and Technology (NIST), working with Drs. Spencer Breiner and Eswaran Subrahmanian. We are currently gathering user requirements for category theoretic software to be developed by or with NIST in the future. This questionnaire will give us insight about your past or present use of CT software and your ideal uses for such software. Providing us with the information on how you would like to use this type of software will help us to make the right design choices in development. The survey is available on Google Forms: http://goo.gl/forms/vfOgR26dHnKynHU23 If you have any colleagues who might be willing to fill out this survey, you can forward our message or you can provide us with their contact information at the end of the survey. If you have any questions or concerns, please feel free to contact us by replying to this email. We would like to thank you for your participation in this initial step of the development process. Regards, Joie Murphy -------------- next part -------------- An HTML attachment was scrubbed... URL: From bergey at teallabs.org Fri Jun 24 19:54:39 2016 From: bergey at teallabs.org (Daniel Bergey) Date: Fri, 24 Jun 2016 15:54:39 -0400 Subject: [Haskell-cafe] up-to-date glfw examples In-Reply-To: <20160624085246.2eac593a@basalt.deldotd.com> References: <20160623130251.5ccca3b7@basalt.deldotd.com> <877fde4pu6.fsf@chladni.i-did-not-set--mail-host-address--so-tickle-me> <20160624085246.2eac593a@basalt.deldotd.com> Message-ID: <871t3m4b28.fsf@chladni.i-did-not-set--mail-host-address--so-tickle-me> On 2016-06-24 at 11:52, briand at aracnet.com wrote: > cabal: At least the following dependencies are missing: > OpenGLRaw >=3 && <3.2, singletons >=1.0 && <2.1 > > I have > > OpenGLRaw-3.2.0.0 > singletons-2.1 I just pushed a commit that allows these two package versions. > However when I went into the cabal file and replaced "<" with "<=" > that didn't seem to make the build happy. Also, since you used "<" > specifically I thought there might be a good reason for that. The reason is that the last time I touched this package those versions weren't out, and I made the conservative assumption that changes in these versions might require changes in my package. I figure it's no big deal if someone building my examples needs to use a 2-month-old dependency, but frustrating if what's intended as a tutorial example fails at compile time. cheers, bergey From svenpanne at gmail.com Fri Jun 24 21:39:48 2016 From: svenpanne at gmail.com (Sven Panne) Date: Fri, 24 Jun 2016 23:39:48 +0200 Subject: [Haskell-cafe] up-to-date glfw examples In-Reply-To: <871t3m4b28.fsf@chladni.i-did-not-set--mail-host-address--so-tickle-me> References: <20160623130251.5ccca3b7@basalt.deldotd.com> <877fde4pu6.fsf@chladni.i-did-not-set--mail-host-address--so-tickle-me> <20160624085246.2eac593a@basalt.deldotd.com> <871t3m4b28.fsf@chladni.i-did-not-set--mail-host-address--so-tickle-me> Message-ID: 2016-06-24 21:54 GMT+02:00 Daniel Bergey : > [...] I figure it's no big deal if someone building my examples needs to > use a > 2-month-old dependency, but frustrating if what's intended as a tutorial > example fails at compile time. > Well, it depends on the definition of "failed": If the examples build cleanly in a fresh cabal sandbox or equivalently via "stack init && stack build", then I wouldn't consider this a failure. A consequence of the package versioning policy is actually that building a non-trivial project outside of a sandbox will fail with a high probability. This wouldn't be the case in an ideal world where every package author makes no mistakes and foresees the future, but alas, that's not the world we live in... :-D Cheers, S. -------------- next part -------------- An HTML attachment was scrubbed... URL: From carter.schonwald at gmail.com Sat Jun 25 00:35:20 2016 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Fri, 24 Jun 2016 20:35:20 -0400 Subject: [Haskell-cafe] User Requirements Survey for CT Software (Beta) In-Reply-To: References: Message-ID: How do you plan to handle extensional elements of category theory? On Friday, June 24, 2016, Murphy, Joie R. (Assoc) wrote: > Hello, > > > > My name is Joie Murphy and I am a Summer Research Student at the US > National Institute of Standards and Technology (NIST), working with Drs. > Spencer Breiner and Eswaran Subrahmanian. We are currently gathering user > requirements for category theoretic software to be developed by or with > NIST in the future. This questionnaire will give us insight about your past > or present use of CT software and your ideal uses for such software. > Providing us with the information on how you would like to use this type of > software will help us to make the right design choices in development. > > > > The survey is available on Google Forms: > http://goo.gl/forms/vfOgR26dHnKynHU23 > > > > If you have any colleagues who might be willing to fill out this survey, > you can forward our message or you can provide us with their contact > information at the end of the survey. If you have any questions or > concerns, please feel free to contact us by replying to this email. > > > > We would like to thank you for your participation in this initial step of > the development process. > > > > Regards, > > Joie Murphy > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From chneukirchen at gmail.com Sat Jun 25 17:29:10 2016 From: chneukirchen at gmail.com (Christian Neukirchen) Date: Sat, 25 Jun 2016 19:29:10 +0200 Subject: [Haskell-cafe] Munich Haskell Meeting, 2016-06-29 @ 19:30 Augustiner-Keller Message-ID: <87ziq9i3dl.fsf@gmail.com> Dear all, Next week, our monthly Munich Haskell Meeting will take place again on Wednesday, June 29 at Augustiner-Keller Arnulfstr. at 19h30. **Please note the different day and location!** For details see here: http://muenchen.haskell.bayern/dates.html (Yes, we got a new domain!) 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-jun-2016/ Everybody is welcome! cu, -- Christian Neukirchen http://chneukirchen.org From diaz.carrete at gmail.com Sun Jun 26 14:39:28 2016 From: diaz.carrete at gmail.com (=?UTF-8?Q?Daniel_D=C3=ADaz?=) Date: Sun, 26 Jun 2016 07:39:28 -0700 (PDT) Subject: [Haskell-cafe] Using streams to clarify (?) the signature of Data.Text.replace Message-ID: <8868df54-909c-41af-9b5f-f1cf699cd789@googlegroups.com> In the "text" package, the signature of Data.Text.replace always sends me looking into the haddocks: replace :: Text -> Text -> Text -> Text Which argument is the text to replace, which is the replacement and which is the text that should be scanned? Imagine a generalized version of replace that 1) works on streams, and 2) allows replacing a sequence of texts (like, say, chapter headers) instead of replacing the same text repeatedly. It could have the following signature: replace' :: Stream (Stream (Of Text) m) m () > -> Stream (Stream (Of Text) m) m Void > -> Stream (Of Text) m r > -> Stream (Of Text) m r Do you find easy to intuit, just by looking at that signature, which is the function of each argument? -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan.miljenovic at gmail.com Sun Jun 26 21:53:26 2016 From: ivan.miljenovic at gmail.com (Ivan Lazar Miljenovic) Date: Mon, 27 Jun 2016 07:53:26 +1000 Subject: [Haskell-cafe] Using streams to clarify (?) the signature of Data.Text.replace In-Reply-To: <8868df54-909c-41af-9b5f-f1cf699cd789@googlegroups.com> References: <8868df54-909c-41af-9b5f-f1cf699cd789@googlegroups.com> Message-ID: (Apologies if you receive this twice, but it seems my previous attempt was sent to a non-existent Google Group rather than Cafe :s) On 27 June 2016 at 00:39, Daniel Díaz wrote: > In the "text" package, the signature of Data.Text.replace always sends me > looking into the haddocks: > >> replace :: Text -> Text -> Text -> Text > > > Which argument is the text to replace, which is the replacement and which is > the text that should be scanned? > > Imagine a generalized version of replace that 1) works on streams, and 2) > allows replacing a sequence of texts (like, say, chapter headers) instead of > replacing the same text repeatedly. It could have the following signature: > >> replace' :: Stream (Stream (Of Text) m) m () >> -> Stream (Stream (Of Text) m) m Void >> -> Stream (Of Text) m r >> -> Stream (Of Text) m r > > > Do you find easy to intuit, just by looking at that signature, which is the > function of each argument? Whilst this type signature is easier to intuit which is the actual text in which the replacement is occurring, it gives me no clues as to which of the first two arguments is the text to search for and which is the replacement. -- Ivan Lazar Miljenovic Ivan.Miljenovic at gmail.com http://IvanMiljenovic.wordpress.com From ok at cs.otago.ac.nz Mon Jun 27 00:57:06 2016 From: ok at cs.otago.ac.nz (Richard A. O'Keefe) Date: Mon, 27 Jun 2016 12:57:06 +1200 Subject: [Haskell-cafe] Using streams to clarify (?) the signature of Data.Text.replace In-Reply-To: <8868df54-909c-41af-9b5f-f1cf699cd789@googlegroups.com> References: <8868df54-909c-41af-9b5f-f1cf699cd789@googlegroups.com> Message-ID: <84e69e23-d4ea-e5b8-08c9-1e8d341e0e4c@cs.otago.ac.nz> On 27/06/16 2:39 AM, Daniel Díaz wrote: > In the "text" package, the signature of Data.Text.replace > > always sends me looking into the haddocks: > > replace :: Text-> Text -> Text-> Text > > > Which argument is the text to replace, which is the replacement and > which is the text that should be scanned? Considering partial application, the order that makes the most sense is - what to look for - what to replace it with - the big string to search and replace in I've never used this function. Let's go look at the documentation. Pats self on back: nailed it. > Imagine a generalized version of replace that 1) works on streams, and > 2) allows replacing a sequence of texts (like, say, chapter headers) > instead of replacing the same text repeatedly. It could have the > following signature: > > replace' :: Stream (Stream (Of Text) m) m () > -> Stream (Stream (Of Text) m) m Void > -> Stream (Of Text) m r > -> Stream (Of Text) m r > > > Do you find easy to intuit, just by looking at that signature, which > is the function of each argument? Absolutely not. In fact, this crossed my personal complexity horizon and is still accelerating towards some kind of singularity. The more I try to imagine a problem that this might be a solution to, the less I can understand why it would be approached this way. To be perfectly honest, I've never found replacing one string by another to be terribly useful. Replacing one *token sequence* by another, yes. Replacing a (match for a) regular expression by a derived string, yes. From fa-ml at ariis.it Mon Jun 27 04:28:56 2016 From: fa-ml at ariis.it (Francesco Ariis) Date: Mon, 27 Jun 2016 06:28:56 +0200 Subject: [Haskell-cafe] [Haskell] The Haddock documentation is not showing up on the Hackage In-Reply-To: References: Message-ID: <20160627042856.GA2986@casa.casa> On Mon, Jun 27, 2016 at 01:28:57PM +0900, KwangYul Seo wrote: > Hi, > > I uploaded a package named enchant on the Hackage last week, but the > Haddock documentation is not showing up yet. The Status field says "Docs > pending" and "Build status unknown". > > https://hackage.haskell.org/package/enchant-0.1.0.0 > > enchant uses c2hs as a build tool to generate the FFI binding and requires > libenchant-dev to be installed on the machine. I wonder how I can tell > these build requirements to the Hackage server. I had a similar problem a few months ago, resolved to upload a 0.1.0.1 version, that triggered the build. p.s.: I am replying in haskell-cafe at haskell.org , which is probably more suited (haskell@ is for announcements, etc.) From harendra.kumar at gmail.com Mon Jun 27 05:53:25 2016 From: harendra.kumar at gmail.com (Harendra Kumar) Date: Mon, 27 Jun 2016 11:23:25 +0530 Subject: [Haskell-cafe] [Haskell] The Haddock documentation is not showing up on the Hackage In-Reply-To: <20160627042856.GA2986@casa.casa> References: <20160627042856.GA2986@casa.casa> Message-ID: I had a similar problem recently. If a candidate package is re-uploaded with the same version again, doc was not being re-generated. I too changed the version to 0.1.0.1 to trigger the doc update. I raised an issue for that (https://github.com/haskell/hackage-server/issues/512). -harendra On 27 June 2016 at 09:58, Francesco Ariis wrote: > On Mon, Jun 27, 2016 at 01:28:57PM +0900, KwangYul Seo wrote: > > Hi, > > > > I uploaded a package named enchant on the Hackage last week, but the > > Haddock documentation is not showing up yet. The Status field says "Docs > > pending" and "Build status unknown". > > > > https://hackage.haskell.org/package/enchant-0.1.0.0 > > > > enchant uses c2hs as a build tool to generate the FFI binding and > requires > > libenchant-dev to be installed on the machine. I wonder how I can tell > > these build requirements to the Hackage server. > > I had a similar problem a few months ago, resolved to upload a 0.1.0.1 > version, that triggered the build. > > p.s.: I am replying in haskell-cafe at haskell.org , which is probably more > suited (haskell@ is for announcements, etc.) > _______________________________________________ > 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 kwangyul.seo at gmail.com Mon Jun 27 06:07:45 2016 From: kwangyul.seo at gmail.com (KwangYul Seo) Date: Mon, 27 Jun 2016 15:07:45 +0900 Subject: [Haskell-cafe] [Haskell] The Haddock documentation is not showing up on the Hackage In-Reply-To: References: <20160627042856.GA2986@casa.casa> Message-ID: It would be nice if there is a way to re-trigger the haddock generation without uploading a new version. I will file an issue requesting for this feature. BTW, I still wonder how I can specify the build requirements for the Hackage server. For example, I specify c2hs and libenchant-dev as dependencies in .travis.yml for the Travis build: ``` before_install: - sudo apt-get install -y libenchant-dev c2hs ``` Regards, Kwang Yul Seo On Mon, Jun 27, 2016 at 2:53 PM, Harendra Kumar wrote: > I had a similar problem recently. If a candidate package is re-uploaded > with the same version again, doc was not being re-generated. I too changed > the version to 0.1.0.1 to trigger the doc update. I raised an issue for > that (https://github.com/haskell/hackage-server/issues/512). > > -harendra > > On 27 June 2016 at 09:58, Francesco Ariis wrote: > >> On Mon, Jun 27, 2016 at 01:28:57PM +0900, KwangYul Seo wrote: >> > Hi, >> > >> > I uploaded a package named enchant on the Hackage last week, but the >> > Haddock documentation is not showing up yet. The Status field says "Docs >> > pending" and "Build status unknown". >> > >> > https://hackage.haskell.org/package/enchant-0.1.0.0 >> > >> > enchant uses c2hs as a build tool to generate the FFI binding and >> requires >> > libenchant-dev to be installed on the machine. I wonder how I can tell >> > these build requirements to the Hackage server. >> >> I had a similar problem a few months ago, resolved to upload a 0.1.0.1 >> version, that triggered the build. >> >> p.s.: I am replying in haskell-cafe at haskell.org , which is probably more >> suited (haskell@ is for announcements, etc.) >> _______________________________________________ >> 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 lemming at henning-thielemann.de Mon Jun 27 07:01:00 2016 From: lemming at henning-thielemann.de (Henning Thielemann) Date: Mon, 27 Jun 2016 09:01:00 +0200 (CEST) Subject: [Haskell-cafe] [Haskell] The Haddock documentation is not showing up on the Hackage In-Reply-To: References: Message-ID: On Mon, 27 Jun 2016, KwangYul Seo wrote: > I uploaded a package named enchant on the Hackage last week, but the > Haddock documentation is not showing up yet. The Status field says "Docs > pending" and "Build status unknown". This is certainly not for haskell at haskell.org. I am answering to haskell-cafe and cabal-devel. > https://hackage.haskell.org/package/enchant-0.1.0.0 > > enchant uses c2hs as a build tool to generate the FFI binding and > requires libenchant-dev to be installed on the machine. I wonder how I > can tell these build requirements to the Hackage server. I assume that it is not a good idea to install many additional packages on the Haskell server. Thus I think the best you can do is to upload the documentation yourself via the package maintenance site. Here is a script that should help creating the docs locally and upload them to Hackage: https://raw.githubusercontent.com/ekmett/lens/master/scripts/hackage-docs.sh From davean at xkcd.com Mon Jun 27 07:10:29 2016 From: davean at xkcd.com (davean) Date: Mon, 27 Jun 2016 03:10:29 -0400 Subject: [Haskell-cafe] [Haskell] The Haddock documentation is not showing up on the Hackage In-Reply-To: References: <20160627042856.GA2986@casa.casa> Message-ID: I've installed the dependency and rebuilt it. On Mon, Jun 27, 2016 at 2:07 AM, KwangYul Seo wrote: > It would be nice if there is a way to re-trigger the haddock generation > without uploading a new version. I will file an issue requesting for this > feature. > > BTW, I still wonder how I can specify the build requirements for the > Hackage server. For example, I specify c2hs and libenchant-dev as > dependencies in .travis.yml for the Travis build: > > ``` > before_install: > - sudo apt-get install -y libenchant-dev c2hs > ``` > > Regards, > Kwang Yul Seo > > > On Mon, Jun 27, 2016 at 2:53 PM, Harendra Kumar > wrote: > >> I had a similar problem recently. If a candidate package is re-uploaded >> with the same version again, doc was not being re-generated. I too changed >> the version to 0.1.0.1 to trigger the doc update. I raised an issue for >> that (https://github.com/haskell/hackage-server/issues/512). >> >> -harendra >> >> On 27 June 2016 at 09:58, Francesco Ariis wrote: >> >>> On Mon, Jun 27, 2016 at 01:28:57PM +0900, KwangYul Seo wrote: >>> > Hi, >>> > >>> > I uploaded a package named enchant on the Hackage last week, but the >>> > Haddock documentation is not showing up yet. The Status field says >>> "Docs >>> > pending" and "Build status unknown". >>> > >>> > https://hackage.haskell.org/package/enchant-0.1.0.0 >>> > >>> > enchant uses c2hs as a build tool to generate the FFI binding and >>> requires >>> > libenchant-dev to be installed on the machine. I wonder how I can tell >>> > these build requirements to the Hackage server. >>> >>> I had a similar problem a few months ago, resolved to upload a 0.1.0.1 >>> version, that triggered the build. >>> >>> p.s.: I am replying in haskell-cafe at haskell.org , which is probably more >>> suited (haskell@ is for announcements, etc.) >>> _______________________________________________ >>> 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 diaz.carrete at gmail.com Mon Jun 27 07:17:05 2016 From: diaz.carrete at gmail.com (=?UTF-8?Q?Daniel_D=C3=ADaz?=) Date: Mon, 27 Jun 2016 00:17:05 -0700 (PDT) Subject: [Haskell-cafe] Using streams to clarify (?) the signature of Data.Text.replace In-Reply-To: <84e69e23-d4ea-e5b8-08c9-1e8d341e0e4c@cs.otago.ac.nz> References: <8868df54-909c-41af-9b5f-f1cf699cd789@googlegroups.com> <84e69e23-d4ea-e5b8-08c9-1e8d341e0e4c@cs.otago.ac.nz> Message-ID: <994773d1-8f8e-4cdb-b5c4-a11b526fba40@googlegroups.com> (I mistakenly posted this thread in Haskell-cafe instead of the Haskell Pipes list. Oh well.) On Monday, June 27, 2016 at 2:57:15 AM UTC+2, Richard A. O'Keefe wrote: > > > > replace :: Text-> Text -> Text-> Text > > > > > > Which argument is the text to replace, which is the replacement and > > which is the text that should be scanned? > > Considering partial application, the order that makes the most sense is > - what to look for > - what to replace it with > - the big string to search and replace in > Interesting, I forgot that the order of parameters can tell you things about how they are used. Did you arrive at your conclusion by assuming the "most variable" arguments come last? > Imagine a generalized version of replace that 1) works on streams, and > > > 2) allows replacing a sequence of texts (like, say, chapter headers) > > instead of replacing the same text repeatedly. It could have the > > following signature: > > > > replace' :: Stream (Stream (Of Text) m) m () > > -> Stream (Stream (Of Text) m) m Void > > -> Stream (Of Text) m r > > -> Stream (Of Text) m r > > > > > > Do you find easy to intuit, just by looking at that signature, which > > is the function of each argument? > > Absolutely not. In fact, this crossed my personal complexity horizon > and is still accelerating towards some kind of singularity. > Yeah, I was mostly experimenting about how to encode the the purpose of each argument in the types, without giving much thought to how complicated the signature ended up being. About the first two function arguments, my reasoning was: the first stream (that returns ()) can be finite or infinite while the second (that returns Void) is necessarily infinite. Therefore it makes sense that the first is the stream of things to search for, and the second the stream of substitutions, that will be consumed as long as matches are found. > The more I try to imagine a problem that this might be a solution to, > the less I can understand why it would be approached this way. > > > A possible use case: you want to "splice" the contents of a sequence of files into another file at certain words, without having to keep whole files in memory, and without using lazy I/O. -------------- next part -------------- An HTML attachment was scrubbed... URL: From corentin.dupont at gmail.com Mon Jun 27 07:38:28 2016 From: corentin.dupont at gmail.com (Corentin Dupont) Date: Mon, 27 Jun 2016 09:38:28 +0200 Subject: [Haskell-cafe] Help to choose a library name Message-ID: Hi community, I'm writing a reactive programming library (yet another). I need it for the game Nomyx, but couldn't find the features I wanted from the existing libraries. Now the library is called Nomyx-Events. But I'd like to find a cool name that is not related to Nomyx... Some propositions: - Nomev - Noa Some French names: - Imprevu (French for unforseen, like in "unforseen event"). - Rendez-vous - Dejavu I like a lot Imprevu. How does it sound to English native speakers? Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at joachim-breitner.de Mon Jun 27 08:25:03 2016 From: mail at joachim-breitner.de (Joachim Breitner) Date: Mon, 27 Jun 2016 10:25:03 +0200 Subject: [Haskell-cafe] Help to choose a library name In-Reply-To: References: Message-ID: <1467015903.2214.0.camel@joachim-breitner.de> Hi, Am Montag, den 27.06.2016, 09:38 +0200 schrieb Corentin Dupont: > I need it for the game Nomyx, but couldn't find the features I wanted > from the existing libraries. any chance to extend existing libraries to support what you need? Library proliferation does not really help the ecosystem. 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: 819 bytes Desc: This is a digitally signed message part URL: From kwangyul.seo at gmail.com Mon Jun 27 08:46:11 2016 From: kwangyul.seo at gmail.com (KwangYul Seo) Date: Mon, 27 Jun 2016 17:46:11 +0900 Subject: [Haskell-cafe] [Haskell] The Haddock documentation is not showing up on the Hackage In-Reply-To: References: Message-ID: On Mon, Jun 27, 2016 at 4:01 PM, Henning Thielemann < lemming at henning-thielemann.de> wrote: > > On Mon, 27 Jun 2016, KwangYul Seo wrote: > > I uploaded a package named enchant on the Hackage last week, but the >> Haddock documentation is not showing up yet. The Status field says "Docs >> pending" and "Build status unknown". >> > > This is certainly not for haskell at haskell.org. I am answering to > haskell-cafe and cabal-devel. > > https://hackage.haskell.org/package/enchant-0.1.0.0 >> >> enchant uses c2hs as a build tool to generate the FFI binding and >> requires libenchant-dev to be installed on the machine. I wonder how I can >> tell these build requirements to the Hackage server. >> > > I assume that it is not a good idea to install many additional packages on > the Haskell server. Thus I think the best you can do is to upload the > documentation yourself via the package maintenance site. > > Here is a script that should help creating the docs locally and upload > them to Hackage: > > https://raw.githubusercontent.com/ekmett/lens/master/scripts/hackage-docs.sh > Thanks for the tip! I didn't know that I can upload the documentation separately from the source. Regards, Kwang Yul Seo -------------- next part -------------- An HTML attachment was scrubbed... URL: From kwangyul.seo at gmail.com Mon Jun 27 08:48:56 2016 From: kwangyul.seo at gmail.com (KwangYul Seo) Date: Mon, 27 Jun 2016 17:48:56 +0900 Subject: [Haskell-cafe] [Haskell] The Haddock documentation is not showing up on the Hackage In-Reply-To: References: Message-ID: Thanks! But the build log still says that c2hs could not be found: https://hackage.haskell.org/package/enchant-0.1.0.0/reports/1 It would be nice if c2hs is available on the Hackage server because it is used by many Haskell packages to create FFI bindings. Thanks, Kwang Yul Seo On Mon, Jun 27, 2016 at 5:46 PM, KwangYul Seo wrote: > > > On Mon, Jun 27, 2016 at 4:01 PM, Henning Thielemann < > lemming at henning-thielemann.de> wrote: > >> >> On Mon, 27 Jun 2016, KwangYul Seo wrote: >> >> I uploaded a package named enchant on the Hackage last week, but the >>> Haddock documentation is not showing up yet. The Status field says "Docs >>> pending" and "Build status unknown". >>> >> >> This is certainly not for haskell at haskell.org. I am answering to >> haskell-cafe and cabal-devel. >> >> https://hackage.haskell.org/package/enchant-0.1.0.0 >>> >>> enchant uses c2hs as a build tool to generate the FFI binding and >>> requires libenchant-dev to be installed on the machine. I wonder how I can >>> tell these build requirements to the Hackage server. >>> >> >> I assume that it is not a good idea to install many additional packages >> on the Haskell server. Thus I think the best you can do is to upload the >> documentation yourself via the package maintenance site. >> >> Here is a script that should help creating the docs locally and upload >> them to Hackage: >> >> https://raw.githubusercontent.com/ekmett/lens/master/scripts/hackage-docs.sh >> > > Thanks for the tip! I didn't know that I can upload the documentation > separately from the source. > > Regards, > Kwang Yul Seo > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mikhail.glushenkov at gmail.com Mon Jun 27 09:09:19 2016 From: mikhail.glushenkov at gmail.com (Mikhail Glushenkov) Date: Mon, 27 Jun 2016 11:09:19 +0200 Subject: [Haskell-cafe] [Haskell] The Haddock documentation is not showing up on the Hackage In-Reply-To: References: Message-ID: Hi, > On Mon, Jun 27, 2016 at 4:01 PM, Henning Thielemann > wrote: >> Here is a script that should help creating the docs locally and upload >> them to Hackage: >> >> https://raw.githubusercontent.com/ekmett/lens/master/scripts/hackage-docs.sh Note that starting with cabal-install 1.24 you can use 'cabal upload --doc' to build and upload documentation. From david_carlson at oxfordcorp.com Mon Jun 27 12:49:03 2016 From: david_carlson at oxfordcorp.com (Dave Carlson) Date: Mon, 27 Jun 2016 12:49:03 +0000 Subject: [Haskell-cafe] Haskell contract position in US (TX) In-Reply-To: <906CD6CF9EB5C646B7A53873E2F834BF01F56B3D64@PRD-MSG-MBX-001.oaifield.onasgn.com> References: <906CD6CF9EB5C646B7A53873E2F834BF01F56B3D64@PRD-MSG-MBX-001.oaifield.onasgn.com> Message-ID: <906CD6CF9EB5C646B7A53873E2F834BF01F56B3D94@PRD-MSG-MBX-001.oaifield.onasgn.com> I have a client located in the US, Texas who is looking for a Haskell developer ideally with 8+/- years of development experience. If someone is interested in the position below please contact me ASAP. Thanks- Dave Location: TX (potential for some remote/ off-site work) Duration: 6+ months Position Title: Haskell Developer Duties: Client is looking for a Sr. level Haskell developer who has recent experience to work on an AI platform for their product team. Candidate will be assisting building the infrastructure and writing in Haskell coding. Candidate will need to come in from a mentor stand-point and help mentor and train/build- out of platform. Candidate needs to have functional programming experience and be able to do an implementation stack that is based on Haskell & Haskell programming. Candidate needs to be familiar with ECO system tools within Haskell. Candidate needs to have some experience with basic micro services in Haskell & have some Big Data process experience and know how to move data through a pipeline. Candidate needs to understand best practices and bring in the right tools to get the problem done. Necessary Experience: 8+ years of recent Haskell Experience (coding experience & build out) Experience with Functional Programming Able to do implementation stack Exp. with ECO system tools within Haskell Exp. with Basic Micro Services in Haskell Exp. with Big Data process & how to move data through Pipeline Understanding best practices and bring in right tools to get the problem done Desired Experience: Scala Experience GO experience F# Experience Ocamel Language __________________________________ Dave Carlson Senior Recruiting Executive, Software & Hardware Oxford International 100 Cummings Center Suite 365G Beverly, MA 01915 877.258.9982 Office 978.717.7659 Direct david_carlson at oxfordcorp.com NYSE: ASGN oxfordcorp.com | LinkedIn | facebook | twitter | Oxford Index Blog The Right Talent. Right Now. The information transmitted, including attachments, is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this e-mail in error, please notify the sender immediately by replying to the message and deleting the material from your computer. -------------- next part -------------- An HTML attachment was scrubbed... URL: From corentin.dupont at gmail.com Mon Jun 27 13:27:27 2016 From: corentin.dupont at gmail.com (Corentin Dupont) Date: Mon, 27 Jun 2016 15:27:27 +0200 Subject: [Haskell-cafe] Help to choose a library name In-Reply-To: <1467015903.2214.0.camel@joachim-breitner.de> References: <1467015903.2214.0.camel@joachim-breitner.de> Message-ID: Hi Joachim, I agree... I looked hard at them :) https://wiki.haskell.org/Functional_Reactive_Programming I need a library with a DSL able to create forms on the fly, in a "demand driven" way. I.e. if at some point in time the user program needs a boolean from the user, a radio button will be created on the screen of that user. The objective is to retrieve the boolean, creating the form is just a way to do that. Complex forms can be created, capable of generating full ADTs. The styling of the form is not important. Other requirements: - it should be possible to run the event DSL in a monad different from IO. - the event DSL need to be instance of Alternative: events can be put in concurrence, the first to fire wins. On Mon, Jun 27, 2016 at 10:25 AM, Joachim Breitner wrote: > Hi, > > Am Montag, den 27.06.2016, 09:38 +0200 schrieb Corentin Dupont: > > I need it for the game Nomyx, but couldn't find the features I wanted > > from the existing libraries. > > any chance to extend existing libraries to support what you need? > Library proliferation does not really help the ecosystem. > > 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 > _______________________________________________ > 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 carter.schonwald at gmail.com Mon Jun 27 14:01:32 2016 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Mon, 27 Jun 2016 14:01:32 +0000 (UTC) Subject: [Haskell-cafe] Extensionality in category theory RE: User Requirements Survey for CT Software (Beta) In-Reply-To: References: Message-ID: <9D6ED38D20C05297.9DD371D4-0F2E-46D7-A3C6-1B4A0E6D4AF0@mail.outlook.com> Hey Joie, I'll cc the list because certain list members (Dan, Gershom, and others) can better clarify / expound on this topic  Probably the simplest example is function extensionality , that is the reasoning principle that if forall X , g X == f X , then g == f My understanding is that it can be derived in a homotopy type theory setting, but in in more standard type theories like vanilla coq / Agda / lean that folks often use to model certain categorical objects, this is at best a not computable axiom.   The very definitions of an epimorphism and monomorphism (the categorical generalization of the dual pair of surjective and injective mappings) Have a sort of function extensional equality! https://ncatlab.org/nlab/show/equality  Touches a wee bit On the topic of equalities.  There's a number of approaches to treating / deciding when two ... Things (a very technical term 😉)are the same / equal.  -Carter _____________________________ From: Breiner, Spencer J. (Fed) Sent: Monday, June 27, 2016 9:44 AM Subject: RE: [Haskell-cafe] User Requirements Survey for CT Software (Beta) To: Carter Schonwald , Murphy, Joie R. (Assoc) Cc: Subrahmanian, Eswaran (Assoc) Carter,   Thanks for your reply. I removed the Haskell mailing list from the cc because I don’t know the list’s etiquette, but please forward this response back to the list if you are aiming for a public discussion.   I’m not quite sure what you mean by “extensional elements”? Is this extension in the sense of “one class extends another” (in which case this would be expressed explicitly by functors). Or extension in the (related) sense of “the extension of a proposition”, the elements which satisfy it. These sorts of issues would probably be expressed as functors into (some computational implementation of) finite sets.   Let me know and I’m happy to talk some more.   Thanks again, Spencer Breiner NIST       From: Carter Schonwald [mailto:carter.schonwald at gmail.com] Sent: Friday, June 24, 2016 8:35 PM To: Murphy, Joie R. (Assoc) Cc: haskell-cafe at haskell.org; Subrahmanian, Eswaran (Assoc) ; Breiner, Spencer J. (Fed) Subject: Re: [Haskell-cafe] User Requirements Survey for CT Software (Beta)   How do you plan to handle extensional elements of category theory?  On Friday, June 24, 2016, Murphy, Joie R. (Assoc) wrote: Hello,   My name is Joie Murphy and I am a Summer Research Student at the US National Institute of Standards and Technology (NIST), working with Drs. Spencer Breiner and Eswaran Subrahmanian. We are currently gathering user requirements for category theoretic software to be developed by or with NIST in the future. This questionnaire will give us insight about your past or present use of CT software and your ideal uses for such software. Providing us with the information on how you would like to use this type of software will help us to make the right design choices in development.   The survey is available on Google Forms:http://goo.gl/forms/vfOgR26dHnKynHU23   If you have any colleagues who might be willing to fill out this survey, you can forward our message or you can provide us with their contact information at the end of the survey. If you have any questions or concerns, please feel free to contact us by replying to this email.   We would like to thank you for your participation in this initial step of the development process.   Regards, Joie Murphy   -------------- next part -------------- An HTML attachment was scrubbed... URL: From spencer.breiner at nist.gov Mon Jun 27 14:47:45 2016 From: spencer.breiner at nist.gov (Breiner, Spencer J. (Fed)) Date: Mon, 27 Jun 2016 14:47:45 +0000 Subject: [Haskell-cafe] Extensionality in category theory RE: User Requirements Survey for CT Software (Beta) In-Reply-To: <9D6ED38D20C05297.9DD371D4-0F2E-46D7-A3C6-1B4A0E6D4AF0@mail.outlook.com> References: <9D6ED38D20C05297.9DD371D4-0F2E-46D7-A3C6-1B4A0E6D4AF0@mail.outlook.com> Message-ID: Carter, Hi. This is Spencer Breiner; I am Joie’s supervisor here at NIST. Extensionality is certainly an issue when we are talking about categorical models of type theory, but I don’t see it as such an issue here (which could just be lack of insight). Certainly it would depend on which type of functional component in the software is involved. In the simplest case, defining a finite category of paths from a directed acyclic graph poses no problems; ditto for path equations in the finite case. Of course, once we allow cyclic graphs we can get infinite categories, and (if I remember correctly) path equations becomes semi-decidable. In particular, we really need to distinguish between the abstract category and its presentation in terms of generators and relations. Whether this is a problem or not depends on what we want to do with the category. Functors out are no problem, functors in might be. The real issue seems to be whether you need and are able to check equalities between arrows. Where it does arise, I suspect the solution would be something like in HoTT, where we use computer-aided proof search to verify the equations that we need. Are there particular sorts of things that you would like to do with categories (besides modeling type theory ;-), where you think these sorts of issues would probably arise? For the work with Joie we are focused on user interface and functional requirements, but I am very interested in these sorts of questions. Thanks, Spencer From: Carter Schonwald [mailto:carter.schonwald at gmail.com] Sent: Monday, June 27, 2016 10:02 AM To: Murphy, Joie R. (Assoc) ; Breiner, Spencer J. (Fed) Cc: Subrahmanian, Eswaran (Assoc) ; haskell-cafe at haskell.org Subject: Extensionality in category theory RE: [Haskell-cafe] User Requirements Survey for CT Software (Beta) Hey Joie, I'll cc the list because certain list members (Dan, Gershom, and others) can better clarify / expound on this topic Probably the simplest example is function extensionality , that is the reasoning principle that if forall X , g X == f X , then g == f My understanding is that it can be derived in a homotopy type theory setting, but in in more standard type theories like vanilla coq / Agda / lean that folks often use to model certain categorical objects, this is at best a not computable axiom. The very definitions of an epimorphism and monomorphism (the categorical generalization of the dual pair of surjective and injective mappings) Have a sort of function extensional equality! https://ncatlab.org/nlab/show/equality Touches a wee bit On the topic of equalities. There's a number of approaches to treating / deciding when two ... Things (a very technical term 😉)are the same / equal. -Carter _____________________________ From: Breiner, Spencer J. (Fed) > Sent: Monday, June 27, 2016 9:44 AM Subject: RE: [Haskell-cafe] User Requirements Survey for CT Software (Beta) To: Carter Schonwald >, Murphy, Joie R. (Assoc) > Cc: Subrahmanian, Eswaran (Assoc) > Carter, Thanks for your reply. I removed the Haskell mailing list from the cc because I don’t know the list’s etiquette, but please forward this response back to the list if you are aiming for a public discussion. I’m not quite sure what you mean by “extensional elements”? Is this extension in the sense of “one class extends another” (in which case this would be expressed explicitly by functors). Or extension in the (related) sense of “the extension of a proposition”, the elements which satisfy it. These sorts of issues would probably be expressed as functors into (some computational implementation of) finite sets. Let me know and I’m happy to talk some more. Thanks again, Spencer Breiner NIST From: Carter Schonwald [mailto:carter.schonwald at gmail.com] Sent: Friday, June 24, 2016 8:35 PM To: Murphy, Joie R. (Assoc) > Cc: haskell-cafe at haskell.org; Subrahmanian, Eswaran (Assoc) >; Breiner, Spencer J. (Fed) > Subject: Re: [Haskell-cafe] User Requirements Survey for CT Software (Beta) How do you plan to handle extensional elements of category theory? On Friday, June 24, 2016, Murphy, Joie R. (Assoc) > wrote: Hello, My name is Joie Murphy and I am a Summer Research Student at the US National Institute of Standards and Technology (NIST), working with Drs. Spencer Breiner and Eswaran Subrahmanian. We are currently gathering user requirements for category theoretic software to be developed by or with NIST in the future. This questionnaire will give us insight about your past or present use of CT software and your ideal uses for such software. Providing us with the information on how you would like to use this type of software will help us to make the right design choices in development. The survey is available on Google Forms:http://goo.gl/forms/vfOgR26dHnKynHU23 If you have any colleagues who might be willing to fill out this survey, you can forward our message or you can provide us with their contact information at the end of the survey. If you have any questions or concerns, please feel free to contact us by replying to this email. We would like to thank you for your participation in this initial step of the development process. Regards, Joie Murphy -------------- next part -------------- An HTML attachment was scrubbed... URL: From cma at bitemyapp.com Mon Jun 27 18:49:22 2016 From: cma at bitemyapp.com (Christopher Allen) Date: Mon, 27 Jun 2016 13:49:22 -0500 Subject: [Haskell-cafe] Haskell contract position in US (TX) In-Reply-To: <906CD6CF9EB5C646B7A53873E2F834BF01F56B3D94@PRD-MSG-MBX-001.oaifield.onasgn.com> References: <906CD6CF9EB5C646B7A53873E2F834BF01F56B3D64@PRD-MSG-MBX-001.oaifield.onasgn.com> <906CD6CF9EB5C646B7A53873E2F834BF01F56B3D94@PRD-MSG-MBX-001.oaifield.onasgn.com> Message-ID: The client uses Scala only, there's no Haskell involved in this gig. The recruiting org itself is a bit shady too. I wasn't looking for a Haskell job (I'm happily employed using Haskell), but I thought I'd put this out there so no one is misled. On Mon, Jun 27, 2016 at 7:49 AM, Dave Carlson wrote: > I have a client located in the US, Texas who is looking for a Haskell > developer ideally with 8+/- years of development experience. If someone is > interested in the position below please contact me ASAP. > > Thanks- Dave > > *Location: *TX (potential for some remote/ off-site work) > > *Duration: *6+ months > > *Position Title: *Haskell Developer > > > *Duties: *Client is looking for a Sr. level Haskell developer who has > recent experience to work on an AI platform for their product team. > Candidate will be assisting building the infrastructure and writing in > Haskell coding. Candidate will need to come in from a mentor stand-point > and help mentor and train/build- out of platform. Candidate needs to have > functional programming experience and be able to do an implementation stack > that is based on Haskell & Haskell programming. Candidate needs to be > familiar with ECO system tools within Haskell. Candidate needs to have some > experience with basic micro services in Haskell & have some Big Data > process experience and know how to move data through a pipeline. Candidate > needs to understand best practices and bring in the right tools to get the > problem done. > > > > *Necessary Experience:* > 8+ years of recent Haskell Experience (coding experience & build out) > Experience with Functional Programming > Able to do implementation stack > Exp. with ECO system tools within Haskell > > Exp. with Basic Micro Services in Haskell > Exp. with Big Data process & how to move data through Pipeline > Understanding best practices and bring in right tools to get the problem > done > > > > *Desired Experience:* > > Scala Experience > GO experience > F# Experience > Ocamel Language > > > > __________________________________ > > *Dave Carlson* > > *Senior Recruiting Executive, Software & Hardware* > *Oxford International* > > 100 Cummings Center Suite 365G > > Beverly, MA 01915 > > > > 877.258.9982 Office > > 978.717.7659 Direct > > david_carlson at oxfordcorp.com > > > > NYSE: ASGN > > > * oxfordcorp.com | LinkedIn > | facebook > | twitter > | Oxford Index Blog > * > > > > > > > The Right Talent.* Right Now.* > > > > The information transmitted, including attachments, is intended only for > the person or entity to which it is addressed and may contain confidential > and/or privileged material. Any review, retransmission, dissemination or > other use of, or taking of any action in reliance upon this information by > persons or entities other than the intended recipient is prohibited. If you > received this e-mail in error, please notify the sender immediately by > replying to the message and deleting the material from your computer. > > _______________________________________________ > 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: From david_carlson at oxfordcorp.com Mon Jun 27 19:26:59 2016 From: david_carlson at oxfordcorp.com (Dave Carlson) Date: Mon, 27 Jun 2016 19:26:59 +0000 Subject: [Haskell-cafe] Haskell contract position in US (TX) In-Reply-To: References: <906CD6CF9EB5C646B7A53873E2F834BF01F56B3D64@PRD-MSG-MBX-001.oaifield.onasgn.com> <906CD6CF9EB5C646B7A53873E2F834BF01F56B3D94@PRD-MSG-MBX-001.oaifield.onasgn.com> Message-ID: <906CD6CF9EB5C646B7A53873E2F834BF01F56B5E38@PRD-MSG-MBX-001.oaifield.onasgn.com> In addition to the description below (from the account manager dealing directly with the client) – “Client is trying to build out a team of Haskell & Scala developers and wants a Sr. Haskell developer to be able to train and mentor his team on Haskell development and best practices.” Additionally “The manager knows Scala but they really want to use Haskell for this project. The manager knows his way around Haskell but needs help understanding things like – which frameworks to use, etc.” Should anyone have any questions or comments regarding this position please contact me directly. Dave From: Haskell-Cafe [mailto:haskell-cafe-bounces at haskell.org] On Behalf Of Christopher Allen Sent: Monday, June 27, 2016 2:49 PM To: Haskell-Cafe at haskell.org Subject: Re: [Haskell-cafe] Haskell contract position in US (TX) The client uses Scala only, there's no Haskell involved in this gig. The recruiting org itself is a bit shady too. I wasn't looking for a Haskell job (I'm happily employed using Haskell), but I thought I'd put this out there so no one is misled. On Mon, Jun 27, 2016 at 7:49 AM, Dave Carlson > wrote: I have a client located in the US, Texas who is looking for a Haskell developer ideally with 8+/- years of development experience. If someone is interested in the position below please contact me ASAP. Thanks- Dave Location: TX (potential for some remote/ off-site work) Duration: 6+ months Position Title: Haskell Developer Duties: Client is looking for a Sr. level Haskell developer who has recent experience to work on an AI platform for their product team. Candidate will be assisting building the infrastructure and writing in Haskell coding. Candidate will need to come in from a mentor stand-point and help mentor and train/build- out of platform. Candidate needs to have functional programming experience and be able to do an implementation stack that is based on Haskell & Haskell programming. Candidate needs to be familiar with ECO system tools within Haskell. Candidate needs to have some experience with basic micro services in Haskell & have some Big Data process experience and know how to move data through a pipeline. Candidate needs to understand best practices and bring in the right tools to get the problem done. Necessary Experience: 8+ years of recent Haskell Experience (coding experience & build out) Experience with Functional Programming Able to do implementation stack Exp. with ECO system tools within Haskell Exp. with Basic Micro Services in Haskell Exp. with Big Data process & how to move data through Pipeline Understanding best practices and bring in right tools to get the problem done Desired Experience: Scala Experience GO experience F# Experience Ocamel Language __________________________________ Dave Carlson Senior Recruiting Executive, Software & Hardware Oxford International 100 Cummings Center Suite 365G Beverly, MA 01915 877.258.9982 Office 978.717.7659 Direct david_carlson at oxfordcorp.com NYSE: ASGN oxfordcorp.com | LinkedIn | facebook | twitter | Oxford Index Blog The Right Talent. Right Now. The information transmitted, including attachments, is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this e-mail in error, please notify the sender immediately by replying to the message and deleting the material from your computer. _______________________________________________ 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: From yallop at gmail.com Mon Jun 27 22:02:53 2016 From: yallop at gmail.com (Jeremy Yallop) Date: Mon, 27 Jun 2016 23:02:53 +0100 Subject: [Haskell-cafe] International summer school on metaprogramming (Cambridge, 8-12 Aug 2016) In-Reply-To: References: Message-ID: [A final call for applications for the Metaprogramming Summer School. We're happy to announce that Oracle Labs will also sponsor this event, which will allow us to fully subsidise more applicants. If you or someone you know think of applying, please note that the deadline for applications _and_ support letters is this Thursday, 30th June. Yours, Jeremy, Gemma, and Ohad.] ==================================================================== International summer school on metaprogramming Robinson College, Cambridge, United Kingdom 8th-12th August, 2016 http://www.cl.cam.ac.uk/events/metaprog2016/ ==================================================================== Metaprogramming is an approach to improving programs by treating program fragments (such as expressions or types) as values that the program can manipulate. Metaprogramming comes in various forms, including * staged programming: treating expressions as program values. The execution of a staged program is spread over several phases, with each stage using the available data to generate specialized code. Staged programming has a wide variety of applications — numeric computations, parsing, database queries, generic programming, domain specific languages, and many more. Precompiling the staged code can have dramatic performance improvements, in some cases an order of magnitude or more. * generic programming: treating types as program values. Generic programming can improve code flexibility, allowing to give a single definition of a function that operates in a predictable (but not uniform) way on many different types. Generic programming techniques can be used to define a wide variety of functions, including traversals, comparisons, pretty printers, serialization functions, and many more. The goal of the summer school is to explore the state-of-the art in metaprogramming and its applications, covering both theory and practice. -------------------------------------------------------------------- Lecturers and courses Philip Wadler, Sam Lindley and Shayan Najd (University of Edinburgh) Normalisation and embedding Simon Peyton Jones (Microsoft Research) Oleg Kiselyov (Tohoku University) Type-safe embedding and optimizing domain-specific languages in the typed final style Laurence Tratt (Kings College London) The highs and lows of macros in a modern language Jeremy Yallop (University of Cambridge) Staging generic programming Martin Berger (University of Sussex) Foundations of meta-programming Chris Seaton (Oracle Labs) Self-Specialising Interpreters and Partial Evaluation José Pedro Magalhães (Standard Chartered) -------------------------------------------------------------------- Prerequisites The school is aimed at graduate students in programming languages and related areas, but is open to researchers, practitioners and strong masters students with the support of a supervisor. Some experience of typed functional programming in Haskell, OCaml, Scala, or a similar language will be assumed. -------------------------------------------------------------------- Costs Thanks to generous industrial sponsorship, we are able to offer places with significantly reduced fees. There are three categories of fees, all of which cover registration, accommodation in Robinson College from Monday to Friday, and all meals and refreshments. Participants who can pay the full fees will help allocate more fully-subsidised slots to less financially-able students. Your category of fees will not have any direct bearing on your acceptance into the school, but could affect how many slots we can offer. * The full fee is £800. * The standard (partly-subsidised) fee is £295. * We also have a limited number of fully-subsidised places available for a nominal registration fee of £50. We will notify you of your fee upon acceptance. -------------------------------------------------------------------- Application procedure You will need to complete the online registration form at: http://www.cl.cam.ac.uk/events/metaprog2016/application.html and ensure your referees send your references to: metaprog-2016 at cl.cam.ac.uk by the application deadline. TIMETABLE * 30 June: Application and reference letters deadline. * 10 July: Notification of acceptance. * 24 July: Registration deadline. * 8 August: Summer school. -------------------------------------------------------------------- Further information For questions relating to the material of the school, please contact Jeremy Yallop (jeremy.yallop at cl.cam.ac.uk) Ohad Kammar (ohad.kammar at cs.ox.ac.uk) For administrative questions, please contact Gemma Gordon (gg417 at cl.cam.ac.uk) From corentin.dupont at gmail.com Mon Jun 27 22:31:22 2016 From: corentin.dupont at gmail.com (Corentin Dupont) Date: Tue, 28 Jun 2016 00:31:22 +0200 Subject: [Haskell-cafe] Help to choose a library name In-Reply-To: References: <1467015903.2214.0.camel@joachim-breitner.de> Message-ID: Wow, it is very impressive. I need to give it more time. I have one question regarding this example: main = keep $ do th <- liftIO myThreadId -- thread 89 r <- async (do threadDelay 1000000; return "hello") -- thread 90 <|> async (return "world") -- thread 91 th' <- liftIO myThreadId -- thread 90 and 91 liftIO $ print (th, th', r) -- thread 90 and 91 Output: (ThreadId 89,ThreadId 91,"world") (ThreadId 89,ThreadId 90,"hello") For me it's counter-intuitive that there are two outputs. What is the reason behind? It seems that the use of the <|> affects the rest of the program. It looks strange to me because the two lines situated after the <|> does not look "syntactically" involved, if you see what I mean. Instead I was expecting only one output, with the first thread to finish "wins". In fact I implemented it like that: http://www.corentindupont.info/blog/posts/Programming/2014-09-23-Nomyx-Language.html#event-alternative-interface Cheers Corentin On Mon, Jun 27, 2016 at 8:22 PM, Geraldus wrote: > Sorry, here is some links: > Wiki paga on GitHub > https://github.com/agocorona/transient/wiki/Transient-tutorial > Programming at specification level > https://github.com/agocorona/transient/wiki/Programming-at-the-specification-level > > пн, 27 июн. 2016 г. в 23:19, Geraldus : > >> Hi! Have you looked at Transient by Alberto Gomez Corona? >> >> пн, 27 июн. 2016 г. в 18:27, Corentin Dupont : >> >>> Hi Joachim, >>> I agree... I looked hard at them :) >>> https://wiki.haskell.org/Functional_Reactive_Programming >>> >>> I need a library with a DSL able to create forms on the fly, in a >>> "demand driven" way. >>> I.e. if at some point in time the user program needs a boolean from the >>> user, a radio button will be created on the screen of that user. The >>> objective is to retrieve the boolean, creating the form is just a way to do >>> that. Complex forms can be created, capable of generating full ADTs. The >>> styling of the form is not important. >>> Other requirements: >>> - it should be possible to run the event DSL in a monad different from >>> IO. >>> - the event DSL need to be instance of Alternative: events can be put in >>> concurrence, the first to fire wins. >>> >>> >>> >>> >>> On Mon, Jun 27, 2016 at 10:25 AM, Joachim Breitner < >>> mail at joachim-breitner.de> wrote: >>> >>>> Hi, >>>> >>>> Am Montag, den 27.06.2016, 09:38 +0200 schrieb Corentin Dupont: >>>> > I need it for the game Nomyx, but couldn't find the features I wanted >>>> > from the existing libraries. >>>> >>>> any chance to extend existing libraries to support what you need? >>>> Library proliferation does not really help the ecosystem. >>>> >>>> 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 >>>> _______________________________________________ >>>> 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 monkleyon at googlemail.com Mon Jun 27 23:00:14 2016 From: monkleyon at googlemail.com (MarLinn) Date: Tue, 28 Jun 2016 01:00:14 +0200 Subject: [Haskell-cafe] Using streams to clarify (?) the signature of Data.Text.replace In-Reply-To: <994773d1-8f8e-4cdb-b5c4-a11b526fba40@googlegroups.com> References: <8868df54-909c-41af-9b5f-f1cf699cd789@googlegroups.com> <84e69e23-d4ea-e5b8-08c9-1e8d341e0e4c@cs.otago.ac.nz> <994773d1-8f8e-4cdb-b5c4-a11b526fba40@googlegroups.com> Message-ID: <9b23429f-95ff-9114-e5d6-dbad99e2e54c@gmail.com> > > Imagine a generalized version of replace that 1) works on > streams, and > > > replace' :: Stream (Stream (Of Text) m) m () > > -> Stream (Stream (Of Text) m) m Void > > -> Stream (Of Text) m r > > -> Stream (Of Text) m r > > > > > > Do you find easy to intuit, just by looking at that signature, which > > is the function of each argument? > > Absolutely not. In fact, this crossed my personal complexity horizon > and is still accelerating towards some kind of singularity. > I agree 100%. What is going on here? If you just wanted to clarify the signature, why not just use type synonyms? type Replaced = Text type Replacement = Text replace :: Replaced -> Replacement -> Text -> Text No breaking changes necessary. You don't even have to export the synonyms. Or generalize the function in a much simpler fashion: replace :: (Text -> Text) -> Text -> Text There should be no ambiguity here. It's less powerful than the stream-monster because the argument function is stateless - but then whatever kind of stream you use probably has some zipWith function that you could use for more complicated cases. > A possible use case: you want to "splice" the contents of a sequence > of files into another file at certain words, without having to keep > whole files in memory, and without using lazy I/O. I'm not really familiar with streams or pipes, but that does sound like a perfect use case for conduits. Still, I'm at a loss how that thing would look internally. How do you "find" a stream of Text in another Text? What does that even mean, semantically? So if I understand the use case correctly, you have some "trigger words" in a Text and want to replace each trigger with the contents of a file, as in a templating system. The simplest type I could come up with for that would be replace' :: Map Text (Stream (Of Text) m ()) -> Stream (Of Text) m r -> Stream (Of Text) m r Note: No Stream on the left side of an arrow. No Stream of triggers, so ordering is not important anymore. It wasn't helpful anyway. Easily generalized to non-text stuff. And as such it may already be part of some streaming libraries. Which is exactly as it should be: streaming functions should be part of streaming libraries, not a text library. From heraldhoi at gmail.com Tue Jun 28 05:25:13 2016 From: heraldhoi at gmail.com (Geraldus) Date: Tue, 28 Jun 2016 05:25:13 +0000 Subject: [Haskell-cafe] Help to choose a library name In-Reply-To: References: <1467015903.2214.0.camel@joachim-breitner.de> Message-ID: This is because the whole computation is kept (via `keep`). If you just run computation with `runTransient` you will see only “world” in output and then program ends, however since the computation is kept when second action finishes it prints “hello”. `r <- async … <|> async …` Here `r` is a continuation, everything below it will be re-computed when any of alternatives will return a result. For example, you can add another choice: `r <- async … <|> async … <|> waitEvents someEventAction` In this case every time your `someEventAction` returns a value `r` takes it and the rest of code re-executed (or in other words when you have a new continuation the computation re-evaluated). Hope this makes sense. вт, 28 июн. 2016 г. в 3:31, Corentin Dupont : > Wow, it is very impressive. I need to give it more time. > I have one question regarding this example: > > main = keep $ do > th <- liftIO myThreadId -- thread 89 > r <- async (do threadDelay 1000000; return "hello") -- thread 90 > <|> async (return "world") -- thread 91 > th' <- liftIO myThreadId -- thread 90 and 91 > liftIO $ print (th, th', r) -- thread 90 and 91 > > Output: > > (ThreadId 89,ThreadId 91,"world") > (ThreadId 89,ThreadId 90,"hello") > > > For me it's counter-intuitive that there are two outputs. What is the > reason behind? > It seems that the use of the <|> affects the rest of the program. > It looks strange to me because the two lines situated after the <|> does > not look "syntactically" involved, if you see what I mean. > Instead I was expecting only one output, with the first thread to finish > "wins". > In fact I implemented it like that: > http://www.corentindupont.info/blog/posts/Programming/2014-09-23-Nomyx-Language.html#event-alternative-interface > > Cheers > Corentin > > > On Mon, Jun 27, 2016 at 8:22 PM, Geraldus wrote: > >> Sorry, here is some links: >> Wiki paga on GitHub >> https://github.com/agocorona/transient/wiki/Transient-tutorial >> Programming at specification level >> https://github.com/agocorona/transient/wiki/Programming-at-the-specification-level >> >> пн, 27 июн. 2016 г. в 23:19, Geraldus : >> >>> Hi! Have you looked at Transient by Alberto Gomez Corona? >>> >>> пн, 27 июн. 2016 г. в 18:27, Corentin Dupont >> >: >>> >>>> Hi Joachim, >>>> I agree... I looked hard at them :) >>>> https://wiki.haskell.org/Functional_Reactive_Programming >>>> >>>> I need a library with a DSL able to create forms on the fly, in a >>>> "demand driven" way. >>>> I.e. if at some point in time the user program needs a boolean from the >>>> user, a radio button will be created on the screen of that user. The >>>> objective is to retrieve the boolean, creating the form is just a way to do >>>> that. Complex forms can be created, capable of generating full ADTs. The >>>> styling of the form is not important. >>>> Other requirements: >>>> - it should be possible to run the event DSL in a monad different from >>>> IO. >>>> - the event DSL need to be instance of Alternative: events can be put >>>> in concurrence, the first to fire wins. >>>> >>>> >>>> >>>> >>>> On Mon, Jun 27, 2016 at 10:25 AM, Joachim Breitner < >>>> mail at joachim-breitner.de> wrote: >>>> >>>>> Hi, >>>>> >>>>> Am Montag, den 27.06.2016, 09:38 +0200 schrieb Corentin Dupont: >>>>> > I need it for the game Nomyx, but couldn't find the features I wanted >>>>> > from the existing libraries. >>>>> >>>>> any chance to extend existing libraries to support what you need? >>>>> Library proliferation does not really help the ecosystem. >>>>> >>>>> 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 >>>>> _______________________________________________ >>>>> 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 oleg at okmij.org Tue Jun 28 07:36:47 2016 From: oleg at okmij.org (Oleg) Date: Tue, 28 Jun 2016 16:36:47 +0900 Subject: [Haskell-cafe] Instances for (->) a (b :: * -> *)? Message-ID: <20160628073647.GA1043@Magus.sf-private> Jim Pryor wrote: > If one wants to declare instances for a type schema `a -> _`, one writes > something like this: > instance Context => Class parameters ... ((->) a) where { ... } > But what if you want to declare instances for a type schema `a -> b _`, > that is, where the slot to be filled is not just the result of (->) a, > but rather the composition of that together with another type operation > b :: * -> *? Then one defines a new type: newtype TwoArrow a b x = TwoArrow{unTA:: a -> b -> x} instance MyClass (TwoArrow a b) where ... Ditto for the composition. Alas, one is stuck with adding the dummy conversions TwoArrow/unTA at various places. > Concretely, here's what I'm trying to achieve. I wrote a typeclass for > MonadReaders that are embedded inside (one level) of other MonadReaders, > like this: > {-# LANGUAGE FunctionalDependencies FlexibleInstances > UndecidableInstances #-} > class MonadReader w m => DeepMonadReader w r m | m -> r where > { deepask :: m r > ; deepask = deepreader id The first instance of the curly-braces notation on this list in more than a decade! I think you are trying to build a monad with several pieces of environment. Assuming that just making a record with two different pieces (and making that record the single environment) doesn't work for you, you can find many solutions on Hackage. For example, various extensible effects libraries offer the desired functionality right out of the box. Or, if you really want to define a new class, why not to do something more general, like class Monad m => MonadMReader var r m | var m -> r where ask :: var -> m r to be used like data Var1 = Var1; data Var2 = Var2 do x <- ask Var1 y <- ask Var2 return $ x + y (and implement it, that is, define the instance any way you wish, e.g., with a Free or a Freer monad). For completeness, the old `reflection' trick, see https://hackage.haskell.org/package/reflection offers multiple pieces of configuration data. From diaz.carrete at gmail.com Tue Jun 28 07:49:57 2016 From: diaz.carrete at gmail.com (=?UTF-8?Q?Daniel_D=C3=ADaz?=) Date: Tue, 28 Jun 2016 00:49:57 -0700 (PDT) Subject: [Haskell-cafe] Using streams to clarify (?) the signature of Data.Text.replace In-Reply-To: <9b23429f-95ff-9114-e5d6-dbad99e2e54c@gmail.com> References: <8868df54-909c-41af-9b5f-f1cf699cd789@googlegroups.com> <84e69e23-d4ea-e5b8-08c9-1e8d341e0e4c@cs.otago.ac.nz> <994773d1-8f8e-4cdb-b5c4-a11b526fba40@googlegroups.com> <9b23429f-95ff-9114-e5d6-dbad99e2e54c@gmail.com> Message-ID: <4e7bee7c-2925-4f00-b15a-636a5292012a@googlegroups.com> > > Which is exactly as it should be: streaming > functions should be part of streaming libraries, not a text library. > > _______________________________________________ > > Note however that a stream of strict texts is like a generalized Data.Text.Lazy.Text in which you can have effects when producing each chunk, and there's also a result value at the end that is useful for things like dividing the stream. Text-specific functions that worked on such streams (say, divide the stream at a given Char) would belong in a text library, I think. The package streaming-bytestring does something similar for lazy bytestrings. -------------- next part -------------- An HTML attachment was scrubbed... URL: From agocorona at gmail.com Tue Jun 28 07:50:42 2016 From: agocorona at gmail.com (Alberto G. Corona ) Date: Tue, 28 Jun 2016 09:50:42 +0200 Subject: [Haskell-cafe] Help to choose a library name In-Reply-To: References: Message-ID: Rendez-vous sounds great 2016-06-27 9:38 GMT+02:00 Corentin Dupont : > Hi community, > I'm writing a reactive programming library (yet another). > I need it for the game Nomyx, but couldn't find the features I wanted from > the existing libraries. > Now the library is called Nomyx-Events. But I'd like to find a cool name > that is not related to Nomyx... > Some propositions: > - Nomev > - Noa > Some French names: > - Imprevu (French for unforseen, like in "unforseen event"). > - Rendez-vous > - Dejavu > > I like a lot Imprevu. How does it sound to English native speakers? > > 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. > -- Alberto. -------------- next part -------------- An HTML attachment was scrubbed... URL: From agocorona at gmail.com Tue Jun 28 08:04:12 2016 From: agocorona at gmail.com (Alberto G. Corona ) Date: Tue, 28 Jun 2016 10:04:12 +0200 Subject: [Haskell-cafe] Help to choose a library name In-Reply-To: References: <1467015903.2214.0.camel@joachim-breitner.de> Message-ID: Corentin: Transient has the same behaviour than your reactive library. Your library must produce two results if you press the first and then the second button, (and more if you press them more times). In the example, return "hello" and return "world" are two different events that are triggered inmediately, and each one produces an output. The Transient EDSL for Web programming has the same behaviour than yours and use the same <|> (submitButton "hello" `fire` OnClick) <|> (submitButton "world" `fire` onClick) return either one or the other. But it can produce, like yours (I suppose) two or more results, as many events as you trigger. 2016-06-28 0:31 GMT+02:00 Corentin Dupont : > Wow, it is very impressive. I need to give it more time. > I have one question regarding this example: > > main = keep $ do > th <- liftIO myThreadId -- thread 89 > r <- async (do threadDelay 1000000; return "hello") -- thread 90 > <|> async (return "world") -- thread 91 > th' <- liftIO myThreadId -- thread 90 and 91 > liftIO $ print (th, th', r) -- thread 90 and 91 > > Output: > > (ThreadId 89,ThreadId 91,"world") > (ThreadId 89,ThreadId 90,"hello") > > > For me it's counter-intuitive that there are two outputs. What is the > reason behind? > It seems that the use of the <|> affects the rest of the program. > It looks strange to me because the two lines situated after the <|> does > not look "syntactically" involved, if you see what I mean. > Instead I was expecting only one output, with the first thread to finish > "wins". > In fact I implemented it like that: > http://www.corentindupont.info/blog/posts/Programming/2014-09-23-Nomyx-Language.html#event-alternative-interface > > Cheers > Corentin > > > On Mon, Jun 27, 2016 at 8:22 PM, Geraldus wrote: > >> Sorry, here is some links: >> Wiki paga on GitHub >> https://github.com/agocorona/transient/wiki/Transient-tutorial >> Programming at specification level >> https://github.com/agocorona/transient/wiki/Programming-at-the-specification-level >> >> пн, 27 июн. 2016 г. в 23:19, Geraldus : >> >>> Hi! Have you looked at Transient by Alberto Gomez Corona? >>> >>> пн, 27 июн. 2016 г. в 18:27, Corentin Dupont >> >: >>> >>>> Hi Joachim, >>>> I agree... I looked hard at them :) >>>> https://wiki.haskell.org/Functional_Reactive_Programming >>>> >>>> I need a library with a DSL able to create forms on the fly, in a >>>> "demand driven" way. >>>> I.e. if at some point in time the user program needs a boolean from the >>>> user, a radio button will be created on the screen of that user. The >>>> objective is to retrieve the boolean, creating the form is just a way to do >>>> that. Complex forms can be created, capable of generating full ADTs. The >>>> styling of the form is not important. >>>> Other requirements: >>>> - it should be possible to run the event DSL in a monad different from >>>> IO. >>>> - the event DSL need to be instance of Alternative: events can be put >>>> in concurrence, the first to fire wins. >>>> >>>> >>>> >>>> >>>> On Mon, Jun 27, 2016 at 10:25 AM, Joachim Breitner < >>>> mail at joachim-breitner.de> wrote: >>>> >>>>> Hi, >>>>> >>>>> Am Montag, den 27.06.2016, 09:38 +0200 schrieb Corentin Dupont: >>>>> > I need it for the game Nomyx, but couldn't find the features I wanted >>>>> > from the existing libraries. >>>>> >>>>> any chance to extend existing libraries to support what you need? >>>>> Library proliferation does not really help the ecosystem. >>>>> >>>>> 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 >>>>> _______________________________________________ >>>>> 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. >>> >>> > -- Alberto. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok at cs.otago.ac.nz Tue Jun 28 23:05:13 2016 From: ok at cs.otago.ac.nz (Richard A. O'Keefe) Date: Wed, 29 Jun 2016 11:05:13 +1200 Subject: [Haskell-cafe] Using streams to clarify (?) the signature of Data.Text.replace In-Reply-To: <994773d1-8f8e-4cdb-b5c4-a11b526fba40@googlegroups.com> References: <8868df54-909c-41af-9b5f-f1cf699cd789@googlegroups.com> <84e69e23-d4ea-e5b8-08c9-1e8d341e0e4c@cs.otago.ac.nz> <994773d1-8f8e-4cdb-b5c4-a11b526fba40@googlegroups.com> Message-ID: On 27/06/16 7:17 PM, Daniel Díaz wrote: > Considering partial application, the order that makes the most sense is > > - what to look for > - what to replace it with > - the big string to search and replace in > > > Interesting, I forgot that the order of parameters can tell you things > about how they are used. Did you arrive at your conclusion by assuming > the "most variable" arguments come last? No, by considering "what would be most useful as a specialisation". It's different psychologically, but not, I believe, pragmatically. Of course, that approach only worked this time because whoever designed the function must have done some similar thinking. From corentin.dupont at gmail.com Wed Jun 29 08:21:44 2016 From: corentin.dupont at gmail.com (Corentin Dupont) Date: Wed, 29 Jun 2016 10:21:44 +0200 Subject: [Haskell-cafe] Help to choose a library name In-Reply-To: References: <1467015903.2214.0.camel@joachim-breitner.de> Message-ID: Hi Alberto, On Tue, Jun 28, 2016 at 10:04 AM, Alberto G. Corona wrote: > Corentin: > > Transient has the same behaviour than your reactive library. Your library > must produce two results if you press the first and then the second button, > (and more if you press them more times). > Actually no, in Nomyx the events, when they occur, are "consumed" and deleted (replaced by their result). So in the case of: True <$ inputButton "click here for True" <|> False <$ inputButton "click here for False" Once one of the buttons is clicked, both disappear and the result is produced. But it's merely a design choice I suppose... > > In the example, return "hello" and return "world" are two different > events that are triggered inmediately, and each one produces an output. > > The Transient EDSL for Web programming has the same behaviour than yours > and use the same <|> > > (submitButton "hello" `fire` OnClick) <|> (submitButton "world" `fire` > onClick) > > return either one or the other. But it can produce, like yours (I suppose) > two or more results, as many events as you trigger. > I like a lot Transient, I would have surely used it in Nomyx if it was around some years ago :) One question is, Transient seems a lot dependant on the IO monad, would it be possible to abstract from it? > > 2016-06-28 0:31 GMT+02:00 Corentin Dupont : > >> Wow, it is very impressive. I need to give it more time. >> I have one question regarding this example: >> >> main = keep $ do >> th <- liftIO myThreadId -- thread 89 >> r <- async (do threadDelay 1000000; return "hello") -- thread 90 >> <|> async (return "world") -- thread 91 >> th' <- liftIO myThreadId -- thread 90 and 91 >> liftIO $ print (th, th', r) -- thread 90 and 91 >> >> Output: >> >> (ThreadId 89,ThreadId 91,"world") >> (ThreadId 89,ThreadId 90,"hello") >> >> >> For me it's counter-intuitive that there are two outputs. What is the >> reason behind? >> It seems that the use of the <|> affects the rest of the program. >> It looks strange to me because the two lines situated after the <|> does >> not look "syntactically" involved, if you see what I mean. >> Instead I was expecting only one output, with the first thread to finish >> "wins". >> In fact I implemented it like that: >> http://www.corentindupont.info/blog/posts/Programming/2014-09-23-Nomyx-Language.html#event-alternative-interface >> >> Cheers >> Corentin >> >> >> On Mon, Jun 27, 2016 at 8:22 PM, Geraldus wrote: >> >>> Sorry, here is some links: >>> Wiki paga on GitHub >>> https://github.com/agocorona/transient/wiki/Transient-tutorial >>> Programming at specification level >>> https://github.com/agocorona/transient/wiki/Programming-at-the-specification-level >>> >>> пн, 27 июн. 2016 г. в 23:19, Geraldus : >>> >>>> Hi! Have you looked at Transient by Alberto Gomez Corona? >>>> >>>> пн, 27 июн. 2016 г. в 18:27, Corentin Dupont >>> >: >>>> >>>>> Hi Joachim, >>>>> I agree... I looked hard at them :) >>>>> https://wiki.haskell.org/Functional_Reactive_Programming >>>>> >>>>> I need a library with a DSL able to create forms on the fly, in a >>>>> "demand driven" way. >>>>> I.e. if at some point in time the user program needs a boolean from >>>>> the user, a radio button will be created on the screen of that user. The >>>>> objective is to retrieve the boolean, creating the form is just a way to do >>>>> that. Complex forms can be created, capable of generating full ADTs. The >>>>> styling of the form is not important. >>>>> Other requirements: >>>>> - it should be possible to run the event DSL in a monad different from >>>>> IO. >>>>> - the event DSL need to be instance of Alternative: events can be put >>>>> in concurrence, the first to fire wins. >>>>> >>>>> >>>>> >>>>> >>>>> On Mon, Jun 27, 2016 at 10:25 AM, Joachim Breitner < >>>>> mail at joachim-breitner.de> wrote: >>>>> >>>>>> Hi, >>>>>> >>>>>> Am Montag, den 27.06.2016, 09:38 +0200 schrieb Corentin Dupont: >>>>>> > I need it for the game Nomyx, but couldn't find the features I >>>>>> wanted >>>>>> > from the existing libraries. >>>>>> >>>>>> any chance to extend existing libraries to support what you need? >>>>>> Library proliferation does not really help the ecosystem. >>>>>> >>>>>> 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 >>>>>> _______________________________________________ >>>>>> 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. >>>> >>>> >> > > > -- > Alberto. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From corentin.dupont at gmail.com Wed Jun 29 08:31:53 2016 From: corentin.dupont at gmail.com (Corentin Dupont) Date: Wed, 29 Jun 2016 10:31:53 +0200 Subject: [Haskell-cafe] Help to choose a library name In-Reply-To: References: <1467015903.2214.0.camel@joachim-breitner.de> Message-ID: I understand, my comment was just on the syntax. Actually I have the same problem with "guard": test x = do guard x XXXXXXXXX YYYYYYYYY .... Unless I read all the monad body, there is no visual cue that XXX and YYY might not be run. The control flow is not syntactically visible. That's why I prefer using guards like that: test x = do guard x >> do XXXXXXXXX YYYYYYYYY .... Here the indentation shows that there is a control flow decision. Is it possible to do the same thing with Transient? Something like: main = keep $ do async (return "hello") <|> async (return "world") >>= \r -> do liftIO $ print r On Tue, Jun 28, 2016 at 7:25 AM, Geraldus wrote: > This is because the whole computation is kept (via `keep`). If you just > run computation with `runTransient` you will see only “world” in output and > then program ends, however since the computation is kept when second action > finishes it prints “hello”. > > `r <- async … <|> async …` > Here `r` is a continuation, everything below it will be re-computed when > any of alternatives will return a result. For example, you can add another > choice: > `r <- async … <|> async … <|> waitEvents someEventAction` > In this case every time your `someEventAction` returns a value `r` takes > it and the rest of code re-executed (or in other words when you have a new > continuation the computation re-evaluated). > > Hope this makes sense. > > вт, 28 июн. 2016 г. в 3:31, Corentin Dupont : > >> Wow, it is very impressive. I need to give it more time. >> I have one question regarding this example: >> >> main = keep $ do >> th <- liftIO myThreadId -- thread 89 >> r <- async (do threadDelay 1000000; return "hello") -- thread 90 >> <|> async (return "world") -- thread 91 >> th' <- liftIO myThreadId -- thread 90 and 91 >> liftIO $ print (th, th', r) -- thread 90 and 91 >> >> Output: >> >> (ThreadId 89,ThreadId 91,"world") >> (ThreadId 89,ThreadId 90,"hello") >> >> >> For me it's counter-intuitive that there are two outputs. What is the >> reason behind? >> It seems that the use of the <|> affects the rest of the program. >> It looks strange to me because the two lines situated after the <|> does >> not look "syntactically" involved, if you see what I mean. >> Instead I was expecting only one output, with the first thread to finish >> "wins". >> In fact I implemented it like that: >> http://www.corentindupont.info/blog/posts/Programming/2014-09-23-Nomyx-Language.html#event-alternative-interface >> >> Cheers >> Corentin >> >> >> On Mon, Jun 27, 2016 at 8:22 PM, Geraldus wrote: >> >>> Sorry, here is some links: >>> Wiki paga on GitHub >>> https://github.com/agocorona/transient/wiki/Transient-tutorial >>> Programming at specification level >>> https://github.com/agocorona/transient/wiki/Programming-at-the-specification-level >>> >>> пн, 27 июн. 2016 г. в 23:19, Geraldus : >>> >>>> Hi! Have you looked at Transient by Alberto Gomez Corona? >>>> >>>> пн, 27 июн. 2016 г. в 18:27, Corentin Dupont >>> >: >>>> >>>>> Hi Joachim, >>>>> I agree... I looked hard at them :) >>>>> https://wiki.haskell.org/Functional_Reactive_Programming >>>>> >>>>> I need a library with a DSL able to create forms on the fly, in a >>>>> "demand driven" way. >>>>> I.e. if at some point in time the user program needs a boolean from >>>>> the user, a radio button will be created on the screen of that user. The >>>>> objective is to retrieve the boolean, creating the form is just a way to do >>>>> that. Complex forms can be created, capable of generating full ADTs. The >>>>> styling of the form is not important. >>>>> Other requirements: >>>>> - it should be possible to run the event DSL in a monad different from >>>>> IO. >>>>> - the event DSL need to be instance of Alternative: events can be put >>>>> in concurrence, the first to fire wins. >>>>> >>>>> >>>>> >>>>> >>>>> On Mon, Jun 27, 2016 at 10:25 AM, Joachim Breitner < >>>>> mail at joachim-breitner.de> wrote: >>>>> >>>>>> Hi, >>>>>> >>>>>> Am Montag, den 27.06.2016, 09:38 +0200 schrieb Corentin Dupont: >>>>>> > I need it for the game Nomyx, but couldn't find the features I >>>>>> wanted >>>>>> > from the existing libraries. >>>>>> >>>>>> any chance to extend existing libraries to support what you need? >>>>>> Library proliferation does not really help the ecosystem. >>>>>> >>>>>> 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 >>>>>> _______________________________________________ >>>>>> 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 asmith9983 at gmail.com Wed Jun 29 09:53:44 2016 From: asmith9983 at gmail.com (A Smith) Date: Wed, 29 Jun 2016 10:53:44 +0100 Subject: [Haskell-cafe] Fwd: Delivery Status Notification (Failure) In-Reply-To: <94eb2c07b1d8857df605364c823e@google.com> References: <94eb2c07b1d8857df605364c823e@google.com> Message-ID: Hi I'm a Haskell noob, and decided to experiment with a simple package to get me started; ansi-terminal. However, I found a bug in one of the functions. How and to whom do I send a bug report ? Andrew in Scotland -------------- next part -------------- An HTML attachment was scrubbed... URL: From fa-ml at ariis.it Wed Jun 29 09:56:56 2016 From: fa-ml at ariis.it (Francesco Ariis) Date: Wed, 29 Jun 2016 11:56:56 +0200 Subject: [Haskell-cafe] How to report a bug on a Haskell package In-Reply-To: References: <94eb2c07b1d8857df605364c823e@google.com> Message-ID: <20160629095656.GA8785@casa.casa> On Wed, Jun 29, 2016 at 10:53:44AM +0100, A Smith wrote: > Hi > I'm a Haskell noob, and decided to experiment with a simple package to > get me started; ansi-terminal. > However, I found a bug in one of the functions. > How and to whom do I send a bug report ? Hello Andrew, check the package page [1] and pick your fav method (email of github). Paste some code here too, if you want: maybe people can help. [1] https://hackage.haskell.org/package/ansi-terminal From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Wed Jun 29 10:02:30 2016 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Wed, 29 Jun 2016 11:02:30 +0100 Subject: [Haskell-cafe] Fwd: Delivery Status Notification (Failure) In-Reply-To: References: <94eb2c07b1d8857df605364c823e@google.com> Message-ID: <20160629100230.GM4718@weber> On Wed, Jun 29, 2016 at 10:53:44AM +0100, A Smith wrote: > I'm a Haskell noob, and decided to experiment with a simple package to > get me started; ansi-terminal. > However, I found a bug in one of the functions. > How and to whom do I send a bug report ? Here's the Hackage page of ansi-terminal https://hackage.haskell.org/package/ansi-terminal It links to the Github repo https://github.com/feuerbach/ansi-terminal which has an issues tab https://github.com/feuerbach/ansi-terminal/issues I suggest you report your bug there. Tom From agocorona at gmail.com Wed Jun 29 11:22:13 2016 From: agocorona at gmail.com (Alberto G. Corona ) Date: Wed, 29 Jun 2016 13:22:13 +0200 Subject: [Haskell-cafe] Help to choose a library name In-Reply-To: References: <1467015903.2214.0.camel@joachim-breitner.de> Message-ID: Hi Corentin, 2016-06-29 10:21 GMT+02:00 Corentin Dupont : > Hi Alberto, > > > On Tue, Jun 28, 2016 at 10:04 AM, Alberto G. Corona > wrote: > >> Corentin: >> >> Transient has the same behaviour than your reactive library. Your library >> must produce two results if you press the first and then the second button, >> (and more if you press them more times). >> > > Actually no, in Nomyx the events, when they occur, are "consumed" and > deleted (replaced by their result). > So in the case of: > > True <$ inputButton "click here for True" <|> False <$ inputButton "click here for False" > > Once one of the buttons is clicked, both disappear and the result is > produced. > But it's merely a design choice I suppose... > > > >> >> In the example, return "hello" and return "world" are two different >> events that are triggered inmediately, and each one produces an output. >> >> The Transient EDSL for Web programming has the same behaviour than yours >> and use the same <|> >> >> (submitButton "hello" `fire` OnClick) <|> (submitButton "world" `fire` >> onClick) >> >> return either one or the other. But it can produce, like yours (I >> suppose) two or more results, as many events as you trigger. >> > > I like a lot Transient, I would have surely used it in Nomyx if it was > around some years ago :) > One question is, Transient seems a lot dependant on the IO monad, would it > be possible to abstract from it? > > > That is because Transient is though as general purpose language, not an EDSL, so it has liftIO. But you can restrict it by creating your own EDSL over it: newtype EDSL a= EDSL{runEDSL :: TransIO a} deriving(Monad,Applicative... and export your own primitives that limit the possible IO operations. > > >> >> 2016-06-28 0:31 GMT+02:00 Corentin Dupont : >> >>> Wow, it is very impressive. I need to give it more time. >>> I have one question regarding this example: >>> >>> main = keep $ do >>> th <- liftIO myThreadId -- thread 89 >>> r <- async (do threadDelay 1000000; return "hello") -- thread 90 >>> <|> async (return "world") -- thread 91 >>> th' <- liftIO myThreadId -- thread 90 and 91 >>> liftIO $ print (th, th', r) -- thread 90 and 91 >>> >>> Output: >>> >>> (ThreadId 89,ThreadId 91,"world") >>> (ThreadId 89,ThreadId 90,"hello") >>> >>> >>> For me it's counter-intuitive that there are two outputs. What is the >>> reason behind? >>> It seems that the use of the <|> affects the rest of the program. >>> It looks strange to me because the two lines situated after the <|> does >>> not look "syntactically" involved, if you see what I mean. >>> Instead I was expecting only one output, with the first thread to finish >>> "wins". >>> In fact I implemented it like that: >>> http://www.corentindupont.info/blog/posts/Programming/2014-09-23-Nomyx-Language.html#event-alternative-interface >>> >>> Cheers >>> Corentin >>> >>> >>> On Mon, Jun 27, 2016 at 8:22 PM, Geraldus wrote: >>> >>>> Sorry, here is some links: >>>> Wiki paga on GitHub >>>> https://github.com/agocorona/transient/wiki/Transient-tutorial >>>> Programming at specification level >>>> https://github.com/agocorona/transient/wiki/Programming-at-the-specification-level >>>> >>>> пн, 27 июн. 2016 г. в 23:19, Geraldus : >>>> >>>>> Hi! Have you looked at Transient by Alberto Gomez Corona? >>>>> >>>>> пн, 27 июн. 2016 г. в 18:27, Corentin Dupont < >>>>> corentin.dupont at gmail.com>: >>>>> >>>>>> Hi Joachim, >>>>>> I agree... I looked hard at them :) >>>>>> https://wiki.haskell.org/Functional_Reactive_Programming >>>>>> >>>>>> I need a library with a DSL able to create forms on the fly, in a >>>>>> "demand driven" way. >>>>>> I.e. if at some point in time the user program needs a boolean from >>>>>> the user, a radio button will be created on the screen of that user. The >>>>>> objective is to retrieve the boolean, creating the form is just a way to do >>>>>> that. Complex forms can be created, capable of generating full ADTs. The >>>>>> styling of the form is not important. >>>>>> Other requirements: >>>>>> - it should be possible to run the event DSL in a monad different >>>>>> from IO. >>>>>> - the event DSL need to be instance of Alternative: events can be put >>>>>> in concurrence, the first to fire wins. >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> On Mon, Jun 27, 2016 at 10:25 AM, Joachim Breitner < >>>>>> mail at joachim-breitner.de> wrote: >>>>>> >>>>>>> Hi, >>>>>>> >>>>>>> Am Montag, den 27.06.2016, 09:38 +0200 schrieb Corentin Dupont: >>>>>>> > I need it for the game Nomyx, but couldn't find the features I >>>>>>> wanted >>>>>>> > from the existing libraries. >>>>>>> >>>>>>> any chance to extend existing libraries to support what you need? >>>>>>> Library proliferation does not really help the ecosystem. >>>>>>> >>>>>>> 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 >>>>>>> _______________________________________________ >>>>>>> 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. >>>>> >>>>> >>> >> >> >> -- >> Alberto. >> > > -- Alberto. -------------- next part -------------- An HTML attachment was scrubbed... URL: From agocorona at gmail.com Wed Jun 29 11:28:05 2016 From: agocorona at gmail.com (Alberto G. Corona ) Date: Wed, 29 Jun 2016 13:28:05 +0200 Subject: [Haskell-cafe] Help to choose a library name In-Reply-To: References: <1467015903.2214.0.camel@joachim-breitner.de> Message-ID: 2016-06-29 10:31 GMT+02:00 Corentin Dupont : > I understand, my comment was just on the syntax. > Actually I have the same problem with "guard": > > test x = do > guard x > XXXXXXXXX > YYYYYYYYY > .... > > Unless I read all the monad body, there is no visual cue that XXX and YYY > might not be run. > The control flow is not syntactically visible. > That's why I prefer using guards like that: > > test x = do > guard x >> do > XXXXXXXXX > YYYYYYYYY > .... > > Here the indentation shows that there is a control flow decision. > Is it possible to do the same thing with Transient? > Something like: > > main = keep $ do > async (return "hello") <|> async (return "world") >>= \r -> do > liftIO $ print r > > > Yes, it is possible, just like in any other monad. but the alternative expression must be in parenthesis if you want both results to be printed. I do not remember which operator has more precedence <|> or >>=. I guess >>= main = keep $ do (async (return "hello") <|> async (return "world")) >>= \r -> do liftIO $ print r > > On Tue, Jun 28, 2016 at 7:25 AM, Geraldus wrote: > >> This is because the whole computation is kept (via `keep`). If you just >> run computation with `runTransient` you will see only “world” in output and >> then program ends, however since the computation is kept when second action >> finishes it prints “hello”. >> >> `r <- async … <|> async …` >> Here `r` is a continuation, everything below it will be re-computed when >> any of alternatives will return a result. For example, you can add another >> choice: >> `r <- async … <|> async … <|> waitEvents someEventAction` >> In this case every time your `someEventAction` returns a value `r` takes >> it and the rest of code re-executed (or in other words when you have a new >> continuation the computation re-evaluated). >> >> Hope this makes sense. >> >> вт, 28 июн. 2016 г. в 3:31, Corentin Dupont : >> >>> Wow, it is very impressive. I need to give it more time. >>> I have one question regarding this example: >>> >>> main = keep $ do >>> th <- liftIO myThreadId -- thread 89 >>> r <- async (do threadDelay 1000000; return "hello") -- thread 90 >>> <|> async (return "world") -- thread 91 >>> th' <- liftIO myThreadId -- thread 90 and 91 >>> liftIO $ print (th, th', r) -- thread 90 and 91 >>> >>> Output: >>> >>> (ThreadId 89,ThreadId 91,"world") >>> (ThreadId 89,ThreadId 90,"hello") >>> >>> >>> For me it's counter-intuitive that there are two outputs. What is the >>> reason behind? >>> It seems that the use of the <|> affects the rest of the program. >>> It looks strange to me because the two lines situated after the <|> does >>> not look "syntactically" involved, if you see what I mean. >>> Instead I was expecting only one output, with the first thread to finish >>> "wins". >>> In fact I implemented it like that: >>> http://www.corentindupont.info/blog/posts/Programming/2014-09-23-Nomyx-Language.html#event-alternative-interface >>> >>> Cheers >>> Corentin >>> >>> >>> On Mon, Jun 27, 2016 at 8:22 PM, Geraldus wrote: >>> >>>> Sorry, here is some links: >>>> Wiki paga on GitHub >>>> https://github.com/agocorona/transient/wiki/Transient-tutorial >>>> Programming at specification level >>>> https://github.com/agocorona/transient/wiki/Programming-at-the-specification-level >>>> >>>> пн, 27 июн. 2016 г. в 23:19, Geraldus : >>>> >>>>> Hi! Have you looked at Transient by Alberto Gomez Corona? >>>>> >>>>> пн, 27 июн. 2016 г. в 18:27, Corentin Dupont < >>>>> corentin.dupont at gmail.com>: >>>>> >>>>>> Hi Joachim, >>>>>> I agree... I looked hard at them :) >>>>>> https://wiki.haskell.org/Functional_Reactive_Programming >>>>>> >>>>>> I need a library with a DSL able to create forms on the fly, in a >>>>>> "demand driven" way. >>>>>> I.e. if at some point in time the user program needs a boolean from >>>>>> the user, a radio button will be created on the screen of that user. The >>>>>> objective is to retrieve the boolean, creating the form is just a way to do >>>>>> that. Complex forms can be created, capable of generating full ADTs. The >>>>>> styling of the form is not important. >>>>>> Other requirements: >>>>>> - it should be possible to run the event DSL in a monad different >>>>>> from IO. >>>>>> - the event DSL need to be instance of Alternative: events can be put >>>>>> in concurrence, the first to fire wins. >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> On Mon, Jun 27, 2016 at 10:25 AM, Joachim Breitner < >>>>>> mail at joachim-breitner.de> wrote: >>>>>> >>>>>>> Hi, >>>>>>> >>>>>>> Am Montag, den 27.06.2016, 09:38 +0200 schrieb Corentin Dupont: >>>>>>> > I need it for the game Nomyx, but couldn't find the features I >>>>>>> wanted >>>>>>> > from the existing libraries. >>>>>>> >>>>>>> any chance to extend existing libraries to support what you need? >>>>>>> Library proliferation does not really help the ecosystem. >>>>>>> >>>>>>> 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 >>>>>>> _______________________________________________ >>>>>>> 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. >>>>> >>>>> >>> > -- Alberto. -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefanjacholke at gmail.com Thu Jun 30 20:10:35 2016 From: stefanjacholke at gmail.com (Stefan) Date: Thu, 30 Jun 2016 22:10:35 +0200 Subject: [Haskell-cafe] Announcing Blocks for CodeWorld Message-ID: Hi everyone, (this is somewhat cross-posted from reddit) I'm announcing Blocks for CodeWorld, which is a functional based drag-and-drop programming environment. The project is part of Haskell Summer of Code. The aim of the project is to create a web application with which users can drag-and-drop blocks in order to create CodeWorld applications, The project is primarily educational based, and more advanced applications may be created with the regular CodeWorld text UI. The application uses Blockly to allow users to drag-and-drop blocks, which can then be snapped together in order to build programs, in a Scratch-esque manner. The generated code is Haskell, which is then sent to the regular CodeWorld server and compiled with GHCJS, the resulting JavaScript is then run on the site. Code is generated as students are introduced to programming concepts with the Blocks and will later be exposed to a more text based environment. The majority of the code, aside from Blockly, is in Haskell, which is compiled to JavaScript using GHCJS. Currently, in this initial release, the user is able to: - Build and run simple CodeWorld programs, mostly pictures and transformations thereof - Save and Load projects, load a program by its URL. - Use polymorphic blocks, such as an if-then-else block and some others - Use Let definition blocks to create top level bindings Later, more advanced functional features such as pattern matching and some support for first-class functions might be covered. For anyone interested, an initial version can be found at code.world/blocks. If you want to follow on the progress you can check out my blog . -------------- next part -------------- An HTML attachment was scrubbed... URL: From bog at khumba.net Thu Jun 30 23:03:05 2016 From: bog at khumba.net (Bryan Gardiner) Date: Thu, 30 Jun 2016 16:03:05 -0700 Subject: [Haskell-cafe] Packaging a library with a separate shared object Message-ID: <20160630160305.6e61c847@khumba.net> Hi folks! I'm working on packaging Qtah (my Qt bindings) for upload to Hackage. This is somewhat complicated, as I have some C++ glue code that I build into a shared library that the Haskell library needs. Currently, my build hooks are as follows, in: https://gitlab.com/khumba/qtah/blob/packaging/qtah/Setup.hs - postConf: Generate Haskell code in src/ and C++ code in cpp/. - preBuild: Add cpp/ to HookedBuildInfo.extraLibDirs because the build phase needs this needs this. - buildHook: Run make to build the C++ code into libqtah.so before the Haskell code builds. - copyHook and instHook: Copy libqtah.so into InstallDirs.libdir (~/.cabal/lib/.../qtah-*/). This installs successfully, but ultimately doesn't work because the Haskell libHSqtah*.so that gets built can't find libqtah.so. The installation directory ~/cabal/lib/.../qtah-*/ isn't on libHSqtah*.so's RUNPATH (which makes sense, it's not known at link time). I could create a separate package for the C++ bits, but I'd rather not do that unless necessary (there's already a qtah-generator package as well). I can't see how I can avoid doing this though. Are there any Cabal experts that could point me in the right direction, or confirm that I'll need to split the package? Many thanks, Bryan -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 801 bytes Desc: OpenPGP digital signature URL: From noonslists at gmail.com Thu Jun 30 23:43:21 2016 From: noonslists at gmail.com (Noon van der Silk) Date: Fri, 1 Jul 2016 09:43:21 +1000 Subject: [Haskell-cafe] Compose :: Conference, Melbourne, 2016, Call for Presentations! In-Reply-To: References: Message-ID: Hey Cafe, Following up on this, we've extended our CFP until July 11th: http://www.composeconference.org/2016-melbourne/cfp/ We've had lots of great submissions so far! If you've been wondering if you should submit something, but perhaps missed the June 30th date, then this is your chance! We'd love to see you there! -- Noon, on behalf of the Compose Conference Melbourne Organising Committee http://www.composeconference.org/ On Sun, Jun 19, 2016 at 12:10 PM, Noon van der Silk wrote: > (Web version: http://www.composeconference.org/2016-melbourne/cfp/) > > # Call for Presentations > > Compose Melbourne - http://www.composeconference.org/ - is pleased to > announce its call for presentations. > > Compose Melbourne is a new functional programming conference focused on > developing the community and bringing typed functional programming to a > wider audience. It is a 2-day event being held in Melbourne, Australia on > the 29th and 30th of August 2016. The first day features a single track of > presentations followed by a second day of workshops and an unconference. It > is the new sister-conference of the NY based Compose Conference. > > Submit your presentation proposal here: > https://easychair.org/conferences/?conf=cmc2016 > > > # Important Dates > > - CFP Launch Party - 19th May > - CFP Opens - 19th May > - CFP Closes - June 30th > - Notify Presenters - July 15th > - Conference Day 1: Presentations - Monday, 29-Aug-2016 > - Conference Day 2: Unconference - Tuesday, 30-Aug-2016 > > > # Talk and Workshop Submission > > ## Day 1 - Presentations > > Submit a Presentation Proposal via Easy Chair: > https://easychair.org/conferences/?conf=cmc2016. > > ## Day 2 - Unconference and Workshops > > Contact us (composemel-admin at googlegroups.com) with your workshop > proposals. > > > # Submission Guidelines > > Talk slots will be 30 minutes: 25 minute talk and 5 minutes for questions. > > Provide sufficient detail in your submission to enable the reviewers to > understand your proposal and clearly identify what an attendee will gain > from attending your session. You should include the following information > in the submission system: > > - Authors - The details of each of the presenters > - Title - Title of the presentation (please keep it brief and specific) > - Abstract - A 300-500 word description of your presentation, ideally > including... > - Description of the content > - Goal > - Keywords - List any keywords that will help the program committee and > attendees categorise your presentation. Also indicate the functional > programming languages that you will be targeting. > > Nothing upsets an audience more than a speaker that stands on stage > blatantly promoting his or her company, product or achievements. > > Please keep the content of your talk on-topic and do not use this speaking > opportunity as a sales pitch. > > > # Feel > > We want Compose Melbourne to be all about the community. We're aiming to > help foster the growth of Functional Programming in Melbourne and unite all > interested parties to spark a unified presence and a feeling of camaraderie > amongst FP and Theory proponents in this wonderful city! > > > # Audience > > Functional-Programming and Programming-Language-Theory professionals and > enthusiasts. Newcomers, experts, anyone from other disciplines of fields > who is interested in what FP is or how it could help them with their work, > or simply make life more enjoyable! > > > # Diversity > > Just like Compose-Conference, we would also like to put an emphasis on > soliciting a diverse set of speakers - anything you can do to distribute > information about this CFP and encourage submissions from under-represented > groups would be greatly appreciated. We welcome *all* (new and established) > contributions and encourage you to apply! > > > # Day One > > All topics for proposals for presentations are invited, but not limited to > explore the following topics: > > ## New Languages > > The development of new and emerging Functional Languages, and the toolsets > around them. > > ## Libraries and Tools > > Exploring the use and development of new and underrepresented tools and > libraries. > > ## Production Systems > > 2016 has seen many previously undeployed languages and systems break > through into production. We're looking for war-stories, success-stories and > sob-stories! > > ## Theory > > Theory is the cutting edge of new functional programming. Show the world > what is rising over the horizon. > > ## Art and Music > > Exciting and innovative usage of functional programming language in the > arts! > > > # Day Two > > The second day will be dedicated to workshops and unconferences. > > ## Workshops > > We will be running a beginners Haskell workshop. > > If you wish to run a workshop on the second day of the conference, then > please let us know. Alternatively, if there is a workshop that would > interest you as an attendee, then please also let us know. > > ## Unconference > > Got something random you want to talk about? The unconference will run the > second day. There will be a whiteboard with spaces where anyone can write > their name down to speak. There's no need to bring anything but yourself > and your ideas and speaking voice. > > > # Sponsors > > We are seeking sponsors to support us in putting on this conference. If > you or your company would like to sponsor us, please get in contact via > composemel-admin at googlegroups.com. > > You can find our prospectus here: > https://github.com/composeconference/Compose-Melbourne/blob/master/ComposeMelbourneSponsorshipProspectus.pdf > . > > -- > Compose Conference Melbourne Organising Committee > http://www.composeconference.org/ > -- Noon Silk, ن https://silky.github.io/ "Every morning when I wake up, I experience an exquisite joy — the joy of being this signature." -------------- next part -------------- An HTML attachment was scrubbed... URL: