From alex323 at gmail.com Fri Dec 2 19:29:08 2016 From: alex323 at gmail.com (Alex) Date: Fri, 2 Dec 2016 14:29:08 -0500 Subject: [Haskell-cafe] monad-coroutine alternatives Message-ID: <20161202142908.20f615bb@gmail.com> Hello, Are there any data structures isomorphic to Coroutine[0] available on Hackage? -- Alex [0] https://hackage.haskell.org/package/monad-coroutine-0.9.0.3/docs/Control-Monad-Coroutine.html From mblazevic at stilo.com Fri Dec 2 20:41:54 2016 From: mblazevic at stilo.com (=?UTF-8?Q?Mario_Bla=c5=beevi=c4=87?=) Date: Fri, 2 Dec 2016 15:41:54 -0500 Subject: [Haskell-cafe] monad-coroutine alternatives In-Reply-To: <20161202142908.20f615bb@gmail.com> References: <20161202142908.20f615bb@gmail.com> Message-ID: <46aec59c-07ae-ed34-bd1d-2288115b43b5@stilo.com> On 2016-12-02 02:29 PM, Alex wrote: > Hello, > > Are there any data structures isomorphic to Coroutine[0] available on > Hackage? I believe the top recommendation is FreeT: http://hackage.haskell.org/package/free-4.12.4/docs/Control-Monad-Trans-Free.html#t:FreeT Note, if the reason you need the coroutines is to implement streaming, you may want to proceed straight to Pipes or Conduit. From alex323 at gmail.com Fri Dec 2 20:51:16 2016 From: alex323 at gmail.com (Alex) Date: Fri, 2 Dec 2016 15:51:16 -0500 Subject: [Haskell-cafe] monad-coroutine alternatives In-Reply-To: <46aec59c-07ae-ed34-bd1d-2288115b43b5@stilo.com> References: <20161202142908.20f615bb@gmail.com> <46aec59c-07ae-ed34-bd1d-2288115b43b5@stilo.com> Message-ID: <20161202155116.3814fb4c@gmail.com> On Fri, 2 Dec 2016 15:41:54 -0500 Mario Blažević wrote: > On 2016-12-02 02:29 PM, Alex wrote: > > Hello, > > > > Are there any data structures isomorphic to Coroutine[0] available > > on Hackage? > > I believe the top recommendation is FreeT: > > http://hackage.haskell.org/package/free-4.12.4/docs/Control-Monad-Trans-Free.html#t:FreeT > > Note, if the reason you need the coroutines is to implement > streaming, you may want to proceed straight to Pipes or Conduit. > Thanks! I am implementing a network protocol, so I need to suspend the computation while I wait for Alice/Bob to send a response. The protocol is specified as a series of tokens to form a DSL. -- Alex From hjgtuyl at chello.nl Sat Dec 3 01:39:56 2016 From: hjgtuyl at chello.nl (Henk-Jan van Tuyl) Date: Sat, 03 Dec 2016 02:39:56 +0100 Subject: [Haskell-cafe] Fearing Haskell Message-ID: L.S., IBM's Watson can analyze web pages, see https://alchemy-language-demo.mybluemix.net/ . If I feed it the URL https://wiki.haskell.org/Haskell , Watson states that this page is about a person called Haskell, with a fearful sentiment. With the URL https://en.wikipedia.org/wiki/Haskell_(programming_language) , there is both joy and sadness in Haskell. :-) Regards, Henk-Jan van Tuyl -- Folding at home What if you could share your unused computer power to help find a cure? In just 5 minutes you can join the world's biggest networked computer and get us closer sooner. Watch the video. http://folding.stanford.edu/ http://Van.Tuyl.eu/ http://members.chello.nl/hjgtuyl/tourdemonad.html Haskell programming -- From sivanov at colimite.fr Mon Dec 5 12:43:43 2016 From: sivanov at colimite.fr (Sergiu Ivanov) Date: Mon, 05 Dec 2016 14:43:43 +0200 Subject: [Haskell-cafe] [course announcement] Haskell for Life Message-ID: <87h96i35s0.fsf@colimite.fr> Dear Haskell Cafe, This year I have taught and will teach a short course introducing people to Haskell. I realised that such a course might interest the subscribers of this list, so here is the course page, with all course materials (CC-BY licence): http://lacl.fr/~sivanov/doku.php?id=en:haskell_for_life Any feedback is welcome. (I will teach the next instance of the course in the following two weeks in Chișinău, Republic of Moldova, so if you happen to be around, don't hesitate to come by and give me a wink IRL ;-) ) -- Sergiu -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 454 bytes Desc: not available URL: From noonslists at gmail.com Mon Dec 5 21:54:32 2016 From: noonslists at gmail.com (Noon van der Silk) Date: Tue, 6 Dec 2016 08:54:32 +1100 Subject: [Haskell-cafe] [Haskell-community] Call for Haskell.org Committee Nominations In-Reply-To: References: Message-ID: Out of interest, when will the new committee members be announced? On Sat, Nov 12, 2016 at 9:29 AM, Gershom B wrote: > Dear Haskellers, > > It is time to put out a call for new nominations (typically but not > necessarily self-nominations) to the haskell.org committee. We have > four members of our committee due for retirement -- Adam Foltzer, > Nicolas Wu, Andres Loeh, and Edward Kmett (who is stepping down > early). As per our bylaws, three of the slots will be for regular > three year terms, and one will be a short one year term to fill out > the remainder of Edward's. > > To nominate yourself, please send an email to committee at haskell.org > by December 2, 2016. The retiring members are eligible to re-nominate > themselves. Please feel free to include any information about yourself > that you think will help us to make a decision. > > The Haskell.org committee serves as a board of directors for > Haskell.org, a 501(c)3 nonprofit which oversees technical and > financial resources related to Haskell community infrastructure. > > Being a member of the committee does not necessarily require a > significant amount of time, but committee members should aim to be > responsive during discussions when the committee is called upon to > make a decision. Strong leadership, communication, and judgement are > very important characteristics for committee members. The role is > about setting policy, providing direction/guidance for Haskell.org > infrastructure, planning for the long term, and being fiscally > responsible with the Haskell.org funds (and donations). As overseers > for policy regarding the open source side of Haskell, committee > members must also be able to set aside personal or business related > bias and make decisions with the good of the open source Haskell > community in mind. > > We seek a broad representation from different segments of the Haskell > world -- including but not limited to those focused on education, > those focused on industrial applications, those with background in > organizing users-groups, and those focused directly on our technical > infrastructure. > > More details about the committee's roles and responsibilities are on > > https://wiki.haskell.org/Haskell.org_committee > > If you have any questions about the process, please feel free to > e-mail us at committee at haskell.org, or contact one of us > individually. > > Best, > Gershom Bazerman > _______________________________________________ > Haskell-community mailing list > Haskell-community at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-community > -- 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: From gershomb at gmail.com Mon Dec 5 21:58:35 2016 From: gershomb at gmail.com (Gershom B) Date: Mon, 5 Dec 2016 16:58:35 -0500 Subject: [Haskell-cafe] [Haskell-community] Call for Haskell.org Committee Nominations In-Reply-To: References: Message-ID: We're starting the discussion now. Ideally we'll wrap it up within seven days or so. --Gershom On Mon, Dec 5, 2016 at 4:54 PM, Noon van der Silk wrote: > Out of interest, when will the new committee members be announced? > > On Sat, Nov 12, 2016 at 9:29 AM, Gershom B wrote: >> >> Dear Haskellers, >> >> It is time to put out a call for new nominations (typically but not >> necessarily self-nominations) to the haskell.org committee. We have >> four members of our committee due for retirement -- Adam Foltzer, >> Nicolas Wu, Andres Loeh, and Edward Kmett (who is stepping down >> early). As per our bylaws, three of the slots will be for regular >> three year terms, and one will be a short one year term to fill out >> the remainder of Edward's. >> >> To nominate yourself, please send an email to committee at haskell.org >> by December 2, 2016. The retiring members are eligible to re-nominate >> themselves. Please feel free to include any information about yourself >> that you think will help us to make a decision. >> >> The Haskell.org committee serves as a board of directors for >> Haskell.org, a 501(c)3 nonprofit which oversees technical and >> financial resources related to Haskell community infrastructure. >> >> Being a member of the committee does not necessarily require a >> significant amount of time, but committee members should aim to be >> responsive during discussions when the committee is called upon to >> make a decision. Strong leadership, communication, and judgement are >> very important characteristics for committee members. The role is >> about setting policy, providing direction/guidance for Haskell.org >> infrastructure, planning for the long term, and being fiscally >> responsible with the Haskell.org funds (and donations). As overseers >> for policy regarding the open source side of Haskell, committee >> members must also be able to set aside personal or business related >> bias and make decisions with the good of the open source Haskell >> community in mind. >> >> We seek a broad representation from different segments of the Haskell >> world -- including but not limited to those focused on education, >> those focused on industrial applications, those with background in >> organizing users-groups, and those focused directly on our technical >> infrastructure. >> >> More details about the committee's roles and responsibilities are on >> >> https://wiki.haskell.org/Haskell.org_committee >> >> If you have any questions about the process, please feel free to >> e-mail us at committee at haskell.org, or contact one of us >> individually. >> >> Best, >> Gershom Bazerman >> _______________________________________________ >> Haskell-community mailing list >> Haskell-community at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-community > > > > > -- > Noon Silk, ن > > https://silky.github.io/ > > "Every morning when I wake up, I experience an exquisite joy — the joy > of being this signature." From fernandes.andre at gmail.com Tue Dec 6 01:13:05 2016 From: fernandes.andre at gmail.com (Andre Fernandes) Date: Mon, 5 Dec 2016 17:13:05 -0800 (PST) Subject: [Haskell-cafe] stack setup errors when user name has accents Message-ID: I am new in Haskell, and I am trying to use stack in my "Windows 10" machine to study a little more. Stack installed nicely, but when I run "stack setup" at the command prompt I get the following error: *"Could not parse 'C:\Users\Andr├®\AppData\Roaming\stack\config.yaml':* *InvalidYaml (Just (YamlException "Yaml file not found: C:\\Users\\Andr\233\\AppData\\Roaming\\stack\\config.yaml"))* *See http://docs.haskellstack.org/en/stable/yaml_configuration/."* My name is "André" with an accent, and that's the problem, it can not find config.yaml at my windows user directory. Is there a way to solve this problem, maybe force stack to look into another folder, or something else? My windows command prompt encoding is 850, I do not not know if this info could help. Thanks in advance for any answer, André. -------------- next part -------------- An HTML attachment was scrubbed... URL: From saurabhnanda at gmail.com Tue Dec 6 06:31:29 2016 From: saurabhnanda at gmail.com (Saurabh Nanda) Date: Tue, 6 Dec 2016 12:01:29 +0530 Subject: [Haskell-cafe] Following-up on the laziness thread on Reddit Message-ID: Thoughts on this particular comment - https://www.reddit.com/r/haskell/comments/5fyg9e/how_important_is_laziness_in_practice/dap8fih/ - from core GHC hackers would be very interesting and enlightening. -- Saurabh. -------------- next part -------------- An HTML attachment was scrubbed... URL: From rf at rufflewind.com Tue Dec 6 14:50:00 2016 From: rf at rufflewind.com (Phil Ruffwind) Date: Tue, 06 Dec 2016 09:50:00 -0500 Subject: [Haskell-cafe] stack setup errors when user name has accents In-Reply-To: References: Message-ID: <1481035800.2966661.810142065.11EA84D0@webmail.messagingengine.com> > *"Could not parse 'C:\Users\Andr├®\AppData\Roaming\stack\config.yaml':* > *InvalidYaml (Just (YamlException "Yaml file not found: > C:\\Users\\Andr\233\\AppData\\Roaming\\stack\\config.yaml"))* > > *See http://docs.haskellstack.org/en/stable/yaml_configuration/."* I think the accented letter is displayed as “├®” because GHC renders all Unicode strings using UTF-8, regardless of what the console codepage is. When the UTF-8 encoded letter is shown in codepage 850, it will produce this incorrect display. That being said, the presence of `\233` (the Unicode code point for the accented e) suggests that internally it is correctly storing the accented letter. Since the yaml library uses System.Posix.Internals.c_open, which does claim to handle Unicode properly on Windows, I'm actually confused why it doesn't work. Maybe the problem is not with the yaml library? From fernandes.andre at gmail.com Tue Dec 6 17:01:26 2016 From: fernandes.andre at gmail.com (Andre Fernandes) Date: Tue, 6 Dec 2016 09:01:26 -0800 (PST) Subject: [Haskell-cafe] stack setup errors when user name has accents In-Reply-To: References: Message-ID: > > This was due to a bug in the yaml package, apologies. It's been patched, > and the next version of Stack will have the bugfix. I believe the next > version will be released in the next few days, but if you're able to build > from master, you can use that. > Thanks a lot for your answer, it's good to know that soon the new Stack version will solve it. > > Here's the original issue, which includes a link to a temporary workaround: > https://github.com/commercialhaskell/stack/issues/2491 > > I'll take a look at that. > On Mon, Dec 5, 2016 at 8:13 PM, Andre Fernandes > wrote: > >> I am new in Haskell, and I am trying to use stack in my "Windows 10" >> machine to study a little more. >> >> Stack installed nicely, but when I run "stack setup" at the command >> prompt I get the following error: >> >> *"Could not parse 'C:\Users\Andr├®\AppData\Roaming\stack\config.yaml':* >> *InvalidYaml (Just (YamlException "Yaml file not found: >> C:\\Users\\Andr\233\\AppData\\Roaming\\stack\\config.yaml"))* >> >> *See http://docs.haskellstack.org/en/stable/yaml_configuration/ >> ."* >> >> My name is "André" with an accent, and that's the problem, it can not >> find config.yaml at my windows user directory. Is there a way to solve this >> problem, maybe force stack to look into another folder, or something else? >> >> My windows command prompt encoding is 850, I do not not know if this info >> could help. >> >> Thanks in advance for any answer, >> André. >> >> _______________________________________________ >> 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 lexi.lambda at gmail.com Wed Dec 7 00:30:21 2016 From: lexi.lambda at gmail.com (Alexis King) Date: Tue, 6 Dec 2016 16:30:21 -0800 Subject: [Haskell-cafe] Use of errorWithoutStackTrace in the Prelude Message-ID: <12E0EBDA-C0BB-4D3E-B517-FDF6415899D9@gmail.com> Hello, I noticed that the partial functions in the Prelude use errorWithoutStackTrace instead of `error` to provide their error messages, which produces significantly worse error messages. I stumbled into this when a coworker of mine had trouble tracking down a use of `head` that was throwing an exception, but didn’t include any information about where it was in the source. What exactly is the rationale for this? Is it to avoid the performance penalty of passing around the implicit parameter? That seems relatively unlikely, since the performance hit seems trivial, but perhaps it’s to avoid breaking tests that depend on error messages? I think it would be nice for Prelude-provided functions to be informative by default, so the change seems worth it to me, but I’m wondering if there’s something I’ve overlooked. Also, if the answer really is “no, errorWithoutStackTrace is correct”, is the expectation that people will use -prof if they want stacks? This seems a bit frustrating to a newcomer who might not understand anything more complicated than running `stack test` and might not be able to figure out how to pass the right options (especially since options need to be passed both at compile-time and at runtime). Thanks, Alexis From eric at seidel.io Wed Dec 7 05:04:02 2016 From: eric at seidel.io (Eric Seidel) Date: Tue, 06 Dec 2016 21:04:02 -0800 Subject: [Haskell-cafe] Use of errorWithoutStackTrace in the Prelude In-Reply-To: <12E0EBDA-C0BB-4D3E-B517-FDF6415899D9@gmail.com> References: <12E0EBDA-C0BB-4D3E-B517-FDF6415899D9@gmail.com> Message-ID: <1481087042.3979603.810965025.4F097095@webmail.messagingengine.com> The performance impact is part of the rationale, but a bigger issue is the burden on the type signatures. Using the new `error` would not be enough to get useful locations for `head` and friends. The stack trace would only contain the call to error *inside* head, and not the call to head itself, which is pure noise. If we wanted to add the call to head, we would have to add a `HasCallStack` constraint to `head` itself (and all other partial functions). We discussed this back when I first implemented the implicit call-stacks, and decided to be conservative with their use in base for these reasons. Though it is worth noting that at this point we were still using an explicit implicit parameter instead of the `HasCallStack` alias, which made the constraint more unfamiliar especially to newcomers. Perhaps with the new alias the API-cluttering concerns are less of a problem. In the meantime, I have a package http://hackage.haskell.org/package/located-base that provides callstack-aware variants of many partial functions that I use, and would happily accept a PR for any others that you use! Eric On Tue, Dec 6, 2016, at 16:30, Alexis King wrote: > Hello, > > I noticed that the partial functions in the Prelude use > errorWithoutStackTrace instead of `error` to provide their error > messages, which produces significantly worse error messages. I > stumbled into this when a coworker of mine had trouble tracking > down a use of `head` that was throwing an exception, but didn’t > include any information about where it was in the source. > > What exactly is the rationale for this? Is it to avoid the performance > penalty of passing around the implicit parameter? That seems > relatively unlikely, since the performance hit seems trivial, but > perhaps it’s to avoid breaking tests that depend on error messages? > I think it would be nice for Prelude-provided functions to be > informative by default, so the change seems worth it to me, but I’m > wondering if there’s something I’ve overlooked. > > Also, if the answer really is “no, errorWithoutStackTrace is correct”, > is the expectation that people will use -prof if they want stacks? > This seems a bit frustrating to a newcomer who might not understand > anything more complicated than running `stack test` and might not > be able to figure out how to pass the right options (especially > since options need to be passed both at compile-time and at runtime). > > Thanks, > Alexis > _______________________________________________ > 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 guillaum.bouchard+haskell at gmail.com Wed Dec 7 07:43:09 2016 From: guillaum.bouchard+haskell at gmail.com (Guillaume Bouchard) Date: Wed, 07 Dec 2016 07:43:09 +0000 Subject: [Haskell-cafe] Injective type family on a sub domain Message-ID: Hi. I have the following GADT : ----------------------------- type family Or a b where Or 'False 'False = 'False Or _ _ = 'True data Expr t where Add :: Expr t -> Expr t' -> Expr (Or t t') Lit :: Int -> Expr 'False Var :: Expr 'True ---------------------- The idea is that if the `Expr` contains a sub `Var`, its type is `Expr 'True`, else it is `Expr 'False`. I now want to evaluate my expression, something like that : -------------- eval :: Expr t -> Int eval (Lit i) = i eval (Add a b) = eval a + eval b eval Var = error "Cannot evaluate expression with variable" ---------------- Using the GADT I previously defined, I'm tempted to remove the impossible "Var" case with : --------------- eval' :: Expr 'False -> Int eval' (Lit i) = i eval' (Add a b) = eval' a + eval' b ---------------- However this does not typecheck because GHC cannot deduce that `a` and `b` are `~ Expr 'False`. Because the type family `Or` is not injective. The wiki https://ghc.haskell.org/trac/ghc/wiki/InjectiveTypeFamilies classifies injectives types families in three categories, but I don't think my `Or` appears in any of them. Actually `Or` is injective only if `Or t t' ~ 'False` and in this case, we can deduce that `t ~ 'False` and `t' ~ 'False`. I qualify it as a "partialy injective type family". The type checker does not know that, hence my code does not compile. Is there a solution, other than writing a custom type checker plugin? Is there a way to provide the inverse type family function, something such as: type family InverseOr a where InverseOr 'False = ('False, 'False) Thank you. -- G. -------------- next part -------------- An HTML attachment was scrubbed... URL: From atrudyjane at protonmail.com Wed Dec 7 07:59:55 2016 From: atrudyjane at protonmail.com (Atrudyjane) Date: Wed, 07 Dec 2016 02:59:55 -0500 Subject: [Haskell-cafe] Qualified imports and REPL output in GHCi 8.0.1 Message-ID: When I do a qualified import such as: λ> import qualified Data.Bool then query a type, this is the output. λ> :t Data.Bool.bool Data.Bool.bool :: a -> a -> Bool -> a Was expecting: λ> :t Data.Bool.bool Data.Bool.bool :: a -> a -> Data.Bool.bool -> a I experimented with changing the -fno-implicit-import-qualified flag and the result was the same. Is there an option that needs to be set to show the expected behavior? Regards, Andrea Sent with [ProtonMail](https://protonmail.com) Secure Email. -------------- next part -------------- An HTML attachment was scrubbed... URL: From lexi.lambda at gmail.com Wed Dec 7 08:00:49 2016 From: lexi.lambda at gmail.com (Alexis King) Date: Wed, 7 Dec 2016 00:00:49 -0800 Subject: [Haskell-cafe] Use of errorWithoutStackTrace in the Prelude In-Reply-To: <1481087042.3979603.810965025.4F097095@webmail.messagingengine.com> References: <12E0EBDA-C0BB-4D3E-B517-FDF6415899D9@gmail.com> <1481087042.3979603.810965025.4F097095@webmail.messagingengine.com> Message-ID: <5301FF20-40B0-4EF4-A6BD-3322F11B3E9C@gmail.com> > On Dec 6, 2016, at 21:04, Eric Seidel wrote: > > The performance impact is part of the rationale, but a bigger issue is > the burden on the type signatures. > > Using the new `error` would not be enough to get useful locations for > `head` and friends. The stack trace would only contain the call to error > *inside* head, and not the call to head itself, which is pure noise. If > we wanted to add the call to head, we would have to add a `HasCallStack` > constraint to `head` itself (and all other partial functions). Right, of course; my assumption was that it would be necessary to both add HasCallStack and use `error`, though I figured you would also want to use withFrozenCallStack to prevent the call stack from `error` from bubbling through (since that really is just noise; nobody needs to know the location of `error` inside of base). Upon further inspection, though, I realized errorWithoutStackTrace effectively includes withFrozenCallStack (rather than taking an alternate path that ignores the call stack entirely), so adding the HasCallStack constraint seems like it should be sufficient on its own. > We discussed this back when I first implemented the implicit > call-stacks, and decided to be conservative with their use in base for > these reasons. Though it is worth noting that at this point we were > still using an explicit implicit parameter instead of the `HasCallStack` > alias, which made the constraint more unfamiliar especially to > newcomers. Perhaps with the new alias the API-cluttering concerns are > less of a problem. Yeah, I could see the potential for confusion here, but IMO the potential gains from offering source locations in error messages by default is a bigger win for beginners than the slightly more complicated type signatures are a loss. That’s obviously just my opinion though, since I have no evidence whatsoever to back that up, but it’s definitely something I’d like to see. > In the meantime, I have a package > > http://hackage.haskell.org/package/located-base > > that provides callstack-aware variants of many partial functions that I > use, and would happily accept a PR for any others that you use! This is a nice package; thank you for writing it! I’ll definitely keep it in mind, though admittedly, it’s pretty unlikely I’d find it worth it to import just to get the call stacks for a handful of functions I try to avoid whenever possible, anyway (which is why I think these need to be in base to be all that useful — my guess is that beginners are by far the most likely to use partial functions in situations that may throw, and they are unlikely to discover your package). That said, it’s good to have, and I’ll relay its existence to my coworker. Alexis From lexi.lambda at gmail.com Wed Dec 7 08:05:10 2016 From: lexi.lambda at gmail.com (Alexis King) Date: Wed, 7 Dec 2016 00:05:10 -0800 Subject: [Haskell-cafe] Qualified imports and REPL output in GHCi 8.0.1 In-Reply-To: References: Message-ID: Since Bool is already imported unqualified from the Prelude, GHC favors printing the unqualified version. If I include the -XNoImplicitPrelude option to disable the implicit import of the Prelude, I get the behavior you expect: $ ghci -XNoImplicitPrelude GHCi, version 8.0.1: http://www.haskell.org/ghc/ :? for help ghci> import qualified Data.Bool ghci> :t Data.Bool.bool Data.Bool.bool :: a -> a -> Data.Bool.Bool -> a Alexis > On Dec 6, 2016, at 23:59, Atrudyjane via Haskell-Cafe wrote: > > When I do a qualified import such as: > λ> import qualified Data.Bool > > then query a type, this is the output. > λ> :t Data.Bool.bool > Data.Bool.bool :: a -> a -> Bool -> a > > Was expecting: > λ> :t Data.Bool.bool > Data.Bool.bool :: a -> a -> Data.Bool.bool -> a > > I experimented with changing the -fno-implicit-import-qualified flag and the result was the same. Is there an option that needs to be set to show the expected behavior? > > Regards, > Andrea From atrudyjane at protonmail.com Wed Dec 7 08:21:14 2016 From: atrudyjane at protonmail.com (Atrudyjane) Date: Wed, 07 Dec 2016 03:21:14 -0500 Subject: [Haskell-cafe] Qualified imports and REPL output in GHCi 8.0.1 In-Reply-To: References: Message-ID: That did it, thank you Alexis! The Haskell Book says to turn Prelude back on before trying out the qualified import examples, so that's what happened. Andrea Sent with [ProtonMail](https://protonmail.com) Secure Email. -------- Original Message -------- Subject: Re: [Haskell-cafe] Qualified imports and REPL output in GHCi 8.0.1 Local Time: December 7, 2016 2:05 AM UTC Time: December 7, 2016 8:05 AM From: lexi.lambda at gmail.com To: Atrudyjane haskell-cafe at haskell.org Since Bool is already imported unqualified from the Prelude, GHC favors printing the unqualified version. If I include the -XNoImplicitPrelude option to disable the implicit import of the Prelude, I get the behavior you expect: $ ghci -XNoImplicitPrelude GHCi, version 8.0.1: http://www.haskell.org/ghc/ :? for help ghci> import qualified Data.Bool ghci> :t Data.Bool.bool Data.Bool.bool :: a -> a -> Data.Bool.Bool -> a Alexis > On Dec 6, 2016, at 23:59, Atrudyjane via Haskell-Cafe wrote: > > When I do a qualified import such as: > λ> import qualified Data.Bool > > then query a type, this is the output. > λ> :t Data.Bool.bool > Data.Bool.bool :: a -> a -> Bool -> a > > Was expecting: > λ> :t Data.Bool.bool > Data.Bool.bool :: a -> a -> Data.Bool.bool -> a > > I experimented with changing the -fno-implicit-import-qualified flag and the result was the same. Is there an option that needs to be set to show the expected behavior? > > Regards, > Andrea -------------- next part -------------- An HTML attachment was scrubbed... URL: From kolsrud at gmail.com Wed Dec 7 09:43:06 2016 From: kolsrud at gmail.com (=?UTF-8?Q?=C3=98ystein_Kolsrud?=) Date: Wed, 7 Dec 2016 10:43:06 +0100 Subject: [Haskell-cafe] State of records in Haskell Message-ID: Hi! I recently had a look at a talk by Simon Peyton Jones on lenses (https://skillsmatter.com/skillscasts/4251-lenses-compositional-data-access-and-manipulation) and happened to notice that, at the very end, he mentions that there were changes going into GHC 7.10 that would make it possible to use the same field name for multiple record types. I was searching around a little for more information on this, but had a hard time finding what I was looking for and was hoping that someone here could give me a pointer. What does GHC support in this domain at the moment, and are there any particular flags I need to use in order to use that functionality? Best regards, Øystein Kolsrud From M.W.Wang at kent.ac.uk Wed Dec 7 10:27:59 2016 From: M.W.Wang at kent.ac.uk (Meng Wang) Date: Wed, 7 Dec 2016 10:27:59 +0000 Subject: [Haskell-cafe] CFP Bx 17: 6th International Workshop on Bidirectional Transformations Message-ID: <5D81991B-C1F1-45BC-9130-5CF4E1C2044C@kent.ac.uk> CFP Bx 17: 6th International Workshop on Bidirectional Transformations CALL FOR PAPERS Sixth International Workshop on Bidirectional Transformations (Bx 2017) Uppsala, Sweden (Saturday April 29th, as part of ETAPS 2017) http://bx-community.wikidot.com/bx2017:home Bidirectional transformations (bx) are a mechanism for maintaining the consistency of at least two related sources of information. Such sources can be relational databases, software models and code, or any other document following standard or ad-hoc formats. Bx are an emerging topic in a wide range of research areas, with prominent presence at top conferences in several different fields (namely databases, programming languages, software engineering, and graph transformation), but with results in one field often getting limited exposure in the others. Bx 2017 is a dedicated venue for bx in all relevant fields, and is part of a workshop series that was created in order to promote cross-disciplinary research and awareness in the area. As such, since its beginning in 2012, the workshop has rotated between venues in different fields. IMPORTANT DATES - Abstract submission: 20 Jan 2017 - Paper submission: 27 Jan 2017 - Author notification: 17 Feb 2017 - Camera-ready version: 1 March 2017 - Workshop date: 29 April 2017 AIMS AND TOPICS The aim of the workshop is to bring together researchers and practitioners, established and new, interested in bx from different perspectives, including but not limited to: - data and model synchronization - view updating - inter-model consistency analysis and repair - data/schema (or model/metamodel) co-evolution - coupled software/model transformations - inversion of transformations and data exchange mappings - domain-specific languages for bx - analysis and classification of requirements for bx - bridging the gap between formal concepts and application scenarios - analysis of efficiency of transformation algorithms and benchmarks - survey and comparison of bx technologies - case studies and tool support PAPER CATEGORIES Submissions to Bx 2017 can be: - Regular papers (up to 15 pages) - in-depth presentations of novel concepts and results - applications of bx to new domains - survey papers providing novel comparisons between existing bx technologies and approaches - case studies - Tool papers (up to 8 pages) - guideline papers presenting best practices for employing a specific bx approach (with a specific tool) - presentation of new tools or substantial improvements to existing ones - qualitative and/or quantitative comparisons of applying different bx approaches and tools - Short papers (up to 4 pages) - work in progress - small focused contributions - position papers and research perspectives - critical questions and challenges for bx - Talk proposals (up to 2 pages) - proposed lectures about topics of interest for bx - existing work representing relevant contributions for bx - promising contributions that are not mature enough to be proposed as papers of the other categories All papers are expected to be self-contained and well-written. Tool papers are not expected to present novel scientific results, but to document artifacts of interest and share bx experience/best practices with the community. Short papers should primarily provoke interesting discussion at the workshop and will not be held to the same standard of maturity as regular papers. Talk proposals are expected to present works of particular interest for the community and that are worth a talk slot at the workshop. We strongly encourage authors to ensure that any (variants of) examples are present in the bx example repository at the time of submission, and for tool papers, to allow for reproducibility with minimal effort, either via a virtual machine (e.g. via Share - http://share20.eu) or a dedicated website with relevant artifacts and tool access. SUBMISSION GUIDELINES Submitted papers must follow the CEUR one column style available at http://ceur-ws.org/Vol-XXX/samplestyles/. Papers must be submitted via the EasyChair system: https://www.easychair.org/conferences/?conf=bx2017. Submissions not complying with the above guidelines may be excluded from the reviewing process without further notice. If a paper is accepted, one author of the paper is expected to participate in the workshop to present it. Authors of accepted tool papers are also expected to be available to demonstrate their tool at the event. PROCEEDINGS AND SPECIAL ISSUE The workshop proceedings, including all accepted papers (except talk proposals), will be published electronically by CEUR (http://ceur-ws.org). Authors of accepted papers (of all categories except talk proposal) that have high-quality and the potential to be extended into journal articles will be invited to submit a revised and extended version of their paper to an expected special issue of the Journal of Object Technology (http://www.jot.fm); these papers will then be subject to a careful reviewing and selection process according to the scientific standards of the Journal of Object Technology. PROGRAM CO-CHAIRS - Romina Eramo, University of L'Aquila, Italy - Michael Johnson, Macquarie University, Australia PROGRAM COMMITTEE MEMBERS - Anthony Anjorin, University of Paderborn, Germany - Soichiro Hidaka, Hosei University, Japan - Max E. Kramer, Karlsruhe Institute of Technology, Germany - James McKinna, University of Edinburgh, UK - Hugo Pacheco, University of Minho, Portugal - Alfonso Pierantonio, University of L'Aquila, Italy - Andy Schürr, Technical University of Darmstadt, Germany - Daniel Strüber, Universität Koblenz-Landau, Germany - James Terwilliger, Microsoft, USA - Meng Wang, University of Kent, UK - Bernhard Westfechtel, Universität Bayreuth, Germany - Manuel Wimmer, Vienna University of Technology, Austria +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Dr. Meng Wang | Lecturer in Computer Science School of Computing | University of Kent | Canterbury, Kent, CT2 7NF, UK m.w.wang at kent.ac.uk | www.cs.kent.ac.uk/~mw516 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -------------- next part -------------- An HTML attachment was scrubbed... URL: From tomas.carnecky at gmail.com Wed Dec 7 10:36:35 2016 From: tomas.carnecky at gmail.com (Tomas Carnecky) Date: Wed, 07 Dec 2016 10:36:35 +0000 Subject: [Haskell-cafe] State of records in Haskell In-Reply-To: References: Message-ID: https://ghc.haskell.org/trac/ghc/wiki/Records/OverloadedRecordFields On Wed, Dec 7, 2016 at 10:43 AM Øystein Kolsrud wrote: > Hi! I recently had a look at a talk by Simon Peyton Jones on lenses > ( > https://skillsmatter.com/skillscasts/4251-lenses-compositional-data-access-and-manipulation > ) > and happened to notice that, at the very end, he mentions that there > were changes going into GHC 7.10 that would make it possible to use > the same field name for multiple record types. I was searching around > a little for more information on this, but had a hard time finding > what I was looking for and was hoping that someone here could give me > a pointer. > > What does GHC support in this domain at the moment, and are there any > particular flags I need to use in order to use that functionality? > > Best regards, Øystein Kolsrud > _______________________________________________ > 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 ben.richard.spencer at me.com Wed Dec 7 13:34:10 2016 From: ben.richard.spencer at me.com (Ben Spencer) Date: Wed, 07 Dec 2016 13:34:10 +0000 (GMT) Subject: [Haskell-cafe] Gitter Haskell Community Message-ID: <7033a798-3c01-48c4-883f-7368f5fb3871@me.com> Hello all, We have a small group of Haskellers over in our Gitter community chat. If you're inclined, come check us out at https://gitter.im/haskell-chat/Lobby. We have about 40 Haskell enthusiasts so far! Why Gitter you might ask? Gitter was designed for open communities. It's free for unlimited users and you get full access to your chat history. And you only need your Github account to sign up. Plus if we generate enough activity, Gitter will feature Haskell as a suggested community! Best, Ben -------------- next part -------------- An HTML attachment was scrubbed... URL: From will.yager at gmail.com Wed Dec 7 16:40:52 2016 From: will.yager at gmail.com (William Yager) Date: Wed, 7 Dec 2016 10:40:52 -0600 Subject: [Haskell-cafe] Gitter Haskell Community In-Reply-To: <7033a798-3c01-48c4-883f-7368f5fb3871@me.com> References: <7033a798-3c01-48c4-883f-7368f5fb3871@me.com> Message-ID: What are the advantages of this over the #haskell IRC on freenode? It's very active, usually with over 1500 nicks at any given time. I generally prefer IRC to any of these hip web chat solutions because IRC is client-agnostic and very rugged against companies folding or deciding they don't want to host a project any more. Basically the only way to kill an IRC channel is through social attrition, whereas any social value built up in hosted chat services might disappear overnight. The one major advantage of hosted chats over IRC is that they work better with mobile users, but I don't think that's very relevant for haskell dev. Will On Wed, Dec 7, 2016 at 7:34 AM, Ben Spencer wrote: > > Why Gitter you might ask? > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tomas.carnecky at gmail.com Wed Dec 7 16:50:43 2016 From: tomas.carnecky at gmail.com (Tomas Carnecky) Date: Wed, 07 Dec 2016 16:50:43 +0000 Subject: [Haskell-cafe] Gitter Haskell Community In-Reply-To: References: <7033a798-3c01-48c4-883f-7368f5fb3871@me.com> Message-ID: Usability matters. It's easier to tell people to open a browser window and point them at a URL than tell them to download an IRC chat client and how to connect to the server and... On Wed, Dec 7, 2016 at 5:41 PM William Yager wrote: > What are the advantages of this over the #haskell IRC on freenode? It's > very active, usually with over 1500 nicks at any given time. > > I generally prefer IRC to any of these hip web chat solutions because IRC > is client-agnostic and very rugged against companies folding or deciding > they don't want to host a project any more. Basically the only way to kill > an IRC channel is through social attrition, whereas any social value built > up in hosted chat services might disappear overnight. > > The one major advantage of hosted chats over IRC is that they work better > with mobile users, but I don't think that's very relevant for haskell dev. > > Will > > On Wed, Dec 7, 2016 at 7:34 AM, Ben Spencer > wrote: > > Why Gitter you might ask? > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From cma at bitemyapp.com Wed Dec 7 16:51:48 2016 From: cma at bitemyapp.com (Christopher Allen) Date: Wed, 7 Dec 2016 10:51:48 -0600 Subject: [Haskell-cafe] Gitter Haskell Community In-Reply-To: References: <7033a798-3c01-48c4-883f-7368f5fb3871@me.com> Message-ID: For that, there's http://fpchat.com/ which is an established Slack community. The #haskell channel alone has 1,208 people in it right now. On Wed, Dec 7, 2016 at 10:50 AM, Tomas Carnecky wrote: > Usability matters. It's easier to tell people to open a browser window and > point them at a URL than tell them to download an IRC chat client and how to > connect to the server and... > > On Wed, Dec 7, 2016 at 5:41 PM William Yager wrote: >> >> What are the advantages of this over the #haskell IRC on freenode? It's >> very active, usually with over 1500 nicks at any given time. >> >> I generally prefer IRC to any of these hip web chat solutions because IRC >> is client-agnostic and very rugged against companies folding or deciding >> they don't want to host a project any more. Basically the only way to kill >> an IRC channel is through social attrition, whereas any social value built >> up in hosted chat services might disappear overnight. >> >> The one major advantage of hosted chats over IRC is that they work better >> with mobile users, but I don't think that's very relevant for haskell dev. >> >> Will >> >> On Wed, Dec 7, 2016 at 7:34 AM, Ben Spencer >> wrote: >>> >>> Why Gitter you might ask? >> >> _______________________________________________ >> 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. -- Chris Allen Currently working on http://haskellbook.com From allbery.b at gmail.com Wed Dec 7 16:54:50 2016 From: allbery.b at gmail.com (Brandon Allbery) Date: Wed, 7 Dec 2016 16:54:50 +0000 Subject: [Haskell-cafe] Gitter Haskell Community In-Reply-To: References: <7033a798-3c01-48c4-883f-7368f5fb3871@me.com> Message-ID: On Wed, Dec 7, 2016 at 4:50 PM, Tomas Carnecky wrote: > Usability matters Only for some people, apparently. A web-only interface is not positive usability for some of us. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From justin.k.wood at gmail.com Wed Dec 7 16:55:20 2016 From: justin.k.wood at gmail.com (Justin Wood) Date: Wed, 7 Dec 2016 11:55:20 -0500 Subject: [Haskell-cafe] Gitter Haskell Community In-Reply-To: References: <7033a798-3c01-48c4-883f-7368f5fb3871@me.com> Message-ID: > It's easier to tell people to open a browser window and point them at a URL You could always point someone to https://webchat.freenode.net/ or any other web based IRC client. On Wed, Dec 7, 2016 at 11:51 AM, Christopher Allen wrote: > For that, there's http://fpchat.com/ which is an established Slack > community. The #haskell channel alone has 1,208 people in it right > now. > > On Wed, Dec 7, 2016 at 10:50 AM, Tomas Carnecky > wrote: > > Usability matters. It's easier to tell people to open a browser window > and > > point them at a URL than tell them to download an IRC chat client and > how to > > connect to the server and... > > > > On Wed, Dec 7, 2016 at 5:41 PM William Yager > wrote: > >> > >> What are the advantages of this over the #haskell IRC on freenode? It's > >> very active, usually with over 1500 nicks at any given time. > >> > >> I generally prefer IRC to any of these hip web chat solutions because > IRC > >> is client-agnostic and very rugged against companies folding or deciding > >> they don't want to host a project any more. Basically the only way to > kill > >> an IRC channel is through social attrition, whereas any social value > built > >> up in hosted chat services might disappear overnight. > >> > >> The one major advantage of hosted chats over IRC is that they work > better > >> with mobile users, but I don't think that's very relevant for haskell > dev. > >> > >> Will > >> > >> On Wed, Dec 7, 2016 at 7:34 AM, Ben Spencer > > >> wrote: > >>> > >>> Why Gitter you might ask? > >> > >> _______________________________________________ > >> 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. > > > > -- > Chris Allen > Currently working on http://haskellbook.com > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben.richard.spencer at me.com Wed Dec 7 17:07:13 2016 From: ben.richard.spencer at me.com (Ben Spencer) Date: Wed, 07 Dec 2016 17:07:13 +0000 (GMT) Subject: [Haskell-cafe] Gitter Haskell Community Message-ID: <2973cb33-a8ac-4e83-805b-b11907c10363@me.com> Hey Chris, As I've mentioned Slack isn't a good choice for open communities. It's really designed for businesses. On Dec 07, 2016, at 11:52 AM, Christopher Allen wrote: For that, there's http://fpchat.com/ which is an established Slack community. The #haskell channel alone has 1,208 people in it right now. On Wed, Dec 7, 2016 at 10:50 AM, Tomas Carnecky wrote: Usability matters. It's easier to tell people to open a browser window and point them at a URL than tell them to download an IRC chat client and how to connect to the server and... On Wed, Dec 7, 2016 at 5:41 PM William Yager wrote: What are the advantages of this over the #haskell IRC on freenode? It's very active, usually with over 1500 nicks at any given time. I generally prefer IRC to any of these hip web chat solutions because IRC is client-agnostic and very rugged against companies folding or deciding they don't want to host a project any more. Basically the only way to kill an IRC channel is through social attrition, whereas any social value built up in hosted chat services might disappear overnight. The one major advantage of hosted chats over IRC is that they work better with mobile users, but I don't think that's very relevant for haskell dev. Will On Wed, Dec 7, 2016 at 7:34 AM, Ben Spencer wrote: Why Gitter you might ask? _______________________________________________ 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. -- Chris Allen Currently working on http://haskellbook.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben.richard.spencer at me.com Wed Dec 7 17:07:37 2016 From: ben.richard.spencer at me.com (Ben Spencer) Date: Wed, 07 Dec 2016 17:07:37 +0000 (GMT) Subject: [Haskell-cafe] Gitter Haskell Community Message-ID: <595158bb-af31-436e-9ba4-a0f5631208a3@me.com> Hello Tomas, I agree usability does matter.  On Dec 07, 2016, at 11:55 AM, Ben Spencer wrote: Hello Tomas, I agree usability does matter.  On Dec 07, 2016, at 11:51 AM, Tomas Carnecky wrote: Usability matters. It's easier to tell people to open a browser window and point them at a URL than tell them to download an IRC chat client and how to connect to the server and... On Wed, Dec 7, 2016 at 5:41 PM William Yager wrote: What are the advantages of this over the #haskell IRC on freenode? It's very active, usually with over 1500 nicks at any given time. I generally prefer IRC to any of these hip web chat solutions because IRC is client-agnostic and very rugged against companies folding or deciding they don't want to host a project any more. Basically the only way to kill an IRC channel is through social attrition, whereas any social value built up in hosted chat services might disappear overnight. The one major advantage of hosted chats over IRC is that they work better with mobile users, but I don't think that's very relevant for haskell dev. Will On Wed, Dec 7, 2016 at 7:34 AM, Ben Spencer wrote: Why Gitter you might ask?  _______________________________________________ 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 ben.richard.spencer at me.com Wed Dec 7 17:08:00 2016 From: ben.richard.spencer at me.com (Ben Spencer) Date: Wed, 07 Dec 2016 17:08:00 +0000 (GMT) Subject: [Haskell-cafe] Gitter Haskell Community Message-ID: <5c1a575a-0c25-4bae-b908-0c6a9fdeb118@me.com> Hey William, I'll speak from my experience. I've noticed that the developers I work with (mostly younger developers) have embraced tech like Github, Slack, and Gitter. When I first tried Slack I didn't like it much but now I understand the appeal. I remember trying IRC a long time ago. It seemed to work for the time but for whatever reason I didn't take to it. This part is my opinion, but if a community like Haskell wants to gain wider appeal we have to meet new people where they are at. Most people know about Github and like Github. A solution like Gitter integrates nicely. Slack isn't a good option because it's designed for businesses in mind. The chat history is limited and you have to pay for extra features. IRC is a bit aged. It doesn't make it bad but newer developers are interested in the new shiny technology. I've also seen a few posts that in order to get it to work well (ie having a chat history) you have to have a hosted service. That's overhead I rather not have.  But more importantly, we should meet the community where they're at and that's on Github. Best, Ben Spencer On Dec 07, 2016, at 11:41 AM, William Yager wrote: What are the advantages of this over the #haskell IRC on freenode? It's very active, usually with over 1500 nicks at any given time. I generally prefer IRC to any of these hip web chat solutions because IRC is client-agnostic and very rugged against companies folding or deciding they don't want to host a project any more. Basically the only way to kill an IRC channel is through social attrition, whereas any social value built up in hosted chat services might disappear overnight. The one major advantage of hosted chats over IRC is that they work better with mobile users, but I don't think that's very relevant for haskell dev. Will On Wed, Dec 7, 2016 at 7:34 AM, Ben Spencer wrote: Why Gitter you might ask?  -------------- next part -------------- An HTML attachment was scrubbed... URL: From mike at barrucadu.co.uk Wed Dec 7 17:09:46 2016 From: mike at barrucadu.co.uk (Michael Walker) Date: Wed, 7 Dec 2016 17:09:46 +0000 Subject: [Haskell-cafe] Gitter Haskell Community In-Reply-To: <2973cb33-a8ac-4e83-805b-b11907c10363@me.com> References: <2973cb33-a8ac-4e83-805b-b11907c10363@me.com> Message-ID: The Haskell slack seems to be working well, so regardless of the suitability of slack to open communities or not, I don't really see the advantage of fragmenting the community even further. Why would someone pick gitter over the two existing platforms that have thousands of users? They would be intentionally limiting the help they can get. On 7 December 2016 at 17:07, Ben Spencer wrote: > Hey Chris, > > As I've mentioned Slack isn't a good choice for open communities. It's > really designed for businesses. > > On Dec 07, 2016, at 11:52 AM, Christopher Allen wrote: > > For that, there's http://fpchat.com/ which is an established Slack > community. The #haskell channel alone has 1,208 people in it right > now. > > On Wed, Dec 7, 2016 at 10:50 AM, Tomas Carnecky > wrote: > > Usability matters. It's easier to tell people to open a browser window and > > point them at a URL than tell them to download an IRC chat client and how to > > connect to the server and... > > > On Wed, Dec 7, 2016 at 5:41 PM William Yager wrote: > > > What are the advantages of this over the #haskell IRC on freenode? It's > > very active, usually with over 1500 nicks at any given time. > > > I generally prefer IRC to any of these hip web chat solutions because IRC > > is client-agnostic and very rugged against companies folding or deciding > > they don't want to host a project any more. Basically the only way to kill > > an IRC channel is through social attrition, whereas any social value built > > up in hosted chat services might disappear overnight. > > > The one major advantage of hosted chats over IRC is that they work better > > with mobile users, but I don't think that's very relevant for haskell dev. > > > Will > > > On Wed, Dec 7, 2016 at 7:34 AM, Ben Spencer > > wrote: > > > Why Gitter you might ask? > > > _______________________________________________ > > 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. > > > > > -- > Chris Allen > Currently working on http://haskellbook.com > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -- Michael Walker (http://www.barrucadu.co.uk) From justin.k.wood at gmail.com Wed Dec 7 17:09:52 2016 From: justin.k.wood at gmail.com (Justin Wood) Date: Wed, 7 Dec 2016 12:09:52 -0500 Subject: [Haskell-cafe] Gitter Haskell Community In-Reply-To: <8ae3b71a-5759-4969-819f-a6fd3e94e13f@me.com> References: <8ae3b71a-5759-4969-819f-a6fd3e94e13f@me.com> Message-ID: Ben, Please make sure that you use reply all in the future so that the message does not go just to me. For everyone else on the list, this was the message > That comes back to usability. The client functions but it is not appealing. Personal taste, I suppose. I agree that freenode webchat is not the most appealing piece of software, but there are plenty of web based IRC clients. I'm sure there are some that are appealing. On Wed, Dec 7, 2016 at 11:56 AM, Ben Spencer wrote: > That comes back to usability. The client functions but it is not > appealing. Personal taste, I suppose. > > On Dec 07, 2016, at 11:55 AM, Justin Wood wrote: > > > It's easier to tell people to open a browser window and point them at a > URL > > You could always point someone to https://webchat.freenode.net/ or any > other web based IRC client. > > On Wed, Dec 7, 2016 at 11:51 AM, Christopher Allen > wrote: > >> For that, there's http://fpchat.com/ which is an established Slack >> community. The #haskell channel alone has 1,208 people in it right >> now. >> >> On Wed, Dec 7, 2016 at 10:50 AM, Tomas Carnecky >> wrote: >> > Usability matters. It's easier to tell people to open a browser window >> and >> > point them at a URL than tell them to download an IRC chat client and >> how to >> > connect to the server and... >> > >> > On Wed, Dec 7, 2016 at 5:41 PM William Yager >> wrote: >> >> >> >> What are the advantages of this over the #haskell IRC on freenode? It's >> >> very active, usually with over 1500 nicks at any given time. >> >> >> >> I generally prefer IRC to any of these hip web chat solutions because >> IRC >> >> is client-agnostic and very rugged against companies folding or >> deciding >> >> they don't want to host a project any more. Basically the only way to >> kill >> >> an IRC channel is through social attrition, whereas any social value >> built >> >> up in hosted chat services might disappear overnight. >> >> >> >> The one major advantage of hosted chats over IRC is that they work >> better >> >> with mobile users, but I don't think that's very relevant for haskell >> dev. >> >> >> >> Will >> >> >> >> On Wed, Dec 7, 2016 at 7:34 AM, Ben Spencer < >> ben.richard.spencer at me.com> >> >> wrote: >> >>> >> >>> Why Gitter you might ask? >> >> >> >> _______________________________________________ >> >> 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. >> >> >> >> -- >> Chris Allen >> Currently working on http://haskellbook.com >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view archives go to: >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> Only members subscribed via the mailman list are allowed to post. >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben.richard.spencer at me.com Wed Dec 7 17:14:27 2016 From: ben.richard.spencer at me.com (Ben Spencer) Date: Wed, 07 Dec 2016 17:14:27 +0000 (GMT) Subject: [Haskell-cafe] Gitter Haskell Community Message-ID: <480cdfad-b417-4827-ad89-796cfc03965f@me.com> I think it's important to recognize that users have different tastes and needs. Additionally, Gitter allows you to view the chat channel if you wish. It's also something that's publicly viewable and searchable from Gitter explore. It doesn't require the odd signup process that Slack has implemented. I can actually see my chat history for more than 2 days! But beyond that if you like Slack and its community then more power to you. We can certainly have a difference of opinion and preferences. -Ben On Dec 07, 2016, at 12:09 PM, Michael Walker wrote: The Haskell slack seems to be working well, so regardless of the suitability of slack to open communities or not, I don't really see the advantage of fragmenting the community even further. Why would someone pick gitter over the two existing platforms that have thousands of users? They would be intentionally limiting the help they can get. On 7 December 2016 at 17:07, Ben Spencer wrote: Hey Chris, As I've mentioned Slack isn't a good choice for open communities. It's really designed for businesses. On Dec 07, 2016, at 11:52 AM, Christopher Allen wrote: For that, there's http://fpchat.com/ which is an established Slack community. The #haskell channel alone has 1,208 people in it right now. On Wed, Dec 7, 2016 at 10:50 AM, Tomas Carnecky wrote: Usability matters. It's easier to tell people to open a browser window and point them at a URL than tell them to download an IRC chat client and how to connect to the server and... On Wed, Dec 7, 2016 at 5:41 PM William Yager wrote: What are the advantages of this over the #haskell IRC on freenode? It's very active, usually with over 1500 nicks at any given time. I generally prefer IRC to any of these hip web chat solutions because IRC is client-agnostic and very rugged against companies folding or deciding they don't want to host a project any more. Basically the only way to kill an IRC channel is through social attrition, whereas any social value built up in hosted chat services might disappear overnight. The one major advantage of hosted chats over IRC is that they work better with mobile users, but I don't think that's very relevant for haskell dev. Will On Wed, Dec 7, 2016 at 7:34 AM, Ben Spencer wrote: Why Gitter you might ask? _______________________________________________ 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. -- Chris Allen Currently working on http://haskellbook.com _______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post. -- Michael Walker (http://www.barrucadu.co.uk) -------------- next part -------------- An HTML attachment was scrubbed... URL: From mihai.maruseac at gmail.com Wed Dec 7 19:02:08 2016 From: mihai.maruseac at gmail.com (Mihai Maruseac) Date: Wed, 7 Dec 2016 11:02:08 -0800 Subject: [Haskell-cafe] Gitter Haskell Community In-Reply-To: <480cdfad-b417-4827-ad89-796cfc03965f@me.com> References: <480cdfad-b417-4827-ad89-796cfc03965f@me.com> Message-ID: Problem is not in having different preferences but in splitting the community even further. That is something we should avoid. /me goes and investigates if a bot who will duplicate lines in #irc/slack/gitter to the other 2 channels is a good investment. On Wed, Dec 7, 2016 at 9:14 AM, Ben Spencer wrote: > I think it's important to recognize that users have different tastes and > needs. > > Additionally, Gitter allows you to view the chat channel if you wish. It's > also something that's publicly viewable and searchable from Gitter explore. > It doesn't require the odd signup process that Slack has implemented. I can > actually see my chat history for more than 2 days! > > But beyond that if you like Slack and its community then more power to you. > We can certainly have a difference of opinion and preferences. > > -Ben > > On Dec 07, 2016, at 12:09 PM, Michael Walker wrote: > > The Haskell slack seems to be working well, so regardless of the > suitability of slack to open communities or not, I don't really see > the advantage of fragmenting the community even further. Why would > someone pick gitter over the two existing platforms that have > thousands of users? They would be intentionally limiting the help they > can get. > > On 7 December 2016 at 17:07, Ben Spencer wrote: > > Hey Chris, > > > As I've mentioned Slack isn't a good choice for open communities. It's > > really designed for businesses. > > > On Dec 07, 2016, at 11:52 AM, Christopher Allen wrote: > > > For that, there's http://fpchat.com/ which is an established Slack > > community. The #haskell channel alone has 1,208 people in it right > > now. > > > On Wed, Dec 7, 2016 at 10:50 AM, Tomas Carnecky > > wrote: > > > Usability matters. It's easier to tell people to open a browser window and > > > point them at a URL than tell them to download an IRC chat client and how to > > > connect to the server and... > > > > On Wed, Dec 7, 2016 at 5:41 PM William Yager wrote: > > > > What are the advantages of this over the #haskell IRC on freenode? It's > > > very active, usually with over 1500 nicks at any given time. > > > > I generally prefer IRC to any of these hip web chat solutions because IRC > > > is client-agnostic and very rugged against companies folding or deciding > > > they don't want to host a project any more. Basically the only way to kill > > > an IRC channel is through social attrition, whereas any social value built > > > up in hosted chat services might disappear overnight. > > > > The one major advantage of hosted chats over IRC is that they work better > > > with mobile users, but I don't think that's very relevant for haskell dev. > > > > Will > > > > On Wed, Dec 7, 2016 at 7:34 AM, Ben Spencer > > > wrote: > > > > Why Gitter you might ask? > > > > _______________________________________________ > > > 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. > > > > > > -- > > Chris Allen > > Currently working on http://haskellbook.com > > > > _______________________________________________ > > Haskell-Cafe mailing list > > To (un)subscribe, modify options or view archives go to: > > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > Only members subscribed via the mailman list are allowed to post. > > > > > -- > Michael Walker (http://www.barrucadu.co.uk) > > > _______________________________________________ > 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. -- Mihai Maruseac (MM) "If you can't solve a problem, then there's an easier problem you can solve: find it." -- George Polya From allbery.b at gmail.com Wed Dec 7 19:06:22 2016 From: allbery.b at gmail.com (Brandon Allbery) Date: Wed, 7 Dec 2016 19:06:22 +0000 Subject: [Haskell-cafe] Gitter Haskell Community In-Reply-To: References: <480cdfad-b417-4827-ad89-796cfc03965f@me.com> Message-ID: On Wed, Dec 7, 2016 at 7:02 PM, Mihai Maruseac wrote: > /me goes and investigates if a bot who will duplicate lines in > #irc/slack/gitter to the other 2 channels is a good investment. > Duplicating stuff between communities with >1000 participants can be asking for pain. #haskell already decided against such a link with the Slack community (or rather, such a link exists but by specific request it only forwards from IRC to Slack). -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From mihai.maruseac at gmail.com Wed Dec 7 19:07:27 2016 From: mihai.maruseac at gmail.com (Mihai Maruseac) Date: Wed, 7 Dec 2016 11:07:27 -0800 Subject: [Haskell-cafe] Gitter Haskell Community In-Reply-To: References: <480cdfad-b417-4827-ad89-796cfc03965f@me.com> Message-ID: >> >> /me goes and investigates if a bot who will duplicate lines in >> #irc/slack/gitter to the other 2 channels is a good investment. > > > Duplicating stuff between communities with >1000 participants can be asking > for pain. #haskell already decided against such a link with the Slack > community (or rather, such a link exists but by specific request it only > forwards from IRC to Slack). Investigation closed. Thanks :) From david.feuer at gmail.com Thu Dec 8 02:16:51 2016 From: david.feuer at gmail.com (David Feuer) Date: Wed, 7 Dec 2016 21:16:51 -0500 Subject: [Haskell-cafe] Injective type family on a sub domain In-Reply-To: References: Message-ID: Yes, you can do this. Enable ConstraintKinds, import Data.Type.Bool and something exporting Constraint, and change your Add constructor to Add :: (r ~ Or t t', If (Not r) (t ~ 'False, t' ~ 'False) (() :: Constraint) => Expr t -> Expr t' -> Expr r Then both eval and eval' are accepted. There may be some cleaner way; I'm no expert. On Dec 7, 2016 2:43 AM, "Guillaume Bouchard" < guillaum.bouchard+haskell at gmail.com> wrote: Hi. I have the following GADT : ----------------------------- type family Or a b where Or 'False 'False = 'False Or _ _ = 'True data Expr t where Add :: Expr t -> Expr t' -> Expr (Or t t') Lit :: Int -> Expr 'False Var :: Expr 'True ---------------------- The idea is that if the `Expr` contains a sub `Var`, its type is `Expr 'True`, else it is `Expr 'False`. I now want to evaluate my expression, something like that : -------------- eval :: Expr t -> Int eval (Lit i) = i eval (Add a b) = eval a + eval b eval Var = error "Cannot evaluate expression with variable" ---------------- Using the GADT I previously defined, I'm tempted to remove the impossible "Var" case with : --------------- eval' :: Expr 'False -> Int eval' (Lit i) = i eval' (Add a b) = eval' a + eval' b ---------------- However this does not typecheck because GHC cannot deduce that `a` and `b` are `~ Expr 'False`. Because the type family `Or` is not injective. The wiki https://ghc.haskell.org/trac/ghc/wiki/InjectiveTypeFamilies classifies injectives types families in three categories, but I don't think my `Or` appears in any of them. Actually `Or` is injective only if `Or t t' ~ 'False` and in this case, we can deduce that `t ~ 'False` and `t' ~ 'False`. I qualify it as a "partialy injective type family". The type checker does not know that, hence my code does not compile. Is there a solution, other than writing a custom type checker plugin? Is there a way to provide the inverse type family function, something such as: type family InverseOr a where InverseOr 'False = ('False, 'False) Thank you. -- G. _______________________________________________ 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 david.feuer at gmail.com Thu Dec 8 02:18:26 2016 From: david.feuer at gmail.com (David Feuer) Date: Wed, 7 Dec 2016 21:18:26 -0500 Subject: [Haskell-cafe] Injective type family on a sub domain In-Reply-To: References: Message-ID: Er... There's a missing close paren at the end of the context; sorry. That should be Add :: (r ~ Or t t', If (Not r) (t ~ 'False, t' ~ 'False) (() :: Constraint)) => Expr t -> Expr t' -> Expr r On Dec 7, 2016 9:16 PM, "David Feuer" wrote: Yes, you can do this. Enable ConstraintKinds, import Data.Type.Bool and something exporting Constraint, and change your Add constructor to Add :: (r ~ Or t t', If (Not r) (t ~ 'False, t' ~ 'False) (() :: Constraint) => Expr t -> Expr t' -> Expr r Then both eval and eval' are accepted. There may be some cleaner way; I'm no expert. On Dec 7, 2016 2:43 AM, "Guillaume Bouchard" wrote: Hi. I have the following GADT : ----------------------------- type family Or a b where Or 'False 'False = 'False Or _ _ = 'True data Expr t where Add :: Expr t -> Expr t' -> Expr (Or t t') Lit :: Int -> Expr 'False Var :: Expr 'True ---------------------- The idea is that if the `Expr` contains a sub `Var`, its type is `Expr 'True`, else it is `Expr 'False`. I now want to evaluate my expression, something like that : -------------- eval :: Expr t -> Int eval (Lit i) = i eval (Add a b) = eval a + eval b eval Var = error "Cannot evaluate expression with variable" ---------------- Using the GADT I previously defined, I'm tempted to remove the impossible "Var" case with : --------------- eval' :: Expr 'False -> Int eval' (Lit i) = i eval' (Add a b) = eval' a + eval' b ---------------- However this does not typecheck because GHC cannot deduce that `a` and `b` are `~ Expr 'False`. Because the type family `Or` is not injective. The wiki https://ghc.haskell.org/trac/ghc/wiki/InjectiveTypeFamilies classifies injectives types families in three categories, but I don't think my `Or` appears in any of them. Actually `Or` is injective only if `Or t t' ~ 'False` and in this case, we can deduce that `t ~ 'False` and `t' ~ 'False`. I qualify it as a "partialy injective type family". The type checker does not know that, hence my code does not compile. Is there a solution, other than writing a custom type checker plugin? Is there a way to provide the inverse type family function, something such as: type family InverseOr a where InverseOr 'False = ('False, 'False) Thank you. -- G. _______________________________________________ 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 david.feuer at gmail.com Thu Dec 8 02:51:21 2016 From: david.feuer at gmail.com (David Feuer) Date: Wed, 7 Dec 2016 21:51:21 -0500 Subject: [Haskell-cafe] Injective type family on a sub domain In-Reply-To: References: Message-ID: While you're at it, you should probably add the rest of the implications: If (r && Not t) (t' ~ 'True) (() :: Constraint), If (r && Not t') (t ~ 'True) (() :: Constraint) On Dec 7, 2016 9:18 PM, "David Feuer" wrote: Er... There's a missing close paren at the end of the context; sorry. That should be Add :: (r ~ Or t t', If (Not r) (t ~ 'False, t' ~ 'False) (() :: Constraint)) => Expr t -> Expr t' -> Expr r On Dec 7, 2016 9:16 PM, "David Feuer" wrote: Yes, you can do this. Enable ConstraintKinds, import Data.Type.Bool and something exporting Constraint, and change your Add constructor to Add :: (r ~ Or t t', If (Not r) (t ~ 'False, t' ~ 'False) (() :: Constraint) => Expr t -> Expr t' -> Expr r Then both eval and eval' are accepted. There may be some cleaner way; I'm no expert. On Dec 7, 2016 2:43 AM, "Guillaume Bouchard" wrote: Hi. I have the following GADT : ----------------------------- type family Or a b where Or 'False 'False = 'False Or _ _ = 'True data Expr t where Add :: Expr t -> Expr t' -> Expr (Or t t') Lit :: Int -> Expr 'False Var :: Expr 'True ---------------------- The idea is that if the `Expr` contains a sub `Var`, its type is `Expr 'True`, else it is `Expr 'False`. I now want to evaluate my expression, something like that : -------------- eval :: Expr t -> Int eval (Lit i) = i eval (Add a b) = eval a + eval b eval Var = error "Cannot evaluate expression with variable" ---------------- Using the GADT I previously defined, I'm tempted to remove the impossible "Var" case with : --------------- eval' :: Expr 'False -> Int eval' (Lit i) = i eval' (Add a b) = eval' a + eval' b ---------------- However this does not typecheck because GHC cannot deduce that `a` and `b` are `~ Expr 'False`. Because the type family `Or` is not injective. The wiki https://ghc.haskell.org/trac/ghc/wiki/InjectiveTypeFamilies classifies injectives types families in three categories, but I don't think my `Or` appears in any of them. Actually `Or` is injective only if `Or t t' ~ 'False` and in this case, we can deduce that `t ~ 'False` and `t' ~ 'False`. I qualify it as a "partialy injective type family". The type checker does not know that, hence my code does not compile. Is there a solution, other than writing a custom type checker plugin? Is there a way to provide the inverse type family function, something such as: type family InverseOr a where InverseOr 'False = ('False, 'False) Thank you. -- G. _______________________________________________ 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.grenrus at iki.fi Thu Dec 8 08:13:06 2016 From: oleg.grenrus at iki.fi (Oleg Grenrus) Date: Thu, 8 Dec 2016 10:13:06 +0200 Subject: [Haskell-cafe] Injective type family on a sub domain In-Reply-To: References: Message-ID: The david’s approach is ingenious, but a more direct way, is to construct the type equality proof yourself. It’s more like what it would look like in say Agda: {-# LANGUAGE DataKinds #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} {-# OPTIONS_GHC -Wall -Wno-redundant-constraints #-} import Data.Type.Bool import Data.Type.Equality -- http://hackage.haskell.org/package/singleton-bool-0.1.2.0/docs/Data-Singletons-Bool.html import Data.Singletons.Bool import Unsafe.Coerce (unsafeCoerce) -- Safe version proof :: forall a b. (SBoolI a, SBoolI b, (a || b) ~ 'False) => (a :~: 'False, b :~: 'False) proof = case (sbool :: SBool a, sbool :: SBool b) of (SFalse, SFalse) -> (Refl, Refl) -- with unsafeCoerce we don't need the contexts. they can be satisfied for all a, b :: Bool -- and we don't want runtime SBool dictionaries hanging around (would need to change Expr definition) proof' :: forall a b. ((a || b) ~ 'False) => (a :~: 'False, b :~: 'False) proof' = (unsafeCoerce trivialRefl, unsafeCoerce trivialRefl) data Expr t where Add :: Expr t -> Expr t' -> Expr (t || t') Lit :: Int -> Expr 'False Var :: Expr 'True eval' :: Expr 'False -> Int eval' (Lit i) = i eval' (Add a b) = add a b where add :: forall t t'. ((t || t') ~ 'False) => Expr t -> Expr t' -> Int add x y = case proof' :: (t :~: 'False, t' :~: 'False) of (Refl, Refl) -> eval' x + eval' y > On 07 Dec 2016, at 09:43, Guillaume Bouchard wrote: > > Hi. > > I have the following GADT : > > ----------------------------- > type family Or a b where > Or 'False 'False = 'False > Or _ _ = 'True > > data Expr t where > Add :: Expr t -> Expr t' -> Expr (Or t t') > Lit :: Int -> Expr 'False > Var :: Expr 'True > ---------------------- > > The idea is that if the `Expr` contains a sub `Var`, its type is `Expr 'True`, else it is `Expr 'False`. > > I now want to evaluate my expression, something like that : > > -------------- > eval :: Expr t -> Int > eval (Lit i) = i > eval (Add a b) = eval a + eval b > eval Var = error "Cannot evaluate expression with variable" > ---------------- > > Using the GADT I previously defined, I'm tempted to remove the impossible "Var" case with : > > --------------- > eval' :: Expr 'False -> Int > eval' (Lit i) = i > eval' (Add a b) = eval' a + eval' b > ---------------- > > However this does not typecheck because GHC cannot deduce that `a` and `b` are `~ Expr 'False`. Because the type family `Or` is not injective. > > The wiki https://ghc.haskell.org/trac/ghc/wiki/InjectiveTypeFamilies classifies injectives types families in three categories, but I don't think my `Or` appears in any of them. > > Actually `Or` is injective only if `Or t t' ~ 'False` and in this case, we can deduce that `t ~ 'False` and `t' ~ 'False`. I qualify it as a "partialy injective type family". > > The type checker does not know that, hence my code does not compile. > > Is there a solution, other than writing a custom type checker plugin? Is there a way to provide the inverse type family function, something such as: > > type family InverseOr a where > InverseOr 'False = ('False, 'False) > > Thank you. > > -- > G. > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 842 bytes Desc: Message signed with OpenPGP using GPGMail URL: From heraldhoi at gmail.com Thu Dec 8 08:44:35 2016 From: heraldhoi at gmail.com (Geraldus) Date: Thu, 08 Dec 2016 08:44:35 +0000 Subject: [Haskell-cafe] Gitter Haskell Community In-Reply-To: References: <480cdfad-b417-4827-ad89-796cfc03965f@me.com> Message-ID: >From my point of view all mentioned solutions aren't perfect: + with IRC I always lose the history, also, my client (Lingo on OS X) always disconnects and I can lose answers really easy too + I tried Slack in the past, and found no advantages or something that buys me + Gitter is quite buggy for now However my personal preference is Gitter, because it give history, edit abilities and nice code appearance for free (though I wish to see light theme for code highlighter as GitHub provides by default). -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.feuer at gmail.com Thu Dec 8 09:04:59 2016 From: david.feuer at gmail.com (David Feuer) Date: Thu, 8 Dec 2016 04:04:59 -0500 Subject: [Haskell-cafe] Injective type family on a sub domain In-Reply-To: References: Message-ID: Another option, I believe, would be to include singletons (or constraints providing them) to the Add constructor. On Dec 8, 2016 3:13 AM, "Oleg Grenrus" wrote: The david’s approach is ingenious, but a more direct way, is to construct the type equality proof yourself. It’s more like what it would look like in say Agda: {-# LANGUAGE DataKinds #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} {-# OPTIONS_GHC -Wall -Wno-redundant-constraints #-} import Data.Type.Bool import Data.Type.Equality -- http://hackage.haskell.org/package/singleton-bool-0.1.2. 0/docs/Data-Singletons-Bool.html import Data.Singletons.Bool import Unsafe.Coerce (unsafeCoerce) -- Safe version proof :: forall a b. (SBoolI a, SBoolI b, (a || b) ~ 'False) => (a :~: 'False, b :~: 'False) proof = case (sbool :: SBool a, sbool :: SBool b) of (SFalse, SFalse) -> (Refl, Refl) -- with unsafeCoerce we don't need the contexts. they can be satisfied for all a, b :: Bool -- and we don't want runtime SBool dictionaries hanging around (would need to change Expr definition) proof' :: forall a b. ((a || b) ~ 'False) => (a :~: 'False, b :~: 'False) proof' = (unsafeCoerce trivialRefl, unsafeCoerce trivialRefl) data Expr t where Add :: Expr t -> Expr t' -> Expr (t || t') Lit :: Int -> Expr 'False Var :: Expr 'True eval' :: Expr 'False -> Int eval' (Lit i) = i eval' (Add a b) = add a b where add :: forall t t'. ((t || t') ~ 'False) => Expr t -> Expr t' -> Int add x y = case proof' :: (t :~: 'False, t' :~: 'False) of (Refl, Refl) -> eval' x + eval' y On 07 Dec 2016, at 09:43, Guillaume Bouchard wrote: Hi. I have the following GADT : ----------------------------- type family Or a b where Or 'False 'False = 'False Or _ _ = 'True data Expr t where Add :: Expr t -> Expr t' -> Expr (Or t t') Lit :: Int -> Expr 'False Var :: Expr 'True ---------------------- The idea is that if the `Expr` contains a sub `Var`, its type is `Expr 'True`, else it is `Expr 'False`. I now want to evaluate my expression, something like that : -------------- eval :: Expr t -> Int eval (Lit i) = i eval (Add a b) = eval a + eval b eval Var = error "Cannot evaluate expression with variable" ---------------- Using the GADT I previously defined, I'm tempted to remove the impossible "Var" case with : --------------- eval' :: Expr 'False -> Int eval' (Lit i) = i eval' (Add a b) = eval' a + eval' b ---------------- However this does not typecheck because GHC cannot deduce that `a` and `b` are `~ Expr 'False`. Because the type family `Or` is not injective. The wiki https://ghc.haskell.org/trac/ghc/wiki/InjectiveTypeFamilies classifies injectives types families in three categories, but I don't think my `Or` appears in any of them. Actually `Or` is injective only if `Or t t' ~ 'False` and in this case, we can deduce that `t ~ 'False` and `t' ~ 'False`. I qualify it as a "partialy injective type family". The type checker does not know that, hence my code does not compile. Is there a solution, other than writing a custom type checker plugin? Is there a way to provide the inverse type family function, something such as: type family InverseOr a where InverseOr 'False = ('False, 'False) Thank you. -- G. _______________________________________________ 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 78emil at gmail.com Thu Dec 8 10:31:56 2016 From: 78emil at gmail.com (Emil Axelsson) Date: Thu, 8 Dec 2016 11:31:56 +0100 Subject: [Haskell-cafe] Injective type family on a sub domain In-Reply-To: References: Message-ID: <1b4e42a8-0548-ff6f-598f-95647a131a50@gmail.com> A different way to achieve the guarantee you want is to let unification do the "oring" for you: {-# LANGUAGE GADTs #-} {-# LANGUAGE Rank2Types #-} {-# OPTIONS_GHC -fwarn-incomplete-patterns #-} data HasVar data Expr t where Add :: Expr x -> Expr x -> Expr x Lit :: Int -> Expr x Var :: Expr HasVar eval :: (forall x . Expr x) -> Int eval = go where go :: Expr () -> Int go (Add a b) = go a + go b go (Lit a) = a / Emil Den 2016-12-07 kl. 08:43, skrev Guillaume Bouchard: > Hi. > > I have the following GADT : > > ----------------------------- > type family Or a b where > Or 'False 'False = 'False > Or _ _ = 'True > > data Expr t where > Add :: Expr t -> Expr t' -> Expr (Or t t') > Lit :: Int -> Expr 'False > Var :: Expr 'True > ---------------------- > > The idea is that if the `Expr` contains a sub `Var`, its type is `Expr 'True`, > else it is `Expr 'False`. > > I now want to evaluate my expression, something like that : > > -------------- > eval :: Expr t -> Int > eval (Lit i) = i > eval (Add a b) = eval a + eval b > eval Var = error "Cannot evaluate expression with variable" > ---------------- > > Using the GADT I previously defined, I'm tempted to remove the impossible "Var" > case with : > > --------------- > eval' :: Expr 'False -> Int > eval' (Lit i) = i > eval' (Add a b) = eval' a + eval' b > ---------------- > > However this does not typecheck because GHC cannot deduce that `a` and `b` are > `~ Expr 'False`. Because the type family `Or` is not injective. > > The wiki https://ghc.haskell.org/trac/ghc/wiki/InjectiveTypeFamilies classifies > injectives types families in three categories, but I don't think my `Or` appears > in any of them. > > Actually `Or` is injective only if `Or t t' ~ 'False` and in this case, we can > deduce that `t ~ 'False` and `t' ~ 'False`. I qualify it as a "partialy > injective type family". > > The type checker does not know that, hence my code does not compile. > > Is there a solution, other than writing a custom type checker plugin? Is there a > way to provide the inverse type family function, something such as: > > type family InverseOr a where > InverseOr 'False = ('False, 'False) > > Thank you. > > -- > G. > > > > _______________________________________________ > 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 alexander.kjeldaas at gmail.com Thu Dec 8 11:01:20 2016 From: alexander.kjeldaas at gmail.com (Alexander Kjeldaas) Date: Thu, 8 Dec 2016 12:01:20 +0100 Subject: [Haskell-cafe] Gitter Haskell Community In-Reply-To: References: <480cdfad-b417-4827-ad89-796cfc03965f@me.com> Message-ID: I agree. While I've used IRC for almost 20 years, it just isn't as usable as the newer tools. - IRC assumes a permanently connected computer, which again requires a VPS as indirection. I do use that, but there are clear usability issues here. - IRC further assumes that I will be on one device only. Again I solve this by jumping through a VPS. It's a design flow though. - Slack is great, but enterprise (login ++). - Gitter is just "yet another tool", might be the best thing, but it just hasn't got the mindshare yet. A technical solution where freenode's #haskell is bridged to one of the new fancy web UIs, where history is kept, and multiple devices can be used, would be great. I'm not sure if anyone is doing that though. Alexander On Thu, Dec 8, 2016 at 9:44 AM, Geraldus wrote: > From my point of view all mentioned solutions aren't perfect: > > + with IRC I always lose the history, also, my client (Lingo on OS X) > always disconnects and I can lose answers really easy too > + I tried Slack in the past, and found no advantages or something that > buys me > + Gitter is quite buggy for now > > However my personal preference is Gitter, because it give history, edit > abilities and nice code appearance for free (though I wish to see light > theme for code highlighter as GitHub provides by default). > > _______________________________________________ > 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 ollie at ocharles.org.uk Thu Dec 8 12:26:39 2016 From: ollie at ocharles.org.uk (Oliver Charles) Date: Thu, 08 Dec 2016 12:26:39 +0000 Subject: [Haskell-cafe] Gitter Haskell Community In-Reply-To: References: <480cdfad-b417-4827-ad89-796cfc03965f@me.com> Message-ID: Does this really have to be all or nothing? It's just chat, something I consider fairly ephemeral anyway. I'd much rather people talk about Haskell as much as possible, even if that comes at the expensive of having one blessed channel/medium. On Thu, Dec 8, 2016 at 11:02 AM Alexander Kjeldaas < alexander.kjeldaas at gmail.com> wrote: > I agree. > > While I've used IRC for almost 20 years, it just isn't as usable as the > newer tools. > - IRC assumes a permanently connected computer, which again requires a VPS > as indirection. I do use that, but there are clear usability issues here. > - IRC further assumes that I will be on one device only. Again I solve > this by jumping through a VPS. It's a design flow though. > - Slack is great, but enterprise (login ++). > - Gitter is just "yet another tool", might be the best thing, but it just > hasn't got the mindshare yet. > > > A technical solution where freenode's #haskell is bridged to one of the > new fancy web UIs, where history is kept, and multiple devices can be used, > would be great. I'm not sure if anyone is doing that though. > > Alexander > > > On Thu, Dec 8, 2016 at 9:44 AM, Geraldus wrote: > > From my point of view all mentioned solutions aren't perfect: > > + with IRC I always lose the history, also, my client (Lingo on OS X) > always disconnects and I can lose answers really easy too > + I tried Slack in the past, and found no advantages or something that > buys me > + Gitter is quite buggy for now > > However my personal preference is Gitter, because it give history, edit > abilities and nice code appearance for free (though I wish to see light > theme for code highlighter as GitHub provides by default). > > _______________________________________________ > 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 kaura.dev at sange.fi Thu Dec 8 12:19:32 2016 From: kaura.dev at sange.fi (Aura Kelloniemi) Date: Thu, 08 Dec 2016 14:19:32 +0200 Subject: [Haskell-cafe] Modelling structurally subtyped and cyclic data in type safe Haskell Message-ID: <878trqipez.fsf@sange.fi> Hello This is my first post to Haskell Café. I am a hobbyist programmer who has lots of experience with imperative and OO languages ranging from 80286 assembly to Ada and Ruby. Last four years I've been learning Haskell, which has been a painfully educational experience - I have a good understanding about how CPUs work, but very little understanding about maths. This is a very long post, I apologize. Now I'm trying to create a tool which automatically generates foreign function interface (FFI) imports from C and C++ to Haskell. I have written a GCC plugin which extracts all relevant (and lots of irrelevant) information from GCC's TREEs and dumps the output as JSON. It also dumps preprocessor macros which is one of the reasons this tol is being given birth. The tool is used like Shake - import Development.Familiar and write code which glues all relevant data processing and FFI generation functions together. This is also going to be a reusable library which others can use for whatever they find the data to be useful for. This could include making FFI bindings to other languages. Some code analysis tools also might find the data useful. I'm having a hard time importing this data to Haskell in a type safe way. GCC's TREEs are structured in an OO way. I have tried to find a more functional way of representing them, but so far with no luck. The JSON data is typed, and the hierarchy is exactly the same as in GCC. Below I construct a tree of the hierarchy where I list a few of possible types and very few of the fields the data types contain. For listing fields and their types I use a syntax similar to Haskell. This shortened listing should be enough for illustration: * macro: (data fields include: name :: string, tokens :: [token], etc.) * tree: all nodes have a unique ID to be able to recover the cycles among the node graph; (id :: integer) * * translation_unit: (declarations :: [top_level_declaration]) * * constant: a compile-time constant value; (type :: type) * * * complex_constant: (value :: complex) * * * integer_constant: (value :: integer) * * namespace_decl: (name :: identifier, declarations :: [top_level_declaration]) * * declaration: (name :: identifier, type :: type) * * * const_decl: One component of enum type; (value :: type) * * * function_decl: (type :: function_type, params :: [param_decl], result :: result_decl) * * * type_decl: (no additional fields) * * type: (declaration :: type_decl, name :: identifier, size :: integer_constant, alignment :: integer, qualifiers :: [qualifier], completeness :: bool) * * * array_type: (element_type :: type, element_count :: integer) * * * numeric_type: (precision :: integer, signed :: bool, min_value :: integer_constant, max_value :: integer_constant) * * * * enumeral_type: (values :: [const_decl]) * * * function_type: (param_types :: [type], result_type :: type) * * * pointer_type: (referred_type :: type) * * * record_type: struct (C or C++)/union; (base_types :: [(type, access_info)], fields :: [field_decl or const_decl or type_decl], methods :: [method_decl]) * reference: Any node may be replaced by a reference. They can be forward or backward references. (referred_id :: integer) As you may see, tree nodes form many many cycles together. Subclasses sometimes provide stronger invariants for their fields than the parent classes. For example all declarations are associated with a type and for function_decl nodes this type is always a function_type. Now to my question. How to represent this in Haskell. Because of the enormous amount of fields per tree node, I certainly need to use records. -- Haskell follows: data BaseTree = BaseTree { id :: Int, ... ... } data BaseDecl = BaseDecl { baseTree :: BaseTree, name :: Identifier, declType :: Type, ... } data ConstDecl = ConstDecl { baseDecl :: BaseDecl, value :: ConstValue } data ConstValue = ComplexConst Complex | IntegerConst Integer data TypeDecl = TypeDecl { baseDecl :: BaseDecl } But... What shall I do about the heterogenous lists which many nodes contain. I wish I don't need to make myriards of ADTs for them, like: data AnyTopLevelDecl = ATLDConst ConstDecl | ATLDFunction FunctionDecl | ATLDNamespace NamespaceDecl | ATLDType TypeDecl -- ... data StructFieldDecl = SFDConst ConstDecl | SFDField FieldDecl | SFDType TypeDecl And so forth, basicly each heterogenous list gets its own ADT, because there is often variance in which node types can appear in the lists. I could use one big ADT like AnyDecl. However, to me it would feel like a bad design, if my types allowed RecordType nodes to reference NamespaceDecls, and therefore I don't want to pack all nodes into one type, unless I could use some type parameters or constraints to restrict the possible values the ADT could take. At first I thought that the following could solve my problem: data SomeDecl a = SomeDecl where SomeConst :: ConstDecl -> SomeDecl ConstDecl SomeField :: FieldDecl ->SomeDecl FieldDecl SomeFunction :: FunctionDecl -> SomeDecl FunctionDecl SomeType :: TypeDecl -> SomeDecl TypeDecl -- and then I would use type classes like this class TopLevelDecl decl where -- No methods needed instance TopLevelDecl ConstDecl instance TopLevelDecl FunctionDecl instance TopLevelDecl TypeDecl -- And then I could write functions like this: handleTopLevelDecl :: TopLevelDecl d => SomeDecl d -> Whatever handleTopLevelDecl (FunctionDecl f) = -- ... -- and I'd list all cases which have a TopLevelDecl instance, but not -- those which don't have. I also thought that my data types could look like -- this: data NamespaceDecl where NamespaceDecl :: { baseTree :: BaseTree, forall a. TopLevelDecl a => declarations :: [a] } Obviously this does not work, because type classes are open, and even though GHC prevents me from calling handleTopLevelDecl with (SOmeDecl FieldDecl), it still complains if I don't define an equation for it, because in some other module somebody might make a TopLevelDecl instance for FieldDecl. Now I would like to know if there is a way to solve my problem in an elegant way, e.g. by using type families. My second question is how to resolve the cyclicity of the node graph. I don't want to tie the knot, because I want to be able to manipulate the graph. Maps are one option, yes: data AnyNode = (list all possible nodes) type Id = Int type NodeIdMap = Map Id AnyNode -- Then my data types refer to other nodes like this: data FunctionDecl = FunctionDecl { parameters :: [Id] } Now I lose all type safety. I would have to insert a run-time check to every dereference of an Id if I want to make sure that function parameter declarations don't contain StringConstants. I've also considered using STRefs. During JSON parsing I would need to populate the nodes with the node Ids they refer to and then have a separate pass which turns all Ids to typed STRefs. At least with this approach I would get all possible run-time errors straight after parsing, and not when the data is used. I'm again sorry for this long elaboration. However I think that if you consider answering me you have a pretty good understanding of my problem and also a good knowledge of my level of understanding Haskell. I would like to unlearn OO-style thinking, and I would want to find a data and type representation which feels Haskellish. However I don't want to cut down the data. I want all information to be accessible in case somebody needs it. Thank you in advance! -- Aura From heraldhoi at gmail.com Thu Dec 8 13:16:56 2016 From: heraldhoi at gmail.com (Geraldus) Date: Thu, 08 Dec 2016 13:16:56 +0000 Subject: [Haskell-cafe] Gitter Haskell Community In-Reply-To: References: <480cdfad-b417-4827-ad89-796cfc03965f@me.com> Message-ID: > > Does this really have to be all or nothing? It's just chat, something I > consider fairly ephemeral anyway. I'd much rather people talk about Haskell > as much as possible, even if that comes at the expensive of having one > blessed channel/medium. > +1 -------------- next part -------------- An HTML attachment was scrubbed... URL: From agocorona at gmail.com Thu Dec 8 14:06:41 2016 From: agocorona at gmail.com (Alberto G. Corona ) Date: Thu, 8 Dec 2016 15:06:41 +0100 Subject: [Haskell-cafe] Gitter Haskell Community In-Reply-To: References: <480cdfad-b417-4827-ad89-796cfc03965f@me.com> Message-ID: Slack and Gitter are necessary steps for the final goal: The rediscovery of google wave. I would like to link to specific comments in the code, execute bots and collaborative editing, But is more usable than IRC. 2016-12-08 14:16 GMT+01:00 Geraldus : > Does this really have to be all or nothing? It's just chat, something I >> consider fairly ephemeral anyway. I'd much rather people talk about Haskell >> as much as possible, even if that comes at the expensive of having one >> blessed channel/medium. >> > > +1 > > _______________________________________________ > 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 imantc at gmail.com Thu Dec 8 14:19:03 2016 From: imantc at gmail.com (Imants Cekusins) Date: Thu, 8 Dec 2016 15:19:03 +0100 Subject: [Haskell-cafe] Gitter Haskell Community In-Reply-To: References: <480cdfad-b417-4827-ad89-796cfc03965f@me.com> Message-ID: > The rediscovery of google wave. It's a pity Google Wave was shut down. I used Google Wave, found it very convenient and would use a similar product again (even with fewer features) if it became available. ​ -------------- next part -------------- An HTML attachment was scrubbed... URL: From fa-ml at ariis.it Thu Dec 8 14:28:41 2016 From: fa-ml at ariis.it (Francesco Ariis) Date: Thu, 8 Dec 2016 15:28:41 +0100 Subject: [Haskell-cafe] Gitter Haskell Community In-Reply-To: References: <480cdfad-b417-4827-ad89-796cfc03965f@me.com> Message-ID: <20161208142841.GA27276@casa.casa> On Thu, Dec 08, 2016 at 03:19:03PM +0100, Imants Cekusins wrote: > It's a pity Google Wave was shut down. I used Google Wave, found it very > convenient and would use a similar product again (even with fewer features) > if it became available. Apache wave! Which is open-source too, unlike Slack and apparently this new fangled tool for open communities. From mihai.maruseac at gmail.com Thu Dec 8 14:36:11 2016 From: mihai.maruseac at gmail.com (Mihai Maruseac) Date: Thu, 8 Dec 2016 06:36:11 -0800 Subject: [Haskell-cafe] Gitter Haskell Community In-Reply-To: References: <480cdfad-b417-4827-ad89-796cfc03965f@me.com> Message-ID: IRC for #haskell (and similar) has all the history since some years ago. http://ircbrowse.net/ Thanks, Chris Done. Also, as others mentioned, it's doubtful someone will want to read chat lines from years ago. From guillaum.bouchard+haskell at gmail.com Thu Dec 8 14:51:33 2016 From: guillaum.bouchard+haskell at gmail.com (Guillaume Bouchard) Date: Thu, 08 Dec 2016 14:51:33 +0000 Subject: [Haskell-cafe] Injective type family on a sub domain In-Reply-To: <1b4e42a8-0548-ff6f-598f-95647a131a50@gmail.com> References: <1b4e42a8-0548-ff6f-598f-95647a131a50@gmail.com> Message-ID: Thank you, Emil, your solution is really interesting and helped me to understand the trick in the ST monad. David, beautiful and generic solution, thank you. Oleg, I live your solution because it does not leak the implementation details of the eval function in the type. However this solution melted my brain and I now have more question than I previously had. The most important ones are: - What about the unsafeCoerce, I don't really understand its need - The case statement (in proof and add) let me think that the process is done at runtime. However it is clear that it is a compile time process and that the case always succeed. So I'm lost. Could you elaborate a bit on this ? Thank you. Le jeu. 8 déc. 2016 à 11:31, Emil Axelsson <78emil at gmail.com> a écrit : > A different way to achieve the guarantee you want is to let unification > do the "oring" for you: > > {-# LANGUAGE GADTs #-} > {-# LANGUAGE Rank2Types #-} > > {-# OPTIONS_GHC -fwarn-incomplete-patterns #-} > > data HasVar > > data Expr t where > Add :: Expr x -> Expr x -> Expr x > Lit :: Int -> Expr x > Var :: Expr HasVar > > eval :: (forall x . Expr x) -> Int > eval = go > where > go :: Expr () -> Int > go (Add a b) = go a + go b > go (Lit a) = a > > / Emil > > Den 2016-12-07 kl. 08:43, skrev Guillaume Bouchard: > > Hi. > > > > I have the following GADT : > > > > ----------------------------- > > type family Or a b where > > Or 'False 'False = 'False > > Or _ _ = 'True > > > > data Expr t where > > Add :: Expr t -> Expr t' -> Expr (Or t t') > > Lit :: Int -> Expr 'False > > Var :: Expr 'True > > ---------------------- > > > > The idea is that if the `Expr` contains a sub `Var`, its type is `Expr > 'True`, > > else it is `Expr 'False`. > > > > I now want to evaluate my expression, something like that : > > > > -------------- > > eval :: Expr t -> Int > > eval (Lit i) = i > > eval (Add a b) = eval a + eval b > > eval Var = error "Cannot evaluate expression with variable" > > ---------------- > > > > Using the GADT I previously defined, I'm tempted to remove the > impossible "Var" > > case with : > > > > --------------- > > eval' :: Expr 'False -> Int > > eval' (Lit i) = i > > eval' (Add a b) = eval' a + eval' b > > ---------------- > > > > However this does not typecheck because GHC cannot deduce that `a` and > `b` are > > `~ Expr 'False`. Because the type family `Or` is not injective. > > > > The wiki https://ghc.haskell.org/trac/ghc/wiki/InjectiveTypeFamilies > classifies > > injectives types families in three categories, but I don't think my `Or` > appears > > in any of them. > > > > Actually `Or` is injective only if `Or t t' ~ 'False` and in this case, > we can > > deduce that `t ~ 'False` and `t' ~ 'False`. I qualify it as a "partialy > > injective type family". > > > > The type checker does not know that, hence my code does not compile. > > > > Is there a solution, other than writing a custom type checker plugin? Is > there a > > way to provide the inverse type family function, something such as: > > > > type family InverseOr a where > > InverseOr 'False = ('False, 'False) > > > > Thank you. > > > > -- > > G. > > > > > > > > _______________________________________________ > > 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 iblech at web.de Thu Dec 8 15:44:02 2016 From: iblech at web.de (Ingo Blechschmidt) Date: Thu, 8 Dec 2016 16:44:02 +0100 Subject: [Haskell-cafe] ANN: Free hands-on Haskell workshop in Augsburg, Germany on 2012-12-17 [with German videos] Message-ID: <20161208154402.GA4871@speicherleck.de> Dear lovers of generalized abstract nonsense, this mail is directed at Haskell neophytes, novices, and advanced learners living near Augsburg, Germany; and at Haskell aficionados living all over the world but speaking German. On 2012-12-17, we -- the Curry Club Augsburg -- will organize a free all-day hands-on workshop on Haskell. Join us in the morning without having seen a single line of Haskell code and leave with working knowledge of Haskell's basics. If you already know a bit of Haskell, then learn your ways with Haskell's vast library ecosystem, how to structure bigger programs, how to check your code for correctness, and how to write parsers/websites/numerical simulations/user interfaces/two- and three-dimensional games. So that we don't exceed our capacity for individual mentoring during the workshop, a mandatory but nonbinding registration is necessary. [1] In case that you want to dive deeper into Haskell and other functional languages after having participated in the workshop, you are invited to join us at our monthly meetings. There are typically two to three talks on a wide range of topics of interest to Haskell programmers, such as latest news from the Kmettiverse, glimpses into formal logic and proof assistants like Isabelle, and introductions to the category-theoretic background of freer monads or to infinite-time Turing machines and the effective topos. All of our talks are recorded [2]. Our workshop documents are CC-licensed [3]. Feel free to copy them, modify them, and host Haskell workshops at other places! Cheers, Ingo of Augsburg's Curry Club [1] http://curry-club-augsburg.de/posts/2016-12-06-dritter-workshop.html [2] https://www.youtube.com/channel/UCKV6TVS9DWaEix6l3_l457Q [3] https://rawgit.com/curry-club-aux/haskell-workshop/gh-pages/uebung.pdf https://rawgit.com/curry-club-aux/haskell-workshop/gh-pages/uebung2.pdf http://curry-club-augsburg.de/posts/2015-10-27-monaden-in-haskell.html (All hail the monad tutorial fallacy. English translation by Harry Garrood at https://gist.github.com/iblech/429652a31b05e408262b.) From alex at kazik.de Thu Dec 8 15:44:02 2016 From: alex at kazik.de (ALeX Kazik) Date: Thu, 8 Dec 2016 16:44:02 +0100 Subject: [Haskell-cafe] Bits.bitSize Message-ID: Hi, I think it would be a good idea to provide a default implementation for bitSize, example: bitSize b = fromMaybe (error "bitSize is undefined") (bitSizeMaybe b) The advantage is that from now on new instances of Bits no longer need to define bitSize. And once bitSize has been removed there will be no errors about it not being a method of class Bits. ALeX. From gershomb at gmail.com Thu Dec 8 19:19:57 2016 From: gershomb at gmail.com (Gershom B) Date: Thu, 8 Dec 2016 14:19:57 -0500 Subject: [Haskell-cafe] Summer of Haskell 2016 Wrap-Up Message-ID: We wanted to let folks know what happened with all our Summer of Haskell projects, and thank again all those who donated as individuals or sponsored students to make this possible. As a reminder, the accepted projects were announced on reddit at: https://www.reddit.com/r/haskell/comments/4kp6zg/summer_of_haskell_2016_accepted_projects/ * * * 1) Native Metaprogramming in Haskell This very ambitious project made significant progress, though is not yet ready for a full merge into GHC. A talk and paper on work relating to it were presented at the Haskell Implementors Workshop at ICFP, and a page on the GHC wiki describes the current status.   - https://www.youtube.com/watch?v=DSWoGdfYt68   - https://arxiv.org/abs/1610.04799   - https://ghc.haskell.org/trac/ghc/wiki/NativeMetaprogramming 2) GHCVM - A JVM Backend for GHC Again, significant progress made on a very ambitious project, which has now been renamed to “eta”. A talk on the work done was given at the HIW, and the project is considered ready for “hobbyist use”.   - https://www.youtube.com/watch?v=G4m7xFVzd50   - https://github.com/typelead/eta 3) Completing the LLVM backend for Accelerate All operators of the LLVM backend are now implemented, and we’re told that the accelerate-llvm project, already usable, will be get a more proper announcement as ready for widespread use real soon now (tm).   - https://github.com/AccelerateHS/accelerate-llvm   - https://github.com/AccelerateHS/accelerate-llvm/commits?author=ZihengJiang 4) Hackage Improvements A whole raft of usability improvements to hackage (including the long-awaited rollout of reverse dependency tracking, and a very usable package browser interface) are undergoing final code review and polish in a PR before being rolled out. The student’s blog contains more information about what’s on the way.   - http://sooryanarayan.me/blog/hsoc-testimonial/ 5) Derivable Storable and Prim instances This work resulted in both a package (usable today) and a plugin to improve the performance of the derived code. Updates on the decisions made and work done were posted to the numerical-haskell group   - https://hackage.haskell.org/package/derive-storable   - http://hackage.haskell.org/package/derive-storable-plugin   - https://groups.google.com/forum/#!forum/numericalhaskell 6) Visual functional block-based programming language for CodeWorld This work went well and is described on the student’s blog. It is usable today at https://code.world/blocks and apparently has already begun to be integrated into CodeWorld lesson plans.  - http://stefanj.me/funblocks/  - https://code.world/blocks 7) Jupyter for GHCJS Apparently this ran into a far amount of difficulties and didn’t make significant progress, though not for lack of effort. The student is anticipated to write up an experience report describing some of the problems encountered and how others might work around them in the future. 8) Live Profiling and Performance Monitoring Server A lot of work was accomplished on various fronts here. A number of changes to the GHC RTS are in review and pending merge. A tool has been written to take advantage of the newly available information. And various other small packages that met needs along the way were extracted and contributed to hackage. A fuller write-up of progress and future work is available at the student’s blog.   - https://phabricator.haskell.org/D2522   - https://github.com/NCrashed/live-profile-monitor   - http://ncrashed.github.io/blog/posts/2016-09-11-hsoc-results.html * * * Apologies for the delays in assembling this information -- as they say, man plans, the fates laugh. Thanks to all our students for their dedicated work and contributions to the ecosystem. We hope to see much more from all of you in the future. And thanks to all our mentors for donating their time to guide, teach, and make this possible. And a very special thanks to Edward Kmett for co-ordinating much of the administrative work here, as well as fundraising towards this great Summer of Haskell. * * * Sponsors (listed on summer.haskell.org): - haskell.org kicked things off this year by funding a student and organizing the Summer of Haskell. - Awake Networks is building a next generation network security and analytics platform. They are a proud sponsor of the Summer of Haskell and contribute broadly to the Haskell community. - Haskell Book is a proud sponsor of the Summer of Haskell and provides a complete and up-to-date resource for learning Haskell, suitable whether you're completely new to Haskell or are at an intermediate level and want to deepen your understanding. - YOW! Australia is a proud sponsor of the Summer of Haskell and organizes conferences throughout Australia. - Chris Smith volunteered to fund two students to work on CodeWorld in particular. - Edward Kmett and Gershom Bazerman volunteered to personally fund a student project. Best, Gershom Bazerman Haskell.org Committee From takenobu.hs at gmail.com Fri Dec 9 13:05:52 2016 From: takenobu.hs at gmail.com (Takenobu Tani) Date: Fri, 9 Dec 2016 22:05:52 +0900 Subject: [Haskell-cafe] Dockerfile for building ghc8.0 with ubuntu 16.04LTS Message-ID: Hi cafe, I pushed Dockerfile for building ghc8.0 with ubuntu 16.04LTS. (If you need Debian and Arcanist, please use Greg's Dockerfile[1].) Dockerfile for Haskell GHC building https://github.com/takenobu-hs/ghc-build-docker Let's get familiar with ghc building and validating :) [1]: https://github.com/gregwebs/ghc-docker-dev [2]: https://ghc.haskell.org/trac/ghc/wiki/Building Enjoy, Takenobu -------------- next part -------------- An HTML attachment was scrubbed... URL: From yallop at gmail.com Fri Dec 9 17:31:32 2016 From: yallop at gmail.com (Jeremy Yallop) Date: Fri, 9 Dec 2016 17:31:32 +0000 Subject: [Haskell-cafe] Partial Evaluation & Program Manipulation (PEPM'17): Call for Participation Message-ID: CALL FOR PARTICIPATION 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) Registration ------------ http://popl17.sigplan.org/attending/registration Early registration deadline: Saturday 17th Dec 2016 Programme --------- Monday 16th January 09:00-10:00: Keynote Compiling Untyped Lambda Calculus to Lower-Level Code by Game Semantics and Partial Evaluation Neil D. Jones (with Daniil Berezun) 10:30-12:00: Programming languages Lightweight Soundness for Towers of Language Extensions Alejandro Serrano, Jurriaan Hage Detecting code clones with gaps by function applications Tsubasa Matsushita, Isao Sasano PEG Parsing in Less Space Using Progressive Tabling and Dynamic Analysis Fritz Henglein, Ulrik Terp Rasmussen 14:00-15:30: Tutorial and Poster Session Idris, Inside-Out: A Tutorial on Extending Idris in Idris David Christiansen Language-integrated Query with Ordering, Grouping and Outer Joins (poster) Tatsuya Katsushima, Oleg Kiselyov 16:00-17:00: Transformation (part I) Verification of Code Generators via Higher-Order Model Checking Takashi Suwa, Takeshi Tsukada, Naoki Kobayashi, Atsushi Igarashi Interactive data representation migration: Exploiting program dependence to aid program transformation Krishna Narasimhan, Julia Lawall, Christoph Reichenbach Tue 17th January 09:00-10:00: Tutorial Reversible computing from a programming language perspective Robert Glück 10:30-12:00: Types Cost versus Precision for Approximate Typing for Python Levin Fritz, Jurriaan Hage Refining types using type guards in TypeScript Ivo Gabe de Wolff, Jurriaan Hage Predicting Resource Consumption of Higher-Order Workflows Markus Klinik, Jurriaan Hage, Jan Martin Jansen, Rinus Plasmeijer 14:00-15:30: Tutorial Practical Partial Evaluation for Language Implementation with Graal & Truffle Gilles Duboscq 16:00-17:00: Transformation (part II) Functional Parallels of Sequential Imperatives Tiark Rompf, Kevin J. Brown A Functional Reformulation of UnCAL Graph-Transformations: Or, Graph Transformation as Graph Reduction Kazutaka Matsuda, Kazuyuki Asada From ruben.astud at gmail.com Sat Dec 10 11:15:02 2016 From: ruben.astud at gmail.com (Ruben Astudillo) Date: Sat, 10 Dec 2016 08:15:02 -0300 Subject: [Haskell-cafe] what is lens-based parsing? Message-ID: <21057b2c-5ffe-58c3-eea6-98f44cbb3502@gmail.com> Dear Cafe I've reading the tutorial for pipes-parse, and I got some references that it supports lens-based parsing. I know lens, yet I don't really know what is that about. Also looking in google doesn't get any detailed blogpost. Can anybody help me out on what is this? -- -- Ruben From li-yao.xia at ens.fr Sat Dec 10 11:59:31 2016 From: li-yao.xia at ens.fr (Li-yao Xia) Date: Sat, 10 Dec 2016 11:59:31 +0000 Subject: [Haskell-cafe] what is lens-based parsing? In-Reply-To: <21057b2c-5ffe-58c3-eea6-98f44cbb3502@gmail.com> References: <21057b2c-5ffe-58c3-eea6-98f44cbb3502@gmail.com> Message-ID: Hello Ruben, I think this just refers to the fact that parsers can be combined using the lenses provided by the library. Gabriel Gonzalez[1] wrote "pipes-parse-3.0.0 introduces a new lens-based parsing mechanism." So it doesn't seem to correspond to a globally known pattern. Li-yao [1] http://www.haskellforall.com/2014/02/pipes-parse-30-lens-based-parsing.html On 12/10/2016 11:15 AM, Ruben Astudillo wrote: > Dear Cafe > > I've reading the tutorial for pipes-parse, and I got some references > that it supports lens-based parsing. I know lens, yet I don't really > know what is that about. Also looking in google doesn't get any detailed > blogpost. Can anybody help me out on what is this? > From mdgeorge at cs.cornell.edu Sat Dec 10 16:50:03 2016 From: mdgeorge at cs.cornell.edu (Michael George) Date: Sat, 10 Dec 2016 11:50:03 -0500 Subject: [Haskell-cafe] memoizing with a default Message-ID: <80fdd1d5-d11b-4b1f-0528-ae41f087640f@cs.cornell.edu> I've come across a slight variant of memoization and I'm curious if either there is a better way to think about (I have yet to reach Haskell Enlightement), or if it's been thought about before. I'm writing a program that does DFA minimization, as described here: https://www.tutorialspoint.com/automata_theory/dfa_minimization.htm. For me, the simplest way to understand the algorithm is we form an equivalence relation, where two states are different if either one is final and the other isn't, or if there are transitions from them to states that are different. different a b = isFinal a && not (isFinal b) || isFinal b && not (isFinal a) || exists chars (\c -> different (step a c) (step b c)) This definition diverges; it never decides that two states are the same. The standard algorithm builds a table, starting with the assumption that all states are the same, and iteratively applying this definition until it converges. I'm thinking of that algorithm as a memoized version of the implementation of different above. But it's not quite: different = memoFix2 different' where different' different'' a b = isFinal a && not (isFinal b) || isFinal b && not (isFinal a) || exists chars (\c -> different'' (step a c) (step b c)) for the same reason; it diverges. But with memoization I can detect the diversion by putting a marker in the memo table. If the computation makes a recursive call on an input that is started but not computed, then (in this case) I want to return false. In general, I think what I want is memoFixWithDefault :: (a -> b) -> ((a->b) -> (a -> b)) -> (a -> b) Where (memoFixWithDefault default f) is like (memoFix f) except that if (memoFix f a) would loop, then (memoFixWithDefault default f a) = default a. I suspect there's a nice denotational way of describing this, but my denotational semantics is rusty (maybe it's the least fixed point of f that is greater than g or something, but that's not it). I suspect that there needs to be a nice relationship between f and g for memoFixWithDefault f g to be sensible. I also suspect that there's a cute 3-line implementation like all the other implementations of memoize out there, but I don't see it. I also suspect that depth-first search has a cute implementation using this combinator. So I was wondering if other people had thoughts or references before I went off and thought about it. Thanks! -M From apfelmus at quantentunnel.de Sat Dec 10 21:02:10 2016 From: apfelmus at quantentunnel.de (Heinrich Apfelmus) Date: Sat, 10 Dec 2016 22:02:10 +0100 Subject: [Haskell-cafe] Modelling structurally subtyped and cyclic data in type safe Haskell In-Reply-To: <878trqipez.fsf@sange.fi> References: <878trqipez.fsf@sange.fi> Message-ID: Dear Aura, apparently, the data type that you are dealing with is very complex. I don't fully understand it, so I do not know what "the best" representation as a Haskell data type would be, but maybe I can help with some general guidelines and pointers. First, the most important guideline is probably to remember that a type system is way to have someone (the compiler) check your program and reject it when it is "obviously" wrong. This is extremely helpful, but it is up to you to decide how far you want to take it. Your data type comes with many invariants ("The fields of a record are always either type declarations or constant declarations, or ..."), but it may not necessarily be the best idea to encode *all* of them in the types, it might be more elegant to encode only *most* of them in the types. For instance, you could make a type `Declaration` and use it for both `AnyTopLevelDecl` and `StructFieldDecl`. and accept the fact that the compiler may not catch all mistakes that you might make here. If you need to write less code that way, this may well be worth the trade-off. Second, it may helpful to look at how others do it. Your writing indicates that are already very knowledgeable, so this advice may be not very helpful, but for the sake of completeness, I would like to mention it anyway. For example, the `haskell-src-exts` package implements a syntax tree for Haskell, maybe it can offer an inspiration or two. http://hackage.haskell.org/packages/search?terms=haskell-src-exts Third, some more concrete ideas. A. When one node type is a subset of another, it may be helpful to encode the data types in the same way: data TopLevelDecl = StructField StructFieldDecl | Namespace NamespaceDecl data StructFieldDecl = Const ConstDecl | ... Then, you can at least reuse the same code for everything that is a `StructFieldDecl`. B. If you don't like that, you can try anonymous sums instead, which are built with the type operator (:+:) available in the module `GHC.Generics`. It's essentially the same thing as the `Either` type, but the syntax is a bit slicker: type TopLevelDecl = NamespaceDecl :+: ConstDecl :+: ... type StructFieldDecl = ConstDecl :+: ... See also the paper "Data Types à la Carte" http://www.cs.ru.nl/~W.Swierstra/Publications/DataTypesALaCarte.pdf for more. C. Phantom types (and, more generally, GADTs) are your friend, and you have already figured this out yourself. Phantom types can also help you with the unique identifiers. Instead of using a plain type type Key = Int -- Id you can write newtype Key a = K Int -- Id that points to a value of type a and use data FunctionDecl = FunctionDecl { parameters :: [Key Type] } to restrict the type of things that the key can refer to. (The argument to the `Key` type is called a "phantom", because the representation of the Key does not care about it.) Of course, you would then need one map for each node type that you want to have keys for. If that seems to onerous, there is also the option to use a "heterogeneous map", e.g. from my package http://hackage.haskell.org/package/vault It gives you a `Key` type constructor and a `Vault` type, which contains the corresponding key-value pairs. It's a bit like `STRef`, but pure. I hope this helps! Best regards, Heinrich Apfelmus PS: Your project seems quite valuable (and ambitious). The Haskell ecosystem features nice tools for generating FFI imports from C, but C++ support has been sorely lacking, if I remember correctly. There are only few offerings on hackage: http://hackage.haskell.org/packages/#cat:FFI%20Tools -- http://apfelmus.nfshost.com Aura Kelloniemi wrote: > Hello > > This is my first post to Haskell Café. I am a hobbyist programmer who has lots > of experience with imperative and OO languages ranging from 80286 assembly to > Ada and Ruby. Last four years I've been learning Haskell, which has been a > painfully educational experience - I have a good understanding about how CPUs > work, but very little understanding about maths. This is a very long post, I apologize. > > Now I'm trying to create a tool which automatically generates foreign function > interface (FFI) imports from C and C++ to Haskell. I have written a GCC plugin > which extracts all relevant (and lots of irrelevant) information from GCC's > TREEs and dumps the output as JSON. It also dumps preprocessor macros which is > one of the reasons this tol is being given birth. > > The tool is used like Shake - import Development.Familiar and write code which > glues all relevant data processing and FFI generation functions together. > > This is also going to be a reusable library which others can use for whatever > they find the data to be useful for. This could include making FFI bindings to > other languages. Some code analysis tools also might find the data useful. > > I'm having a hard time importing this data to Haskell in a type safe way. > GCC's TREEs are structured in an OO way. I have tried to find a more > functional way of representing them, but so far with no luck. > > The JSON data is typed, and the hierarchy is exactly the same as in GCC. Below > I construct a tree of the hierarchy where I list a few of possible types and > very few of the fields the data types contain. For listing fields and their > types I use a syntax similar to Haskell. This shortened listing should be > enough for illustration: > > * macro: (data fields include: name :: string, tokens :: [token], etc.) > * tree: all nodes have a unique ID to be able to recover the cycles > among the node graph; (id :: integer) > * * translation_unit: (declarations :: [top_level_declaration]) > * * constant: a compile-time constant value; (type :: type) > * * * complex_constant: (value :: complex) > * * * integer_constant: (value :: integer) > * * namespace_decl: (name :: identifier, > declarations :: [top_level_declaration]) > * * declaration: (name :: identifier, type :: type) > * * * const_decl: One component of enum type; (value :: type) > * * * function_decl: (type :: function_type, params :: [param_decl], > result :: result_decl) > * * * type_decl: (no additional fields) > * * type: (declaration :: type_decl, name :: identifier, > size :: integer_constant, alignment :: integer, > qualifiers :: [qualifier], completeness :: bool) > * * * array_type: (element_type :: type, element_count :: integer) > * * * numeric_type: (precision :: integer, signed :: bool, > min_value :: integer_constant, > max_value :: integer_constant) > * * * * enumeral_type: (values :: [const_decl]) > * * * function_type: (param_types :: [type], result_type :: type) > * * * pointer_type: (referred_type :: type) > * * * record_type: struct (C or C++)/union; > (base_types :: [(type, access_info)], > fields :: [field_decl or const_decl or type_decl], > methods :: [method_decl]) > * reference: Any node may be replaced by a reference. They can be > forward or backward references. (referred_id :: integer) > > As you may see, tree nodes form many many cycles together. Subclasses > sometimes provide stronger invariants for their fields than the parent > classes. For example all declarations are associated with a type and for > function_decl nodes this type is always a function_type. > > Now to my question. How to represent this in Haskell. Because of the enormous > amount of fields per tree node, I certainly need to use records. > > -- Haskell follows: > data BaseTree = BaseTree { id :: Int, ... ... } > data BaseDecl = BaseDecl { baseTree :: BaseTree, name :: Identifier, > declType :: Type, ... } > data ConstDecl = ConstDecl { baseDecl :: BaseDecl, value :: ConstValue } > data ConstValue = ComplexConst Complex | IntegerConst Integer > data TypeDecl = TypeDecl { baseDecl :: BaseDecl } > > But... What shall I do about the heterogenous lists which many nodes contain. > I wish I don't need to make myriards of ADTs for them, like: > > data AnyTopLevelDecl = ATLDConst ConstDecl > | ATLDFunction FunctionDecl > | ATLDNamespace NamespaceDecl > | ATLDType TypeDecl -- ... > data StructFieldDecl = SFDConst ConstDecl > | SFDField FieldDecl > | SFDType TypeDecl > > And so forth, basicly each heterogenous list gets its own ADT, because there > is often variance in which node types can appear in the lists. > > I could use one big ADT like AnyDecl. However, to me it would feel like a bad > design, if my types allowed RecordType nodes to reference NamespaceDecls, and > therefore I don't want to pack all nodes into one type, unless I could use > some type parameters or constraints to restrict the possible values the ADT > could take. > > At first I thought that the following could solve my problem: > > data SomeDecl a = SomeDecl where > SomeConst :: ConstDecl -> SomeDecl ConstDecl > SomeField :: FieldDecl ->SomeDecl FieldDecl > SomeFunction :: FunctionDecl -> SomeDecl FunctionDecl > SomeType :: TypeDecl -> SomeDecl TypeDecl > > -- and then I would use type classes like this > class TopLevelDecl decl where > -- No methods needed > instance TopLevelDecl ConstDecl > instance TopLevelDecl FunctionDecl > instance TopLevelDecl TypeDecl > > -- And then I could write functions like this: > handleTopLevelDecl :: TopLevelDecl d => SomeDecl d -> Whatever > handleTopLevelDecl (FunctionDecl f) = -- ... > -- and I'd list all cases which have a TopLevelDecl instance, but not > -- those which don't have. I also thought that my data types could look like > -- this: > > data NamespaceDecl where > NamespaceDecl :: { > baseTree :: BaseTree, > forall a. TopLevelDecl a => declarations :: [a] > } > > Obviously this does not work, because type classes are open, and even though > GHC prevents me from calling handleTopLevelDecl with (SOmeDecl FieldDecl), it > still complains if I don't define an equation for it, because in some other > module somebody might make a TopLevelDecl instance for FieldDecl. > > Now I would like to know if there is a way to solve my problem in an elegant > way, e.g. by using type families. > > My second question is how to resolve the cyclicity of the node graph. I don't > want to tie the knot, because I want to be able to manipulate the graph. > > Maps are one option, yes: > > data AnyNode = (list all possible nodes) > type Id = Int > type NodeIdMap = Map Id AnyNode > > -- Then my data types refer to other nodes like this: > data FunctionDecl = FunctionDecl { > parameters :: [Id] > } > > Now I lose all type safety. I would have to insert a run-time check to every > dereference of an Id if I want to make sure that function parameter > declarations don't contain StringConstants. > > I've also considered using STRefs. During JSON parsing I would need to > populate the nodes with the node Ids they refer to and then have a separate > pass which turns all Ids to typed STRefs. At least with this approach I would > get all possible run-time errors straight after parsing, and not when the data > is used. > > I'm again sorry for this long elaboration. However I think that if you > consider answering me you have a pretty good understanding of my problem and > also a good knowledge of my level of understanding Haskell. I would like to > unlearn OO-style thinking, and I would want to find a data and type > representation which feels Haskellish. However I don't want to cut down the > data. I want all information to be accessible in case somebody needs it. > > Thank you in advance! > From li-yao.xia at ens.fr Sat Dec 10 22:40:32 2016 From: li-yao.xia at ens.fr (Li-yao Xia) Date: Sat, 10 Dec 2016 22:40:32 +0000 Subject: [Haskell-cafe] memoizing with a default In-Reply-To: <80fdd1d5-d11b-4b1f-0528-ae41f087640f@cs.cornell.edu> References: <80fdd1d5-d11b-4b1f-0528-ae41f087640f@cs.cornell.edu> Message-ID: <319e847f-4c90-2fcd-30ef-af49383663d2@ens.fr> Hello Michael, As indicated by its name, memoFix defines a fixed point of its argument. In particular it defines the least defined fixed point, which is unique, and can formally be obtained by iteration starting from bottom. You want a function which is defined everywhere, so it is maximal for the ordering of definedness. In general there is no unique greatest fixed point for that ordering (e.g., id makes everything a fixed point), which explains why there is no standard way to build one. In your case different' also doesn't have a unique fixed point if your automaton is not minimal. There are at least the one you're looking for, and the function corresponding to the total relation (State × State): const (const True) Since different' is defined with disjunctions and no negations, it is monotonic with the ordering (False < True) lifted to total functions. Thus iterating from the bottom value (const (const False)) gets you the least fixed point... Interesting. By the way > Where (memoFixWithDefault default f) is like (memoFix f) except that if > (memoFix f a) would loop, then (memoFixWithDefault default f a) = > default a. That will not produce the correct result. For instance, assume there are two non-final states A and B which point to themselves with the same letter C, (A -C-> A, B -C-> B) but are actually not equivalent, so different A B should be True. Yet different (step A C) (step B C) = different A B so memoFix may still loop. Shortcircuiting when a loop is detected works to compute a *least defined* fixed point (i.e., Haskell's fix, or memoFix) because definedness is "conjunctive" (expanding the parallel between bottom and False): all values which are needed must be defined, so encountering bottom kills the whole computation. On the contrary, the function "different" is "disjunctive", it shortcircuits on True. When you encounter a loop, the result (which you are in the middle of computing) could still be either True or False. So you could *temporarily* return False from such a recursive call in order to continue searching, but must not mark the value as having been computed, because you're still doing that. Regards, Li-yao On 12/10/2016 04:50 PM, Michael George wrote: > I've come across a slight variant of memoization and I'm curious if > either there is a better way to think about (I have yet to reach Haskell > Enlightement), or if it's been thought about before. > > I'm writing a program that does DFA minimization, as described here: > https://www.tutorialspoint.com/automata_theory/dfa_minimization.htm. > > For me, the simplest way to understand the algorithm is we form an > equivalence relation, where two states are different if either one is > final and the other isn't, or if there are transitions from them to > states that are different. > > different a b = isFinal a && not (isFinal b) || isFinal b && not > (isFinal a) || exists chars (\c -> different (step a c) (step b c)) > > This definition diverges; it never decides that two states are the same. > The standard algorithm builds a table, starting with the assumption > that all states are the same, and iteratively applying this definition > until it converges. > > I'm thinking of that algorithm as a memoized version of the > implementation of different above. But it's not quite: > > different = memoFix2 different' where > different' different'' a b = isFinal a && not (isFinal b) || isFinal > b && not (isFinal a) || exists chars (\c -> different'' (step a c) (step > b c)) > > > In general, I think what I want is > > memoFixWithDefault :: (a -> b) -> ((a->b) -> (a -> b)) -> (a -> b) > > > > I suspect there's a nice denotational way of describing this, but my > denotational semantics is rusty (maybe it's the least fixed point of f > that is greater than g or something, but that's not it). I suspect that > there needs to be a nice relationship between f and g for > memoFixWithDefault f g to be sensible. I also suspect that there's a > cute 3-line implementation like all the other implementations of memoize > out there, but I don't see it. I also suspect that depth-first search > has a cute implementation using this combinator. > > So I was wondering if other people had thoughts or references before I > went off and thought about it. > > Thanks! > > -M > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. From tdammers at gmail.com Sun Dec 11 16:53:07 2016 From: tdammers at gmail.com (Tobias Dammers) Date: Sun, 11 Dec 2016 17:53:07 +0100 Subject: [Haskell-cafe] Optional C dependencies / build-time feature toggles Message-ID: <20161211165306.GA4803@nibbler> Hello Cafe, I have this project here: https://sprinkles.tobiasdammers.nl/ (source on github: https://github.com/tdammers/sprinkles), and it has a bunch of runtime dependencies on C libraries. Many of them are only required for certain use cases, e.g., the libmysqlclient dependency is only relevant if you want to access MySQL database backends, libfcgi is only required for hosting as FastCGI (which isn't even the recommended first choice), etc. Still, in order to build and run Sprinkles, all the dependencies must be installed, which is of course not ideal. The pipe dream would be for those dependencies to be optional *at run time*, such that the application would test for their presence on startup, or load them dynamically when and if they're needed. However, I'm also fine with making them compile-time feature toggles, such that users can enable only the ones they need. Doing some sort of autotools-style dependency discovery would of course be cool as well (i.e., only enable mysql support if libmysqlclient is present). So the broad question is, which of these are realistic, and how would I go about it? And, regarding feature toggles, this bit in the Cabal FAQ baffles me a little: > Question: I like to let the user enable extended functionality using a > Cabal flag. Is this the right way? > > Answer: Certainly not. Since other packages can distinguish packages > only according to their name and their version, it is not a good idea > to allow different APIs for the same package version. Cumbersome as it > is you have to move extra features to a separate package. Moving the features to a separate package wouldn't really solve anything AFAICT, because I'd still have to bring them together somehow. -- Tobias Dammers - tdammers at gmail.com From allbery.b at gmail.com Sun Dec 11 19:20:45 2016 From: allbery.b at gmail.com (Brandon Allbery) Date: Sun, 11 Dec 2016 14:20:45 -0500 Subject: [Haskell-cafe] Optional C dependencies / build-time feature toggles In-Reply-To: <20161211165306.GA4803@nibbler> References: <20161211165306.GA4803@nibbler> Message-ID: On Sun, Dec 11, 2016 at 11:53 AM, Tobias Dammers wrote: > And, regarding feature toggles, this bit in the Cabal FAQ baffles me a > little: > > > Question: I like to let the user enable extended functionality using a > > Cabal flag. Is this the right way? > > > > Answer: Certainly not. Since other packages can distinguish packages > > only according to their name and their version, it is not a good idea > > to allow different APIs for the same package version. Cumbersome as it > > is you have to move extra features to a separate package. > > Moving the features to a separate package wouldn't really solve anything > AFAICT, because I'd still have to bring them together somehow. > This is the same as the variants problem with MacPorts: you can't have another port depend on a variant, because then dependency calculation (already nightmarish) gets a combinatorial explosion on top of all the existing problems. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From alan.zimm at gmail.com Sun Dec 11 19:39:29 2016 From: alan.zimm at gmail.com (Alan & Kim Zimmerman) Date: Sun, 11 Dec 2016 21:39:29 +0200 Subject: [Haskell-cafe] [Ann] Haskell Ecosystem Proposals Message-ID: Earlier this year Simon Peyton Jones wrote about respect [1], and said "It's worth separating two things 1. Publicly debating an issue where judgements differ 2. Using offensive or adversarial language in that debate" There is now a repository[2] for us as a community to have the first kind of discussion about issues that affect the community as a whole. The intention is that this becomes a neutral place where discussion can take place about coordinating the various services offered to the haskell community. This is partly to expose the thinking and constraints on a particular approach, so proponents of other approaches can have a better understanding of how things can evolve. The idea is that through an honest understanding of the various parts we can achieve consensus on how to improve things. If this all sounds a bit handwavy, the first concrete example of this approach is a pull request [3] discussing the management of implicit or speculative version bounds between cabal-install/hackage and stack/stackage. This has reached a point where there is a clearer understanding of the actual problem, and a viable solution must be agreed. The structure of the repository is shamelessly copied from the one for GHC proposals, so the actual process description is way off. It should probably just state that we discuss until consensus is reached if possible, but that we are always open for further discussion. It is up to all of us to make this work. Regards Alan [1] https://mail.haskell.org/pipermail/haskell/2016-September/024995.html [2] https://github.com/haskell/ecosystem-proposals [3] https://github.com/haskell/ecosystem-proposals/pull/1 -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at orlitzky.com Sun Dec 11 20:36:28 2016 From: michael at orlitzky.com (Michael Orlitzky) Date: Sun, 11 Dec 2016 15:36:28 -0500 Subject: [Haskell-cafe] Optional C dependencies / build-time feature toggles In-Reply-To: <20161211165306.GA4803@nibbler> References: <20161211165306.GA4803@nibbler> Message-ID: <2ebd7b40-e9fd-e72a-4737-c3ebc94ac42d@orlitzky.com> On 12/11/2016 11:53 AM, Tobias Dammers wrote: > > The pipe dream would be for those dependencies to be optional *at run > time*, such that the application would test for their presence on > startup, or load them dynamically when and if they're needed. However, > I'm also fine with making them compile-time feature toggles, such that > users can enable only the ones they need. Doing some sort of > autotools-style dependency discovery would of course be cool as well > (i.e., only enable mysql support if libmysqlclient is present). This actually isn't ideal, because once everything is installed, you have no idea what is important. Can I uninstall libfoo-mysql? Well, bar-utils is making use of it, but it always does when libfoo-mysql is present, so there's no way to tell if the mysql support is important (i.e. whether or not the user wanted it when he installed bar-utils). The end result is that every "optional" dependency has to remain installed unconditionally forever, because removing them might break software that auto-detects their presence. (Google: "automagic dependencies") > So the broad question is, which of these are realistic, and how would I > go about it? > > And, regarding feature toggles, this bit in the Cabal FAQ baffles me a > little: > >> Question: I like to let the user enable extended functionality using a >> Cabal flag. Is this the right way? >> >> Answer: Certainly not. Since other packages can distinguish packages >> only according to their name and their version, it is not a good idea >> to allow different APIs for the same package version. Cumbersome as it >> is you have to move extra features to a separate package. This is a cabal-install or stack deficiency, not one inherent to Haskell packages or package management in general. The real solution: use a feature flag, and then use a package manager that knows what to do with them. As an added bonus, a real package manager can handle the C library dependencies as well, and your application won't break randomly when those libraries move around or disappear. From jo at durchholz.org Mon Dec 12 07:03:31 2016 From: jo at durchholz.org (Joachim Durchholz) Date: Mon, 12 Dec 2016 08:03:31 +0100 Subject: [Haskell-cafe] Modelling structurally subtyped and cyclic data in type safe Haskell In-Reply-To: References: <878trqipez.fsf@sange.fi> Message-ID: <04917494-b428-91b6-b8f8-151b2f90dd78@durchholz.org> Am 10.12.2016 um 22:02 schrieb Heinrich Apfelmus: > (The argument > to the `Key` type is called a "phantom", because the representation of > the Key does not care about it.) This kind of type exists in other languages, e.g. in Java it is commonly referred to as a "marker interface". (Personally, I have a dislike for terms like "phantom", because they highlight what the referred-to concept is _not_, which means that a newcomer needs an additional explanation to understand the concept. "Marker type" would make instantly clear what the type is intended for. YMMV.) Regards, Jo From chpatrick at gmail.com Mon Dec 12 07:40:00 2016 From: chpatrick at gmail.com (Patrick Chilton) Date: Mon, 12 Dec 2016 08:40:00 +0100 Subject: [Haskell-cafe] Modelling structurally subtyped and cyclic data in type safe Haskell In-Reply-To: <878trqipez.fsf@sange.fi> References: <878trqipez.fsf@sange.fi> Message-ID: Hi Aura, I recently added a typed module for exactly this data in clang-pure: https://hackage.haskell.org/package/clang-pure-0.2.0.2/docs/Language-C-Clang-Cursor-Typed.html As in libclang, the AST is represented as a tree of Cursors, which have a CursorKind such as StructDecl, CallExpr etc. In Haskell it's possible to lift this CursorKind to the type level, so you know at compile-time what kind of Cursor you're dealing with. This is useful because only certain kinds of Cursors have certain types of properties, for example source extent, spelling etc. You can use matchKind :: forall kind. SingI kind => Cursor -> Maybe (CursorK kind) to convert an untyped Cursor into a Cursor with a particular known kind. Then, if you search the AST and only look at cursors where this function returns Just, you know that the given cursor has certain properties you expect. Patrick On Thu, Dec 8, 2016 at 1:19 PM, Aura Kelloniemi wrote: > Hello > > This is my first post to Haskell Café. I am a hobbyist programmer who has > lots > of experience with imperative and OO languages ranging from 80286 assembly > to > Ada and Ruby. Last four years I've been learning Haskell, which has been a > painfully educational experience - I have a good understanding about how > CPUs > work, but very little understanding about maths. This is a very long post, > I apologize. > > Now I'm trying to create a tool which automatically generates foreign > function > interface (FFI) imports from C and C++ to Haskell. I have written a GCC > plugin > which extracts all relevant (and lots of irrelevant) information from GCC's > TREEs and dumps the output as JSON. It also dumps preprocessor macros > which is > one of the reasons this tol is being given birth. > > The tool is used like Shake - import Development.Familiar and write code > which > glues all relevant data processing and FFI generation functions together. > > This is also going to be a reusable library which others can use for > whatever > they find the data to be useful for. This could include making FFI > bindings to > other languages. Some code analysis tools also might find the data useful. > > I'm having a hard time importing this data to Haskell in a type safe way. > GCC's TREEs are structured in an OO way. I have tried to find a more > functional way of representing them, but so far with no luck. > > The JSON data is typed, and the hierarchy is exactly the same as in GCC. > Below > I construct a tree of the hierarchy where I list a few of possible types > and > very few of the fields the data types contain. For listing fields and their > types I use a syntax similar to Haskell. This shortened listing should be > enough for illustration: > > * macro: (data fields include: name :: string, tokens :: [token], etc.) > * tree: all nodes have a unique ID to be able to recover the cycles > among the node graph; (id :: integer) > * * translation_unit: (declarations :: [top_level_declaration]) > * * constant: a compile-time constant value; (type :: type) > * * * complex_constant: (value :: complex) > * * * integer_constant: (value :: integer) > * * namespace_decl: (name :: identifier, > declarations :: [top_level_declaration]) > * * declaration: (name :: identifier, type :: type) > * * * const_decl: One component of enum type; (value :: type) > * * * function_decl: (type :: function_type, params :: [param_decl], > result :: result_decl) > * * * type_decl: (no additional fields) > * * type: (declaration :: type_decl, name :: identifier, > size :: integer_constant, alignment :: integer, > qualifiers :: [qualifier], completeness :: bool) > * * * array_type: (element_type :: type, element_count :: integer) > * * * numeric_type: (precision :: integer, signed :: bool, > min_value :: integer_constant, > max_value :: integer_constant) > * * * * enumeral_type: (values :: [const_decl]) > * * * function_type: (param_types :: [type], result_type :: type) > * * * pointer_type: (referred_type :: type) > * * * record_type: struct (C or C++)/union; > (base_types :: [(type, access_info)], > fields :: [field_decl or const_decl or type_decl], > methods :: [method_decl]) > * reference: Any node may be replaced by a reference. They can be > forward or backward references. (referred_id :: integer) > > As you may see, tree nodes form many many cycles together. Subclasses > sometimes provide stronger invariants for their fields than the parent > classes. For example all declarations are associated with a type and for > function_decl nodes this type is always a function_type. > > Now to my question. How to represent this in Haskell. Because of the > enormous > amount of fields per tree node, I certainly need to use records. > > -- Haskell follows: > data BaseTree = BaseTree { id :: Int, ... ... } > data BaseDecl = BaseDecl { baseTree :: BaseTree, name :: Identifier, > declType :: Type, ... } > data ConstDecl = ConstDecl { baseDecl :: BaseDecl, value :: ConstValue } > data ConstValue = ComplexConst Complex | IntegerConst Integer > data TypeDecl = TypeDecl { baseDecl :: BaseDecl } > > But... What shall I do about the heterogenous lists which many nodes > contain. > I wish I don't need to make myriards of ADTs for them, like: > > data AnyTopLevelDecl = ATLDConst ConstDecl > | ATLDFunction FunctionDecl > | ATLDNamespace NamespaceDecl > | ATLDType TypeDecl -- ... > data StructFieldDecl = SFDConst ConstDecl > | SFDField FieldDecl > | SFDType TypeDecl > > And so forth, basicly each heterogenous list gets its own ADT, because > there > is often variance in which node types can appear in the lists. > > I could use one big ADT like AnyDecl. However, to me it would feel like a > bad > design, if my types allowed RecordType nodes to reference NamespaceDecls, > and > therefore I don't want to pack all nodes into one type, unless I could use > some type parameters or constraints to restrict the possible values the ADT > could take. > > At first I thought that the following could solve my problem: > > data SomeDecl a = SomeDecl where > SomeConst :: ConstDecl -> SomeDecl ConstDecl > SomeField :: FieldDecl ->SomeDecl FieldDecl > SomeFunction :: FunctionDecl -> SomeDecl FunctionDecl > SomeType :: TypeDecl -> SomeDecl TypeDecl > > -- and then I would use type classes like this > class TopLevelDecl decl where > -- No methods needed > instance TopLevelDecl ConstDecl > instance TopLevelDecl FunctionDecl > instance TopLevelDecl TypeDecl > > -- And then I could write functions like this: > handleTopLevelDecl :: TopLevelDecl d => SomeDecl d -> Whatever > handleTopLevelDecl (FunctionDecl f) = -- ... > -- and I'd list all cases which have a TopLevelDecl instance, but not > -- those which don't have. I also thought that my data types could look > like > -- this: > > data NamespaceDecl where > NamespaceDecl :: { > baseTree :: BaseTree, > forall a. TopLevelDecl a => declarations :: [a] > } > > Obviously this does not work, because type classes are open, and even > though > GHC prevents me from calling handleTopLevelDecl with (SOmeDecl FieldDecl), > it > still complains if I don't define an equation for it, because in some other > module somebody might make a TopLevelDecl instance for FieldDecl. > > Now I would like to know if there is a way to solve my problem in an > elegant > way, e.g. by using type families. > > My second question is how to resolve the cyclicity of the node graph. I > don't > want to tie the knot, because I want to be able to manipulate the graph. > > Maps are one option, yes: > > data AnyNode = (list all possible nodes) > type Id = Int > type NodeIdMap = Map Id AnyNode > > -- Then my data types refer to other nodes like this: > data FunctionDecl = FunctionDecl { > parameters :: [Id] > } > > Now I lose all type safety. I would have to insert a run-time check to > every > dereference of an Id if I want to make sure that function parameter > declarations don't contain StringConstants. > > I've also considered using STRefs. During JSON parsing I would need to > populate the nodes with the node Ids they refer to and then have a separate > pass which turns all Ids to typed STRefs. At least with this approach I > would > get all possible run-time errors straight after parsing, and not when the > data > is used. > > I'm again sorry for this long elaboration. However I think that if you > consider answering me you have a pretty good understanding of my problem > and > also a good knowledge of my level of understanding Haskell. I would like to > unlearn OO-style thinking, and I would want to find a data and type > representation which feels Haskellish. However I don't want to cut down the > data. I want all information to be accessible in case somebody needs it. > > Thank you in advance! > > -- > Aura > _______________________________________________ > 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 D.J.Duke at leeds.ac.uk Mon Dec 12 09:43:57 2016 From: D.J.Duke at leeds.ac.uk (David Duke) Date: Mon, 12 Dec 2016 09:43:57 +0000 Subject: [Haskell-cafe] PhD studentships at Leeds Message-ID: <23906CC2-5EAE-4F95-A41E-F2D4862BD34A@leeds.ac.uk> The School of Computing at the University of Leeds is advertising a number of PhD studentships open to UK, EU and international applicants. Two of the projects are at the overlap between functional programming and visualization, one on performance analysis, one on explaining type inference. Please see the following URL for further information including how to apply: https://engineering.leeds.ac.uk/research-opportunity/201323/research-degrees/614/funded-studentships-in-the-school-of-computing- Closing date: 06/01/2017 --- 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/ From jo at durchholz.org Mon Dec 12 16:10:09 2016 From: jo at durchholz.org (Joachim Durchholz) Date: Mon, 12 Dec 2016 17:10:09 +0100 Subject: [Haskell-cafe] A Procedural-Functional Language (WIP) In-Reply-To: References: <50a704b8-14b7-ca49-7093-143dbe9bbd86@durchholz.org> Message-ID: Sorry for replying so late, this got stuck in the outbox. Am 26.10.2016 um 17:48 schrieb Rik Howard: > Also, subtypes and binary operators do not really mix; google for > "parallel type hierarchy". (The core of the problem is that if you > make Byte a subtype of Word, declaring the (+) operator in Word as > Word -> Word will preclude Byte from being a subtype because you > want a covariant signature in Byte but that violates subtyping rules > for functions. So you need parametric polymorphism, but now you > cannot use the simple methods for subtyping anymore.) > > > Clearly there is more to be done in this area. That's a pretty well-explored part of design space. Unfortunately, there seems to a really hard trade-off between things like modularity / extensibility, freeness from surprises, and soundness, so most languages to not offer this. Striking a useful compromise is hard. Even integer arithmetic isn't easy; e.g. what's the type and value of (byte 254)+(byte 254)? For some languages it is (word 510), for some it is (word -4), some say (bigint 510). I have seen strong arguments brought forward for each of these answers, but since these solutions are mutually incompatible, and whatever answer you pick for your language, you have to ignore the arguments in favor of the other choices. > I think you should elaborate similarities and differences with how > Haskell does IO, that's a well-known standard it is going to make > the paper easier to read. Same goes for Clean&Mercury. > > Something like that is addressed in Related Work. Clean is already on > the list but it sounds, from your comments and those of others, as if > Mercury may be worth including as well. Just for reference, e.g. which of your concepts are the same in the other languages, which are different and what are the differences. > It's hard to tell whether it is actually new, too many details are > missing. > > Certainly you have spotted the vagueness in the types however I think > that that issue can be momentarily set aside from the point of view of > novelty. Novelty is entirely uninteresting. Usefulness is. Novelty *may* point out new ways to constructing something that's more useful than we have, but you need to point out how the novelty will help with that if you want to raise serious interest in your work. Regards, Jo From mlang at delysid.org Mon Dec 12 18:27:03 2016 From: mlang at delysid.org (Mario Lang) Date: Mon, 12 Dec 2016 19:27:03 +0100 Subject: [Haskell-cafe] Gitter Haskell Community In-Reply-To: (Tomas Carnecky's message of "Wed, 07 Dec 2016 16:50:43 +0000") References: <7033a798-3c01-48c4-883f-7368f5fb3871@me.com> Message-ID: <87y3zl2ebs.fsf@fx.delysid.org> Tomas Carnecky writes: > Usability matters. It's easier to tell people to open a browser window and > point them at a URL than tell them to download an IRC chat client and how > to connect to the server and... As someone relying on Accessibility on a daily basis, I notice that this myth does not apply to me. As a blind user, working with a browser-based chat system is definitely less accessible then a native local client solution using something established and well-tested like IRC. Actually, I am afraid most of you have absolutely no idea how bad web accessibility has become in the modern days of realtime web-based applications. The digital divide is about to hit really hard with the next wave of new technology hype. HTML + JavaScript was never designed to be an application development platform, and forcing it to be one does not make the job for assistive technology providers easier, in fact, it makes it virtually impossible. > On Wed, Dec 7, 2016 at 5:41 PM William Yager wrote: > >> What are the advantages of this over the #haskell IRC on freenode? It's >> very active, usually with over 1500 nicks at any given time. >> >> I generally prefer IRC to any of these hip web chat solutions because IRC >> is client-agnostic and very rugged against companies folding or deciding >> they don't want to host a project any more. Basically the only way to kill >> an IRC channel is through social attrition, whereas any social value built >> up in hosted chat services might disappear overnight. >> >> The one major advantage of hosted chats over IRC is that they work better >> with mobile users, but I don't think that's very relevant for haskell dev. >> >> Will >> >> On Wed, Dec 7, 2016 at 7:34 AM, Ben Spencer >> wrote: >> >> Why Gitter you might ask? >> >> _______________________________________________ >> 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. -- CYa, ⡍⠁⠗⠊⠕ | Blog: GitHub: .''`. | Twitter: @blindbird23 FaceBook: disyled : :' : | SoundCloud: `. `' | YouTube: `- From jo at durchholz.org Mon Dec 12 18:38:37 2016 From: jo at durchholz.org (Joachim Durchholz) Date: Mon, 12 Dec 2016 19:38:37 +0100 Subject: [Haskell-cafe] Gitter Haskell Community In-Reply-To: <87y3zl2ebs.fsf@fx.delysid.org> References: <7033a798-3c01-48c4-883f-7368f5fb3871@me.com> <87y3zl2ebs.fsf@fx.delysid.org> Message-ID: <62909691-d1ce-45ea-81cb-48d942ac9d1e@durchholz.org> Am 12.12.2016 um 19:27 schrieb Mario Lang: > Actually, I am afraid most of you have absolutely no idea how bad web > accessibility has become in the modern days of realtime web-based > applications. Actually I do, but I may be talking from a minority position here. However, It's not about accessibility, it's that webapps have zero installation overhead and a non-zero barrier between web data and your personal data; for installed applications, it is the other way round. > The digital divide is about to hit really hard with the > next wave of new technology hype. HTML + JavaScript was never designed > to be an application development platform, and forcing it to be one does > not make the job for assistive technology providers easier, in fact, it > makes it virtually impossible. That's one of the things I have been disliking about how the W3C has been pushing Javascript instead of simply extending the set of standard controls. What's also missing is UI design guidelines such as those that have been established for Mac, Windows, and Linux. Most webapps have a horrid user experience even for me, who is neither blind nor colorblind nor mouse-precision-impaired, i.e. usability is bad even for mainstream users. Regards, Jo From monkleyon at googlemail.com Mon Dec 12 19:14:26 2016 From: monkleyon at googlemail.com (MarLinn) Date: Mon, 12 Dec 2016 20:14:26 +0100 Subject: [Haskell-cafe] Gitter Haskell Community In-Reply-To: <62909691-d1ce-45ea-81cb-48d942ac9d1e@durchholz.org> References: <7033a798-3c01-48c4-883f-7368f5fb3871@me.com> <87y3zl2ebs.fsf@fx.delysid.org> <62909691-d1ce-45ea-81cb-48d942ac9d1e@durchholz.org> Message-ID: On 2016-12-12 19:38, Joachim Durchholz wrote: > Am 12.12.2016 um 19:27 schrieb Mario Lang: >> The digital divide is about to hit really hard with the next wave of >> new technology hype. HTML + JavaScript was never designed to be an >> application development platform, and forcing it to be one does not >> make the job for assistive technology providers easier, in fact, it >> makes it virtually impossible. > > That's one of the things I have been disliking about how the W3C has > been pushing Javascript instead of simply extending the set of > standard controls. What's also missing is UI design guidelines such as > those that have been established for Mac, Windows, and Linux. Most > webapps have a horrid user experience even for me, who is neither > blind nor colorblind nor mouse-precision-impaired, i.e. usability is > bad even for mainstream users. Of course we are part of the problem. The general approach when it comes to Haskell on the web seems to be to throw some react and some ghcjs and some jquery and some god-knows-what together, and be done with it so you can get back to Haskell. I get that people want to stay in Haskell land, and these technologies are not bad per se, but we might have set the wrong incentives so that we rely on them too much. Most of the frameworks we have are absolutely not UI- or accessibility-oriented. If someone wants to create a static site with five pages, and it feels easier to rely on ghcjs+react with all its setup, have the user add three security exceptions, and then still crash the browser than it is to create five static pages, then we failed. Or rather, some parts of our community were too successful. It's kind of funny how many of us use Haskell because we'd rather think ten minutes than debug for twenty, but when it comes to web stuff many of us still throw careful consideration overboard. It's probably because the whole web dev world is a bit bonkers. But if any community has the right people to add a voice of reason, I'd still think ours might be a strong candidate. Naturally it's not a really loud voice, but then we do have some great server libraries as a selling point. Cheers, MarLinn From acfoltzer at gmail.com Mon Dec 12 19:46:37 2016 From: acfoltzer at gmail.com (Adam Foltzer) Date: Mon, 12 Dec 2016 11:46:37 -0800 Subject: [Haskell-cafe] Supporting Haskell.org in 2016 Message-ID: Dear Haskellers, A great deal of core infrastructure, including HaskellWiki, Hackage, Hoogle, and build infrastructure for GHC are hosted and managed with the help of donations to haskell.org, from you, the Haskell community. As many of us are in tax jurisdictions where December 31st is a deadline for charitable giving, I’d like to remind you that donations to support these activities are tax-deductible. You can donate online right now through the donate button on the wiki: https://wiki.haskell.org/Donate_to_Haskell.org. Mailing information for checks is also on that page. New for this year, individual donations may be made directly via Paypal rather than the clickandpledge service, and Haskell.org is also can now accept donations through employers via Benevity using the unique ID 475236502. This year we had a successful first Summer of Haskell, offering 8 stipends of $5,500 to students making valuable contributions to our shared tooling and infrastructure such as ghc, ghcjs, and hackage, and engaging them in what we hope becomes a long succession of contributions to open source software. The exciting results are available at https://mail.haskell.org/ pipermail/haskell-cafe/2016-December/125702.html; this work is only made possible by your generous support, and that of the sponsors listed at https://summer.haskell.org/. We also have continued improving our infrastructure, using committee funds to help the development of a new performance tracker for ghc, with the aim of opening this up to a broader range of projects as well. With your support, we hope to continue these activities and more in 2017. Best wishes, Adam Foltzer on behalf of the Haskell.org committee -------------- next part -------------- An HTML attachment was scrubbed... URL: From jo at durchholz.org Mon Dec 12 20:07:15 2016 From: jo at durchholz.org (Joachim Durchholz) Date: Mon, 12 Dec 2016 21:07:15 +0100 Subject: [Haskell-cafe] Gitter Haskell Community In-Reply-To: References: <7033a798-3c01-48c4-883f-7368f5fb3871@me.com> <87y3zl2ebs.fsf@fx.delysid.org> <62909691-d1ce-45ea-81cb-48d942ac9d1e@durchholz.org> Message-ID: <041c8363-b8fe-07c8-08cb-44fef3c0f74a@durchholz.org> Am 12.12.2016 um 20:14 schrieb MarLinn via Haskell-Cafe: > It's probably because > the whole web dev world is a bit bonkers. My impression: Lack of generally accepted style guidelines, plus too many hard technological challenges to leave much energy for making the UI slick. To make matters even worse, some of the solutions to the technological challenges make some UI patterns more difficult than others, so people start to think technology-first, usability-later, so the whole usability thing doesn't get the attention that it deserves. E.g. incremental loading over an (inherently) unreliable and laggy network collides with a type-to-search approach - you can't search in a list that you haven't fully loaded yet. > But if any community has the > right people to add a voice of reason, I'd still think ours might be a > strong candidate. Naturally it's not a really loud voice, but then we do > have some great server libraries as a selling point. If it turns out to work better than existing libs, loudness will come without even working much on it. However, language&lib quality factors only partly into final framework quality. Being a good Haskeller is orthogonal to being a good at web UI usability, so there's no reason to assume that Haskell will bring better quality to the masses in this specific area. Doesn't mean that it is a bad idea to try it anyway, just don't expect to get specific leverage out of Haskell :-) The various things that are important: - Ability to easily shift computations between frontend (browser) and backend (server). Because latencies or changing data volumes might force you reversing decisions about whether something is processed on the server or on the client. - For anything that happens on the client, the server needs to be able to re-check it (because the user might be trying to hack the server). Absolute must: No need to code this twice, once in JS and once in Haskell (otherwise you'll get inconsistent checks, which are one of the worst security problem generators because people will mistakenly check browser logic when they should be checking server logic and vice versa). - "Reactivity", which means that the majority of pages should be equally displayable on a desktop, in a desktop browser, and on cramped smartphone space. Setting up such a framework definitely requires excellent Javascript and DOM knowledge over a range of implementations, and either a Haskell-to-Javascript compiler or a DSL-to-Javascript compiler (DSL would be pretty restrictive though because then you'd have to limit the DSL so that it can never execute arbitrary Haskell). It's a really big thing to do, but I suspect doing anything smaller isn't going to get any attention outside the Haskell community. Just my ramblings, YMMV :-) Regards, Jo From ok at cs.otago.ac.nz Tue Dec 13 05:45:52 2016 From: ok at cs.otago.ac.nz (Richard A. O'Keefe) Date: Tue, 13 Dec 2016 18:45:52 +1300 Subject: [Haskell-cafe] Gitter Haskell Community In-Reply-To: <87y3zl2ebs.fsf@fx.delysid.org> References: <7033a798-3c01-48c4-883f-7368f5fb3871@me.com> <87y3zl2ebs.fsf@fx.delysid.org> Message-ID: On 13/12/16 7:27 AM, Mario Lang wrote: > Actually, I am afraid most of you have absolutely no idea how bad web > accessibility has become in the modern days of realtime web-based > applications. The digital divide is about to hit really hard with the > next wave of new technology hype. HTML + JavaScript was never designed > to be an application development platform, and forcing it to be one does > not make the job for assistive technology providers easier, in fact, it > makes it virtually impossible. A few years ago when our departmental web-site was being redesigned I had some usability concerns and went to the local Blind Institute to ask their advice. I have forgotten their exact words, but the gist will stay with me for a long time: * It's no harder to make an accessible site than an inaccessible site. * You just have to seriously WANT to. (Our site doesn't use the design I was concerned about any more.) From ezyang at mit.edu Tue Dec 13 06:14:27 2016 From: ezyang at mit.edu (Edward Z. Yang) Date: Mon, 12 Dec 2016 22:14:27 -0800 Subject: [Haskell-cafe] Optional C dependencies / build-time feature toggles In-Reply-To: <20161211165306.GA4803@nibbler> References: <20161211165306.GA4803@nibbler> Message-ID: <1481609292-sup-8316@sabre> Excerpts from Tobias Dammers's message of 2016-12-11 17:53:07 +0100: > The pipe dream would be for those dependencies to be optional *at run > time*, such that the application would test for their presence on > startup, or load them dynamically when and if they're needed. It's not completely unthinkable to directly interface with dlopen() and similar functions to dynamically load symbols. posix even has a (not very widely used) module for precisely this: https://hackage.haskell.org/package/unix-2.7.2.1/docs/System-Posix-DynamicLinker.html > However, I'm also fine with making them compile-time feature toggles, > such that users can enable only the ones they need. This is certainly what flags in Cabal files can be used for. More below. > Doing some sort of autotools-style dependency discovery would of > course be cool as well (i.e., only enable mysql support if > libmysqlclient is present). This is also possible using build-type: Configure, see: http://cabal.readthedocs.io/en/latest/developing-packages.html#system-dependent-parameters > > Question: I like to let the user enable extended functionality using a > > Cabal flag. Is this the right way? > > > > Answer: Certainly not. Since other packages can distinguish packages > > only according to their name and their version, it is not a good idea > > to allow different APIs for the same package version. Cumbersome as it > > is you have to move extra features to a separate package. > > Moving the features to a separate package wouldn't really solve anything > AFAICT, because I'd still have to bring them together somehow. Yeah, this is something that gets a bit of push and pull, even amongst Cabal developers. It is definitely true that there's no way to depend on a library, AND say that it must have some feature flag toggled, which makes it impossible to accurately specify the dependency. But for an executable application, this seems like less of a problem because no one can depend on you. Seems a lot more reasonable in this situation. Edward From ezyang at mit.edu Tue Dec 13 06:26:58 2016 From: ezyang at mit.edu (Edward Z. Yang) Date: Mon, 12 Dec 2016 22:26:58 -0800 Subject: [Haskell-cafe] memoizing with a default In-Reply-To: <80fdd1d5-d11b-4b1f-0528-ae41f087640f@cs.cornell.edu> References: <80fdd1d5-d11b-4b1f-0528-ae41f087640f@cs.cornell.edu> Message-ID: <1481609942-sup-5559@sabre> Hello Michael, I've been looking for an elegant, functional implementation of DFA minimization and I have not found it. If you discover a way to do it please share. However, I have seen some papers which might be relevant to the problem (although not necessarily good for writing a Haskell implementation). The CoCaml paper discusses how to write recursive functions on infinite objects, which would ordinarily not terminate, but in their language are instead treated as a set of recursive equations and solved by some extralinguistic constraint solver. This is similar in spirit to your desire to "detect diversion" when you loop around the memotable. The Datafun paper recently reminded me that Datalog-style programming is all about fixpoints. I wonder if DFA minimization can be done in a Datalog-like language. I have no idea if these are actually relevant, and would be interested to hear if they are. Edward Excerpts from Michael George's message of 2016-12-10 11:50:03 -0500: > I've come across a slight variant of memoization and I'm curious if > either there is a better way to think about (I have yet to reach Haskell > Enlightement), or if it's been thought about before. > > I'm writing a program that does DFA minimization, as described here: > https://www.tutorialspoint.com/automata_theory/dfa_minimization.htm. > > For me, the simplest way to understand the algorithm is we form an > equivalence relation, where two states are different if either one is > final and the other isn't, or if there are transitions from them to > states that are different. > > different a b = isFinal a && not (isFinal b) || isFinal b && not > (isFinal a) || exists chars (\c -> different (step a c) (step b c)) > > This definition diverges; it never decides that two states are the same. > The standard algorithm builds a table, starting with the assumption > that all states are the same, and iteratively applying this definition > until it converges. > > I'm thinking of that algorithm as a memoized version of the > implementation of different above. But it's not quite: > > different = memoFix2 different' where > different' different'' a b = isFinal a && not (isFinal b) || isFinal > b && not (isFinal a) || exists chars (\c -> different'' (step a c) (step > b c)) > > for the same reason; it diverges. But with memoization I can detect the > diversion by putting a marker in the memo table. If the computation > makes a recursive call on an input that is started but not computed, > then (in this case) I want to return false. > > In general, I think what I want is > > memoFixWithDefault :: (a -> b) -> ((a->b) -> (a -> b)) -> (a -> b) > > Where (memoFixWithDefault default f) is like (memoFix f) except that if > (memoFix f a) would loop, then (memoFixWithDefault default f a) = default a. > > > I suspect there's a nice denotational way of describing this, but my > denotational semantics is rusty (maybe it's the least fixed point of f > that is greater than g or something, but that's not it). I suspect that > there needs to be a nice relationship between f and g for > memoFixWithDefault f g to be sensible. I also suspect that there's a > cute 3-line implementation like all the other implementations of memoize > out there, but I don't see it. I also suspect that depth-first search > has a cute implementation using this combinator. > > So I was wondering if other people had thoughts or references before I > went off and thought about it. > > Thanks! > > -M From oleg.grenrus at iki.fi Tue Dec 13 09:01:15 2016 From: oleg.grenrus at iki.fi (Oleg Grenrus) Date: Tue, 13 Dec 2016 11:01:15 +0200 Subject: [Haskell-cafe] RFC: functor-classes-compat Message-ID: <29d2e457-a33c-6565-ad25-7468d62a6c96@iki.fi> Hi, continuing pushing the adoption Data.Functor.Classes, I wrote a small package `functor-classes-compat` [1]. It provides lifted (Eq1, Ord1, etc.) classes for types in `containers`, `vector` and `unordered-containers`(not for Sequence or Tree yet though). I guess there is no way they could depend on `transformers` to provide instances in build plans with `base < 4.9`, I'm not sure when I'll have time to write patches for the actual packages myself. Current implementations are naive, but more obviously correct. The package is not yet released on Hackage, I'll do that after the comments, which are warmly welcome! Best regards, Oleg Grenrus [1]: https://github.com/phadej/functor-classes-compat -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: OpenPGP digital signature URL: From david.feuer at gmail.com Tue Dec 13 17:06:05 2016 From: david.feuer at gmail.com (David Feuer) Date: Tue, 13 Dec 2016 12:06:05 -0500 Subject: [Haskell-cafe] RFC: functor-classes-compat In-Reply-To: References: <29d2e457-a33c-6565-ad25-7468d62a6c96@iki.fi> Message-ID: On Dec 13, 2016 4:01 AM, "Oleg Grenrus" wrote: Hi, continuing pushing the adoption Data.Functor.Classes, I wrote a small package `functor-classes-compat` [1]. It provides lifted (Eq1, Ord1, etc.) classes for types in `containers`, `vector` and `unordered-containers`(not for Sequence or Tree yet though). Thanks for working on this. Obviously, some of these really belong in containers. I'll try to add them today. I guess there is no way they could depend on `transformers` to provide instances in build plans with `base < 4.9`, I'm not sure when I'll have time to write patches for the actual packages myself. No, I don't think that's likely. One option might be to add these instances to transformers when compiling with older base, but I don't know if Ross Paterson will want them. Current implementations are naive, but more obviously correct. More than what? -------------- next part -------------- An HTML attachment was scrubbed... URL: From oleg.grenrus at iki.fi Tue Dec 13 18:26:51 2016 From: oleg.grenrus at iki.fi (Oleg Grenrus) Date: Tue, 13 Dec 2016 20:26:51 +0200 Subject: [Haskell-cafe] RFC: functor-classes-compat In-Reply-To: References: <29d2e457-a33c-6565-ad25-7468d62a6c96@iki.fi> Message-ID: <9994b1b5-0829-76ec-9c36-6bfd00f2b26d@iki.fi> On 13.12.2016 19:06, David Feuer wrote: > On Dec 13, 2016 4:01 AM, "Oleg Grenrus" > wrote: > > Hi, > > continuing pushing the adoption Data.Functor.Classes, I wrote a small > package `functor-classes-compat` [1]. > > It provides lifted (Eq1, Ord1, etc.) classes for types in > `containers`, > `vector` and `unordered-containers`(not for Sequence or Tree yet > though). > > > Thanks for working on this. Obviously, some of these really belong in > containers. I'll try to add them today. Thanks to you! > > I guess there is no way they could depend on `transformers` to provide > instances in build plans with `base < 4.9`, I'm not sure when I'll > have > time to write patches for the actual packages myself. > > > No, I don't think that's likely. One option might be to add these > instances to transformers when compiling with older base, but I don't > know if Ross Paterson will want them. I'm not sure we want `transformers` to depend on `containers` either, not even mentioning `vector` and `unordered-containers`. Also there are people stuck with `transformers-0.4` (GHC 7.10). > > > Current implementations are naive, but more obviously correct. > > > More than what? It seems that implementation for Data.Map is indeed "check size, compare lists", but e.g for vector it uses streaming framework to make things fuse, I still use "check size, compare lists" approach. Also I see that my `HashMap` implementation is actually incorrect, as HashMap's `toList` may return results in different order (depends on the history) From david.feuer at gmail.com Tue Dec 13 19:24:12 2016 From: david.feuer at gmail.com (David Feuer) Date: Tue, 13 Dec 2016 14:24:12 -0500 Subject: [Haskell-cafe] RFC: functor-classes-compat In-Reply-To: <9994b1b5-0829-76ec-9c36-6bfd00f2b26d@iki.fi> References: <29d2e457-a33c-6565-ad25-7468d62a6c96@iki.fi> <9994b1b5-0829-76ec-9c36-6bfd00f2b26d@iki.fi> Message-ID: On Dec 13, 2016 1:26 PM, "Oleg Grenrus" wrote: I'm not sure we want `transformers` to depend on `containers` either, not even mentioning `vector` and `unordered-containers`. Also there are people stuck with `transformers-0.4` (GHC 7.10). Good point, although practically speaking, containers currently *can't* depend on transformers, because transformers is not currently a GHC boot package. There'll probably be room for your compat package for a while, but you'll have to chase those bounds :-/. > Current implementations are naive, but more obviously correct. > > More than what? It seems that implementation for Data.Map is indeed "check size, compare lists", but e.g for vector it uses streaming framework to make things fuse, I still use "check size, compare lists" approach. I believe the only containers structures with non-boring instances of any of those classes are Data.IntMap, Data.IntSet, and Data.Tree. Side question: why doesn't Read1 have the ReadPrec-based methods that Read does? -------------- next part -------------- An HTML attachment was scrubbed... URL: From oleg.grenrus at iki.fi Tue Dec 13 19:38:07 2016 From: oleg.grenrus at iki.fi (Oleg Grenrus) Date: Tue, 13 Dec 2016 21:38:07 +0200 Subject: [Haskell-cafe] RFC: functor-classes-compat In-Reply-To: References: <29d2e457-a33c-6565-ad25-7468d62a6c96@iki.fi> <9994b1b5-0829-76ec-9c36-6bfd00f2b26d@iki.fi> Message-ID: <0ded2a25-66a8-0145-282a-67d27b45bb51@iki.fi> On 13.12.2016 21:24, David Feuer wrote: > On Dec 13, 2016 1:26 PM, "Oleg Grenrus" > wrote: > > > I'm not sure we want `transformers` to depend on `containers` either, > not even mentioning `vector` and `unordered-containers`. Also > there are > people stuck with `transformers-0.4` (GHC 7.10). > > > Good point, although practically speaking, containers currently > *can't* depend on transformers, because transformers is not currently > a GHC boot package. There'll probably be room for your compat package > for a while, but you'll have to chase those bounds :-/. > > transformers *is* boot package, `ghc` package depends on transformers directly (since GHC 7.6): https://ghc.haskell.org/trac/ghc/wiki/Commentary/Libraries/VersionHistory $ ghc-pkg describe ghc ... depends: array-0.5.1.1 base-4.9.0.0 binary-0.8.3.0 bytestring-0.10.8.1 containers-0.5.7.1 directory-1.2.6.2 filepath-1.4.1.0 ghc-boot-8.0.1 ghci-8.0.1 hoopl-3.10.2.1 hpc-0.6.0.3 process-1.4.2.0 template-haskell-2.11.0.0 time-1.6.0.1 transformers-0.5.2.0 unix-2.7.2.0 > > Current implementations are naive, but more obviously correct. > > > > More than what? > > It seems that implementation for Data.Map is indeed "check size, > compare > lists", but e.g for vector it uses streaming framework to make things > fuse, I still use "check size, compare lists" approach. > > > I believe the only containers structures with non-boring instances of > any of those classes are Data.IntMap, Data.IntSet, and Data.Tree. > IntSet is :: * > Side question: why doesn't Read1 have the ReadPrec-based methods that > Read does? I have been wondering the same -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: OpenPGP digital signature URL: From kaura.dev at sange.fi Tue Dec 13 20:35:43 2016 From: kaura.dev at sange.fi (Aura Kelloniemi) Date: Tue, 13 Dec 2016 22:35:43 +0200 Subject: [Haskell-cafe] Modelling structurally subtyped and cyclic data in type safe Haskell In-Reply-To: References: <878trqipez.fsf@sange.fi> Message-ID: <877f731s9s.fsf@sange.fi> Dear Heinrich, and all others! Heinrich Apfelmus writes: > Second, it may helpful to look at how others do it. Your writing > indicates that are already very knowledgeable, so this advice may be not > very helpful, but for the sake of completeness, I would like to mention > it anyway. For example, the `haskell-src-exts` package implements a > syntax tree for Haskell, maybe it can offer an inspiration or two. Yes, I have looked it up, and iss design is very clean. Unfrotunately my data is not purely a syntax tree, but it contains lots of information related to data layout, code generation, etc. For example haskell-src-exts does not need to track type information, and it can refer to declared entities simply by their name. If I did the same, I would also need to implement full-blown C++ name lookup with symbol tables, which I don't want to do. GHC's sources might be useful though, but I haven't been corageous enough to try my teeth on them. Anyways, I'm very grateful for your pointers! I learned about anonymous sum types and about vault. GADTs composed with phantom types and type families seem to offer countless possibilities. I'm missing some introductory documentation though - something that is more practical than theoretical. (Yes, GADTs are quite well covered, but I haven't found a tutorial for practical use of data families or -XTypeInType, probably because they are quite new features.) -- Aura From jan.loewenstein at gmail.com Tue Dec 13 20:57:03 2016 From: jan.loewenstein at gmail.com (=?UTF-8?Q?Jan_von_L=C3=B6wenstein?=) Date: Tue, 13 Dec 2016 20:57:03 +0000 Subject: [Haskell-cafe] Offline compilation with Stack/Cabal In-Reply-To: <87k2bs7dmx.fsf@gnu.org> References: <87k2bs7dmx.fsf@gnu.org> Message-ID: If anybody else is interested. For now, I settled with a Stack based solution. `STACK_ROOT= stack build --dry-run --prefetch` works like a charm. What I didn't tackle yet is having multiple ghc installations in that folder. Somehow I will find a solution for that as well. For now I live with the fact that `STACK_ROOT= stack build --install-ghc` will connect to the internet to download ghc. Thanks for all the responses. I'll send an update when the ghc thing is solved as well. Best Jan Herbert Valerio Riedel schrieb am Do., 24. Nov. 2016 um 22:48 Uhr: > Hi, > > On 2016-11-24 at 07:57:57 +0100, Jan von Löwenstein wrote: > > Consider the following use case: > > I have to ship a Haskell application as source, bundled with its > > dependencies and a script that can produce the binary on a machine > without > > internet connectivity. > > This situation is not that uncommon; one example is when you have > build-bots which a more or less cut off from the internet (such as > Ubuntu's launchpad buildfarm) > > > Is that possible with Stack or Cabal? > > Any pointers would be much appreciated. > > > Ideally I would like to build each dependency package individually. That > > way I could cache results per Haskell package and don't need to rebuild > > dependencies until they actually change. > > This sounds like something I'd use cabal's filesystem-local repository > feature[1] for, and it should be possible to specify such local > repositories in your `cabal.config` or `cabal.project`[2] files to > produce a self-contained source distribution. > > If you're interested in pursuing this approach or have any questions > about it, let me know! > > > [1]: > http://cabal.readthedocs.io/en/latest/installing-packages.html#repository-specification > [2]: http://cabal.readthedocs.io/en/latest/nix-local-build-overview.html > > Cheers > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan.loewenstein at gmail.com Tue Dec 13 21:45:11 2016 From: jan.loewenstein at gmail.com (=?UTF-8?Q?Jan_von_L=C3=B6wenstein?=) Date: Tue, 13 Dec 2016 21:45:11 +0000 Subject: [Haskell-cafe] Tracing HTTP request/response using servant-client or http-client Message-ID: Hi, I wonder if there is a possibility to make servant-client or the layer below, i.e. http-client log all requests and corresponding responses into a log file. There is `managerModifyRequest :: ManagerSettings -> Request -> IO Request ` ( https://github.com/snoyberg/http-client/blob/master/http-client/Network/HTTP/Client/Types.hs#L672) which would allow to build logging for requests I suppose. However I could neither find a corresponding hook for Response, nor a "batteries included"TM `logRequests = True`, `requestLogger=...` or something along those lines. Best Jan -------------- next part -------------- An HTML attachment was scrubbed... URL: From clintonmead at gmail.com Wed Dec 14 04:32:07 2016 From: clintonmead at gmail.com (Clinton Mead) Date: Wed, 14 Dec 2016 15:32:07 +1100 Subject: [Haskell-cafe] memoizing with a default In-Reply-To: <1481609942-sup-5559@sabre> References: <80fdd1d5-d11b-4b1f-0528-ae41f087640f@cs.cornell.edu> <1481609942-sup-5559@sabre> Message-ID: "But with memoization I can detect the diversion by putting a marker in the memo table." I'm not sure I entirely understand your problem, but it seems when you make a recursive call to a node you've already visited, you want to return false. Like you said, you have to "mark" this in some way. One way do to this is to just add a parameter to the recursive call which notes the nodes you've just visited. There's a number of ways to do this, in the ST Monad an mutable bit array would work nicely but if you're not in ST a map which you check and add elements to should do the job fine. Just make this check the first part of an "and" statement, if it's already there you short circuit and return false. On Tue, Dec 13, 2016 at 5:26 PM, Edward Z. Yang wrote: > Hello Michael, > > I've been looking for an elegant, functional implementation of DFA > minimization and I have not found it. If you discover a way to do > it please share. > > However, I have seen some papers which might be relevant to the > problem (although not necessarily good for writing a Haskell > implementation). > > The CoCaml paper > discusses how to write recursive functions on infinite objects, which > would ordinarily not terminate, but in their language are instead > treated as a set of recursive equations and solved by some extralinguistic > constraint solver. This is similar in spirit to your desire to "detect > diversion" when you loop around the memotable. > > The Datafun paper > recently reminded me that Datalog-style programming is all about > fixpoints. I wonder if DFA minimization can be done in a Datalog-like > language. > > I have no idea if these are actually relevant, and would be interested > to hear if they are. > > Edward > > Excerpts from Michael George's message of 2016-12-10 11:50:03 -0500: > > I've come across a slight variant of memoization and I'm curious if > > either there is a better way to think about (I have yet to reach Haskell > > Enlightement), or if it's been thought about before. > > > > I'm writing a program that does DFA minimization, as described here: > > https://www.tutorialspoint.com/automata_theory/dfa_minimization.htm. > > > > For me, the simplest way to understand the algorithm is we form an > > equivalence relation, where two states are different if either one is > > final and the other isn't, or if there are transitions from them to > > states that are different. > > > > different a b = isFinal a && not (isFinal b) || isFinal b && not > > (isFinal a) || exists chars (\c -> different (step a c) (step b c)) > > > > This definition diverges; it never decides that two states are the same. > > The standard algorithm builds a table, starting with the assumption > > that all states are the same, and iteratively applying this definition > > until it converges. > > > > I'm thinking of that algorithm as a memoized version of the > > implementation of different above. But it's not quite: > > > > different = memoFix2 different' where > > different' different'' a b = isFinal a && not (isFinal b) || isFinal > > b && not (isFinal a) || exists chars (\c -> different'' (step a c) (step > > b c)) > > > > for the same reason; it diverges. But with memoization I can detect the > > diversion by putting a marker in the memo table. If the computation > > makes a recursive call on an input that is started but not computed, > > then (in this case) I want to return false. > > > > In general, I think what I want is > > > > memoFixWithDefault :: (a -> b) -> ((a->b) -> (a -> b)) -> (a -> b) > > > > Where (memoFixWithDefault default f) is like (memoFix f) except that if > > (memoFix f a) would loop, then (memoFixWithDefault default f a) = > default a. > > > > > > I suspect there's a nice denotational way of describing this, but my > > denotational semantics is rusty (maybe it's the least fixed point of f > > that is greater than g or something, but that's not it). I suspect that > > there needs to be a nice relationship between f and g for > > memoFixWithDefault f g to be sensible. I also suspect that there's a > > cute 3-line implementation like all the other implementations of memoize > > out there, but I don't see it. I also suspect that depth-first search > > has a cute implementation using this combinator. > > > > So I was wondering if other people had thoughts or references before I > > went off and thought about it. > > > > Thanks! > > > > -M > _______________________________________________ > 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 erkokl at gmail.com Wed Dec 14 09:04:34 2016 From: erkokl at gmail.com (Levent Erkok) Date: Wed, 14 Dec 2016 01:04:34 -0800 Subject: [Haskell-cafe] memoizing with a default In-Reply-To: <80fdd1d5-d11b-4b1f-0528-ae41f087640f@cs.cornell.edu> References: <80fdd1d5-d11b-4b1f-0528-ae41f087640f@cs.cornell.edu> Message-ID: Hi Michael: This is an interesting question, and I think you might indeed be able to "hack" into the recursive calls if you are willing to be explicit with your fixed-point calculation. Note that you'll have to *do* the work of keeping track of "visited" nodes, so to speak; there's no free lunch. But the construction of the table in a monadic form can be incorporated using what's known as "monadic memoization mixins." See this paper by Brown and Cook for details: https://www.cs.utexas.edu/users/wcook/Drafts/2009/sblp09-memo-mixins.pdf The idea is to detour through a memo-routine before each recursive call to do the bookkeeping necessary. The underlying monad keeps track of the data you are memoizing. However, before diving into memo-mixins, you might want to just implement the algorithm keeping track of a "visited" table in the monadic style, just to appreciate what the mixins will buy you. For fun, I coded your minimize example in idiomatic Haskell here: https://gist.github.com/LeventErkok/615afe9a0e24249daedab3c623241275 Enjoy, -Levent. On Sat, Dec 10, 2016 at 8:50 AM, Michael George wrote: > I've come across a slight variant of memoization and I'm curious if either > there is a better way to think about (I have yet to reach Haskell > Enlightement), or if it's been thought about before. > > I'm writing a program that does DFA minimization, as described here: > https://www.tutorialspoint.com/automata_theory/dfa_minimization.htm. > > For me, the simplest way to understand the algorithm is we form an > equivalence relation, where two states are different if either one is final > and the other isn't, or if there are transitions from them to states that > are different. > > different a b = isFinal a && not (isFinal b) || isFinal b && not (isFinal > a) || exists chars (\c -> different (step a c) (step b c)) > > This definition diverges; it never decides that two states are the same. > The standard algorithm builds a table, starting with the assumption that > all states are the same, and iteratively applying this definition until it > converges. > > I'm thinking of that algorithm as a memoized version of the implementation > of different above. But it's not quite: > > different = memoFix2 different' where > different' different'' a b = isFinal a && not (isFinal b) || isFinal b > && not (isFinal a) || exists chars (\c -> different'' (step a c) (step b c)) > > for the same reason; it diverges. But with memoization I can detect the > diversion by putting a marker in the memo table. If the computation makes > a recursive call on an input that is started but not computed, then (in > this case) I want to return false. > > In general, I think what I want is > > memoFixWithDefault :: (a -> b) -> ((a->b) -> (a -> b)) -> (a -> b) > > Where (memoFixWithDefault default f) is like (memoFix f) except that if > (memoFix f a) would loop, then (memoFixWithDefault default f a) = default a. > > > I suspect there's a nice denotational way of describing this, but my > denotational semantics is rusty (maybe it's the least fixed point of f that > is greater than g or something, but that's not it). I suspect that there > needs to be a nice relationship between f and g for memoFixWithDefault f g > to be sensible. I also suspect that there's a cute 3-line implementation > like all the other implementations of memoize out there, but I don't see > it. I also suspect that depth-first search has a cute implementation using > this combinator. > > So I was wondering if other people had thoughts or references before I > went off and thought about it. > > Thanks! > > -M > _______________________________________________ > 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 jan.loewenstein at gmail.com Wed Dec 14 16:05:01 2016 From: jan.loewenstein at gmail.com (=?UTF-8?Q?Jan_von_L=C3=B6wenstein?=) Date: Wed, 14 Dec 2016 16:05:01 +0000 Subject: [Haskell-cafe] Tracing HTTP request/response using servant-client or http-client In-Reply-To: References: Message-ID: Hi, I just found `checkResponse :: Request -> Response BodyReader -> IO ()`. Unfortunately reading the body from it in order to log it will apparently empty the responseBody for further processors. Any ideas? Regards Jan P.S. I will probably open an issue on http-client Jan von Löwenstein schrieb am Di., 13. Dez. 2016 um 22:45 Uhr: > Hi, > > I wonder if there is a possibility to make servant-client or the layer > below, i.e. http-client log all requests and corresponding responses into a > log file. > > There is `managerModifyRequest :: ManagerSettings > > -> Request > > -> IO > > Request > > ` ( > https://github.com/snoyberg/http-client/blob/master/http-client/Network/HTTP/Client/Types.hs#L672) which > would allow to build logging for requests I suppose. > > However I could neither find a corresponding hook for Response, nor a > "batteries included"TM `logRequests = True`, `requestLogger=...` or > something along those lines. > > Best > Jan > -------------- next part -------------- An HTML attachment was scrubbed... URL: From simon at joyful.com Wed Dec 14 16:06:26 2016 From: simon at joyful.com (Simon Michael) Date: Wed, 14 Dec 2016 08:06:26 -0800 Subject: [Haskell-cafe] Optional C dependencies / build-time feature toggles In-Reply-To: <20161211165306.GA4803@nibbler> References: <20161211165306.GA4803@nibbler> Message-ID: On 12/11/16 8:53 AM, Tobias Dammers wrote: > The pipe dream would be for those dependencies to be optional *at run > time*, such that the application would test for their presence on > startup, or load them dynamically when and if they're needed. However, > I'm also fine with making them compile-time feature toggles, such that > users can enable only the ones they need. Doing some sort of > autotools-style dependency discovery would of course be cool as well > (i.e., only enable mysql support if libmysqlclient is present). Hello Tobias, I asked for this, but indeed it's not easy to see how to implement it. I will say that the C libs required by sprinkles are all widely used so installing them wasn't too hard; and, it's nice having all of the power available from the start. Still, you may add more C-based storage back ends in future, and even one C lib does create friction and slow down adoption. compile-time cabal flags (cabal install sprinkles -fmysql -fpostgres) add complexity for maintainer, tools and users. I suppose they might be justified here. You'd have to decide on manual vs automatic flags (toggleable by Cabal), and enabled or disabled by default. (If they are enabled and automatic, and the required C lib is missing, will Cabal quietly skip that feature or give an error ?). The build-type: Configure suggestion sounds intriguing. A custom Setup.hs for fancy install behaviour might also be interesting, at minimum you could detect the C lib status and give more useful user advice. These also add complexity. Or, you could publish multiple semi-redundant packages - sprinkles, sprinkles-postgres, sprinkles-mysql, sprinkles-sqlite, sprinkles-all, sprinkles-lib... simpler packages, but more of them. From saurabhnanda at gmail.com Fri Dec 16 01:42:10 2016 From: saurabhnanda at gmail.com (Saurabh Nanda) Date: Fri, 16 Dec 2016 07:12:10 +0530 Subject: [Haskell-cafe] Absolutely confused with error/exception handling In-Reply-To: References: Message-ID: Hi, What started as a simple exercise of writing an Airbrake integration for Spock, has turned into a day of reading about errors, Control.Exception, MonadThrow, MonadCatch, sync, asynchronous, etc. Even after all that reading I haven't been able to find answers to the following -- * What exactly is done by the "error" function? How does one "trap" those errors and react to it? Can "catch" trap those errors? What is "e" in the case of errors raised by "error"? * How is "error" different from "throw" and "throwIO" (in the Control.Exception package, I believe) * What does MonadThrow and MonadCatch bring to the table? My understanding is that they are bringing a unified API to representing short-circuitable computations based on the inherently short-circuitable value of the host monad. Eg throwM in Maybe just results in a Nothing. throwM in List results in [] Therefore, in most of the cases throwM is not really using the error machinery built into the Haskell language (what said machinery is, is the very first question that I still don't completely understand) All of this might be obvious, and I might have just reached a mind-block after hours of reading. Help would be really appreciated :) -- Saurabh. -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Fri Dec 16 02:28:14 2016 From: allbery.b at gmail.com (Brandon Allbery) Date: Thu, 15 Dec 2016 21:28:14 -0500 Subject: [Haskell-cafe] Absolutely confused with error/exception handling In-Reply-To: References: Message-ID: On Thu, Dec 15, 2016 at 8:42 PM, Saurabh Nanda wrote: > * What exactly is done by the "error" function? How does one "trap" those > errors and react to it? Can "catch" trap those errors? What is "e" in the > case of errors raised by "error"? > `error` specifically raises a UserError exception, with a user-specified payload (message). `catch` can catch them as such. > * How is "error" different from "throw" and "throwIO" (in the > Control.Exception package, I believe) > `throw` (for pure code / asynchronous) and `throwIO` (for code in IO) can throw any exception. No guarantees are made as to when the exception thrown by `throw` -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Fri Dec 16 02:30:34 2016 From: allbery.b at gmail.com (Brandon Allbery) Date: Thu, 15 Dec 2016 21:30:34 -0500 Subject: [Haskell-cafe] Absolutely confused with error/exception handling In-Reply-To: References: Message-ID: whoops, pressed wrong key... No guarantees are made as to when the exception thrown by `throw` occurs; this allows it to be thrown from pure code. `throwIO` is sequenced as any other I/O operation, so you have some guarantee as to I/O operations before the `throwIO` being performed. On Thu, Dec 15, 2016 at 9:28 PM, Brandon Allbery wrote: > > On Thu, Dec 15, 2016 at 8:42 PM, Saurabh Nanda > wrote: > >> * What exactly is done by the "error" function? How does one "trap" those >> errors and react to it? Can "catch" trap those errors? What is "e" in the >> case of errors raised by "error"? >> > > `error` specifically raises a UserError exception, with a user-specified > payload (message). `catch` can catch them as such. > > >> * How is "error" different from "throw" and "throwIO" (in the >> Control.Exception package, I believe) >> > > `throw` (for pure code / asynchronous) and `throwIO` (for code in IO) can > throw any exception. No guarantees are made as to when the exception thrown > by `throw` > > > -- > brandon s allbery kf8nh sine nomine > associates > allbery.b at gmail.com > ballbery at sinenomine.net > unix, openafs, kerberos, infrastructure, xmonad > http://sinenomine.net > -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From saurabhnanda at gmail.com Fri Dec 16 03:30:16 2016 From: saurabhnanda at gmail.com (Saurabh Nanda) Date: Fri, 16 Dec 2016 09:00:16 +0530 Subject: [Haskell-cafe] Absolutely confused with error/exception handling In-Reply-To: References: Message-ID: Thanks. The air is clearing up a bit. Any reason for "error" and "catch" to be in different packages? Or, why isn't "catch" in prelude? "catch" needs a action in IO. What if I have an action in MonadIO? -- Saurabh. On 16 Dec 2016 8:00 am, "Brandon Allbery" wrote: > whoops, pressed wrong key... > > No guarantees are made as to when the exception thrown by `throw` occurs; > this allows it to be thrown from pure code. `throwIO` is sequenced as any > other I/O operation, so you have some guarantee as to I/O operations before > the `throwIO` being performed. > > On Thu, Dec 15, 2016 at 9:28 PM, Brandon Allbery > wrote: > >> >> On Thu, Dec 15, 2016 at 8:42 PM, Saurabh Nanda >> wrote: >> >>> * What exactly is done by the "error" function? How does one "trap" >>> those errors and react to it? Can "catch" trap those errors? What is "e" in >>> the case of errors raised by "error"? >>> >> >> `error` specifically raises a UserError exception, with a user-specified >> payload (message). `catch` can catch them as such. >> >> >>> * How is "error" different from "throw" and "throwIO" (in the >>> Control.Exception package, I believe) >>> >> >> `throw` (for pure code / asynchronous) and `throwIO` (for code in IO) can >> throw any exception. No guarantees are made as to when the exception thrown >> by `throw` >> >> >> -- >> brandon s allbery kf8nh sine nomine >> associates >> allbery.b at gmail.com >> ballbery at sinenomine.net >> unix, openafs, kerberos, infrastructure, xmonad >> http://sinenomine.net >> > > > > -- > brandon s allbery kf8nh sine nomine > associates > allbery.b at gmail.com > ballbery at sinenomine.net > unix, openafs, kerberos, infrastructure, xmonad > http://sinenomine.net > -------------- next part -------------- An HTML attachment was scrubbed... URL: From parsonsmatt at gmail.com Fri Dec 16 03:39:56 2016 From: parsonsmatt at gmail.com (Matt) Date: Thu, 15 Dec 2016 22:39:56 -0500 Subject: [Haskell-cafe] Absolutely confused with error/exception handling In-Reply-To: References: Message-ID: Hi Saurabh, I've found that the `safe-exceptions` package [1] and related articles [2] to be some of the best reading around exceptions in Haskell. To answer your third question, the `IO` instance for `MonadThrow`/`MonadCatch`/etc. do use Haskell's extensible exception machinery. The monad-ste [3] package uses Haskell's exception hierarchy in a controlled manner where evaluating `Either` ends up being expensive. I've also found exceptions to be one of the hardest parts about Haskell. Interestingly, they're one of the few dynamically typed bits with nearly OO-style inheritance. [1]: https://hackage.haskell.org/package/safe-exceptions [2]: https://haskell-lang.org/tutorial/exception-safety [3]: https://hackage.haskell.org/package/monad-ste Matt Parsons On Thu, Dec 15, 2016 at 10:30 PM, Saurabh Nanda wrote: > Thanks. The air is clearing up a bit. > > Any reason for "error" and "catch" to be in different packages? Or, why > isn't "catch" in prelude? > > "catch" needs a action in IO. What if I have an action in MonadIO? > > -- Saurabh. > > On 16 Dec 2016 8:00 am, "Brandon Allbery" wrote: > >> whoops, pressed wrong key... >> >> No guarantees are made as to when the exception thrown by `throw` occurs; >> this allows it to be thrown from pure code. `throwIO` is sequenced as any >> other I/O operation, so you have some guarantee as to I/O operations before >> the `throwIO` being performed. >> >> On Thu, Dec 15, 2016 at 9:28 PM, Brandon Allbery >> wrote: >> >>> >>> On Thu, Dec 15, 2016 at 8:42 PM, Saurabh Nanda >>> wrote: >>> >>>> * What exactly is done by the "error" function? How does one "trap" >>>> those errors and react to it? Can "catch" trap those errors? What is "e" in >>>> the case of errors raised by "error"? >>>> >>> >>> `error` specifically raises a UserError exception, with a user-specified >>> payload (message). `catch` can catch them as such. >>> >>> >>>> * How is "error" different from "throw" and "throwIO" (in the >>>> Control.Exception package, I believe) >>>> >>> >>> `throw` (for pure code / asynchronous) and `throwIO` (for code in IO) >>> can throw any exception. No guarantees are made as to when the exception >>> thrown by `throw` >>> >>> >>> -- >>> brandon s allbery kf8nh sine nomine >>> associates >>> allbery.b at gmail.com >>> ballbery at sinenomine.net >>> unix, openafs, kerberos, infrastructure, xmonad >>> http://sinenomine.net >>> >> >> >> >> -- >> brandon s allbery kf8nh sine nomine >> associates >> allbery.b at gmail.com >> ballbery at sinenomine.net >> unix, openafs, kerberos, infrastructure, xmonad >> http://sinenomine.net >> > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Fri Dec 16 03:44:00 2016 From: allbery.b at gmail.com (Brandon Allbery) Date: Thu, 15 Dec 2016 22:44:00 -0500 Subject: [Haskell-cafe] Absolutely confused with error/exception handling In-Reply-To: References: Message-ID: On Thu, Dec 15, 2016 at 10:30 PM, Saurabh Nanda wrote: > > Any reason for "error" and "catch" to be in different packages? Or, why > isn't "catch" in prelude? > > "catch" needs a action in IO. What if I have an action in MonadIO? > A version of `catch` used to be in Prelude, but it *only* worked with the IOException subtype; the one in Control.Exception works for all exception types. Rather than propagate the confusion between them, or risk breaking code in weird ways (the one in Prelude was restricted in part because the exception system was redesigned to be extensible, and the Prelude version didn't handle the way the new exception types work), it was simply removed. The Prelude one was something of an oddity even before extensible exceptions and mostly confused new Haskellers, so there didn't seem to be much reason to keep it around. MonadIO is going to be hard. It's not a type but a typeclass for things that can perform operations in IO; but this is not (and can't be, if you think about it) bidirectional. Consider the case of StateT s IO: your exception handler can get an `s` known when the `catch` is evaluated, but can never know the *current* value of the `s` when the exception is thrown --- exceptions do not know how to carry state around like that, and in the most general case can't know how. There are various frameworks that attempt to add this kind of functionality, such as MonadCatch and MonadBaseControl; but it's fairly tricky even at the best of times. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From saurabhnanda at gmail.com Fri Dec 16 04:50:16 2016 From: saurabhnanda at gmail.com (Saurabh Nanda) Date: Fri, 16 Dec 2016 10:20:16 +0530 Subject: [Haskell-cafe] Absolutely confused with error/exception handling In-Reply-To: References: Message-ID: > Consider the case of StateT s IO: your exception handler can get an `s` known when the `catch` is evaluated, but can never know the *current* value of the `s` when the exception is thrown --- exceptions do not know how to carry state around like that, and in the most general case can't know how. There are various frameworks that attempt to add this kind of functionality, such as MonadCatch and MonadBaseControl; but it's fairly tricky even at the best of times. Apologies, but I couldn't understand the example. In an exception where it's not even possible to know the stack trace easily, I don't expect to know the state of the computation. It's an exception -- it is alright if it doesn't have the state. But at least allow me to catch the exception in MonadIO. And this brings me to my original question. What do I need to do to catch an exception in spock's ActionT? I thought I didn't understand something earlier. But now it seems that I have hit a hairy part of Haskell. --Saurabh. On 16 Dec 2016 9:14 am, "Brandon Allbery" wrote: > > On Thu, Dec 15, 2016 at 10:30 PM, Saurabh Nanda > wrote: > >> >> Any reason for "error" and "catch" to be in different packages? Or, why >> isn't "catch" in prelude? >> >> "catch" needs a action in IO. What if I have an action in MonadIO? >> > > A version of `catch` used to be in Prelude, but it *only* worked with the > IOException subtype; the one in Control.Exception works for all exception > types. Rather than propagate the confusion between them, or risk breaking > code in weird ways (the one in Prelude was restricted in part because the > exception system was redesigned to be extensible, and the Prelude version > didn't handle the way the new exception types work), it was simply removed. > The Prelude one was something of an oddity even before extensible > exceptions and mostly confused new Haskellers, so there didn't seem to be > much reason to keep it around. > > MonadIO is going to be hard. It's not a type but a typeclass for things > that can perform operations in IO; but this is not (and can't be, if you > think about it) bidirectional. Consider the case of StateT s IO: your > exception handler can get an `s` known when the `catch` is evaluated, but > can never know the *current* value of the `s` when the exception is thrown > --- exceptions do not know how to carry state around like that, and in the > most general case can't know how. There are various frameworks that attempt > to add this kind of functionality, such as MonadCatch and MonadBaseControl; > but it's fairly tricky even at the best of times. > > -- > brandon s allbery kf8nh sine nomine > associates > allbery.b at gmail.com > ballbery at sinenomine.net > unix, openafs, kerberos, infrastructure, xmonad > http://sinenomine.net > -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Fri Dec 16 04:52:26 2016 From: allbery.b at gmail.com (Brandon Allbery) Date: Thu, 15 Dec 2016 23:52:26 -0500 Subject: [Haskell-cafe] Absolutely confused with error/exception handling In-Reply-To: References: Message-ID: On Thu, Dec 15, 2016 at 11:50 PM, Saurabh Nanda wrote: > Apologies, but I couldn't understand the example. In an exception where > it's not even possible to know the stack trace easily, I don't expect to > know the state of the computation. It's an exception -- it is alright if it > doesn't have the state. But at least allow me to catch the exception in > MonadIO. Use liftIO for that; that's what MonadIO is for. I expected you were needing to go the other way, because if you have MonadIO then you have IO via liftIO. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From saurabhnanda at gmail.com Fri Dec 16 07:30:31 2016 From: saurabhnanda at gmail.com (Saurabh Nanda) Date: Fri, 16 Dec 2016 13:00:31 +0530 Subject: [Haskell-cafe] Absolutely confused with error/exception handling In-Reply-To: References: Message-ID: > > Use liftIO for that; that's what MonadIO is for. I expected you were > needing to go the other way, because if you have MonadIO then you have IO > via liftIO. > The type signature for catch is -- catch :: Exception e => IO a -> (e -> IO a) -> IO a This is Spock's monad: https://hackage.haskell.org/package/Spock-core-0.11.0.0/docs/Web-Spock-Action.html#t:ActionCtxT (it has MonadTrans, MonadIO, Monad, Functor, Applicative, Alternative instances). How do I catch an exception coming out of an action in the ActionCtxT monad? -- Saurabh. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at profpatsch.de Fri Dec 16 09:44:56 2016 From: mail at profpatsch.de (Profpatsch) Date: Fri, 16 Dec 2016 10:44:56 +0100 Subject: [Haskell-cafe] Fwd: Your Assembly at 33C3 Message-ID: <20161216094456.GG16006@katara> We will organize a “Functional Hot-Pot” at 33C3, where friends of functional languages, Haskellistas, Lambdroids and Scalafists can share their experience and have a good time. https://events.ccc.de/congress/2016/wiki/Assembly:Functional_Hot-Pot If you want to maybe organize a workshop or have other ideas, don’t hesitate to contact me (this mail or DECT LBDA). -- Proudly written in Mutt with Vim on NixOS. Q: Why is this email five sentences or less? A: http://five.sentenc.es May take up to five days to read your message. If it’s urgent, call me. -------------- next part -------------- An embedded message was scrubbed... From: 33c3 Assembly Team Subject: Your Assembly at 33C3 Date: Thu, 15 Dec 2016 04:38:41 +0100 Size: 3226 URL: From mail at profpatsch.de Fri Dec 16 09:46:34 2016 From: mail at profpatsch.de (Profpatsch) Date: Fri, 16 Dec 2016 10:46:34 +0100 Subject: [Haskell-cafe] Fwd: Your Assembly at 33C3 In-Reply-To: <20161216094456.GG16006@katara> References: <20161216094456.GG16006@katara> Message-ID: <20161216094634.GH16006@katara> On 16-12-16 10:44am, Profpatsch wrote: > We will organize a “Functional Hot-Pot” at 33C3, where friends > of functional languages, Haskellistas, Lambdroids and Scalafists > can share their experience and have a good time. I forgot: We will be in the hall before hackcenter, to the left of the big tunnel. -- Proudly written in Mutt with Vim on NixOS. Q: Why is this email five sentences or less? A: http://five.sentenc.es May take up to five days to read your message. If it’s urgent, call me. From allbery.b at gmail.com Fri Dec 16 21:43:10 2016 From: allbery.b at gmail.com (Brandon Allbery) Date: Fri, 16 Dec 2016 21:43:10 +0000 Subject: [Haskell-cafe] Absolutely confused with error/exception handling In-Reply-To: References: Message-ID: On Fri, Dec 16, 2016 at 7:30 AM, Saurabh Nanda wrote: > > How do I catch an exception coming out of an action in the ActionCtxT > monad? > I think I'm going to have to let someone else answer. I just got lost in MonadBaseControl, not to mention how you do this if all you have is the ActionCtxT and not the WebStateT where Spock actually handles exceptions. :/ If it helps, exception handling is known to be a sewer --- because it can't be done in a clean and generic way without introducing significant resource leaks and other problems. And MonadBaseControl works when you (or the developer, in this case of Spock) define the right instances, but is doing it the hard way. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From saurabhnanda at gmail.com Sat Dec 17 03:46:00 2016 From: saurabhnanda at gmail.com (Saurabh Nanda) Date: Sat, 17 Dec 2016 09:16:00 +0530 Subject: [Haskell-cafe] Absolutely confused with error/exception handling In-Reply-To: References: Message-ID: To generalise the problem, because I've encountered it in other places as well, how does one write his/her own instance of MonadIO, MonadThrow, or MonadCatch for complicated transformer stacks such has ActionCtxT? On 17 Dec 2016 3:13 am, "Brandon Allbery" wrote: > > On Fri, Dec 16, 2016 at 7:30 AM, Saurabh Nanda > wrote: > >> >> How do I catch an exception coming out of an action in the ActionCtxT >> monad? >> > > I think I'm going to have to let someone else answer. I just got lost in > MonadBaseControl, not to mention how you do this if all you have is the > ActionCtxT and not the WebStateT where Spock actually handles exceptions. :/ > > If it helps, exception handling is known to be a sewer --- because it > can't be done in a clean and generic way without introducing significant > resource leaks and other problems. And MonadBaseControl works when you (or > the developer, in this case of Spock) define the right instances, but is > doing it the hard way. > > -- > brandon s allbery kf8nh sine nomine > associates > allbery.b at gmail.com > ballbery at sinenomine.net > unix, openafs, kerberos, infrastructure, xmonad > http://sinenomine.net > -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Sat Dec 17 03:57:45 2016 From: allbery.b at gmail.com (Brandon Allbery) Date: Sat, 17 Dec 2016 03:57:45 +0000 Subject: [Haskell-cafe] Absolutely confused with error/exception handling In-Reply-To: References: Message-ID: On Sat, Dec 17, 2016 at 3:46 AM, Saurabh Nanda wrote: > To generalise the problem, because I've encountered it in other places as > well, how does one write his/her own instance of MonadIO, MonadThrow, or > MonadCatch for complicated transformer stacks such has ActionCtxT? You do not generally write MonadIO, you use GeneralizedNewtypeDeriving. But if you insist on writing it yourself: instance MonadIO MyMonad ... where liftIO = lift . liftIO (your MyMonad *must* be an instance of MonadTrans) MonadThrow and MonadCatch, I suggest you refer to their documentation. But I will tell you that writing this kind of exception management, in such a way that you do not leak resources (memory, file handles, database connections, ...), is *very hard*. You probably should not attempt it unless you have experience with this. (I won't even try to write one; I understand the basic issues, but lack specific experience with how to deal with them in ghc and with specific exception mechanisms like MonadThrow/MonadCatch and MonadBaseControl.) -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From lambda.fairy at gmail.com Sat Dec 17 05:05:45 2016 From: lambda.fairy at gmail.com (Chris Wong) Date: Sat, 17 Dec 2016 18:05:45 +1300 Subject: [Haskell-cafe] Absolutely confused with error/exception handling In-Reply-To: References: Message-ID: > The type signature for catch is -- > > catch :: Exception e => IO a -> (e -> IO a) -> IO a > > This is Spock's monad: > https://hackage.haskell.org/package/Spock-core-0.11.0.0/docs/Web-Spock-Action.html#t:ActionCtxT > (it has MonadTrans, MonadIO, Monad, Functor, Applicative, Alternative > instances). > > How do I catch an exception coming out of an action in the ActionCtxT monad? The problem is: ActionCtxT includes a custom error system, which is orthogonal to that provided by exceptions. So to handle exceptions in such a monad, you'd need to bend over backwards to make these two systems work together. To be honest I'm not even sure if this is possible, at least in a way that doesn't have surprising edge cases. My recommendation is to catch the exception in IO first, before it is lifted into the ActionCtxT. If your business logic is decoupled from the web framework (as it should be) then it should be easy enough to do this. -- 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 ben.franksen at online.de Sat Dec 17 20:51:26 2016 From: ben.franksen at online.de (Ben Franksen) Date: Sat, 17 Dec 2016 21:51:26 +0100 Subject: [Haskell-cafe] regression in memory usage between 6.10 and 7.x? Message-ID: In the functional pearl "A Play on Regular Expressions" by Sebastian Fischer, Frank Huch, and Thomas Wilke, the authors explain how to implement a Glushkov automaton in a very elegant way. They claim that when they compile their code with ghc-6.10.4 and with -O2 optimization they get: """ 1 MB total memory in use ... Total time 0.06s (0.21s elapsed) """ for a program that matches stdin against the equivalent (in grep -E syntax) of ^(a?){500}a{500}$ When I try their code on my machine with ghc-7.10.3 (and also -O2) I get: """ ben at sarun[1]: .../play/regexfp > ghc Reg.hs -O2 -o re [1 of 1] Compiling Main ( Reg.hs, Reg.o ) Linking re ... ben at sarun[1]: .../play/regexfp > ./re 500 +RTS -s True ... 155 MB total memory in use ... Total time 1.031s ( 1.037s elapsed) """ The details of the RTS report furthermore tell me that GC is responsible for more than 80% of the runtime. Now, I certainly have a different machine and perhaps OS than the authors of the paper, but that can't explain a factor of 16 in runtime and of 150 in memory use. I have double and triple checked my code for possible mistakes. I /do/ get the expected results (same as in the paper). I tried different numbers and found n total memory in use / MB 100 8 200 28 500 169 1000 698 which shows that memory consumtion is roughly quadratic in n. I tried heap profiling but that tells me only that all the allocation is done by the function 'shift', which I already knew (or rather guessed). I also tried several compiler versions: 7.0.4, 7.10.3, 7.4.2, 7.6.3, 8.0.1. They all result in similar performance. The ghc version the authors used is 6.10.4 and I don't have a package for that compatible to my distribution. Any hint as to where these differences might come from are appreciated. I have attached the program for reference. Cheers Ben -- "Make it so they have to reboot after every typo." ― Scott Adams -------------- next part -------------- A non-text attachment was scrubbed... Name: Reg.hs Type: text/x-haskell Size: 1758 bytes Desc: not available URL: From serg.foo at gmail.com Sat Dec 17 21:45:36 2016 From: serg.foo at gmail.com (Sergey Vinokurov) Date: Sat, 17 Dec 2016 23:45:36 +0200 Subject: [Haskell-cafe] regression in memory usage between 6.10 and 7.x? In-Reply-To: References: Message-ID: Hi Ben, After trying out different heap profiling modes it seems to me that the problem is caused by the lazy empty and final fields (attached as reg.svg). These fields contain thunks which hold references to regexps and this quickly fills out the heap. However, making fields strict improves the memory usage a lot, from 1030 MB to 61 MB: $ ghc -O2 --make -o reg Reg.hs -prof -fprof-auto $ ghc -O2 --make -o reg-strict RegStrict.hs -prof -fprof-auto $ ./reg 1000 +RTS -s -hy True 2,244,020,400 bytes allocated in the heap 4,518,833,264 bytes copied during GC 487,761,824 bytes maximum residency (19 sample(s)) 2,235,504 bytes maximum slop 1030 MB total memory in use (0 MB lost due to fragmentation) Tot time (elapsed) Avg pause Max pause Gen 0 3417 colls, 0 par 0.796s 0.835s 0.0002s 0.0109s Gen 1 19 colls, 0 par 4.740s 4.916s 0.2588s 0.7593s INIT time 0.000s ( 0.000s elapsed) MUT time 0.992s ( 2.349s elapsed) GC time 4.156s ( 4.366s elapsed) RP time 0.000s ( 0.000s elapsed) PROF time 1.380s ( 1.385s elapsed) EXIT time 0.004s ( 0.021s elapsed) Total time 6.532s ( 6.736s elapsed) %GC time 63.6% (64.8% elapsed) Alloc rate 2,262,117,338 bytes per MUT second Productivity 15.2% of total user, 14.8% of total elapsed $ ./reg-strict 1000 +RTS -s -hy True 2,227,779,568 bytes allocated in the heap 1,584,870,472 bytes copied during GC 20,760,456 bytes maximum residency (74 sample(s)) 389,104 bytes maximum slop 61 MB total memory in use (0 MB lost due to fragmentation) Tot time (elapsed) Avg pause Max pause Gen 0 3702 colls, 0 par 0.512s 0.536s 0.0001s 0.0004s Gen 1 74 colls, 0 par 0.376s 0.378s 0.0051s 0.0171s INIT time 0.000s ( 0.000s elapsed) MUT time 0.604s ( 0.613s elapsed) GC time 0.856s ( 0.890s elapsed) RP time 0.000s ( 0.000s elapsed) PROF time 0.032s ( 0.024s elapsed) EXIT time 0.000s ( 0.003s elapsed) Total time 1.492s ( 1.507s elapsed) %GC time 57.4% (59.1% elapsed) Alloc rate 3,688,376,768 bytes per MUT second Productivity 40.5% of total user, 40.1% of total elapsed Regards, Sergey On Sat, Dec 17, 2016 at 10:51 PM, Ben Franksen wrote: > In the functional pearl "A Play on Regular Expressions" by Sebastian > Fischer, Frank Huch, and Thomas Wilke, the authors explain how to > implement a Glushkov automaton in a very elegant way. They claim that > when they compile their code with ghc-6.10.4 and with -O2 optimization > they get: > > """ > 1 MB total memory in use > ... > Total time 0.06s (0.21s elapsed) > """ > > for a program that matches stdin against the equivalent (in grep -E > syntax) of > > ^(a?){500}a{500}$ > > When I try their code on my machine with ghc-7.10.3 (and also -O2) I get: > > """ > ben at sarun[1]: .../play/regexfp > ghc Reg.hs -O2 -o re > [1 of 1] Compiling Main ( Reg.hs, Reg.o ) > Linking re ... > ben at sarun[1]: .../play/regexfp > ./re 500 +RTS -s > True > ... > 155 MB total memory in use > ... > Total time 1.031s ( 1.037s elapsed) > """ > > The details of the RTS report furthermore tell me that GC is responsible > for more than 80% of the runtime. > > Now, I certainly have a different machine and perhaps OS than the > authors of the paper, but that can't explain a factor of 16 in runtime > and of 150 in memory use. I have double and triple checked my code for > possible mistakes. I /do/ get the expected results (same as in the paper). > > I tried different numbers and found > > n total memory in use / MB > 100 8 > 200 28 > 500 169 > 1000 698 > > which shows that memory consumtion is roughly quadratic in n. I tried > heap profiling but that tells me only that all the allocation is done by > the function 'shift', which I already knew (or rather guessed). > > I also tried several compiler versions: 7.0.4, 7.10.3, 7.4.2, 7.6.3, > 8.0.1. They all result in similar performance. > > The ghc version the authors used is 6.10.4 and I don't have a package > for that compatible to my distribution. > > Any hint as to where these differences might come from are appreciated. > > I have attached the program for reference. > > Cheers > Ben > -- > "Make it so they have to reboot after every typo." ― Scott Adams > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- A non-text attachment was scrubbed... Name: reg.svg Type: image/svg+xml Size: 8389 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: RegStrict.hs Type: text/x-haskell Size: 1840 bytes Desc: not available URL: From ben.franksen at online.de Sat Dec 17 22:42:28 2016 From: ben.franksen at online.de (Ben Franksen) Date: Sat, 17 Dec 2016 23:42:28 +0100 Subject: [Haskell-cafe] regression in memory usage between 6.10 and 7.x? In-Reply-To: References: Message-ID: Am 17.12.2016 um 22:45 schrieb Sergey Vinokurov: > After trying out different heap profiling modes it seems to me that > the problem is caused by the lazy empty and final fields (attached as > reg.svg). These fields contain thunks which hold references to regexps > and this quickly fills out the heap. However, making fields strict > improves the memory usage a lot, from 1030 MB to 61 MB: Many thanks Sergey, that's it! Two exclamation marks added and all is well. ben at sarun[1]: .../play/regexfp > ./re 500 +RTS -s True 96,115,528 bytes allocated in the heap 20,225,160 bytes copied during GC 154,376 bytes maximum residency (2 sample(s)) 37,368 bytes maximum slop 1 MB total memory in use (0 MB lost due to fragmentation) ... Total time 0.061s ( 0.059s elapsed) Exactly as claimed in the paper. I wonder why the authors did not mention that these fields should be strict and how to (easily) achieve that (not even in a footnote). Neither did the reviewers catch this omission. Cheers Ben > On Sat, Dec 17, 2016 at 10:51 PM, Ben Franksen wrote: >> In the functional pearl "A Play on Regular Expressions" by Sebastian >> Fischer, Frank Huch, and Thomas Wilke, the authors explain how to >> implement a Glushkov automaton in a very elegant way. They claim that >> when they compile their code with ghc-6.10.4 and with -O2 optimization >> they get: >> >> """ >> 1 MB total memory in use >> ... >> Total time 0.06s (0.21s elapsed) >> """ >> >> for a program that matches stdin against the equivalent (in grep -E >> syntax) of >> >> ^(a?){500}a{500}$ >> >> When I try their code on my machine with ghc-7.10.3 (and also -O2) I get: >> >> """ >> ben at sarun[1]: .../play/regexfp > ghc Reg.hs -O2 -o re >> [1 of 1] Compiling Main ( Reg.hs, Reg.o ) >> Linking re ... >> ben at sarun[1]: .../play/regexfp > ./re 500 +RTS -s >> True >> ... >> 155 MB total memory in use >> ... >> Total time 1.031s ( 1.037s elapsed) >> """ -- "Make it so they have to reboot after every typo." ― Scott Adams From saurabhnanda at gmail.com Sun Dec 18 03:45:32 2016 From: saurabhnanda at gmail.com (Saurabh Nanda) Date: Sun, 18 Dec 2016 09:15:32 +0530 Subject: [Haskell-cafe] Absolutely confused with error/exception handling In-Reply-To: References: Message-ID: My recommendation is to catch the exception in IO first, before it is lifted into the ActionCtxT. If your business logic is decoupled from the web framework (as it should be) then it should be easy enough to do this. I'm trying to write a "global" error handler which logs unhandled errors to Airbrake along with information from the request object (domain, URL, params, cookies, etc). I understand that I can make this part of my app monad, but if I don't understand why I'm unable to catch errors in MonadIO I'm bound to get stuck again, or implement it incorrectly (for example, what are the resource leaks that were being referred to?) Also what if a particular handler is not in my app monad? How do I prevent someone from accidentally adding a handler without the airbrake integration? -- Saurabh. -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Sun Dec 18 03:54:31 2016 From: allbery.b at gmail.com (Brandon Allbery) Date: Sun, 18 Dec 2016 03:54:31 +0000 Subject: [Haskell-cafe] Absolutely confused with error/exception handling In-Reply-To: References: Message-ID: On Sun, Dec 18, 2016 at 3:45 AM, Saurabh Nanda wrote: > if I don't understand why I'm unable to catch errors in MonadIO I'm bound > to get stuck again, or implement it incorrectly (for example, what are the > resource leaks that were being referred to?) https://mail.haskell.org/pipermail/libraries/2014-November/024224.html is the start of the rather large thread that led to the current exception primitives, which exception managers ranging from the standard `bracket` to MonadBaseControl rely on. There are quite a few examples of resource leaks during exception handling (or despite exception handling!) in it, along with many other pitfalls that can occur. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From chrisdone at gmail.com Sun Dec 18 21:29:58 2016 From: chrisdone at gmail.com (Christopher Done) Date: Sun, 18 Dec 2016 21:29:58 +0000 Subject: [Haskell-cafe] Foo.Bar.hs filenames poll Message-ID: Short version: here is the poll < https://docs.google.com/forms/d/e/1FAIpQLSdniOfoaX7xflgdWRnjVQ6_VLtk1oxA00SoK3KPMUsoTSPZDw/viewform?c=0&w=1 > I noticed recently that Foo.Bar.hs is supported by GHC. I had always assumed it wasn't because people always use directories. I've never liked having separate directories for each level of hierarchy. It's easier to just list a list of files and script (e.g. even copying a file X.hs to Y.hs is a bummer). When opening them on GitHub you have to click through to get a complete picture of a project. Other languages do and don't do this. Lispers, for example, don't. How do other Haskellers feel about it? Would it mess with anybody's tooling or mojo if I switched to that style in my packages? For one I know that Stack (my own implementation), actually assumes hierarchical filenames. So I'd have to patch that to implement this. E.g. > Unable to find a known candidate for the Cabal entry "HIndent.Types", but did find: HIndent.Types.hs. If you are using a custom preprocessor for this module with its own file extension, consider adding the file(s) to your .cabal under extra-source-files. I suppose the real question is, as a language standard and a community preference, should this be considered a bug? Should people be free to use X.Y.hs or X/Y.hs styles? Ciao! -------------- next part -------------- An HTML attachment was scrubbed... URL: From monkleyon at googlemail.com Sun Dec 18 22:25:22 2016 From: monkleyon at googlemail.com (MarLinn) Date: Sun, 18 Dec 2016 23:25:22 +0100 Subject: [Haskell-cafe] Foo.Bar.hs filenames poll In-Reply-To: References: Message-ID: <37fce243-cfb0-ba7a-231a-1ac5406df0d6@gmail.com> An HTML attachment was scrubbed... URL: From svenpanne at gmail.com Sun Dec 18 22:29:18 2016 From: svenpanne at gmail.com (Sven Panne) Date: Sun, 18 Dec 2016 23:29:18 +0100 Subject: [Haskell-cafe] Foo.Bar.hs filenames poll In-Reply-To: References: Message-ID: 2016-12-18 22:29 GMT+01:00 Christopher Done : > [...] I've never liked having separate directories for each level of > hierarchy. It's easier to just list a list of files and script (e.g. even > copying a file X.hs to Y.hs is a bummer). When opening them on GitHub you > have to click through to get a complete picture of a project. > I think this is just a matter of personal preference, I actually like directories: If you have a toy project, it doesn't make a difference, because you have only a few modules a no urgent need for structuring things. OTOH, if you have a medium or large project, using directories is essential IMHO, and if your namespace is structured in a sane way, you rarely want to see stuff from different parts of the directory tree. If you do: Restructure! :-) > [...] I suppose the real question is, as a language standard and a > community preference, should this be considered a bug? Should people be > free to use X.Y.hs or X/Y.hs styles? > If you have both X.Y.hs *and* X/Y.hs, which one should GHC choose? And what about X.Y.Z.hs vs. X/Y.Z.hs vs X.Y/Z.hs vs. X/Y/Z.hs? My POV is: There should only be one way of doing things, and in our case that should be directories (the no-directories approach doesn't scale). Leaving things up to personal taste confuses different readers, makes tooling more complicated than necessary etc. But that's just my 2c... Cheers, S. -------------- next part -------------- An HTML attachment was scrubbed... URL: From eraker at gmail.com Sun Dec 18 22:48:06 2016 From: eraker at gmail.com (erik) Date: Sun, 18 Dec 2016 14:48:06 -0800 Subject: [Haskell-cafe] Foo.Bar.hs filenames poll In-Reply-To: <37fce243-cfb0-ba7a-231a-1ac5406df0d6@gmail.com> References: <37fce243-cfb0-ba7a-231a-1ac5406df0d6@gmail.com> Message-ID: So here's a variation which goes to the other extreme. It is completely unsupported right now though: ╶┮▬ Bar/ ├─┮▬ Baz/ │ ├─╴ Internals.hs │ ╰─╴ hs ╰─┮▬ Foo/ ├─╴ Internals.hs ╰─╴ hs You may know this already (and I suspect there are those in your audience who know as well), but this is how Python works, except that your 'hs' files are called '__init__.py' and they're generally required for every directory with Python modules in it (mostly you will find empty ones littered throughout Python projects). You can, of course, put code in the __init__.py or rexport stuff from the modules to make them available at the level of Bar.Baz, for instance. For an extended example, if these were Python modules and you wrote: "from bar.baz.internals import some_function" The python interpreter would evaluate the top-level declarations within the __init__.py in each directory in order (1. bar, 2.baz) before finally importing from the internals module (at which point it would also execute all top-level declarations there as well. There are some clunky aspects to it and a danger of circular imports which results in all kinds of nonsense, but one thing I like about Python-style imports is that it's pretty much always obvious where things originated from. On Dec 18, 2016 2:29 PM, "MarLinn via Haskell-Cafe" < haskell-cafe at haskell.org> wrote: > I suppose the real question is, as a language standard and a community > preference, should this be considered a bug? Should people be free to use > X.Y.hs or X/Y.hs styles? > > > First off all, the support you mention seems to be incomplete, or very > recent. At least my ghci 7.10 failed to import a module with a dot-name. > But maybe my quick-and-dirty test was broken… > > I'll also add a fun variation to the discussion. Let's say I have two > modules named Bar.Foo, and Bar.Baz and submodules Bar.Foo.Internals and > Bar.Baz.Internals. (eg. for testing purposes) It always bugged me that > the usual approach would be this: > > ╶┮▬ Bar/ > ├─┮▬ Baz/ > │ ╰─╴ Internals.hs > ├─┮▬ Foo/ > │ ╰─╴ Internals.hs > ├──╴ Baz.hs > ╰──╴ Foo.hs > > My gripe is that here related modules are in completely unrelated > positions. One way to solve it with dot-names would be > > ╶┮▬ Bar/ ├──╴ Baz.hs ├──╴ Baz.Internals.hs > ├──╴ Foo.hs ╰──╴ Foo.Internals.hs > > But that can lead to a lot of clutter fast. So here's a variation which > goes to the other extreme. It is completely unsupported right now though: > > ╶┮▬ Bar/ > ├─┮▬ Baz/ > │ ├─╴ Internals.hs > │ ╰─╴ hs > ╰─┮▬ Foo/ > ├─╴ Internals.hs > ╰─╴ hs > > That hs name does look a bit ridiculous, but the idea is to have > something like an index.html without reserving a name. If slashes and > dots were 100% interchangeable, this would be the logical extension. Now > related files are in related positions. Downside: The hs files don't have > a file extension. (There could be a special case to use .hs as a special > name instead, but that would lead to hidden files and break consistency…) > > I realize this version probably won't gain much approval, but between this > and throwing everything and the kitchen sink on the top level just because > some tools don't offer opened-up nested hierarchical views into directory > structures – I would choose this one, personally. Or maybe a mixture, > depending on actual structure. But then both options are better than the > one with unrelated positions, and the dot-name approach might at least be > one that works right now. > > > Cheers, > MarLinn > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From monkleyon at googlemail.com Mon Dec 19 00:20:41 2016 From: monkleyon at googlemail.com (MarLinn) Date: Mon, 19 Dec 2016 01:20:41 +0100 Subject: [Haskell-cafe] Foo.Bar.hs filenames poll In-Reply-To: References: <37fce243-cfb0-ba7a-231a-1ac5406df0d6@gmail.com> Message-ID: <272f3493-3ee2-c6ca-6a27-48b1a2067509@gmail.com> > You may know this already (and I suspect there are those in your > audience who know as well), but this is how Python works, except that > your 'hs' files are called '__init__.py' and they're generally > required for every directory with Python modules in it (mostly you > will find empty ones littered throughout Python projects). > No, I did not know this! But now that you mention it I am reminded of the magic files you can use to add package-level comments (but only those, no code) in java. It's interesting that there is more prior art like this. However now I am even more convinced that this topic is quite orthogonal to the original question. Speaking of orthogonal issues: > For an extended example, if these were Python modules and you wrote: > > "from bar.baz.internals import some_function" > > The python interpreter would evaluate the top-level declarations > within the __init__.py in each directory in order (1. bar, 2.baz) > before finally importing from the internals module (at which point it > would also execute all top-level declarations there as well. > That sounds like something that might be easy to add to Haskell via a syntax extension: whenever an import contains two dots in a row (or a dot and a question mark, or what have you), special handling like this could kick in from that point on downwards. Maybe require an explicit import list in this case? This is only the engineer in me speaking though, I very much suspect this to be a solution without a problem in our world. Neat thing to ponder though. Cheers, MarLinn -------------- next part -------------- An HTML attachment was scrubbed... URL: From imantc at gmail.com Mon Dec 19 00:46:04 2016 From: imantc at gmail.com (Imants Cekusins) Date: Mon, 19 Dec 2016 01:46:04 +0100 Subject: [Haskell-cafe] Foo.Bar.hs filenames poll In-Reply-To: References: <37fce243-cfb0-ba7a-231a-1ac5406df0d6@gmail.com> Message-ID: > should this be considered a bug? the fewer and simpler standards there are, the better. There may be benefit in simplifying syntax. every non-essential variation in standards is a few hours wasted for someone, often for more than one. in chess, board has been 8x8, same pieces, B&W - for a long time. Seems to be enough: seasoned masters still take time to prepare before each essential game. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok at cs.otago.ac.nz Mon Dec 19 01:11:20 2016 From: ok at cs.otago.ac.nz (Richard A. O'Keefe) Date: Mon, 19 Dec 2016 14:11:20 +1300 Subject: [Haskell-cafe] Foo.Bar.hs filenames poll In-Reply-To: <37fce243-cfb0-ba7a-231a-1ac5406df0d6@gmail.com> References: <37fce243-cfb0-ba7a-231a-1ac5406df0d6@gmail.com> Message-ID: I thought the use of dotted file names was part of the hierarchical packages proposal from back when it was a new thing? From gershomb at gmail.com Mon Dec 19 01:38:18 2016 From: gershomb at gmail.com (Gershom B) Date: Sun, 18 Dec 2016 17:38:18 -0800 Subject: [Haskell-cafe] ANN: New Haskell.org Committee Members Message-ID: Following the self-nomination period and discussion, the Haskell.org committee has selected new members: Full term:   * Mitsutoshi Aoe   * Jasper Van der Jeugt   * Niki Vazou Short term:   * Alan Zimmerman As per the rules of the committee, this discussion was held among the current members of the committee, and the outgoing members of the committee who were not seeking reappointment. Thank you to all the many candidates who submitted a self-nomination. We recieved many strong nominations, from a broad range of geographies and backgrounds. The choice amongst them was not easy, and we would encourage all those who nominated themselves to consider self-nominating again in the future. The outgoing members are: Adam Foltzer, Edward Kmett, Andres Loeh, and Nicolas Wu. Thanks all for your service! These are tough shoes to fill, but I have confidence that our incoming members will more than rise to the occasion. Cheers, Gershom From michael at snoyman.com Mon Dec 19 05:04:35 2016 From: michael at snoyman.com (Michael Snoyman) Date: Mon, 19 Dec 2016 07:04:35 +0200 Subject: [Haskell-cafe] Call for new Stackage Curator Message-ID: I'm copying the text from my blog post today[1]. On behalf of the Stackage curators, I'm putting out a call for a volunteer to join the team. The Stackage curators are responsible for the day-to-day management of the Stackage project: merging PRs, managing builds, reporting bounds issues and build or test failures, and every once in a while making a judgement call on when to bump to newer package versions. The curator team currently consists of Adam Bergmark, Dan Burton, Jens Petersen, and me. The processes we follow are documented in the curator guide[2]. We each rotate shifts, taking one week at a time on duty. Overall, the workload is light and straightforward: usually less than 30 minutes a day. We're putting out this call for a new volunteer since we've been running as a four-person show for a while now, and want to make sure we're getting our processes well documented enough for newcomers to easily come up to speed on the process. While we are currently asking for just one new addition to the team, if there are multiple enthusiastic candidates, we will definitely consider expanding the team further. Joining the curator team is a great way to both contribute to the Haskell ecosystem, and to become more familiar with how things work. You'll also get an opportunity to interact (albeit in brief discussions) with many package maintainers in the Haskell community. If you're interested in applying, please send a message to the Stackage mailing list[3] or, if you prefer applying privately, send me an email and I'll pass the message along to the rest of the team. [1] http://www.snoyman.com/blog/2016/12/call-for-new-stackage-curator [2] https://github.com/fpco/stackage/blob/master/CURATORS.md [3] https://groups.google.com/d/forum/stackage -------------- next part -------------- An HTML attachment was scrubbed... URL: From serge.lehuitouze at gmail.com Mon Dec 19 08:34:21 2016 From: serge.lehuitouze at gmail.com (Serge Le Huitouze) Date: Mon, 19 Dec 2016 09:34:21 +0100 Subject: [Haskell-cafe] Foo.Bar.hs filenames poll In-Reply-To: <37fce243-cfb0-ba7a-231a-1ac5406df0d6@gmail.com> References: <37fce243-cfb0-ba7a-231a-1ac5406df0d6@gmail.com> Message-ID: On Sun, Dec 18, 2016 at 11:25 PM, MarLinn via Haskell-Cafe < haskell-cafe at haskell.org> wrote: > But that can lead to a lot of clutter fast. So here's a variation which goes > to the other extreme. It is completely unsupported right now though: > > ╶┮▬ Bar/ > ├─┮▬ Baz/ > │ ├─╴ Internals.hs > │ ╰─╴ hs > ╰─┮▬ Foo/ > ├─╴ Internals.hs > ╰─╴ hs > > That hs name does look a bit ridiculous, but the idea is to have something > like an index.html without reserving a name. If slashes and dots were 100% > interchangeable, this would be the logical extension. Well, not exactly THE "logical" extension. How about the following one? ╶┮▬ Bar/ ├─┮▬ Baz/ │ ├─┮▬ Internals/ │ ╰─╴ hs │ ╰─╴ hs ╰─┮▬ Foo/ ├─┮▬ Internals/ ╰─╴ hs ╰─╴ hs [Not that I endorse my own proposition, though :-)] Cheers. --Serge -------------- next part -------------- An HTML attachment was scrubbed... URL: From merijn at inconsistent.nl Mon Dec 19 10:55:24 2016 From: merijn at inconsistent.nl (Merijn Verstraaten) Date: Mon, 19 Dec 2016 11:55:24 +0100 Subject: [Haskell-cafe] Foo.Bar.hs filenames poll In-Reply-To: References: Message-ID: <74402730-C859-45C5-9A2E-7EB07D2EA514@inconsistent.nl> Hi Chris, When I proposed adding support for more useful literate haskell extensions (i.e. allow Foo.lhs.md and Foo.lhs.rst) I encountered this too and after further investigation discovered that the Report has *0* specification of how module names are supposed to map to file names/directories. As such, it's impossible to actually write portable source code. The common version of one directory per component with a file for the end seems the most commonly supported one across GHC, Hugs and UHC, which is I think why people using it (And probably why the multiple components in a file name is best avoided). For tools like stack (and everyone's sanity in general) I think it would be best to standardise how modules are resolved, but when I last floated this idea it got shot down, so.... Cheers, Merijn > On 18 Dec 2016, at 22:29, Christopher Done wrote: > > Short version: here is the poll > > > I noticed recently that Foo.Bar.hs is supported by GHC. I had always assumed it wasn't because people always use directories. > > I've never liked having separate directories for each level of hierarchy. It's easier to just list a list of files and script (e.g. even copying a file X.hs to Y.hs is a bummer). When opening them on GitHub you have to click through to get a complete picture of a project. > > Other languages do and don't do this. Lispers, for example, don't. > > How do other Haskellers feel about it? Would it mess with anybody's tooling or mojo if I switched to that style in my packages? > > For one I know that Stack (my own implementation), actually assumes hierarchical filenames. So I'd have to patch that to implement this. E.g. > >> Unable to find a known candidate for the Cabal entry "HIndent.Types", but did find: HIndent.Types.hs. If you are using a custom preprocessor for this module with its own file extension, consider adding the file(s) to your .cabal under extra-source-files. > > I suppose the real question is, as a language standard and a community preference, should this be considered a bug? Should people be free to use X.Y.hs or X/Y.hs styles? > > Ciao! > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 842 bytes Desc: Message signed with OpenPGP using GPGMail URL: From defigueiredo at ucdavis.edu Mon Dec 19 16:38:34 2016 From: defigueiredo at ucdavis.edu (Dimitri DeFigueiredo) Date: Mon, 19 Dec 2016 09:38:34 -0700 Subject: [Haskell-cafe] Foo.Bar.hs filenames poll In-Reply-To: References: Message-ID: <090377db-2e1e-6dde-a196-7671f9078698@ucdavis.edu> I believe it is a mistake to tie the module structure of a software system to a file structure on a hierarchical file system. I see those too structures as different entities. Why can't I coalesce two tiny modules into a single file? I also don't like having to capitalize my file names (Foo.hs instead of foo.hs) in linux, that seems rather ugly. It see this "ugliness" as a symptom of the "arbitrarily forced link" between the module structure and the file structure. Obviously, some conventions should apply, but a one-to-one correspondence seems too strict. Dimitri -- 2E45 D376 A744 C671 5100 A261 210B 8461 0FB0 CA1F From svenpanne at gmail.com Mon Dec 19 17:24:00 2016 From: svenpanne at gmail.com (Sven Panne) Date: Mon, 19 Dec 2016 18:24:00 +0100 Subject: [Haskell-cafe] Foo.Bar.hs filenames poll In-Reply-To: <090377db-2e1e-6dde-a196-7671f9078698@ucdavis.edu> References: <090377db-2e1e-6dde-a196-7671f9078698@ucdavis.edu> Message-ID: 2016-12-19 17:38 GMT+01:00 Dimitri DeFigueiredo : > I believe it is a mistake to tie the module structure of a software > system to a file structure on a hierarchical file system. [..] I think it's not a mistake, it's the only sane thing to do in the current tooling ecosystem. Try e.g. writing a correct Makefile without a 1:1 correspondence, and you will end up with either something shell-script like or miss some dependencies. As an exercise, try something like this for e.g. Java where there is no 1:1 correspondence between the source files and the build artifacts. OK, the compiler knows the dependencies when trying to compile things, but that is basically the only tool which is 100% correct. But this doesn't really help when writing Makefiles, because you can't even see the e.g. dependencies of a .class file (the compiler inlines e.g. "static final int"s without a trace where they came from). The situation in the Haskell world is not much different: Yes, "ghc --make" knows how to do its task, but integrating this into a project where Haskell compilation is only a part is not easy or ends up in something non-declarative shell-script-like. To be honest: I can't really understand all of this discussion. It would be great if the status quo of a mapping between hierarchical names and a directory hierarchy would end up in a spec, so it is *the* way to do it. Doing things in exactly one way frees up the mind from figuring out useless details, in this case based only on personal taste. I haven't heard a single compelling *technical* reason for doing it differently up to now... -------------- next part -------------- An HTML attachment was scrubbed... URL: From monkleyon at googlemail.com Mon Dec 19 21:22:44 2016 From: monkleyon at googlemail.com (MarLinn) Date: Mon, 19 Dec 2016 22:22:44 +0100 Subject: [Haskell-cafe] Foo.Bar.hs filenames poll In-Reply-To: References: <090377db-2e1e-6dde-a196-7671f9078698@ucdavis.edu> Message-ID: <38ad7196-f85c-6e53-d285-6455835c38de@gmail.com> On 2016-12-19 18:24, Sven Panne wrote: > 2016-12-19 17:38 GMT+01:00 Dimitri DeFigueiredo: >> I believe it is a mistake to tie the module structure of a software >> system to a file structure on a hierarchical file system. [..] > I think it's not a mistake, it's the only sane thing to do in the > current tooling ecosystem. > > […] > > Yes, "ghc --make" knows how to do its task, but integrating this into > a project where Haskell compilation is only a part is not easy or ends > up in something non-declarative shell-script-like. > > […] > > I haven't heard a single compelling *technical* reason for doing it > differently up to now... That's because it's not (purely) a technical issue. I think the resistance comes mostly from a more philosophical point of view: If we want our language to remain extensible and at the forefront of language development, we can't tie down too many parts. That includes our module system. Granted: the module system is not what the language is known for right now. But maybe we do want our equivalents to friend classes, extension classes, or multimethods one day, or we might even find that there's a natural way to separate "normal" definitions from instance declarations that is less ugly than orphans or overlapping. Or maybe we realize that all scopes are basically equivalent anyway, from function bodies up to whole modules – so why separate them syntactically. What I'm getting at is not that the mere possibility of such developments should prevent us from trying to find good mid-term solutions. But after all, Haskell was originally conceived as a research language. Even if this type of modularization is not a well-studied topic and mostly solved in an ad-hoc manner in practice, that shouldn't prevent us from leaving the door open at least a bit. The next question then is: How *do* we combine both view points? Especially, how do we do it efficiently? > It would be great if the status quo of a mapping between hierarchical > names and a directory hierarchy would end up in a spec, so it is *the* > way to do it. I think the key word here is "a". As in *a* spec, not *the* spec or *the* report. One spec for each discovery-strategy, easy to find, easy to reference. That makes it trackable like any other dependency. And if there is a spec, translating it into code is almost mechanical, and must only be done once per (tool,spec) pair at most. Of course I'm simplifying a lot, not least because I'm not a tool-maker. So this is only how far I can see from my hermit tower at the moment. Cheers, MarLinn From eyeinsky9 at gmail.com Mon Dec 19 21:38:36 2016 From: eyeinsky9 at gmail.com (eyeinsky .) Date: Mon, 19 Dec 2016 22:38:36 +0100 Subject: [Haskell-cafe] Foo.Bar.hs filenames poll In-Reply-To: References: Message-ID: There was discussion of this some years ago, too lazy to find it. I think John Meacham's jhc supported it, and there was discussion if it should be added to ghc, the general opinion wasn't too eager so nothing happened. On Dec 18, 2016 10:30 PM, "Christopher Done" wrote: > Short version: here is the poll > VLtk1oxA00SoK3KPMUsoTSPZDw/viewform?c=0&w=1> > > I noticed recently that Foo.Bar.hs is supported by GHC. I had always > assumed it wasn't because people always use directories. > > I've never liked having separate directories for each level of hierarchy. > It's easier to just list a list of files and script (e.g. even copying a > file X.hs to Y.hs is a bummer). When opening them on GitHub you have to > click through to get a complete picture of a project. > > Other languages do and don't do this. Lispers, for example, don't. > > How do other Haskellers feel about it? Would it mess with anybody's > tooling or mojo if I switched to that style in my packages? > > For one I know that Stack (my own implementation), actually assumes > hierarchical filenames. So I'd have to patch that to implement this. E.g. > > > Unable to find a known candidate for the Cabal entry "HIndent.Types", > but did find: HIndent.Types.hs. If you are using a custom preprocessor for > this module with its own file extension, consider adding the file(s) to > your .cabal under extra-source-files. > > I suppose the real question is, as a language standard and a community > preference, should this be considered a bug? Should people be free to use > X.Y.hs or X/Y.hs styles? > > Ciao! > > _______________________________________________ > 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 will.yager at gmail.com Mon Dec 19 22:22:15 2016 From: will.yager at gmail.com (William Yager) Date: Mon, 19 Dec 2016 15:22:15 -0700 Subject: [Haskell-cafe] Foo.Bar.hs filenames poll In-Reply-To: <38ad7196-f85c-6e53-d285-6455835c38de@gmail.com> References: <090377db-2e1e-6dde-a196-7671f9078698@ucdavis.edu> <38ad7196-f85c-6e53-d285-6455835c38de@gmail.com> Message-ID: On Mon, Dec 19, 2016 at 2:22 PM, MarLinn via Haskell-Cafe < haskell-cafe at haskell.org> wrote: > If we want our language to remain extensible and at the forefront of > language development, we can't tie down too many parts. I think this is an excellent point. One of the distinguishing features of Haskell is that, as a language, it makes almost no concessions to the underlying architecture on which it is compiled or eventually run (and, impressively, manages to achieve very good performance and usability anyway!). Haskell, among all production languages, is perhaps the only one that would be equally at home on some sort of alien lambda-machine as it would on an x86 processor (i.e. not very, but Haskell's foundations are solid enough that we could make it work well). More practically, one could imagine that someone might like to use Haskell as e.g. some sort of cloud-based scripting language where the notion of a filesystem hierarchy doesn't make a lot of sense. There's no good reason to force the language to adhere to something as arbitrary or restricted as a traditional filesystem hierarchy. "Modules" are a much more general concept than files on a disk, and it would be a mistake to over-specify them. Cheers, Will -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok at cs.otago.ac.nz Tue Dec 20 03:05:13 2016 From: ok at cs.otago.ac.nz (ok at cs.otago.ac.nz) Date: Tue, 20 Dec 2016 16:05:13 +1300 Subject: [Haskell-cafe] Foo.Bar.hs filenames poll In-Reply-To: References: <090377db-2e1e-6dde-a196-7671f9078698@ucdavis.edu> <38ad7196-f85c-6e53-d285-6455835c38de@gmail.com> Message-ID: > On Mon, Dec 19, 2016 at 2:22 PM, MarLinn via Haskell-Cafe < > haskell-cafe at haskell.org> wrote: > There's no good reason to force the language to adhere to something as > arbitrary or restricted as a traditional filesystem hierarchy. "Modules" > are a much more general concept than files on a disk, and it would be a > mistake to over-specify them. It is already the case that Haskell identifiers (including module names) are case sensitive, and some popular file systems are not, making tying to a file system dodgy. In attempt to solve a similar problem, SGML introduced the idea of "entities". SGML chunks are stored as "entities" managed by an "entity manager" which might or might not be some sort of file system. OASIS introduced the idea of "catalogs" which allow entity names to be mapped in various ways. I don't see any reason why, for example, a Haskell compiler couldn't map Foo.Bar.Ugh to Foo.zip(Bar/Ugh.hs) if so directed. From winterkoninkje at gmail.com Tue Dec 20 04:43:22 2016 From: winterkoninkje at gmail.com (wren romano) Date: Mon, 19 Dec 2016 20:43:22 -0800 Subject: [Haskell-cafe] memoizing with a default In-Reply-To: <80fdd1d5-d11b-4b1f-0528-ae41f087640f@cs.cornell.edu> References: <80fdd1d5-d11b-4b1f-0528-ae41f087640f@cs.cornell.edu> Message-ID: On Sat, Dec 10, 2016 at 8:50 AM, Michael George wrote: > different a b = isFinal a && not (isFinal b) || isFinal b && not (isFinal a) > || exists chars (\c -> different (step a c) (step b c)) > > This definition diverges; it never decides that two states are the same. > The standard algorithm builds a table, starting with the assumption that all > states are the same, and iteratively applying this definition until it > converges. In the (skeleton of an) algorithm you linked, it is up to the implementor to ensure convergence, it is not guaranteed. This implementor requirement is hidden in the third step: "Repeat this step until we cannot mark anymore states". Note that "cannot" is a modal operator which implies the existence of some sort of oracle that can tell us about whether something is possible in any potential future. Such an oracle is typically implemented by: (a) carefully ordering things so that you achieve exhaustion by design; (b) having a work queue with things ordered carefully enough that an empty queue logically entails no further changes can be made; (c) keeping track of visited sets, to explicitly detect cycles; (d) building the result in a step-indexed way to detect when convergence has been achieved; or similar. Whether it terminates or not has nothing to do with memoization (memoization just makes the performance reasonable). Termination has to do with whether you've implemented things with a properly well-founded induction. For (a) or (b) that's induction on the size of the work queue, for (c) that's induction on the complement of the visited set, for (d) that's induction on the step indices. As an example of this last one, consider the algorithm: Construct a descending chain of relations E0 >= E1 >= E2 >= ... as follows: E0 = { (s,t) | s <- states, t <- states, s /= t && isFinal s == isFinal t } E{i+1} = flip filter E{i} $ \(s,t) -> flip all chars $ \a -> step s a == step t a || (step s a, step t a) `elem` E{i} Stop once E{n} == E{n+1} for some n. E{n} `union` {(s,s) | s <- states} is the finest equivalence relation on states. Note that this algorithm *does* terminate as written: because E0 is finite, and thanks to properties of filter either E{i+1} < E{i} so the induction is permitted, or else E{i+1} == E{i} so we stop. This particular algorithm is the dual to Myhill–Nerode, constructing the equivalence relation rather than constructing the difference relation. Fundamentally the insight is the same. Of course, the runtime of the algorithm I provided can be halved by making the elements of the relation unordered pairs rather than ordered ones. Operationally we can represent each E{i} as a symmetric 2D bitmap, aka a triangular 2D bitmap. Since each bit of E{i} is independent from one another, we can allocate and fill the triangular 2D bitmap in one go. Since each E{i+1} only depends on the elements of E{i} we can drop the previous table once we've constructed the new one. (Or recycle it, to reduce allocation.) @ezyang: does this algorithm meet your requirements for an elegant functional algorithm? If not, why not? (If so, it should be noted that I'm not the one to come up with it. I can give references if desired.) -- Live well, ~wren From cdsmith at gmail.com Tue Dec 20 08:53:53 2016 From: cdsmith at gmail.com (Chris Smith) Date: Tue, 20 Dec 2016 00:53:53 -0800 Subject: [Haskell-cafe] RebindableSyntax and fail in GHC 8 Message-ID: Hey everyone, Can someone explain to me by GHC 8 causes list comprehension bindings to desugar to use 'fail', when RebindableSyntax is enabled in GHC 8? Note that I do not have monad comprehensions enabled. If I define fail, everything works (apparently regardless of what I define fail to do?!?), but I'd like to understand why it's necessary. Thanks, Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan.loewenstein at gmail.com Tue Dec 20 09:38:30 2016 From: jan.loewenstein at gmail.com (=?UTF-8?Q?Jan_von_L=C3=B6wenstein?=) Date: Tue, 20 Dec 2016 09:38:30 +0000 Subject: [Haskell-cafe] Lenses: Changing/creating values deep inside JSON or HashMap Message-ID: Hi, I want to have code that produces the following result no matter if input A or B was given: Result: { "outer" : { "inner" : "new-value" } } A: { "outer" : { "inner" : "old-value" } } B: {} `json & key "outer"._Object.key "inner" .~ "new-value"` didn't work. Is what I want even possible with lenses? Best Jan -------------- next part -------------- An HTML attachment was scrubbed... URL: From olf at aatal-apotheke.de Tue Dec 20 10:44:58 2016 From: olf at aatal-apotheke.de (Olaf Klinke) Date: Tue, 20 Dec 2016 11:44:58 +0100 (CET) Subject: [Haskell-cafe] stack on Windows and C Preprocessor Message-ID: <235165356.388320.1482230698603@webmail.strato.de> Dear Cafe, not sure who the culprit is, thus trying on this list: My project builds fine with stack on Linux. I installed the latest (1.3.0 x86_64) stack on a Windows box and ran 'stack.exe setup' inside my project's directory. The build fails at the depencency HaXml-1.25.3 with a lexer error on line 34 of this file: http://hackage.haskell.org/package/HaXml-1.25.3/docs/src/Text-XML-HaXml-Wrappers.html lexical error in string/character literal at character '\r' It seems the line (VERSION) is processed by the C preprocessor which somehow messes it up. Unfortunately, stack deletes its temporary files after running into the error, which deprives me of handles to further debug this. Does anyone have an idea how to continue from here? Thanks, Olaf From edwards.benj at gmail.com Tue Dec 20 12:41:50 2016 From: edwards.benj at gmail.com (Benjamin Edwards) Date: Tue, 20 Dec 2016 12:41:50 +0000 Subject: [Haskell-cafe] Lenses: Changing/creating values deep inside JSON or HashMap In-Reply-To: References: Message-ID: If the desired function doesn't inspect the input then why not just use const <> ? As to the lenses part: If you use a prism and it doesn't match, then it's a noop. On Tue, 20 Dec 2016 at 09:38 Jan von Löwenstein wrote: > Hi, > > I want to have code that produces the following result no matter if input > A or B was given: > > Result: > { > "outer" : { > "inner" : "new-value" > } > } > > A: > { > "outer" : { > "inner" : "old-value" > } > } > > B: > {} > > `json & key "outer"._Object.key "inner" .~ "new-value"` didn't work. > > Is what I want even possible with lenses? > > Best > Jan > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at snoyman.com Tue Dec 20 12:58:14 2016 From: michael at snoyman.com (Michael Snoyman) Date: Tue, 20 Dec 2016 14:58:14 +0200 Subject: [Haskell-cafe] stack on Windows and C Preprocessor In-Reply-To: <235165356.388320.1482230698603@webmail.strato.de> References: <235165356.388320.1482230698603@webmail.strato.de> Message-ID: One way to try debugging this further is by unpacking the package in question and building inside that directory, e.g.: stack unpack HaXml-1.25.3 cd HaXml-1.25.3 stack init stack build That should fail with the same error message, but at least you'll have the files available to play with and try tweaking. On Tue, Dec 20, 2016 at 12:44 PM, Olaf Klinke wrote: > Dear Cafe, > > not sure who the culprit is, thus trying on this list: > > My project builds fine with stack on Linux. I installed the latest (1.3.0 > x86_64) stack on a Windows box and ran 'stack.exe setup' inside my > project's directory. The build fails at the depencency HaXml-1.25.3 with a > lexer error on line 34 of this file: > > http://hackage.haskell.org/package/HaXml-1.25.3/docs/src/ > Text-XML-HaXml-Wrappers.html > > lexical error in string/character literal at character '\r' > > It seems the line (VERSION) is processed by the C preprocessor which > somehow messes it up. Unfortunately, stack deletes its temporary files > after running into the error, which deprives me of handles to further debug > this. Does anyone have an idea how to continue from here? > > Thanks, Olaf > _______________________________________________ > 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 jan.loewenstein at gmail.com Tue Dec 20 13:26:29 2016 From: jan.loewenstein at gmail.com (=?UTF-8?Q?Jan_von_L=C3=B6wenstein?=) Date: Tue, 20 Dec 2016 13:26:29 +0000 Subject: [Haskell-cafe] Lenses: Changing/creating values deep inside JSON or HashMap In-Reply-To: References: Message-ID: I guess I haven't explained well what I am looking for. I want to set values deep inside a json structure, no matter if the full structure already exists. Go into "outer", if it doesn't exist make it an empty object. >From there go into "inner" and set it to "new-value". The first part should be arbitrarily deep. Best Jan Benjamin Edwards schrieb am Di., 20. Dez. 2016 um 13:42 Uhr: > If the desired function doesn't inspect the input then why not just use > const <> ? > > As to the lenses part: If you use a prism and it doesn't match, then it's > a noop. > > On Tue, 20 Dec 2016 at 09:38 Jan von Löwenstein > wrote: > > Hi, > > I want to have code that produces the following result no matter if input > A or B was given: > > Result: > { > "outer" : { > "inner" : "new-value" > } > } > > A: > { > "outer" : { > "inner" : "old-value" > } > } > > B: > {} > > `json & key "outer"._Object.key "inner" .~ "new-value"` didn't work. > > Is what I want even possible with lenses? > > Best > Jan > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From malcolm.wallace at me.com Tue Dec 20 13:42:43 2016 From: malcolm.wallace at me.com (Malcolm Wallace) Date: Tue, 20 Dec 2016 13:42:43 +0000 Subject: [Haskell-cafe] Foo.Bar.hs filenames poll In-Reply-To: References: <090377db-2e1e-6dde-a196-7671f9078698@ucdavis.edu> <38ad7196-f85c-6e53-d285-6455835c38de@gmail.com> Message-ID: <103C941F-E98F-465A-86CA-AF0F04BB72D4@me.com> On 19 Dec 2016, at 22:22, William Yager wrote: > There's no good reason to force the language to adhere to something as arbitrary or restricted as a traditional filesystem hierarchy. "Modules" are a much more general concept than files on a disk, and it would be a mistake to over-specify them. And this is exactly why Haskell, the language, leaves this open. There is no forced mapping between module names and their file storage. That is an implementation matter, left to individual compilers. In the past, there has been at least one conformant Haskell compiler which allowed multiple modules to live in the same file. Regards, Malcolm From toad3k at gmail.com Tue Dec 20 15:59:01 2016 From: toad3k at gmail.com (David McBride) Date: Tue, 20 Dec 2016 10:59:01 -0500 Subject: [Haskell-cafe] Lenses: Changing/creating values deep inside JSON or HashMap In-Reply-To: References: Message-ID: Sorry, replying to list: Would that not just be json & key "outer" .~ object ["inner", "new-value"] On Tue, Dec 20, 2016 at 8:26 AM, Jan von Löwenstein < jan.loewenstein at gmail.com> wrote: > I guess I haven't explained well what I am looking for. > > I want to set values deep inside a json structure, no matter if the full > structure already exists. > > Go into "outer", if it doesn't exist make it an empty object. > From there go into "inner" and set it to "new-value". > > The first part should be arbitrarily deep. > > Best > Jan > > Benjamin Edwards schrieb am Di., 20. Dez. 2016 > um 13:42 Uhr: > >> If the desired function doesn't inspect the input then why not just use >> const <> ? >> >> As to the lenses part: If you use a prism and it doesn't match, then it's >> a noop. >> >> On Tue, 20 Dec 2016 at 09:38 Jan von Löwenstein < >> jan.loewenstein at gmail.com> wrote: >> >> Hi, >> >> I want to have code that produces the following result no matter if input >> A or B was given: >> >> Result: >> { >> "outer" : { >> "inner" : "new-value" >> } >> } >> >> A: >> { >> "outer" : { >> "inner" : "old-value" >> } >> } >> >> B: >> {} >> >> `json & key "outer"._Object.key "inner" .~ "new-value"` didn't work. >> >> Is what I want even possible with lenses? >> >> Best >> Jan >> >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view archives go to: >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> Only members subscribed via the mailman list are allowed to post. >> >> > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan.loewenstein at gmail.com Tue Dec 20 20:02:42 2016 From: jan.loewenstein at gmail.com (=?UTF-8?Q?Jan_von_L=C3=B6wenstein?=) Date: Tue, 20 Dec 2016 20:02:42 +0000 Subject: [Haskell-cafe] Lenses: Changing/creating values deep inside JSON or HashMap In-Reply-To: References: Message-ID: Thanks for looking into this. Apparently I did not yet express my question properly. In short: Given a deeply nested data structure (e.g. Json with nested objects) I want to set a leaf value without considering which parent and or sibling nodes already exist. More concrete, given the following Json fragment (out of a configuration file): "disks": { "system": "/dev/xvda", "ephemeral": "/dev/sdb", "persistent": { "" : { "path" : "/container/mounted/volume" } } }, I want to add a persistent disk `my-disk` with a given path `/yet/another/volume` and I don't want to handle - there is no node 'my-disk' - there is no node 'persistent' - there is no node 'disks' Given a function defaultsToEmpty :: Maybe (Value) -> Maybe (Value) defaultsToEmpty Nothing = Just $ Object HashMap.empty defaultsToEmpty m = m I can do json & key "disks" %~ defaultsToEmpty & key "disks".key "persistent" %~ defaultsToEmpty & key "disks".key "persistent".key diskId %~ defaultsToEmpty but this doesn't look nice and was wondering if lenses can do better. David McBride schrieb am Di., 20. Dez. 2016 um 16:59 Uhr: > Sorry, replying to list: > > > Would that not just be > > json & key "outer" .~ object ["inner", "new-value"] > > On Tue, Dec 20, 2016 at 8:26 AM, Jan von Löwenstein < > jan.loewenstein at gmail.com> wrote: > > I guess I haven't explained well what I am looking for. > > I want to set values deep inside a json structure, no matter if the full > structure already exists. > > Go into "outer", if it doesn't exist make it an empty object. > From there go into "inner" and set it to "new-value". > > The first part should be arbitrarily deep. > > Best > Jan > > Benjamin Edwards schrieb am Di., 20. Dez. 2016 > um 13:42 Uhr: > > If the desired function doesn't inspect the input then why not just use > const <> ? > > As to the lenses part: If you use a prism and it doesn't match, then it's > a noop. > > On Tue, 20 Dec 2016 at 09:38 Jan von Löwenstein > wrote: > > Hi, > > I want to have code that produces the following result no matter if input > A or B was given: > > Result: > { > "outer" : { > "inner" : "new-value" > } > } > > A: > { > "outer" : { > "inner" : "old-value" > } > } > > B: > {} > > `json & key "outer"._Object.key "inner" .~ "new-value"` didn't work. > > Is what I want even possible with lenses? > > Best > Jan > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > > > _______________________________________________ > 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 Tue Dec 20 21:59:18 2016 From: dsf at seereason.com (David Fox) Date: Tue, 20 Dec 2016 13:59:18 -0800 Subject: [Haskell-cafe] Lenses: Changing/creating values deep inside JSON or HashMap In-Reply-To: References: Message-ID: You can use the "non" lens for this: λ> view (at "a" . non "") (Data.Map.fromList [("a", "x"), ("b", "y")]) "x" λ> view (at "c" . non "") (Data.Map.fromList [("a", "x"), ("b", "y")]) "" λ> set (at "c" . non "") "z" (Data.Map.fromList [("a", "x"), ("b", "y")]) fromList [("a","x"),("b","y"),("c","z")] So it will return the non argument when an entry doesn't exist, and it will create values using the non argument when you try to set an entry that doesn't exist. On Tue, Dec 20, 2016 at 12:02 PM, Jan von Löwenstein < jan.loewenstein at gmail.com> wrote: > Thanks for looking into this. Apparently I did not yet express my question > properly. > > In short: > Given a deeply nested data structure (e.g. Json with nested objects) I > want to set a leaf value without considering which parent and or sibling > nodes already exist. > > More concrete, given the following Json fragment (out of a configuration > file): > "disks": { > "system": "/dev/xvda", > "ephemeral": "/dev/sdb", > "persistent": { > "" : { "path" : "/container/mounted/volume" } > } > }, > > I want to add a persistent disk `my-disk` with a given path > `/yet/another/volume` and I don't want to handle > > - there is no node 'my-disk' > - there is no node 'persistent' > - there is no node 'disks' > > Given a function > defaultsToEmpty :: Maybe (Value) -> Maybe (Value) > defaultsToEmpty Nothing = Just $ Object HashMap.empty > defaultsToEmpty m = m > I can do > json & key "disks" %~ defaultsToEmpty > & key "disks".key "persistent" %~ defaultsToEmpty > & key "disks".key "persistent".key diskId %~ defaultsToEmpty > but this doesn't look nice and was wondering if lenses can do better. > > > > David McBride schrieb am Di., 20. Dez. 2016 um > 16:59 Uhr: > >> Sorry, replying to list: >> >> >> Would that not just be >> >> json & key "outer" .~ object ["inner", "new-value"] >> >> On Tue, Dec 20, 2016 at 8:26 AM, Jan von Löwenstein < >> jan.loewenstein at gmail.com> wrote: >> >> I guess I haven't explained well what I am looking for. >> >> I want to set values deep inside a json structure, no matter if the full >> structure already exists. >> >> Go into "outer", if it doesn't exist make it an empty object. >> From there go into "inner" and set it to "new-value". >> >> The first part should be arbitrarily deep. >> >> Best >> Jan >> >> Benjamin Edwards schrieb am Di., 20. Dez. 2016 >> um 13:42 Uhr: >> >> If the desired function doesn't inspect the input then why not just use >> const <> ? >> >> As to the lenses part: If you use a prism and it doesn't match, then it's >> a noop. >> >> On Tue, 20 Dec 2016 at 09:38 Jan von Löwenstein < >> jan.loewenstein at gmail.com> wrote: >> >> Hi, >> >> I want to have code that produces the following result no matter if input >> A or B was given: >> >> Result: >> { >> "outer" : { >> "inner" : "new-value" >> } >> } >> >> A: >> { >> "outer" : { >> "inner" : "old-value" >> } >> } >> >> B: >> {} >> >> `json & key "outer"._Object.key "inner" .~ "new-value"` didn't work. >> >> Is what I want even possible with lenses? >> >> Best >> Jan >> >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view archives go to: >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> Only members subscribed via the mailman list are allowed to post. >> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view archives go to: >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> Only members subscribed via the mailman list are allowed to post. >> >> >> _______________________________________________ >> 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 jeremy.odonoghue at gmail.com Tue Dec 20 22:38:34 2016 From: jeremy.odonoghue at gmail.com (Jeremy O'Donoghue) Date: Tue, 20 Dec 2016 22:38:34 +0000 Subject: [Haskell-cafe] stack on Windows and C Preprocessor In-Reply-To: <235165356.388320.1482230698603@webmail.strato.de> References: <235165356.388320.1482230698603@webmail.strato.de> Message-ID: <59545970-9747-4051-9958-818CF1C9336A@gmail.com> C preprocessor on Windows expects \n\r as line ending, so what you think is a line break is being treated as a single line by CPP. Run your file through a unix to dos file tool or configure your version control system to retrieve files in local format. Jeremy Sent from my iPhone > On 20 Dec 2016, at 10:44, Olaf Klinke wrote: > > Dear Cafe, > > not sure who the culprit is, thus trying on this list: > > My project builds fine with stack on Linux. I installed the latest (1.3.0 x86_64) stack on a Windows box and ran 'stack.exe setup' inside my project's directory. The build fails at the depencency HaXml-1.25.3 with a lexer error on line 34 of this file: > > http://hackage.haskell.org/package/HaXml-1.25.3/docs/src/Text-XML-HaXml-Wrappers.html > > lexical error in string/character literal at character '\r' > > It seems the line (VERSION) is processed by the C preprocessor which somehow messes it up. Unfortunately, stack deletes its temporary files after running into the error, which deprives me of handles to further debug this. Does anyone have an idea how to continue from here? > > Thanks, Olaf > _______________________________________________ > 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 S.J.Thompson at kent.ac.uk Wed Dec 21 14:08:18 2016 From: S.J.Thompson at kent.ac.uk (Simon Thompson) Date: Wed, 21 Dec 2016 14:08:18 +0000 Subject: [Haskell-cafe] =?utf-8?b?V2UncmUgcmVjcnVpdGluZyDigKbCoHdoeSBub3Qg?= =?utf-8?q?join_us=3F?= Message-ID: We’re recruiting, and if you’re interested in programming languages, types, logics, or more practical aspects like refactoring and other tools, we’d really welcome an application from you. Simon T. Lecturer in Computing (2 posts) University of Kent - School of Computing We are seeking to appoint two Lecturers in Computing (the equivalent of tenure track, assistant professors), based at our Canterbury campus. We are particularly interested in appointments in Security, or Programming Languages but are happy to consider excellent candidates in other areas that would complement or enhance the School’s existing research strengths. Job description https://www11.i-grasp.com/fe/wrapdev_SendFile.asp?key=49170934&c=336212628234&pagestamp=dbycojjivswemxeujv&index=4 Additional Information https://www11.i-grasp.com/fe/wrapdev_SendFile.asp?key=49170934&c=336212628234&pagestamp=dbycojjivswemxeujv&index=2 Please apply at https://www11.i-grasp.com/fe/tpl_kent01.asp?newms=jj&id=40606&aid=14243 Closing date for applications: 6 February 2017 The School of Computing [1] is a welcoming and diverse environment whose commitment to gender equality has been recognised with a Bronze Athena SWAN [2] award. We are keen to enhance the balanced, inclusive and diverse nature of the community within our School and would particularly encourage female candidates to apply for these posts. We are committed to delivering high quality research and education. Our research is focused on five broad research areas: Programming Languages and Systems; Computer Security; Computational Intelligence; Data Science; and Computing Education. Full details can be found at: https://www.cs.kent.ac.uk/research. The 2014 Research Excellence Framework (REF) ranked our school 12th for research intensity [3], and we are well placed to improve on this in the next REF. The University of Kent has campuses in Canterbury and Medway, and specialist postgraduate centres in Athens, Brussels, Paris and Rome. It was ranked 16th in the UK in The Guardian University Guide 2016. It ranked 4th for overall student satisfaction (NSS, 2016) and 17th for the intensity of its excellent research (REF 2014). It has 20,000 students and 1,872 academic, teaching and research staff. Overlooking the city centre, and with 125 nationalities represented, the Canterbury campus has a very cosmopolitan feel. Canterbury is a small city that retains parts of its medieval walls. Famous for its heritage (Canterbury Cathedral; Chaucer’s Tales; etc), Canterbury is a vibrant community whose culture and leisure facilities are enhanced by hosting three universities. The city and surrounding region combines an attractive and affordable environment, good schools, and fast transport links to London and mainland Europe. Links: [1] https://cs.kent.ac.uk/ [2] http://www.ecu.ac.uk/equality-charters/athena-swan/ [3] https://www.timeshighereducation.com/sites/default/files/Attachments/2014/12/30/a/b/i/subject-ranking-on-intensity.pdf Simon Thompson | Professor of Logic and Computation School of Computing | University of Kent | Canterbury, CT2 7NF, UK s.j.thompson at kent.ac.uk | M +44 7986 085754 | W www.cs.kent.ac.uk/~sjt From ncrashed at gmail.com Wed Dec 21 14:10:22 2016 From: ncrashed at gmail.com (NCrashed .) Date: Wed, 21 Dec 2016 14:10:22 +0000 Subject: [Haskell-cafe] ANNOUNCE: pdf-slave-1.0 tool for PDF generation from haskintex templates Message-ID: I am glad to announce first release of pdf-slave, a tool for generation of PDF documents from LaTeX templates with embedded Haskell. Hackage: http://hackage.haskell.org/package/pdf-slave Github: https://github.com/NCrashed/pdf-slave Description ======= In many real-world systems we need to produce reports, cheque and other documents to users. One possible solution is rendering LaTeX files, but it is not flexible enough as you need to solve burden with generation of LaTeX file from varying inputs, manage static files like images and handling dependencies between pieces of document. The new tool takes the burden away. Now all static files and generation code is located within a single template project, that describes how to build your PDF document in a declarative way. Common work flow with pdf-slave: * Develop template from several LaTeX files with embedded Haskell (thanks to haskintex tool) * Pack the template project into bundle all-in file. * Distribute the bundle (for instance, to your service server). * Call pdf-slave with bundle and inputs in JSON file to generate new PDF document. Status ==== pdf-slave is designed as part of commercial Haskell system. The tool is very young and need time approval, although it already has all needed features one may need from such tool. Special thanks to hint authors and Daniel Díaz, developer of awesome HaTex and haskintex, without these packages pdf-slave wouldn't be possible! Reports, feature request, PR are always welcome! Anton Gushcha aka NCrashed -------------- next part -------------- An HTML attachment was scrubbed... URL: From S.J.Thompson at kent.ac.uk Wed Dec 21 14:15:09 2016 From: S.J.Thompson at kent.ac.uk (Simon Thompson) Date: Wed, 21 Dec 2016 14:15:09 +0000 Subject: [Haskell-cafe] =?utf-8?b?V2UncmUgcmVjcnVpdGluZyDigKbCoHdoeSBub3Qg?= =?utf-8?q?join_us=3F_LINKS_FIXED?= In-Reply-To: References: Message-ID: <23949407-E355-4D5B-8260-1CB7A3CD84EC@kent.ac.uk> Apologies: please ignore the first two links, and to go for all details to: https://www11.i-grasp.com/fe/tpl_kent01.asp?newms=jj&id=40606&aid=14243 We’re recruiting, and if you’re interested in programming languages, types, logics, or more practical aspects like refactoring and other tools, we’d really welcome an application from you. Simon T. Lecturer in Computing (2 posts) University of Kent - School of Computing We are seeking to appoint two Lecturers in Computing (the equivalent of tenure track, assistant professors), based at our Canterbury campus. We are particularly interested in appointments in Security, or Programming Languages but are happy to consider excellent candidates in other areas that would complement or enhance the School’s existing research strengths. Job description Additional Information Please apply at https://www11.i-grasp.com/fe/tpl_kent01.asp?newms=jj&id=40606&aid=14243 Closing date for applications: 6 February 2017 The School of Computing [1] is a welcoming and diverse environment whose commitment to gender equality has been recognised with a Bronze Athena SWAN [2] award. We are keen to enhance the balanced, inclusive and diverse nature of the community within our School and would particularly encourage female candidates to apply for these posts. We are committed to delivering high quality research and education. Our research is focused on five broad research areas: Programming Languages and Systems; Computer Security; Computational Intelligence; Data Science; and Computing Education. Full details can be found at: https://www.cs.kent.ac.uk/research. The 2014 Research Excellence Framework (REF) ranked our school 12th for research intensity [3], and we are well placed to improve on this in the next REF. The University of Kent has campuses in Canterbury and Medway, and specialist postgraduate centres in Athens, Brussels, Paris and Rome. It was ranked 16th in the UK in The Guardian University Guide 2016. It ranked 4th for overall student satisfaction (NSS, 2016) and 17th for the intensity of its excellent research (REF 2014). It has 20,000 students and 1,872 academic, teaching and research staff. Overlooking the city centre, and with 125 nationalities represented, the Canterbury campus has a very cosmopolitan feel. Canterbury is a small city that retains parts of its medieval walls. Famous for its heritage (Canterbury Cathedral; Chaucer’s Tales; etc), Canterbury is a vibrant community whose culture and leisure facilities are enhanced by hosting three universities. The city and surrounding region combines an attractive and affordable environment, good schools, and fast transport links to London and mainland Europe. Links: [1] https://cs.kent.ac.uk/ [2] http://www.ecu.ac.uk/equality-charters/athena-swan/ [3] https://www.timeshighereducation.com/sites/default/files/Attachments/2014/12/30/a/b/i/subject-ranking-on-intensity.pdf Simon Thompson | Professor of Logic and Computation School of Computing | University of Kent | Canterbury, CT2 7NF, UK s.j.thompson at kent.ac.uk | M +44 7986 085754 | W www.cs.kent.ac.uk/~sjt Professor Simon Thompson | Director of Innovation School of Computing | University of Kent | Canterbury, CT2 7NF, UK s.j.thompson at kent.ac.uk | M +44 7986 085754 | W www.cs.kent.ac.uk/~sjt From rae at cs.brynmawr.edu Wed Dec 21 14:24:56 2016 From: rae at cs.brynmawr.edu (Richard Eisenberg) Date: Wed, 21 Dec 2016 09:24:56 -0500 Subject: [Haskell-cafe] RebindableSyntax and fail in GHC 8 In-Reply-To: References: Message-ID: <100BE1DD-16ED-437D-B04B-7D056AA88C6F@cs.brynmawr.edu> Sounds like a bug to me.... and one I may have run into at some point. Would you care to file a bug report? Thanks! Richard > On Dec 20, 2016, at 3:53 AM, Chris Smith wrote: > > Hey everyone, > > Can someone explain to me by GHC 8 causes list comprehension bindings to desugar to use 'fail', when RebindableSyntax is enabled in GHC 8? Note that I do not have monad comprehensions enabled. If I define fail, everything works (apparently regardless of what I define fail to do?!?), but I'd like to understand why it's necessary. > > Thanks, > Chris > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. From ruben.astud at gmail.com Wed Dec 21 17:33:36 2016 From: ruben.astud at gmail.com (Ruben Astudillo) Date: Wed, 21 Dec 2016 14:33:36 -0300 Subject: [Haskell-cafe] emit custom signal from gtk3 haskell side Message-ID: Hi all I implement the following custom signal in my code import qualified System.Glib.Signals as Sig updateSignal :: ButtonClass self => Sig.Signal self (IO ()) updateSignal = Sig.Signal $ Sig.connectGeneric "updateSignal" Such, will be called inside of "model" phase of the app. But looking on the gtk3 documentation (and grepping also) I can't find a equivalent of `gtk_signal_emit_by_name`. I don't believe this omission is accidental. Can Anybody guide where to look at? -- -- Ruben From dave at zednenem.com Wed Dec 21 20:56:24 2016 From: dave at zednenem.com (David Menendez) Date: Wed, 21 Dec 2016 15:56:24 -0500 Subject: [Haskell-cafe] RebindableSyntax and fail in GHC 8 In-Reply-To: References: Message-ID: On Tue, Dec 20, 2016 at 3:53 AM, Chris Smith wrote: > Hey everyone, > > Can someone explain to me by GHC 8 causes list comprehension bindings to > desugar to use 'fail', when RebindableSyntax is enabled in GHC 8? Note > that I do not have monad comprehensions enabled. If I define fail, > everything works (apparently regardless of what I define fail to do?!?), > but I'd like to understand why it's necessary. > Perhaps fail is used by the translation for guards. I don’t have a working GHC right now, but what happens if you define fail = error and evaluate [ x | x <- “a", False]? -- Dave Menendez -------------- next part -------------- An HTML attachment was scrubbed... URL: From cdsmith at gmail.com Wed Dec 21 21:52:12 2016 From: cdsmith at gmail.com (Chris Smith) Date: Wed, 21 Dec 2016 13:52:12 -0800 Subject: [Haskell-cafe] RebindableSyntax and fail in GHC 8 In-Reply-To: References: Message-ID: Thanks Richard, I will file the bug shortly. David, fail doesn't appear to be used at all, either for pattern match failure (which I initially expected), or for guards. Example here: https://code.world/#P2ZO5lhXKM5QGYh-vRd31Ug On Wed, Dec 21, 2016 at 12:56 PM, David Menendez wrote: > On Tue, Dec 20, 2016 at 3:53 AM, Chris Smith wrote: > >> Hey everyone, >> >> Can someone explain to me by GHC 8 causes list comprehension bindings to >> desugar to use 'fail', when RebindableSyntax is enabled in GHC 8? Note >> that I do not have monad comprehensions enabled. If I define fail, >> everything works (apparently regardless of what I define fail to do?!?), >> but I'd like to understand why it's necessary. >> > > Perhaps fail is used by the translation for guards. I don’t have a working > GHC right now, but what happens if you define fail = error and evaluate [ x > | x <- “a", False]? > > -- > Dave Menendez > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cdsmith at gmail.com Wed Dec 21 22:13:34 2016 From: cdsmith at gmail.com (Chris Smith) Date: Wed, 21 Dec 2016 14:13:34 -0800 Subject: [Haskell-cafe] RebindableSyntax and fail in GHC 8 In-Reply-To: <100BE1DD-16ED-437D-B04B-7D056AA88C6F@cs.brynmawr.edu> References: <100BE1DD-16ED-437D-B04B-7D056AA88C6F@cs.brynmawr.edu> Message-ID: Thanks for the response. It appears the bug was already reported in a slightly different context. https://ghc.haskell.org/trac/ghc/ticket/11216 On Wed, Dec 21, 2016 at 6:24 AM, Richard Eisenberg wrote: > Sounds like a bug to me.... and one I may have run into at some point. > Would you care to file a bug report? > > Thanks! > Richard > > > On Dec 20, 2016, at 3:53 AM, Chris Smith wrote: > > > > Hey everyone, > > > > Can someone explain to me by GHC 8 causes list comprehension bindings to > desugar to use 'fail', when RebindableSyntax is enabled in GHC 8? Note > that I do not have monad comprehensions enabled. If I define fail, > everything works (apparently regardless of what I define fail to do?!?), > but I'd like to understand why it's necessary. > > > > Thanks, > > Chris > > _______________________________________________ > > Haskell-Cafe mailing list > > To (un)subscribe, modify options or view archives go to: > > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > Only members subscribed via the mailman list are allowed to post. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jan.loewenstein at gmail.com Thu Dec 22 08:00:10 2016 From: jan.loewenstein at gmail.com (=?UTF-8?Q?Jan_von_L=C3=B6wenstein?=) Date: Thu, 22 Dec 2016 08:00:10 +0000 Subject: [Haskell-cafe] Lenses: Changing/creating values deep inside JSON or HashMap In-Reply-To: References: Message-ID: Thanks a lot. I finally figured out how to use `non` properly. I tried hard to get it working with `key` from Data.Aeson.Lens. Without a Maybe in the signature of `key` I didn't get `non` to work. Took some time to realize this. Now I switched to using `at` and everything is fine (i.e. compiles). David Fox schrieb am Di., 20. Dez. 2016 um 22:59 Uhr: > You can use the "non" lens for this: > > λ> view (at "a" . non "") (Data.Map.fromList [("a", "x"), ("b", "y")]) > "x" > λ> view (at "c" . non "") (Data.Map.fromList [("a", "x"), ("b", "y")]) > "" > λ> set (at "c" . non "") "z" (Data.Map.fromList [("a", "x"), ("b", "y")]) > fromList [("a","x"),("b","y"),("c","z")] > > So it will return the non argument when an entry doesn't exist, and it > will create values using the non argument when you try to set an entry that > doesn't exist. > > > On Tue, Dec 20, 2016 at 12:02 PM, Jan von Löwenstein < > jan.loewenstein at gmail.com> wrote: > > Thanks for looking into this. Apparently I did not yet express my question > properly. > > In short: > Given a deeply nested data structure (e.g. Json with nested objects) I > want to set a leaf value without considering which parent and or sibling > nodes already exist. > > More concrete, given the following Json fragment (out of a configuration > file): > "disks": { > "system": "/dev/xvda", > "ephemeral": "/dev/sdb", > "persistent": { > "" : { "path" : "/container/mounted/volume" } > } > }, > > I want to add a persistent disk `my-disk` with a given path > `/yet/another/volume` and I don't want to handle > > - there is no node 'my-disk' > - there is no node 'persistent' > - there is no node 'disks' > > Given a function > defaultsToEmpty :: Maybe (Value) -> Maybe (Value) > defaultsToEmpty Nothing = Just $ Object HashMap.empty > defaultsToEmpty m = m > I can do > json & key "disks" %~ defaultsToEmpty > & key "disks".key "persistent" %~ defaultsToEmpty > & key "disks".key "persistent".key diskId %~ defaultsToEmpty > but this doesn't look nice and was wondering if lenses can do better. > > > > David McBride schrieb am Di., 20. Dez. 2016 um > 16:59 Uhr: > > Sorry, replying to list: > > > Would that not just be > > json & key "outer" .~ object ["inner", "new-value"] > > On Tue, Dec 20, 2016 at 8:26 AM, Jan von Löwenstein < > jan.loewenstein at gmail.com> wrote: > > I guess I haven't explained well what I am looking for. > > I want to set values deep inside a json structure, no matter if the full > structure already exists. > > Go into "outer", if it doesn't exist make it an empty object. > From there go into "inner" and set it to "new-value". > > The first part should be arbitrarily deep. > > Best > Jan > > Benjamin Edwards schrieb am Di., 20. Dez. 2016 > um 13:42 Uhr: > > If the desired function doesn't inspect the input then why not just use > const <> ? > > As to the lenses part: If you use a prism and it doesn't match, then it's > a noop. > > On Tue, 20 Dec 2016 at 09:38 Jan von Löwenstein > wrote: > > Hi, > > I want to have code that produces the following result no matter if input > A or B was given: > > Result: > { > "outer" : { > "inner" : "new-value" > } > } > > A: > { > "outer" : { > "inner" : "old-value" > } > } > > B: > {} > > `json & key "outer"._Object.key "inner" .~ "new-value"` didn't work. > > Is what I want even possible with lenses? > > Best > Jan > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > > > _______________________________________________ > 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 jwiegley at gmail.com Thu Dec 22 16:55:48 2016 From: jwiegley at gmail.com (John Wiegley) Date: Thu, 22 Dec 2016 08:55:48 -0800 Subject: [Haskell-cafe] Work on mail.haskell.org beginning, please report any problems Message-ID: Hello Haskellers, Beginning today, I am upgrading our Postfix installation on mail.haskell.org, and introducing some new options to reduce the amount of spam that hits our mailman server. If you experience delivery problems, or any bounced mail, please send a copy of the full bounce message to my address: jwiegley at gmail.com. I'll be making more changes gradually over the next few days, and watching the mail logs, but it's possible that mail accepted before will suddenly start getting rejected, depending on how well-behaved your sending mail server is. Activities planned for this Christmas break are: - [x] Upgrade Postfix to 2.11 - [X] Enable postscreen for pre-queue RBL filtering - [ ] DKIM sign messages sent from mailman - [ ] Implement DMARC policy (i.e., reject incoming messages improperly DKIM signed, or failing SPF check) - [ ] Prevent mail being spoofed from haskell.org addresses - [ ] Tighten sender and recipient restrictions - [ ] Re-assess inbound and outbound rate limits - [ ] Use SpamAssassin for post-queue filtering - [ ] If helpful, enable deep protocol pre-filtering - [ ] Document all the above, so others can help with e-mail admin Thank you, John Wiegley Haskell.org, infrastructure team From ietf-dane at dukhovni.org Fri Dec 23 01:44:31 2016 From: ietf-dane at dukhovni.org (Viktor Dukhovni) Date: Thu, 22 Dec 2016 20:44:31 -0500 Subject: [Haskell-cafe] Work on mail.haskell.org beginning, please report any problems In-Reply-To: References: Message-ID: <8F0663C8-C6CF-4233-8CEF-1505E0EF5092@dukhovni.org> > On Dec 22, 2016, at 11:55 AM, John Wiegley wrote: > > - [x] Upgrade Postfix to 2.11 If available as a package for your O/S, might as well use 3.1 > - [X] Enable postscreen for pre-queue RBL filtering This makes it possible to combine multiple lower-weight RBLs, that individually are not sufficient to reject mail, but you should still use the SpamHaus zen RBL in smtpd(8). > - [ ] DKIM sign messages sent from mailman Fair enough. > - [ ] Implement DMARC policy (i.e., reject incoming messages improperly > DKIM signed, or failing SPF check) DO NOT DO THIS! DMARC is an abomination, abused by Yahoo and others to shift costs onto others. The right thing to do with DMARC is to avoid modifying the message headers (no subject tags) and body (no footers). This way relayed posts pass DKIM checks. [ See e.g. perma-thread playing out on ietf at ietf.org at the moment. ] We can ask list subscribers to add the [Haskell-cafe] tag to the first message in each new thread, so that the list can avoid the need to modify the message in transit (beyond adding List- headers, a Sender- header and setting an appropriate envelope sender). > - [ ] Use SpamAssassin for post-queue filtering > - [ ] If helpful, enable deep protocol pre-filtering Deep protocol tests in "postscreen" have proved difficult to use, too many large providers don't retry messages from a stable IP address, and whitelisting their ever-changing address blocks is challenging. -- Viktor. From ietf-dane at dukhovni.org Fri Dec 23 05:05:56 2016 From: ietf-dane at dukhovni.org (Viktor Dukhovni) Date: Fri, 23 Dec 2016 00:05:56 -0500 Subject: [Haskell-cafe] Work on mail.haskell.org beginning, please report any problems In-Reply-To: References: <8F0663C8-C6CF-4233-8CEF-1505E0EF5092@dukhovni.org> Message-ID: > On Dec 22, 2016, at 11:09 PM, John Wiegley wrote: > >> If available as a package for your O/S, might as well use 3.1 > > I'll consider that a second migration, after the dust settles this time > around. I'd need to gain experience with 3.x first on my own server, before > being comfortable enough to do that. The 2.11-based setup I've been running > for a month now on another server. Wietse maintains a strong commitment to backwards-compatibility. While Postfix 3.0 (could equally have been 2.12) brings in new features for distribution maintainers, with dynamically-loadable table drivers on multiple platforms it remains compatible with 2.x releases for users. Your 2.11 configuration will work with 3.1, you may just need to install additional table driver packages, if your O/S maintainer has just started delivering Postfix as multiple components. > >>> - [X] Enable postscreen for pre-queue RBL filtering > >> This makes it possible to combine multiple lower-weight RBLs, that >> individually are not sufficient to reject mail, but you should still use the >> SpamHaus zen RBL in smtpd(8). > > Why is it helpful to run it in smtpd as well? I'm already using: > > postscreen_dnsbl_sites = zen.spamhaus.org*2 ... This is because the TTLs on postscreen whitelists are rather longer than RBL TTLs. If an IP address is added to an RBL, you'll want to refuse access in a timely manner. -- Viktor. From jo at durchholz.org Fri Dec 23 05:40:19 2016 From: jo at durchholz.org (Joachim Durchholz) Date: Fri, 23 Dec 2016 06:40:19 +0100 Subject: [Haskell-cafe] Work on mail.haskell.org beginning, please report any problems In-Reply-To: References: Message-ID: <452feb1f-8154-3581-8855-a08d14630dfd@durchholz.org> Am 22.12.2016 um 17:55 schrieb John Wiegley: > - [ ] Implement DMARC policy (i.e., reject incoming messages improperly > DKIM signed, or failing SPF check) I would be unable to send mail, because my mail installation is a bit old and would not pass either check (probably). This would be the first mailing list to have this problem for me. From ovidiudeac at gmail.com Fri Dec 23 13:22:21 2016 From: ovidiudeac at gmail.com (Ovidiu Deac) Date: Fri, 23 Dec 2016 15:22:21 +0200 Subject: [Haskell-cafe] Datomic-like db for Haskell? Message-ID: Is there any package in Haskell that provides something similar to Datomic http://www.datomic.com/? Basically what I am looking for is a database which could keep all the versions of my data in an efficient way, the same way the persistent data structures do. Ideally it should be implemented over some scalable storage. I looked at Datomic itself but I couldn't find a Haskell client library. The only way to connect to it from a Haskell application is through the REST server which they have just deprecated ( http://docs.datomic.com/rest.html) Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: From esz at posteo.de Fri Dec 23 15:27:38 2016 From: esz at posteo.de (Ertugrul =?utf-8?Q?S=C3=B6ylemez?=) Date: Fri, 23 Dec 2016 16:27:38 +0100 Subject: [Haskell-cafe] Datomic-like db for Haskell? In-Reply-To: References: Message-ID: <867f6qekd1.fsf@posteo.de> > Basically what I am looking for is a database which could keep all the > versions of my data in an efficient way, the same way the persistent > data structures do. > > Ideally it should be implemented over some scalable storage. There are a few options, if you consider that you don't necessarily need special support for versioning: * Would using a snapshot-based revision control system like Git be an option? If yes, you could use the [filestore] library. * Another option is to run an insertion-only relational model on really any database system you want like PostgreSQL. There is nothing about preserving history that needs special handling to be efficient. * Yet another option is to model your application state with history and use [acid-state]. However, acid-state only makes an in-memory Haskell value (the "database") persistent with ACID guarantees. If you mostly work with the current state, keeping the whole history in memory all the time would be a waste. Therefore this option may be less useful. [acid-state]: https://hackage.haskell.org/package/acid-state [filestore]: https://hackage.haskell.org/package/filestore Greets ertes -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 454 bytes Desc: not available URL: From dsf at seereason.com Fri Dec 23 17:02:36 2016 From: dsf at seereason.com (David Fox) Date: Fri, 23 Dec 2016 09:02:36 -0800 Subject: [Haskell-cafe] Lenses: Changing/creating values deep inside JSON or HashMap In-Reply-To: References: Message-ID: Its funny how with lens, you first try something and it doesn't work. Then you work on it a lot, and when you finally get it working it looks exactly like the first thing you tried. Mysterious. On Thu, Dec 22, 2016 at 12:00 AM, Jan von Löwenstein < jan.loewenstein at gmail.com> wrote: > Thanks a lot. > > I finally figured out how to use `non` properly. > > I tried hard to get it working with `key` from Data.Aeson.Lens. > Without a Maybe in the signature of `key` I didn't get `non` to work. Took > some time to realize this. > > Now I switched to using `at` and everything is fine (i.e. compiles). > > David Fox schrieb am Di., 20. Dez. 2016 um 22:59 Uhr: > >> You can use the "non" lens for this: >> >> λ> view (at "a" . non "") (Data.Map.fromList [("a", "x"), ("b", "y")]) >> "x" >> λ> view (at "c" . non "") (Data.Map.fromList [("a", "x"), ("b", "y")]) >> "" >> λ> set (at "c" . non "") "z" (Data.Map.fromList [("a", "x"), ("b", "y")]) >> fromList [("a","x"),("b","y"),("c","z")] >> >> So it will return the non argument when an entry doesn't exist, and it >> will create values using the non argument when you try to set an entry that >> doesn't exist. >> >> >> On Tue, Dec 20, 2016 at 12:02 PM, Jan von Löwenstein < >> jan.loewenstein at gmail.com> wrote: >> >> Thanks for looking into this. Apparently I did not yet express my >> question properly. >> >> In short: >> Given a deeply nested data structure (e.g. Json with nested objects) I >> want to set a leaf value without considering which parent and or sibling >> nodes already exist. >> >> More concrete, given the following Json fragment (out of a configuration >> file): >> "disks": { >> "system": "/dev/xvda", >> "ephemeral": "/dev/sdb", >> "persistent": { >> "" : { "path" : "/container/mounted/volume" } >> } >> }, >> >> I want to add a persistent disk `my-disk` with a given path >> `/yet/another/volume` and I don't want to handle >> >> - there is no node 'my-disk' >> - there is no node 'persistent' >> - there is no node 'disks' >> >> Given a function >> defaultsToEmpty :: Maybe (Value) -> Maybe (Value) >> defaultsToEmpty Nothing = Just $ Object HashMap.empty >> defaultsToEmpty m = m >> I can do >> json & key "disks" %~ defaultsToEmpty >> & key "disks".key "persistent" %~ defaultsToEmpty >> & key "disks".key "persistent".key diskId %~ defaultsToEmpty >> but this doesn't look nice and was wondering if lenses can do better. >> >> >> >> David McBride schrieb am Di., 20. Dez. 2016 um >> 16:59 Uhr: >> >> Sorry, replying to list: >> >> >> Would that not just be >> >> json & key "outer" .~ object ["inner", "new-value"] >> >> On Tue, Dec 20, 2016 at 8:26 AM, Jan von Löwenstein < >> jan.loewenstein at gmail.com> wrote: >> >> I guess I haven't explained well what I am looking for. >> >> I want to set values deep inside a json structure, no matter if the full >> structure already exists. >> >> Go into "outer", if it doesn't exist make it an empty object. >> From there go into "inner" and set it to "new-value". >> >> The first part should be arbitrarily deep. >> >> Best >> Jan >> >> Benjamin Edwards schrieb am Di., 20. Dez. 2016 >> um 13:42 Uhr: >> >> If the desired function doesn't inspect the input then why not just use >> const <> ? >> >> As to the lenses part: If you use a prism and it doesn't match, then it's >> a noop. >> >> On Tue, 20 Dec 2016 at 09:38 Jan von Löwenstein < >> jan.loewenstein at gmail.com> wrote: >> >> Hi, >> >> I want to have code that produces the following result no matter if input >> A or B was given: >> >> Result: >> { >> "outer" : { >> "inner" : "new-value" >> } >> } >> >> A: >> { >> "outer" : { >> "inner" : "old-value" >> } >> } >> >> B: >> {} >> >> `json & key "outer"._Object.key "inner" .~ "new-value"` didn't work. >> >> Is what I want even possible with lenses? >> >> Best >> Jan >> >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view archives go to: >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> Only members subscribed via the mailman list are allowed to post. >> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view archives go to: >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> Only members subscribed via the mailman list are allowed to post. >> >> >> _______________________________________________ >> 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 ovidiudeac at gmail.com Fri Dec 23 17:41:34 2016 From: ovidiudeac at gmail.com (Ovidiu Deac) Date: Fri, 23 Dec 2016 19:41:34 +0200 Subject: [Haskell-cafe] Fwd: Datomic-like db for Haskell? In-Reply-To: References: <867f6qekd1.fsf@posteo.de> Message-ID: > > * Would using a snapshot-based revision control system like Git be an > option? If yes, you could use the [filestore] library. > It's not exactly what I had in mind but I'll think about it. > > * Another option is to run an insertion-only relational model on > really any database system you want like PostgreSQL. There is > nothing about preserving history that needs special handling to be > efficient. > I assume that some sort of structural sharing is needed once the collections grow above a certain size. Also some support for caching would be nice. > * Yet another option is to model your application state with history > and use [acid-state]. However, acid-state only makes an in-memory > Haskell value (the "database") persistent with ACID guarantees. If > you mostly work with the current state, keeping the whole history in > memory all the time would be a waste. Therefore this option may be > less useful. > The database will probably grow bigger than the memory so this is not an option. ...and thanks for the pointers -------------- next part -------------- An HTML attachment was scrubbed... URL: From spam at scientician.net Fri Dec 23 18:54:02 2016 From: spam at scientician.net (Bardur Arantsson) Date: Fri, 23 Dec 2016 19:54:02 +0100 Subject: [Haskell-cafe] Fwd: Datomic-like db for Haskell? In-Reply-To: References: <867f6qekd1.fsf@posteo.de> Message-ID: On 2016-12-23 18:41, Ovidiu Deac wrote: > * Another option is to run an insertion-only relational model on > really any database system you want like PostgreSQL. There is > nothing about preserving history that needs special handling to be > efficient. > > I assume that some sort of structural sharing is needed once the > collections grow above a certain size. Also some support for caching > would be nice. A similar option might be something like https://github.com/BardurArantsson/cqrs *However*, I'm not sure I'd actually recommend using my particular library at this time. I'm probably going to be reworking it (slowly) quite a bit and currently there's no support for persistent[1] queries (see the CQRS/ES description linked from the README). Still, the ideas are sound and pretty simple. (See the PostgreSQL package for exactly what queries CQRS/ES maps to.) [1] As in: stored on disk. Regards, From icfp.publicity at googlemail.com Sat Dec 24 02:56:36 2016 From: icfp.publicity at googlemail.com (Lindsey Kuper) Date: Fri, 23 Dec 2016 18:56:36 -0800 Subject: [Haskell-cafe] Call for Papers: ICFP 2017 Message-ID: <585de3e45eb2b_36f43fd79c865bec71dd@landin.local.mail> ICFP 2017 The 22nd ACM SIGPLAN International Conference on Functional Programming Oxford, United Kingdom http://icfp17.sigplan.org/ Call for Papers ### Important dates Submissions due: Monday, February 27, Anywhere on Earth https://icfp17.hotcrp.com Author response: Monday, April 17, 2017, 15:00 (UTC) - Thursday, April 20, 2017, 15:00 (UTC) Notification: Monday, 1 May, 2017 Final copy due: Monday, 5 June 2017 Early registration: TBA Conference: Monday, 4 September - Wednesday, 6 September, 2017 ### New this year Those familiar with previous ICFP conferences should be aware of two significant changes that are being introduced in 2017: 1. Papers selected for ICFP 2017 will be published as the ICFP 2017 issue of a new journal, Proceedings of the ACM on Programming Languages (PACMPL), which replaces the previous ICFP conference proceedings. The move to PACMPL will have two noticeable impacts on authors: * A new, two-phase selection and reviewing process that conforms to ACM’s journal reviewing guidelines. * A new, single-column format for submissions. 2. Authors of papers that are conditionally accepted in the first phase of the reviewing process will have the option to submit materials for Artifact Evaluation. Further details on each of these changes are included in the following text. ### Scope ICFP 2017 seeks original papers on the art and science of functional programming. Submissions are invited on all topics from principles to practice, from foundations to features, and from abstraction to application. The scope includes all languages that encourage functional programming, including both purely applicative and imperative languages, as well as languages with objects, concurrency, or parallelism. Topics of interest include (but are not limited to): * *Language Design*: concurrency, parallelism, and distribution; modules; components and composition; metaprogramming; type systems; interoperability; domain-specific languages; and relations to imperative, object-oriented, or logic programming. * *Implementation*: abstract machines; virtual machines; interpretation; compilation; compile-time and run-time optimization; garbage collection and memory management; multi-threading; exploiting parallel hardware; interfaces to foreign functions, services, components, or low-level machine resources. * *Software-Development Techniques*: algorithms and data structures; design patterns; specification; verification; validation; proof assistants; debugging; testing; tracing; profiling. * *Foundations*: formal semantics; lambda calculus; rewriting; type theory; monads; continuations; control; state; effects; program verification; dependent types. * *Analysis and Transformation*: control-flow; data-flow; abstract interpretation; partial evaluation; program calculation. * *Applications*: symbolic computing; formal-methods tools; artificial intelligence; systems programming; distributed-systems and web programming; hardware design; databases; XML processing; scientific and numerical computing; graphical user interfaces; multimedia and 3D graphics programming; scripting; system administration; security. * *Education*: teaching introductory programming; parallel programming; mathematical proof; algebra. Submissions will be evaluated according to their relevance, correctness, significance, originality, and clarity. Each submission should explain its contributions in both general and technical terms, clearly identifying what has been accomplished, explaining why it is significant, and comparing it with previous work. The technical content should be accessible to a broad audience. ICFP 2017 also welcomes submissions in two separate categories — Functional Pearls and Experience Reports — that must be marked as such at the time of submission and that need not report original research results. Detailed guidelines on both categories are given at the end of this call. Please contact the program chair if you have questions or are concerned about the appropriateness of a topic. ### Preparation of submissions **Deadline**: The deadline for submissions is Monday, February 27, 2017, Anywhere on Earth (). This deadline will be strictly enforced. **Formatting**: (NOTE: NEW FORMAT REQUIREMENTS FOR ICFP 2017) Submissions must be in PDF format, printable in black and white on US Letter sized paper, and interpretable by common PDF tools. All submissions must adhere to the "ACM Large" template that is available (in both LaTeX and Word formats) from . For authors using LaTeX, a lighter-weight package, including only the essential files, is available from . There is a limit of 24 pages for a full paper or 12 pages for an Experience Report; in either case, the bibliography will not be counted against these limits. These page limits have been chosen to allow essentially the same amount of content with the new single-column format as was possible with the two-column format used in past ICFP conferences. Submissions that exceed the page limits or, for other reasons, do not meet the requirements for formatting, will be summarily rejected. **Submission**: Submissions will be accepted at (in preparation at the time of writing). Improved versions of a paper may be submitted at any point before the submission deadline using the same web interface. **Author Response Period**: Authors will have a 72-hour period, starting at 15:00 UTC on Monday, April 17, 2017, to read reviews and respond to them. **Supplementary Materials**: Authors have the option to attach supplementary material to a submission, on the understanding that reviewers may choose not to look at it. The material should be uploaded at submission time, as a single pdf or a tarball, not via a URL. This supplementary material may or may not be anonymized; if not anonymized, it will only be revealed to reviewers after they have submitted their review of the paper and learned the identity of the author(s). **Authorship Policies**: All submissions are expected to comply with the ACM Policies for Authorship that are detailed at . **Republication Policies**: Each submission must adhere to SIGPLAN's republication policy, as explained on the web at . **Resubmitted Papers**: Authors who submit a revised version of a paper that has previously been rejected by another conference have the option to attach an annotated copy of the reviews of their previous submission(s), explaining how they have addressed these previous reviews in the present submission. If a reviewer identifies him/herself as a reviewer of this previous submission and wishes to see how his/her comments have been addressed, the program chair will communicate to this reviewer the annotated copy of his/her previous review. Otherwise, no reviewer will read the annotated copies of the previous reviews. ### Review Process This section outlines the two-stage process with lightweight double-blind reviewing that will be used to select papers for presentation at ICFP 2017. We anticipate that there will be a need to clarify and expand on this process, and we will maintain a list of frequently asked questions and answers on the conference website to address common concerns. **ICFP 2017 will employ a two-stage review process.** The first stage in the review process will assess submitted papers using the criteria stated above and will allow for feedback and input on initial reviews through the author response period mentioned previously. At the PC meeting, a set of papers will be conditionally accepted and all other papers will be rejected. Authors will be notified of these decisions on May 1, 2017. Authors of conditionally accepted papers will be provided with committee reviews (just as in previous conferences) along with a set of mandatory revisions. After five weeks (June 5, 2017), the authors will provide a second submission. The second and final reviewing phase assesses whether the mandatory revisions have been adequately addressed by the authors and thereby determines the final accept/reject status of the paper. The intent and expectation is that the mandatory revisions can be addressed within five weeks and hence that conditionally accepted papers will in general be accepted in the second phase. The second submission should clearly identify how the mandatory revisions were addressed. To that end, the second submission must be accompanied by a cover letter mapping each mandatory revision request to specific parts of the paper. The cover letter will facilitate a quick second review, allowing for confirmation of final acceptance within two weeks. Conversely, the absence of a cover letter will be grounds for the paper’s rejection. This process is intended as a refinement of the review process that has been used in previous ICFP conferences. By incorporating a second stage, the process will conform to ACM’s journal reviewing guidelines for PACMPL. **ICFP 2017 will employ a lightweight double-blind reviewing process.** To facilitate this, submitted papers must adhere to two rules: 1. **author names and institutions must be omitted**, and 2. **references to authors' own related work should be in the third person** (e.g., not "We build on our previous work ..." but rather "We build on the work of ..."). The purpose of this process is to help the PC and external reviewers come to an initial judgement about the paper without bias, not to make it impossible for them to discover the authors if they were to try. Nothing should be done in the name of anonymity that weakens the submission or makes the job of reviewing the paper more difficult (e.g., important background references should not be omitted or anonymized). In addition, authors should feel free to disseminate their ideas or draft versions of their paper as they normally would. For instance, authors may post drafts of their papers on the web or give talks on their research ideas. ### Information for Authors of Accepted Papers * As a condition of acceptance, final versions of all papers must adhere to the new ACM Large format. The page limits for final versions of papers will be increased to ensure that authors have space to respond to reviewer comments and mandatory revisions. * Authors of accepted submissions will be required to agree to one of the three ACM licensing options: copyright transfer to ACM; retaining copyright but granting ACM exclusive publication rights; or open access on payment of a fee. Further information about ACM author rights is available from . * At least one author of each accepted submissions will be expected to attend and present their paper at the conference. The schedule for presentations will be determined and shared with authors after the full program has been selected. Presentations will be videotaped and released online if the presenter consents. * We intend that the proceedings will be freely available for download from the ACM Digital Library in perpetuity via the OpenTOC mechanism. * ACM Author-Izer is a unique service that enables ACM authors to generate and post links on either their home page or institutional repository for visitors to download the definitive version of their articles from the ACM Digital Library at no charge. Downloads through Author-Izer links are captured in official ACM statistics, improving the accuracy of usage and impact measurements. Consistently linking to the definitive version of an ACM article should reduce user confusion over article versioning. After an article has been published and assigned to the appropriate ACM Author Profile pages, authors should visit to learn how to create links for free downloads from the ACM DL. * 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 the conference. The official publication date affects the deadline for any patent filings related to published work. ### Artifact Evaluation Authors of papers that are conditionally accepted in the first phase of the review process will be encouraged (but not required) to submit supporting materials for Artifact Evaluation. These items will then be reviewed by a committee, separate from the program committee, whose task is to assess how the artifacts support the work described in the associated paper. Papers that go through the Artifact Evaluation process successfully will receive a seal of approval printed on the papers themselves. Authors of accepted papers will be encouraged to make the supporting materials publicly available upon publication of the proceedings, for example, by including them as "source materials" in the ACM Digital Library. An additional seal will mark papers whose artifacts are made available, as outlined in the ACM guidelines for artifact badging. Participation in Artifact Evaluation is voluntary and will not influence the final decision regarding paper acceptance. Further information about the motivations and expectations for Artifact Evaluation can be found at . ### Special categories of papers In addition to research papers, ICFP solicits two kinds of papers that do not require original research contributions: Functional Pearls, which are full papers, and Experience Reports, which are limited to half the length of a full paper. Authors submitting such papers should consider the following guidelines. #### Functional Pearls A Functional Pearl is an elegant essay about something related to functional programming. Examples include, but are not limited to: * a new and thought-provoking way of looking at an old idea * an instructive example of program calculation or proof * a nifty presentation of an old or new data structure * an interesting application of functional programming techniques * a novel use or exposition of functional programming in the classroom While pearls often demonstrate an idea through the development of a short program, there is no requirement or expectation that they do so. Thus, they encompass the notions of theoretical and educational pearls. Functional Pearls are valued as highly and judged as rigorously as ordinary papers, but using somewhat different criteria. In particular, a pearl is not required to report original research, but, it should be concise, instructive, and entertaining. A pearl is likely to be rejected if its readers get bored, if the material gets too complicated, if too much specialized knowledge is needed, or if the writing is inelegant. The key to writing a good pearl is polishing. A submission that is intended to be treated as a pearl must be marked as such on the submission web page, and should contain the words "Functional Pearl" somewhere in its title or subtitle. These steps will alert reviewers to use the appropriate evaluation criteria. Pearls will be combined with ordinary papers, however, for the purpose of computing the conference's acceptance rate. #### Experience Reports The purpose of an Experience Report is to help create a body of published, refereed, citable evidence that functional programming really works — or to describe what obstacles prevent it from working. Possible topics for an Experience Report include, but are not limited to: * insights gained from real-world projects using functional programming * comparison of functional programming with conventional programming in the context of an industrial project or a university curriculum * project-management, business, or legal issues encountered when using functional programming in a real-world project * curricular issues encountered when using functional programming in education * real-world constraints that created special challenges for an implementation of a functional language or for functional programming in general An Experience Report is distinguished from a normal ICFP paper by its title, by its length, and by the criteria used to evaluate it. * Both in the proceedings and in any citations, the title of each accepted Experience Report must begin with the words "Experience Report" followed by a colon. The acceptance rate for Experience Reports will be computed and reported separately from the rate for ordinary papers. * Experience Report submissions can be at most 12 pages long, excluding bibliography. * Each accepted Experience Report will be presented at the conference, but depending on the number of Experience Reports and regular papers accepted, authors of Experience reports may be asked to give shorter talks. * Because the purpose of Experience Reports is to enable our community to accumulate a body of evidence about the efficacy of functional programming, an acceptable Experience Report need not add to the body of knowledge of the functional-programming community by presenting novel results or conclusions. It is sufficient if the Report states a clear thesis and provides supporting evidence. The thesis must be relevant to ICFP, but it need not be novel. The program committee will accept or reject Experience Reports based on whether they judge the evidence to be convincing. Anecdotal evidence will be acceptable provided it is well argued and the author explains what efforts were made to gather as much evidence as possible. Typically, more convincing evidence is obtained from papers which show how functional programming was used than from papers which only say that functional programming was used. The most convincing evidence often includes comparisons of situations before and after the introduction or discontinuation of functional programming. Evidence drawn from a single person's experience may be sufficient, but more weight will be given to evidence drawn from the experience of groups of people. An Experience Report should be short and to the point: it should make a claim about how well functional programming worked on a particular project and why, and produce evidence to substantiate this claim. If functional programming worked in this case in the same ways it has worked for others, the paper need only summarize the results — the main part of the paper should discuss how well it worked and in what context. Most readers will not want to know all the details of the project and its implementation, but the paper should characterize the project and its context well enough so that readers can judge to what degree this experience is relevant to their own projects. The paper should take care to highlight any unusual aspects of the project. Specifics about the project are more valuable than generalities about functional programming; for example, it is more valuable to say that the team delivered its software a month ahead of schedule than it is to say that functional programming made the team more productive. If the paper not only describes experience but also presents new technical results, or if the experience refutes cherished beliefs of the functional-programming community, it may be better off submitted it as a full paper, which will be judged by the usual criteria of novelty, originality, and relevance. The program chair will be happy to advise on any concerns about which category to submit to. ### Organizers General Chair: Jeremy Gibbons (University of Oxford, UK) Program Chair: Mark Jones (Portland State University, USA) Artifact Evaluation Chair: Ryan R. Newton (Indiana University, USA) Industrial Relations Chair: Ryan Trinkle (Obsidian Systems LLC, USA) Programming Contest Organiser: Sam Lindley (University of Edinburgh, UK) Publicity and Web Chair: Lindsey Kuper (Intel Labs, USA) Student Research Competition Chair: Ilya Sergey (University College London, UK) Video Chair: Jose Calderon (Galois, Inc., USA) Workshops Co-Chair: Andres Löh (Well-Typed LLP) Workshops Co-Chair: David Christiansen (Indiana University, USA) Program Committee: Bob Atkey (University of Strathclyde, Scotland) Adam Chlipala (MIT, USA) Dominique Devriese (KU Leuven, Belgium) Martin Erwig (Oregon State, USA) Matthew Flatt (University of Utah, USA) Ronald Garcia (University of British Columbia, Canada) Kathryn Gray (University of Cambridge, England) John Hughes (Chalmers University and Quvik, Sweden) Chung-Kil Hur (Seoul National University, Korea) Graham Hutton (University of Nottingham, England) Alan Jeffrey (Mozilla Research, USA) Ranjit Jhala (University of California, San Diego, USA) Shin-ya Katsumata (Kyoto University, Japan) Lindsey Kuper (Intel Labs, USA) Dan Licata (Wesleyan University, USA) Ben Lippmeier (Digital Asset, Australia) Gabriel Scherer (Northeastern University, USA) Alexandra Silva (University College London, England) Nikhil Swamy (Microsoft Research, USA) Sam Tobin-Hochstadt (Indiana University, USA) Nicolas Wu (University of Bristol, England) Beta Ziliani (CONICET and FAMAF, Universidad Nacional de Córdoba, Argentina) From ovidiudeac at gmail.com Sat Dec 24 15:50:37 2016 From: ovidiudeac at gmail.com (Ovidiu Deac) Date: Sat, 24 Dec 2016 17:50:37 +0200 Subject: [Haskell-cafe] Datomic-like db for Haskell? In-Reply-To: <861swyecy0.fsf@posteo.de> References: <867f6qekd1.fsf@posteo.de> <861swyecy0.fsf@posteo.de> Message-ID: I'll do some research to evaluate my options. So far I have: Homegrown implementation on top of some DB (Riak/Postgres/Mongo...) https://github.com/agentm/project-m36 https://hackage.haskell.org/package/filestore Thanks for the answers! On Fri, Dec 23, 2016 at 8:07 PM, Ertugrul Söylemez wrote: > >> * Another option is to run an insertion-only relational model on > >> really any database system you want like PostgreSQL. There is > >> nothing about preserving history that needs special handling to be > >> efficient. > > > > I assume that some sort of structural sharing is needed once the > > collections grow above a certain size. Also some support for caching > > would be nice. > > Yeah, sharing could improve disk usage and cache utilisation. I'm not > aware of any DBMS-side sharing features in systems I have used > (PostgreSQL and SQLite mainly). The usual way to get sharing in > relational systems is to normalise the schema. That also allows you to > use domain-specific knowledge to get even better sharing. > > Caching is of course supported, at least by PostgreSQL. It aims to keep > as much of the database in memory as possible (or as you tell it to). > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mihai.maruseac at gmail.com Sat Dec 24 19:18:53 2016 From: mihai.maruseac at gmail.com (Mihai Maruseac) Date: Sat, 24 Dec 2016 11:18:53 -0800 Subject: [Haskell-cafe] ANNOUNCE: Haskell Communities and Activities Report (31st ed., November 2016) Message-ID: On behalf of all the contributors, we are pleased to announce that the Haskell Communities and Activities Report (31st edition, November 2016) is now available, in PDF and HTML formats: http://haskell.org/communities/11-2016/report.pdf http://haskell.org/communities/11-2016/html/report.html All previous editions of HCAR can be accessed on the wiki at https://wiki.haskell.org/Haskell_Communities_and_Activities_Report Many thanks go to all the people that contributed to this report, both directly, by sending in descriptions, and indirectly, by doing all the interesting things that are reported. We hope you will find it as interesting a read as we did. If you have not encountered the Haskell Communities and Activities Reports before, you may like to know that the first of these reports was published in November 2001. Their goal is to improve the communication between the increasingly diverse groups, projects, and individuals working on, with, or inspired by Haskell. The idea behind these reports is simple: Every six months, a call goes out to all of you enjoying Haskell to contribute brief summaries of your own area of work. Many of you respond (eagerly, unprompted, and sometimes in time for the actual deadline) to the call. The editors collect all the contributions into a single report and feed that back to the community. When we try for the next update, six months from now, you might want to report on your own work, project, research area or group as well. So, please put the following into your diaries now: ======================================== End of February 2016: target deadline for contributions to the May 2017 edition of the HCAR Report ======================================== Unfortunately, many Haskellers working on interesting projects are so busy with their work that they seem to have lost the time to follow the Haskell related mailing lists and newsgroups, and have trouble even finding time to report on their work. If you are a member, user or friend of a project so burdened, please find someone willing to make time to report and ask them to "register" with the editors for a simple e-mail reminder in November (you could point us to them as well, and we can then politely ask if they want to contribute, but it might work better if you do the initial asking). Of course, they will still have to find the ten to fifteen minutes to draw up their report, but maybe we can increase our coverage of all that is going on in the community. Feel free to circulate this announcement further in order to reach people who might otherwise not see it. Enjoy! -- Mihai Maruseac (MM) "If you can't solve a problem, then there's an easier problem you can solve: find it." -- George Polya From magesh.kuppusamy at gmail.com Sun Dec 25 06:49:27 2016 From: magesh.kuppusamy at gmail.com (Mageshkumar Kuppusamy) Date: Sat, 24 Dec 2016 22:49:27 -0800 Subject: [Haskell-cafe] happy parser generator - stack space overflow error Message-ID: Hello folks, I am generating a parser for SystemVerilog language using happy parser generator. I have the *.y file which i run using happy as below happy -gca ParSysverilog.y and i get the below error. Stack space overflow: current size 8388608 bytes. Use `+RTS -Ksize -RTS' to increase it. to increase the stack size and to get more info on the error, i learned that i need to use something like below. happy -RTS -K16384 -sstderr +RTS -gca ParSysverilog.y but i got an error message happy: Most RTS options are disabled. Link with -rtsopts to enable them. does this mean that, i need to recompile happy source code using the "-rtsopts" to use the +RTS...-RTS options ? any recommendations from your experience ? Thank you in advance Magesh -------------- next part -------------- An HTML attachment was scrubbed... URL: From takenobu.hs at gmail.com Sun Dec 25 08:35:09 2016 From: takenobu.hs at gmail.com (Takenobu Tani) Date: Sun, 25 Dec 2016 17:35:09 +0900 Subject: [Haskell-cafe] many haskell's mails are detected as spam on gmail Message-ID: Hi, I'm using gmail. Recently, many haskell's mails are detected as spam on gmail. (ghc-devs, haskell-cafe, ghc-commit, ...) Does anyone know why? Do you know the workaround? Regards, Takenobu -------------- next part -------------- An HTML attachment was scrubbed... URL: From aeroboy94 at gmail.com Sun Dec 25 09:34:30 2016 From: aeroboy94 at gmail.com (Arian van Putten) Date: Sun, 25 Dec 2016 09:34:30 +0000 Subject: [Haskell-cafe] many haskell's mails are detected as spam on gmail In-Reply-To: References: Message-ID: If I recall correctly it's being worked on. There is a plan to harden the haskell.org domain during the holidays by introducing DKIM and setting up DMARC. There is a thread in haskell-cafe titled "[Haskell-cafe] Work on mail.haskell.org beginning, please report any problems" with more info. On Sun, 25 Dec 2016, 09:35 Takenobu Tani, wrote: Hi, I'm using gmail. Recently, many haskell's mails are detected as spam on gmail. (ghc-devs, haskell-cafe, ghc-commit, ...) Does anyone know why? Do you know the workaround? Regards, Takenobu _______________________________________________ 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 heraldhoi at gmail.com Sun Dec 25 10:25:14 2016 From: heraldhoi at gmail.com (Geraldus) Date: Sun, 25 Dec 2016 10:25:14 +0000 Subject: [Haskell-cafe] many haskell's mails are detected as spam on gmail In-Reply-To: References: Message-ID: I've noticed this too. вс, 25 дек. 2016 г. в 14:34, Arian van Putten : > If I recall correctly it's being worked on. There is a plan to harden the > haskell.org domain during the holidays by introducing DKIM and setting up > DMARC. There is a thread in haskell-cafe titled "[Haskell-cafe] Work on > mail.haskell.org beginning, please report any problems" with more info. > > On Sun, 25 Dec 2016, 09:35 Takenobu Tani, wrote: > > Hi, > > I'm using gmail. > Recently, many haskell's mails are detected as spam on gmail. > (ghc-devs, haskell-cafe, ghc-commit, ...) > > Does anyone know why? > Do you know the workaround? > > Regards, > Takenobu > > _______________________________________________ > 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 takenobu.hs at gmail.com Sun Dec 25 10:37:44 2016 From: takenobu.hs at gmail.com (Takenobu Tani) Date: Sun, 25 Dec 2016 19:37:44 +0900 Subject: [Haskell-cafe] many haskell's mails are detected as spam on gmail In-Reply-To: References: Message-ID: Hi Arian , Thank you for information. At least from about 11th December, detection of the spam have been increasing. I'll report them after I understand it. Regards, Takenobu 2016-12-25 18:34 GMT+09:00 Arian van Putten : > If I recall correctly it's being worked on. There is a plan to harden the > haskell.org domain during the holidays by introducing DKIM and setting up > DMARC. There is a thread in haskell-cafe titled "[Haskell-cafe] Work on > mail.haskell.org beginning, please report any problems" with more info. > > On Sun, 25 Dec 2016, 09:35 Takenobu Tani, wrote: > > Hi, > > I'm using gmail. > Recently, many haskell's mails are detected as spam on gmail. > (ghc-devs, haskell-cafe, ghc-commit, ...) > > Does anyone know why? > Do you know the workaround? > > Regards, > Takenobu > > _______________________________________________ > 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 tdammers at gmail.com Sun Dec 25 11:21:12 2016 From: tdammers at gmail.com (Tobias Dammers) Date: Sun, 25 Dec 2016 12:21:12 +0100 Subject: [Haskell-cafe] happy parser generator - stack space overflow error In-Reply-To: References: Message-ID: In my experience, using one of the excellent parser-combinator libraries out there (megaparsec, attoparsec, trifecta) is usually less painful and perfectly adequate. On Dec 25, 2016 7:49 AM, "Mageshkumar Kuppusamy" wrote: Hello folks, I am generating a parser for SystemVerilog language using happy parser generator. I have the *.y file which i run using happy as below happy -gca ParSysverilog.y and i get the below error. Stack space overflow: current size 8388608 bytes. Use `+RTS -Ksize -RTS' to increase it. to increase the stack size and to get more info on the error, i learned that i need to use something like below. happy -RTS -K16384 -sstderr +RTS -gca ParSysverilog.y but i got an error message happy: Most RTS options are disabled. Link with -rtsopts to enable them. does this mean that, i need to recompile happy source code using the "-rtsopts" to use the +RTS...-RTS options ? any recommendations from your experience ? Thank you in advance Magesh _______________________________________________ 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 johnw at newartisans.com Sun Dec 25 18:20:25 2016 From: johnw at newartisans.com (John Wiegley) Date: Sun, 25 Dec 2016 10:20:25 -0800 Subject: [Haskell-cafe] many haskell's mails are detected as spam on gmail In-Reply-To: (Takenobu Tani's message of "Sun, 25 Dec 2016 17:35:09 +0900") References: Message-ID: >>>>> "TT" == Takenobu Tani writes: TT> I'm using gmail. TT> Recently, many haskell's mails are detected as spam on gmail. TT> (ghc-devs, haskell-cafe, ghc-commit, ...) TT> Does anyone know why? TT> Do you know the workaround? This could be due to changes I've made recently on the mail server. Can you please send the full text of some of those mails to jwiegley at gmail.com? Thanks, -- John Wiegley GPG fingerprint = 4710 CF98 AF9B 327B B80F http://newartisans.com 60E1 46C4 BD1A 7AC1 4BA2 From trebla at vex.net Sun Dec 25 19:32:23 2016 From: trebla at vex.net (Albert Y. C. Lai) Date: Sun, 25 Dec 2016 14:32:23 -0500 Subject: [Haskell-cafe] happy parser generator - stack space overflow error In-Reply-To: References: Message-ID: On 2016-12-25 01:49 AM, Mageshkumar Kuppusamy wrote: > happy -gca ParSysverilog.y and i get the below error. > > Stack space overflow: current size 8388608 bytes. > Use `+RTS -Ksize -RTS' to increase it. This is strange (read: archaic) because GHC since 7.10 (or maybe earlier) has been defaulting stack size to "80% physical memory size" rather than 8MB. Contrapositively, seeing the 8MB cap implies that your copy of happy was built by a pretty old GHC. So simply rebuild happy by a recent GHC to enjoy the modern stack cap. From allbery.b at gmail.com Sun Dec 25 19:34:11 2016 From: allbery.b at gmail.com (Brandon Allbery) Date: Sun, 25 Dec 2016 14:34:11 -0500 Subject: [Haskell-cafe] happy parser generator - stack space overflow error In-Reply-To: References: Message-ID: On Sun, Dec 25, 2016 at 2:32 PM, Albert Y. C. Lai wrote: > This is strange (read: archaic) because GHC since 7.10 (or maybe earlier) > has been defaulting stack size to "80% physical memory size" rather than > 8MB. Contrapositively, seeing the 8MB cap implies that your copy of happy > was built by a pretty old GHC. 7.8, I think --- meaning this is probably Debian with 7.6 from packages. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From mihai.maruseac at gmail.com Sun Dec 25 21:38:07 2016 From: mihai.maruseac at gmail.com (Mihai Maruseac) Date: Sun, 25 Dec 2016 13:38:07 -0800 Subject: [Haskell-cafe] many haskell's mails are detected as spam on gmail In-Reply-To: References: Message-ID: I noticed this before the announcements of those changes. It was only for e-mails sent from Yahoo! mail. Since I know that Yahoo! has some stupid policies regarding DMARC I ignored it. This is an issue with almost all mailing lists in the world, just Yahoo! using stupid settings. On Sun, Dec 25, 2016 at 10:20 AM, John Wiegley wrote: >>>>>> "TT" == Takenobu Tani writes: > > TT> I'm using gmail. > TT> Recently, many haskell's mails are detected as spam on gmail. > TT> (ghc-devs, haskell-cafe, ghc-commit, ...) > > TT> Does anyone know why? > TT> Do you know the workaround? > > This could be due to changes I've made recently on the mail server. Can you > please send the full text of some of those mails to jwiegley at gmail.com? > > Thanks, > -- > John Wiegley GPG fingerprint = 4710 CF98 AF9B 327B B80F > http://newartisans.com 60E1 46C4 BD1A 7AC1 4BA2 > _______________________________________________ > 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. -- Mihai Maruseac (MM) "If you can't solve a problem, then there's an easier problem you can solve: find it." -- George Polya From ietf-dane at dukhovni.org Sun Dec 25 22:59:36 2016 From: ietf-dane at dukhovni.org (Viktor Dukhovni) Date: Sun, 25 Dec 2016 22:59:36 +0000 Subject: [Haskell-cafe] many haskell's mails are detected as spam on gmail In-Reply-To: References: Message-ID: <20161225225936.GO13486@mournblade.imrryr.org> On Sun, Dec 25, 2016 at 01:38:07PM -0800, Mihai Maruseac wrote: > I noticed this before the announcements of those changes. It was only > for e-mails sent from Yahoo! mail. > > Since I know that Yahoo! has some stupid policies regarding DMARC I > ignored it. This is an issue with almost all mailing lists in the > world, just Yahoo! using stupid settings. There are a few choices for working around this issue. My personal preference, which I hope is acceptable to the list community, is to avoid modifying the message subject and body. That is, the onus of adding a "[Haskell-cafe] " subject prefix falls on message authors (and those who respond if the tag is not yet present). And the list [message footer is not added. _______________________________________________ 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. The "List-" headers contain all the requisite (un)sub information. If leaving the message unmolested is deemed no acceptable, then the "mailman" list manager provides a number of alternative DMARC work-arounds that mangle the message "From" field in various ways. Consult the mailman docs. -- Viktor. From johnw at newartisans.com Mon Dec 26 07:40:03 2016 From: johnw at newartisans.com (John Wiegley) Date: Sun, 25 Dec 2016 23:40:03 -0800 Subject: [Haskell-cafe] many haskell's mails are detected as spam on gmail In-Reply-To: <20161225225936.GO13486@mournblade.imrryr.org> (Viktor Dukhovni's message of "Sun, 25 Dec 2016 22:59:36 +0000") References: <20161225225936.GO13486@mournblade.imrryr.org> Message-ID: >>>>> "VD" == Viktor Dukhovni writes: VD> If leaving the message unmolested is deemed no acceptable, then the VD> "mailman" list manager provides a number of alternative DMARC work-arounds VD> that mangle the message "From" field in various ways. Consult the mailman VD> docs. We recently enabled these workarounds (I think about 6 months ago?) in response to others telling us that mail wasn't being delivered. I think Gershom remembers doing this. Apparently, it's not enough of a solution. -- John Wiegley GPG fingerprint = 4710 CF98 AF9B 327B B80F http://newartisans.com 60E1 46C4 BD1A 7AC1 4BA2 From jo at durchholz.org Mon Dec 26 11:31:34 2016 From: jo at durchholz.org (Joachim Durchholz) Date: Mon, 26 Dec 2016 12:31:34 +0100 Subject: [Haskell-cafe] many haskell's mails are detected as spam on gmail In-Reply-To: <20161225225936.GO13486@mournblade.imrryr.org> References: <20161225225936.GO13486@mournblade.imrryr.org> Message-ID: <57b81f6a-7c20-4aa6-333f-17fb87cbc579@durchholz.org> Am 25.12.2016 um 23:59 schrieb Viktor Dukhovni: > My personal > preference, which I hope is acceptable to the list community, is > to avoid modifying the message subject and body. Does this also mean you cannot modify headers? That would be bad, because having a List-Id header enables "reply to list" and such. > That is, the onus > of adding a "[Haskell-cafe] " subject prefix falls on message > authors (and those who respond if the tag is not yet present). I never understood why people want to mangle the subject line anyway; the recipient is easily seen in the "recipient" column of the list of mails. But maybe there's a reason to not have that column, IDK. > And the list [message footer is not added. The footer is actually nice to have. But in my book, that's not important enough to hinder dealing with spam filters. Just my 2c. Jo From ietf-dane at dukhovni.org Mon Dec 26 16:40:56 2016 From: ietf-dane at dukhovni.org (Viktor Dukhovni) Date: Mon, 26 Dec 2016 11:40:56 -0500 Subject: [Haskell-cafe] many haskell's mails are detected as spam on gmail In-Reply-To: <57b81f6a-7c20-4aa6-333f-17fb87cbc579@durchholz.org> References: <20161225225936.GO13486@mournblade.imrryr.org> <57b81f6a-7c20-4aa6-333f-17fb87cbc579@durchholz.org> Message-ID: <541F412F-679B-406E-B9A4-913E39B42595@dukhovni.org> > On Dec 26, 2016, at 6:31 AM, Joachim Durchholz wrote: > >> My personal >> preference, which I hope is acceptable to the list community, is >> to avoid modifying the message subject and body. > > Does this also mean you cannot modify headers? It means that you can add headers, but should avoid changing headers that are already present. DKIM signatures generally cover those headers that already present in a message, and leave room for additional headers. > That would be bad, because having a List-Id header enables "reply to list" and such. The addition of "List-" headers does not break DKIM signatures, as origin DKIM signatures do not cover these (absent at the origin) headers. (I'm over simplifying, but the fine points are not important here). > > That is, the onus >> of adding a "[Haskell-cafe] " subject prefix falls on message >> authors (and those who respond if the tag is not yet present). > > I never understood why people want to mangle the subject line anyway; > the recipient is easily seen in the "recipient" column of the list of > mails. But maybe there's a reason to not have that column, IDK. Some people really want subject tags. If they can do without, it is easier to avoid DMARC trouble, provided they can also do without footers. >> And the list [message footer is not added. > > The footer is actually nice to have. > But in my book, that's not important enough to hinder dealing with > spam filters. Both the footer and subject tags would need to go. There's no point in changing just one of the settings. The DKIM signature covers both the message headers (as present at the origin) and the body content. -- Viktor. From olopierpa at gmail.com Mon Dec 26 16:51:57 2016 From: olopierpa at gmail.com (Pierpaolo Bernardi) Date: Mon, 26 Dec 2016 17:51:57 +0100 Subject: [Haskell-cafe] many haskell's mails are detected as spam on gmail In-Reply-To: <57b81f6a-7c20-4aa6-333f-17fb87cbc579@durchholz.org> References: <20161225225936.GO13486@mournblade.imrryr.org> <57b81f6a-7c20-4aa6-333f-17fb87cbc579@durchholz.org> Message-ID: On Mon, Dec 26, 2016 at 12:31 PM, Joachim Durchholz wrote: > Am 25.12.2016 um 23:59 schrieb Viktor Dukhovni: > I never understood why people want to mangle the subject line anyway; the > recipient is easily seen in the "recipient" column of the list of mails. But > maybe there's a reason to not have that column, IDK. Emails don't have "columns". These must be a feature of the particular email client you use. From fa-ml at ariis.it Mon Dec 26 19:25:57 2016 From: fa-ml at ariis.it (Francesco Ariis) Date: Mon, 26 Dec 2016 20:25:57 +0100 Subject: [Haskell-cafe] many haskell's mails are detected as spam on gmail In-Reply-To: <20161225225936.GO13486@mournblade.imrryr.org> References: <20161225225936.GO13486@mournblade.imrryr.org> Message-ID: <20161226192557.GA6048@casa.casa> On Sun, Dec 25, 2016 at 10:59:36PM +0000, Viktor Dukhovni wrote: > And the list [message footer is not added. > > _______________________________________________ > 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. > > The "List-" headers contain all the requisite (un)sub information. I wouldn't delete the footer, especially the unsub information. Some users are new to mailing lists and how they work; I frequently witness frustration and misunderstandings over how to unsubscribe. From ietf-dane at dukhovni.org Mon Dec 26 20:22:36 2016 From: ietf-dane at dukhovni.org (Viktor Dukhovni) Date: Mon, 26 Dec 2016 15:22:36 -0500 Subject: [Haskell-cafe] many haskell's mails are detected as spam on gmail In-Reply-To: <20161226192557.GA6048@casa.casa> References: <20161225225936.GO13486@mournblade.imrryr.org> <20161226192557.GA6048@casa.casa> Message-ID: <5FB51C79-AF33-4A45-8D66-DA85CF8C9383@dukhovni.org> > On Dec 26, 2016, at 2:25 PM, Francesco Ariis wrote: > > > I wouldn't delete the footer, especially the unsub information. > Some users are new to mailing lists and how they work; I frequently > witness frustration and misunderstandings over how to unsubscribe. Sure, but it is a trade-off. DMARC imposes a penalty on adding a footer, the DKIM signature breaks, and p=reject kicks in, unless we start mangling the From lines, which is IMHO worse, but opinions vary... On the postfix-users list, majordomo (not mailman) is configured to detect various attempts at (un)sub and blocks the post, responding to the user instead with helpful directions. False positives happen rarely, but as the list is email related, not never, and one has to rephrase some posts to get around the filter. -- Viktor. From makos999 at gmail.com Mon Dec 26 23:35:54 2016 From: makos999 at gmail.com (Akos Marton) Date: Mon, 26 Dec 2016 15:35:54 -0800 (PST) Subject: [Haskell-cafe] Call for new Stackage Curator In-Reply-To: References: Message-ID: Might be late, but also interested in providing help! :) -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at nh2.me Tue Dec 27 10:11:31 2016 From: mail at nh2.me (=?UTF-8?Q?Niklas_Hamb=c3=bcchen?=) Date: Tue, 27 Dec 2016 11:11:31 +0100 Subject: [Haskell-cafe] many haskell's mails are detected as spam on gmail In-Reply-To: References: Message-ID: <03ba2967-2a3e-caf9-7937-9ebf9bf315e2@nh2.me> Despite Google's public claims to the contrary, I have found the Gmail spam filter not to work too reliably; I've had cases where it blocked important emails like "OK, here's my invoice (PDF attached)" in the middle of long email threads, of which messages were otherwise let through without problem. As a result, I disabled the Gmail spam filter completely; these instructions worked for me: http://webapps.stackexchange.com/questions/69442/how-to-disable-gmail-anti-spam-completely You may consider this too if the various technical things people are working on in the other replies don't improve the situation for you. On 25/12/16 09:35, Takenobu Tani wrote: > Hi, > > I'm using gmail. > Recently, many haskell's mails are detected as spam on gmail. > (ghc-devs, haskell-cafe, ghc-commit, ...) > > Does anyone know why? > Do you know the workaround? > > Regards, > Takenobu > > > > _______________________________________________ > ghc-devs mailing list > ghc-devs at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs > From allbery.b at gmail.com Tue Dec 27 13:46:44 2016 From: allbery.b at gmail.com (Brandon Allbery) Date: Tue, 27 Dec 2016 08:46:44 -0500 Subject: [Haskell-cafe] many haskell's mails are detected as spam on gmail In-Reply-To: <03ba2967-2a3e-caf9-7937-9ebf9bf315e2@nh2.me> References: <03ba2967-2a3e-caf9-7937-9ebf9bf315e2@nh2.me> Message-ID: On Tue, Dec 27, 2016 at 5:11 AM, Niklas Hambüchen wrote: > Despite Google's public claims to the contrary, I have found the Gmail > spam filter not to work too reliably > I think it depends on your use case (and it's rather indicative of the core problem of spam detection that spam is hard to distinguish from real messages about e.g. attached invoices). I've had maybe 8 Haskell list messages land in my spamtrap, gradually getting rarer as I "mark as not spam" them. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From simon at joyful.com Tue Dec 27 20:17:27 2016 From: simon at joyful.com (Simon Michael) Date: Tue, 27 Dec 2016 12:17:27 -0800 Subject: [Haskell-cafe] hackagebot future ? Message-ID: <69EAC40D-191F-4010-8776-6BD6B091678D@joyful.com> Hello all, hackagebot is the bot I've been maintaining for a few years which announces new hackage uploads in the #haskell IRC channel. I've tried to keep it "a well-behaved, non-annoying bot". It's configured to announce up to 5 uploads at a time, with at least a 5 minute interval between announcements. As our community grows, upload activity increases, and more megaprojects with many uploads appear, I've seen more complaints about the noise, and noticed channel ops muting it temporarily. A few weeks ago this happened, and also a possible problem with the correctness of the announcements or the feed was reported. I didn't have time to investigate, so I left it offline, inviting feedback if anyone missed it. Since then I've heard nothing. So, even though I personally like seeing the uploads, and the conversations and connections that sometimes result, I'm inclined to let hackagebot rest indefinitely. Or, would a new maintainer like to take it on ? If you have feelings about it one way or the other, please reply on-list. Thanks! -Simon From mail at joachim-breitner.de Tue Dec 27 22:22:26 2016 From: mail at joachim-breitner.de (Joachim Breitner) Date: Tue, 27 Dec 2016 23:22:26 +0100 Subject: [Haskell-cafe] hackagebot future ? In-Reply-To: <69EAC40D-191F-4010-8776-6BD6B091678D@joyful.com> References: <69EAC40D-191F-4010-8776-6BD6B091678D@joyful.com> Message-ID: <1482877346.22137.0.camel@joachim-breitner.de> Hi, Am Dienstag, den 27.12.2016, 12:17 -0800 schrieb Simon Michael: > So, even though I personally like seeing the uploads, and the > conversations and connections that sometimes result me too! But I only stop by IRC when I have an agenda these days, so it doesn’t matter to me much more. 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: 833 bytes Desc: This is a digitally signed message part URL: From joehillen at gmail.com Tue Dec 27 22:58:42 2016 From: joehillen at gmail.com (Joe Hillenbrand) Date: Tue, 27 Dec 2016 14:58:42 -0800 Subject: [Haskell-cafe] hackagebot future ? In-Reply-To: <69EAC40D-191F-4010-8776-6BD6B091678D@joyful.com> References: <69EAC40D-191F-4010-8776-6BD6B091678D@joyful.com> Message-ID: I get my release announcements from http://haskellnews.org/ On Tue, Dec 27, 2016 at 12:17 PM, Simon Michael wrote: > Hello all, > > hackagebot is the bot I've been maintaining for a few years which announces new hackage uploads in the #haskell IRC channel. I've tried to keep it "a well-behaved, non-annoying bot". It's configured to announce up to 5 uploads at a time, with at least a 5 minute interval between announcements. > > As our community grows, upload activity increases, and more megaprojects with many uploads appear, I've seen more complaints about the noise, and noticed channel ops muting it temporarily. A few weeks ago this happened, and also a possible problem with the correctness of the announcements or the feed was reported. I didn't have time to investigate, so I left it offline, inviting feedback if anyone missed it. > > Since then I've heard nothing. So, even though I personally like seeing the uploads, and the conversations and connections that sometimes result, I'm inclined to let hackagebot rest indefinitely. Or, would a new maintainer like to take it on ? If you have feelings about it one way or the other, please reply on-list. > > Thanks! > -Simon > > > _______________________________________________ > 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 jays at panix.com Wed Dec 28 02:51:50 2016 From: jays at panix.com (Jay Sulzberger) Date: Tue, 27 Dec 2016 21:51:50 -0500 (EST) Subject: [Haskell-cafe] hackagebot future ? In-Reply-To: <69EAC40D-191F-4010-8776-6BD6B091678D@joyful.com> References: <69EAC40D-191F-4010-8776-6BD6B091678D@joyful.com> Message-ID: On Tue, 27 Dec 2016, Simon Michael wrote: > Hello all, > > hackagebot is the bot I've been maintaining for a few years > which announces new hackage uploads in the #haskell IRC > channel. I've tried to keep it "a well-behaved, non-annoying > bot". It's configured to announce up to 5 uploads at a time, > with at least a 5 minute interval between announcements. > > As our community grows, upload activity increases, and more > megaprojects with many uploads appear, I've seen more > complaints about the noise, and noticed channel ops muting it > temporarily. A few weeks ago this happened, and also a possible > problem with the correctness of the announcements or the feed > was reported. I didn't have time to investigate, so I left it > offline, inviting feedback if anyone missed it. > > Since then I've heard nothing. So, even though I personally > like seeing the uploads, and the conversations and connections > that sometimes result, I'm inclined to let hackagebot rest > indefinitely. Or, would a new maintainer like to take it on ? > If you have feelings about it one way or the other, please > reply on-list. > > Thanks! > -Simon Perhaps one could send a signal to hackagebot telling it to not send announcements, or perhaps to queue 'em up and then send a batch when requested. Or maybe have the bot just send a pointer to today's web page with all of today's announcements, neatly laid out. oo--JS. From allbery.b at gmail.com Wed Dec 28 03:00:37 2016 From: allbery.b at gmail.com (Brandon Allbery) Date: Tue, 27 Dec 2016 22:00:37 -0500 Subject: [Haskell-cafe] hackagebot future ? In-Reply-To: References: <69EAC40D-191F-4010-8776-6BD6B091678D@joyful.com> Message-ID: One of the issues that was brought up was that there was a bit of a flood of badly filled out cabal/stack projects uploaded at one point, so the channel got treated to a lot of "foo: Initial project template" announcements. Not much a bot can do about that, but it does increase the frustration level in-channel a fair bit and make people wonder if an announce bot is worth the trouble. On Tue, Dec 27, 2016 at 9:51 PM, Jay Sulzberger wrote: > > On Tue, 27 Dec 2016, Simon Michael wrote: > > Hello all, >> >> hackagebot is the bot I've been maintaining for a few years >> which announces new hackage uploads in the #haskell IRC >> channel. I've tried to keep it "a well-behaved, non-annoying >> bot". It's configured to announce up to 5 uploads at a time, >> with at least a 5 minute interval between announcements. >> >> As our community grows, upload activity increases, and more >> megaprojects with many uploads appear, I've seen more >> complaints about the noise, and noticed channel ops muting it >> temporarily. A few weeks ago this happened, and also a possible >> problem with the correctness of the announcements or the feed >> was reported. I didn't have time to investigate, so I left it >> offline, inviting feedback if anyone missed it. >> >> Since then I've heard nothing. So, even though I personally >> like seeing the uploads, and the conversations and connections >> that sometimes result, I'm inclined to let hackagebot rest >> indefinitely. Or, would a new maintainer like to take it on ? >> If you have feelings about it one way or the other, please >> reply on-list. >> >> Thanks! >> -Simon >> > > Perhaps one could send a signal to hackagebot telling it to not > send announcements, or perhaps to queue 'em up and then send a > batch when requested. Or maybe have the bot just send a pointer > to today's web page with all of today's announcements, neatly > laid out. > > oo--JS. > > > _______________________________________________ > 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. > -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From jays at panix.com Wed Dec 28 03:11:19 2016 From: jays at panix.com (Jay Sulzberger) Date: Tue, 27 Dec 2016 22:11:19 -0500 (EST) Subject: [Haskell-cafe] hackagebot future ? In-Reply-To: References: <69EAC40D-191F-4010-8776-6BD6B091678D@joyful.com> Message-ID: On Tue, 27 Dec 2016, Brandon Allbery wrote: > One of the issues that was brought up was that there was a bit of a flood > of badly filled out cabal/stack projects uploaded at one point, so the > channel got treated to a lot of "foo: Initial project template" > announcements. Not much a bot can do about that, but it does increase the > frustration level in-channel a fair bit and make people wonder if an > announce bot is worth the trouble. Ah, OK. Last week I gave to the Hackage search engine "Lambda Calculus". I got back many projects. oo--JS. > > On Tue, Dec 27, 2016 at 9:51 PM, Jay Sulzberger wrote: > >> >> On Tue, 27 Dec 2016, Simon Michael wrote: >> >> Hello all, >>> >>> hackagebot is the bot I've been maintaining for a few years >>> which announces new hackage uploads in the #haskell IRC >>> channel. I've tried to keep it "a well-behaved, non-annoying >>> bot". It's configured to announce up to 5 uploads at a time, >>> with at least a 5 minute interval between announcements. >>> >>> As our community grows, upload activity increases, and more >>> megaprojects with many uploads appear, I've seen more >>> complaints about the noise, and noticed channel ops muting it >>> temporarily. A few weeks ago this happened, and also a possible >>> problem with the correctness of the announcements or the feed >>> was reported. I didn't have time to investigate, so I left it >>> offline, inviting feedback if anyone missed it. >>> >>> Since then I've heard nothing. So, even though I personally >>> like seeing the uploads, and the conversations and connections >>> that sometimes result, I'm inclined to let hackagebot rest >>> indefinitely. Or, would a new maintainer like to take it on ? >>> If you have feelings about it one way or the other, please >>> reply on-list. >>> >>> Thanks! >>> -Simon >>> >> >> Perhaps one could send a signal to hackagebot telling it to not >> send announcements, or perhaps to queue 'em up and then send a >> batch when requested. Or maybe have the bot just send a pointer >> to today's web page with all of today's announcements, neatly >> laid out. >> >> oo--JS. >> >> >> _______________________________________________ >> 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. >> > > > > -- > brandon s allbery kf8nh sine nomine associates > allbery.b at gmail.com ballbery at sinenomine.net > unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net > From lambda.fairy at gmail.com Wed Dec 28 06:07:23 2016 From: lambda.fairy at gmail.com (Chris Wong) Date: Wed, 28 Dec 2016 19:07:23 +1300 Subject: [Haskell-cafe] hackagebot future ? In-Reply-To: <69EAC40D-191F-4010-8776-6BD6B091678D@joyful.com> References: <69EAC40D-191F-4010-8776-6BD6B091678D@joyful.com> Message-ID: Hi Simon, I maintain an analogous bot for the Rust community, [1] which also happens to be written in Haskell (for frivolous reasons). I thought it would be useful to share my experience. > ... As our community grows, upload activity increases, and more megaprojects with many uploads appear, I've seen more complaints about the noise, and noticed channel ops muting it temporarily. ... To avoid drowning out discussion, we moved all the bots to their own #rust-bots channel. This solution has worked well for us so far, and lets my bot run with a looser rate limit (20 uploads per minute). We announce compiler+stdlib changes and CI results on there as well. > Since then I've heard nothing. So, even though I personally like seeing the uploads, and the conversations and connections that sometimes result, I'm inclined to let hackagebot rest indefinitely. Or, would a new maintainer like to take it on ? If you have feelings about it one way or the other, please reply on-list. I guess another solution could be to batch up these announcements, and if there are too many of them, send them in a condensed form. Something like this: [hackagebot] New: twilight-0.1, pinkie-0.0. Updated: applejack-0.3.7, rarity-1.0.1.1, fluttershy-4.3.2. [hackagebot] Read more at https://hackage.haskell.org/packages/recent This may be better than the "separate channel" solution if we want to encourage conversation about these new packages. I would be happy to take on maintaining hackagebot. Since I'm already running one package announcer, adding a second shouldn't be too much of a burden 😉. It'd be interesting to see if the two code bases can be merged, and if we could rewrite the bot to use irc-core [2] instead of a home-grown thing. Chris [1] https://github.com/lfairy/hircine/tree/master/brigitte [2] https://hackage.haskell.org/package/irc-core -- 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 codygman.consulting at gmail.com Wed Dec 28 07:28:11 2016 From: codygman.consulting at gmail.com (Cody Goodman) Date: Wed, 28 Dec 2016 01:28:11 -0600 Subject: [Haskell-cafe] Multi groupby with foldl' and Map.insertWithKey Message-ID: My goal is to take data like this: [ Info 0 "Alcohol" "TX" , Info 1 "Alcohol" "TX" , Info 2 "Pregnancy" "MA" ] and build a Map like this: [("MA",[("Pregnancy",1)]),("TX",[("Alcohol",2)])] Here is my failed attempt: {-# LANGUAGE ScopedTypeVariables, BangPatterns #-} import qualified Data.Map as M import Data.List (foldl') import Data.Maybe import Debug.Trace data Info = Info { i :: !Int, healthTopic :: !String, state :: !String } deriving Show m :: M.Map String (M.Map String Integer) m = M.fromList [("MA", M.fromList[("Pregnancy",1)]),("TX", M.fromList[("Alcohol",2)])] constantValsPerState = foldl' (\accum currentRow -> do M.insert (state currentRow) "xxx" accum ) M.empty [ Info 0 "Alcohol" "TX" , Info 1 "Alcohol" "TX" , Info 2 "Pregnancy" "MA" ] -- λ> constantValsPerState -- fromList [("MA","xxx"),("TX","xxx")] -- how can I get something like: -- λ> numTopicsPerState -- fromList [("MA", fromList[("Pregnancy",1)]),("TX", fromList[("Alcohol",2)])] -- so we need to give the modified stae of the new map isntead of M.empty -- λ> m -- fromList [("MA",fromList [("Pregnancy",1)]),("TX",fromList [("Alcohol",2)])] -- λ> M.insertWith (\new old -> new) "MA" M.empty m -- fromList [("MA",fromList []),("TX",fromList [("Alcohol",2)])] numTopicsPerState = foldl' (\(accum :: M.Map String (M.Map String Integer)) currentRow -> do M.insertWithKey (\k new old -> M.insert (healthTopic currentRow) ((fromMaybe 0 $ M.lookup (healthTopic currentRow) old) + 1) new ) (state currentRow) (fromMaybe (M.empty) (M.lookup (state currentRow) accum)) accum ) M.empty [ Info 0 "Alcohol" "TX" , Info 1 "Alcohol" "TX" , Info 2 "Pregnancy" "MA" ] -- WRONG OUTPUT -- λ> numTopicsPerState -- fromList [("MA",fromList []),("TX",fromList [("Alcohol",1)])] -- TODO -- turn -- fromList [("Alcohol",fromList []),("MA",fromList [("Pregnancy",1)]),("TX",fromList [("Alcohol",2)])] -- into -- fromList [("MA",fromList [("Pregnancy",1)]),("TX",fromList [("Alcohol",3)])] -------------- next part -------------- An HTML attachment was scrubbed... URL: From alex at kazik.de Wed Dec 28 07:54:41 2016 From: alex at kazik.de (ALeX Kazik) Date: Wed, 28 Dec 2016 08:54:41 +0100 Subject: [Haskell-cafe] Multi groupby with foldl' and Map.insertWithKey In-Reply-To: References: Message-ID: > My goal is to take data like this: > and build a Map like this: you do not want to insert into the map but alter instead: numTopicsPerState :: M.Map String (M.Map String Integer) numTopicsPerState = foldl' addState M.empty [ Info 0 "Alcohol" "TX" , Info 1 "Alcohol" "TX" , Info 2 "Pregnancy" "MA" ] where addState accum currentRow = M.alter addTopic (state currentRow) accum where addTopic accum = Just $ M.alter incCount (healthTopic currentRow) (fromMaybe M.empty accum) incCount oldCount = Just $ 1 + fromMaybe 0 oldCount From jo at durchholz.org Wed Dec 28 10:09:18 2016 From: jo at durchholz.org (Joachim Durchholz) Date: Wed, 28 Dec 2016 11:09:18 +0100 Subject: [Haskell-cafe] hackagebot future ? In-Reply-To: References: <69EAC40D-191F-4010-8776-6BD6B091678D@joyful.com> Message-ID: Am 28.12.2016 um 03:51 schrieb Jay Sulzberger: > Perhaps one could send a signal to hackagebot telling it to not > send announcements, If one person requests a list, then others might be annoyed because of the noise; moving from push to pull is not a solution for noise. If announcements are to be curated, a bot could be made to post something only on request. Maybe one could integrate a one-line text input field on the upload page on Hackage: In-chat announcement (why is this upload noteworthy?): [______] > or perhaps to queue 'em up and then send a > batch when requested. > > Or maybe have the bot just send a pointer > to today's web page with all of today's announcements, neatly > laid out. The value of chat is that it is instant. For other delivery modes, other media are easier to use: - A mailing list for batched updates. - A web page for people who prefer to pull info when they want it. From olf at aatal-apotheke.de Wed Dec 28 13:07:44 2016 From: olf at aatal-apotheke.de (Olaf Klinke) Date: Wed, 28 Dec 2016 14:07:44 +0100 Subject: [Haskell-cafe] Multi groupby with foldl' and Map.insertWithKey Message-ID: <95754462-9F1B-4A84-B878-08A6B1FEC011@aatal-apotheke.de> I'd say the cleanest way to go is to split your Info data structure into an intermediate key and a value part like so: type Key = String data Value = Value {count :: !Int, healthTopics :: ![String]} keyvalue :: Info -> (Key,Value) keyvalue (Info _ h k) = (k,Value 1 [h]) and give Value a Monoid instance: instance Monoid Value where mempty = Value 0 [] mappend (Value c s) (Value c' s') = Value (c+c') (s++s') (Or you could use (Sum Int) instead of Int and have type Value = (Sum Int,[String]). Then the Monoid instance is derived for you.) Now you can transform a list of Infos into a Map using a generic function: makeMap :: [Info] -> M.Map Key Value makeMap = M.fromListWith mappend . map keyvalue Semantically, it's pretty identical to ALeX Kazik's suggestion of using foldl' and alter. Internally, fromListWith uses a strict fold, so strictness should be the same as using foldl'. Olaf From anatoly.zaretsky at gmail.com Wed Dec 28 13:55:11 2016 From: anatoly.zaretsky at gmail.com (Anatoly Zaretsky) Date: Wed, 28 Dec 2016 15:55:11 +0200 Subject: [Haskell-cafe] Multi groupby with foldl' and Map.insertWithKey In-Reply-To: References: Message-ID: On Wed, Dec 28, 2016 at 9:28 AM, Cody Goodman wrote: > My goal is to take data like this: > > [ Info 0 "Alcohol" "TX" > , Info 1 "Alcohol" "TX" > , Info 2 "Pregnancy" "MA" > ] > > and build a Map like this: > > [("MA",[("Pregnancy",1)]),("TX",[("Alcohol",2)])] > You can convert each individual record to a singleton map: wrapRecord :: Info -> M.Map String (M.Map String Integer) wrapRecord (Info _ state healthTopic) = M.singleton state (M.singleton healthTopic 1) and then union all these singletons: numTopicsPerState = M.unionsWith (M.unionWith (+)) . map wrapRecord $ [Info 0 "Alcohol" "TX", Info 1 "Alcohol" "TX", Info 2 "Pregnancy" "MA"] -------------- next part -------------- An HTML attachment was scrubbed... URL: From hon.lianhung at gmail.com Wed Dec 28 14:20:50 2016 From: hon.lianhung at gmail.com (Lian Hung Hon) Date: Wed, 28 Dec 2016 22:20:50 +0800 Subject: [Haskell-cafe] threadDelay delays less time than expected (Windows) Message-ID: Dear Haskellers, I am baffled by a strange bug (?) with threadDelay on Windows. It delays for less time than expected (500 seconds vs expected 24 hours), and is consistently reproducible on my system. Can someone have a look (need some patience, ~8 minutes waiting), just to be sure? I glanced around trac but didn't find any related issues. How to reproduce: module Main where import Data.Time import Control.Concurrent import Control.Monad main :: IO () main = do _ <- forkIO thread getLine >>= print -- Just to keep the main thread running thread :: IO () thread = forever $ do now <- getCurrentTime print now threadDelay 86400000000 print "done waiting" Expected result: 2016-12-28 13:07:49.5113098 UTC ... (next timing should be the next day 2016-12-29) Actual result: 2016-12-28 13:07:49.5113098 UTC "done waiting" 2016-12-28 13:16:10.2159485 UTC "done waiting" 2016-12-28 13:24:30.8735845 UTC "done waiting" 2016-12-28 13:32:51.5292203 UTC ... System: Windows 7 Enterprise Service Pack 1, ghc 7.10.3 This seems specific to Windows, it doesn't appear on Debian 8. Help is appreciated! Regards, Hon Rant: It has cost me significant debugging time! Please tell me I made a rookie mistake or misread the docs somewhere! -------------- next part -------------- An HTML attachment was scrubbed... URL: From amindfv at gmail.com Wed Dec 28 16:51:48 2016 From: amindfv at gmail.com (amindfv at gmail.com) Date: Wed, 28 Dec 2016 10:51:48 -0600 Subject: [Haskell-cafe] threadDelay delays less time than expected (Windows) In-Reply-To: References: Message-ID: (86400000000 :: Integer) > (fromIntegral (maxBound :: Int)) If True, your machine (32-bit?) is probably overflowing the Int Tom > El 28 dic 2016, a las 08:20, Lian Hung Hon escribió: > > Dear Haskellers, > > I am baffled by a strange bug (?) with threadDelay on Windows. It delays for less time than expected (500 seconds vs expected 24 hours), and is consistently reproducible on my system. Can someone have a look (need some patience, ~8 minutes waiting), just to be sure? I glanced around trac but didn't find any related issues. > > How to reproduce: > > module Main where > > import Data.Time > import Control.Concurrent > import Control.Monad > > main :: IO () > main = do > _ <- forkIO thread > getLine >>= print -- Just to keep the main thread running > > thread :: IO () > thread = forever $ do > now <- getCurrentTime > print now > threadDelay 86400000000 > print "done waiting" > > > Expected result: > 2016-12-28 13:07:49.5113098 UTC > ... > (next timing should be the next day 2016-12-29) > > > Actual result: > 2016-12-28 13:07:49.5113098 UTC > "done waiting" > 2016-12-28 13:16:10.2159485 UTC > "done waiting" > 2016-12-28 13:24:30.8735845 UTC > "done waiting" > 2016-12-28 13:32:51.5292203 UTC > ... > > > System: Windows 7 Enterprise Service Pack 1, ghc 7.10.3 > > > This seems specific to Windows, it doesn't appear on Debian 8. Help is appreciated! > > > Regards, > Hon > > Rant: It has cost me significant debugging time! Please tell me I made a rookie mistake or misread the docs somewhere! > _______________________________________________ > 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 j.stutterheim at me.com Wed Dec 28 16:02:32 2016 From: j.stutterheim at me.com (J. Stutterheim) Date: Wed, 28 Dec 2016 16:02:32 +0000 Subject: [Haskell-cafe] [NL-FP 2017] 2nd CFP: Dutch Functional Programming Day 2017 Message-ID: <577F11F6-0EE4-4804-A724-862B593BBF11@me.com> Second Call for Participation: Dear Friends of Functional Programming, There is still room for more participants for the FP day. Please register until December 31st so we can make arrangements for lunch and dinner. The next Dutch FP Day will be held on Friday, January 6 2017 at the Radboud University in Nijmegen. You are invited to some or all of: participate, give a presentation, join the dinner. For further information, please see the website. https://wiki.clean.cs.ru.nl/NL-FP_dag_2017 Feel free to forward this invitation to colleagues and students who might be interested. Best Regards on behalf of Markus Klinik -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 3117 bytes Desc: not available URL: From jmaessen at alum.mit.edu Wed Dec 28 18:40:17 2016 From: jmaessen at alum.mit.edu (Jan-Willem Maessen) Date: Wed, 28 Dec 2016 13:40:17 -0500 Subject: [Haskell-cafe] Multi groupby with foldl' and Map.insertWithKey In-Reply-To: <95754462-9F1B-4A84-B878-08A6B1FEC011@aatal-apotheke.de> References: <95754462-9F1B-4A84-B878-08A6B1FEC011@aatal-apotheke.de> Message-ID: On Wed, Dec 28, 2016 at 8:07 AM, Olaf Klinke wrote: > I'd say the cleanest way to go is to split your Info data structure into > an intermediate key and a value part like so: > > type Key = String > data Value = Value {count :: !Int, healthTopics :: ![String]} > > keyvalue :: Info -> (Key,Value) > keyvalue (Info _ h k) = (k,Value 1 [h]) > > and give Value a Monoid instance: > > instance Monoid Value where > mempty = Value 0 [] > mappend (Value c s) (Value c' s') = Value (c+c') (s++s') > > (Or you could use (Sum Int) instead of Int and have > type Value = (Sum Int,[String]). > Then the Monoid instance is derived for you.) > A caution on this alternative: the first component of the tuple won't be strict enough and you'll leak space. I think the proposed solution is better. Note that you *don't* necessarily need the strictness annotation on healthTopics – this shifts around when the list append gets run but won't change space much. -Jan-Willem Maessen > Now you can transform a list of Infos into a Map using a generic function: > > makeMap :: [Info] -> M.Map Key Value > makeMap = M.fromListWith mappend . map keyvalue > > Semantically, it's pretty identical to ALeX Kazik's suggestion of using > foldl' and alter. Internally, fromListWith uses a strict fold, so > strictness should be the same as using foldl'. > > Olaf > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gale at sefer.org Wed Dec 28 19:46:44 2016 From: gale at sefer.org (Yitzchak Gale) Date: Wed, 28 Dec 2016 21:46:44 +0200 Subject: [Haskell-cafe] threadDelay delays less time than expected (Windows) In-Reply-To: References: Message-ID: Tom wrote: > (86400000000 :: Integer) > (fromIntegral (maxBound :: Int)) > > If True, your machine (32-bit?) is probably overflowing the Int Good point. Even if False on Lian's Windows machine, it could be there is some 32-bit value somewhere in the Windows implementation that causes this. Yitz From olf at aatal-apotheke.de Wed Dec 28 20:21:06 2016 From: olf at aatal-apotheke.de (Olaf Klinke) Date: Wed, 28 Dec 2016 21:21:06 +0100 Subject: [Haskell-cafe] Multi groupby with foldl' and Map.insertWithKey In-Reply-To: References: <95754462-9F1B-4A84-B878-08A6B1FEC011@aatal-apotheke.de> Message-ID: <2B0C206B-74BA-4CA7-8753-BEAC28C0BD88@aatal-apotheke.de> > Am 28.12.2016 um 19:40 schrieb Jan-Willem Maessen : > > A caution on this alternative: the first component of the tuple won't be strict enough and you'll leak space. I think the proposed solution is better. Note that you *don't* necessarily need the strictness annotation on healthTopics – this shifts around when the list append gets run but won't change space much. > > -Jan-Willem Maessen Thanks for clarifying this, Jan-Willem. So there ought to be stricter versions of the newtype wrappers in Data.Monoid. Even then, the tuple is not strict. Will that also leak space? I just thought the (Sum Int,[String]) type was a neat example of instance deriving. Cheers, Olaf From jmaessen at alum.mit.edu Wed Dec 28 20:38:04 2016 From: jmaessen at alum.mit.edu (Jan-Willem Maessen) Date: Wed, 28 Dec 2016 15:38:04 -0500 Subject: [Haskell-cafe] Multi groupby with foldl' and Map.insertWithKey In-Reply-To: <2B0C206B-74BA-4CA7-8753-BEAC28C0BD88@aatal-apotheke.de> References: <95754462-9F1B-4A84-B878-08A6B1FEC011@aatal-apotheke.de> <2B0C206B-74BA-4CA7-8753-BEAC28C0BD88@aatal-apotheke.de> Message-ID: On Wed, Dec 28, 2016 at 3:21 PM, Olaf Klinke wrote: > > > Am 28.12.2016 um 19:40 schrieb Jan-Willem Maessen >: > > > > A caution on this alternative: the first component of the tuple won't be > strict enough and you'll leak space. I think the proposed solution is > better. Note that you *don't* necessarily need the strictness annotation > on healthTopics – this shifts around when the list append gets run but > won't change space much. > > > > -Jan-Willem Maessen > Thanks for clarifying this, Jan-Willem. So there ought to be stricter > versions of the newtype wrappers in Data.Monoid. Even then, the tuple is > not strict. Will that also leak space? > Yes, the fact that the tuple is strict means that Sum's strictness doesn't matter (and Sum is a newtype, so strictness doesn't really come into play). > I just thought the (Sum Int,[String]) type was a neat example of instance > deriving. > Indeed! And if I were hacking up a one-shot script I'd probably do it that way. > > Cheers, > Olaf -------------- next part -------------- An HTML attachment was scrubbed... URL: From damian.nadales at gmail.com Wed Dec 28 21:22:55 2016 From: damian.nadales at gmail.com (Damian Nadales) Date: Wed, 28 Dec 2016 22:22:55 +0100 Subject: [Haskell-cafe] References on GADT's Message-ID: Hi, I'm climbing up the standardized ladder of functional programming: https://news.ycombinator.com/item?id=13067741 The next topic on my list is to gain some understanding and practice on GADT's (competent section of the ladder). Do you have any resources that you would recommend? Are there any books that cover the topic? Thanks in advance, Damian. From gale at sefer.org Wed Dec 28 21:59:57 2016 From: gale at sefer.org (Yitzchak Gale) Date: Wed, 28 Dec 2016 23:59:57 +0200 Subject: [Haskell-cafe] many haskell's mails are detected as spam on gmail In-Reply-To: <541F412F-679B-406E-B9A4-913E39B42595@dukhovni.org> References: <20161225225936.GO13486@mournblade.imrryr.org> <57b81f6a-7c20-4aa6-333f-17fb87cbc579@durchholz.org> <541F412F-679B-406E-B9A4-913E39B42595@dukhovni.org> Message-ID: Viktor Dukhovni wrote: >>> ...avoid modifying the message subject and body. Joachim Durchholz wrote: >> The footer is actually nice to have. > Both the footer and subject tags would need to go. I believe adding the unsubscribe link in the footer is required by law in the US. Yitz From ietf-dane at dukhovni.org Wed Dec 28 22:39:34 2016 From: ietf-dane at dukhovni.org (Viktor Dukhovni) Date: Wed, 28 Dec 2016 17:39:34 -0500 Subject: [Haskell-cafe] many haskell's mails are detected as spam on gmail In-Reply-To: References: <20161225225936.GO13486@mournblade.imrryr.org> <57b81f6a-7c20-4aa6-333f-17fb87cbc579@durchholz.org> <541F412F-679B-406E-B9A4-913E39B42595@dukhovni.org> Message-ID: > On Dec 28, 2016, at 4:59 PM, Yitzchak Gale wrote: > > I believe adding the unsubscribe link in the footer is > required by law in the US. There are plenty of lists with no such footers. For example, ietf at ietf.org, postfix-users at postfix.org, ... Mailing lists do subscription confirmation, so don't need opt-out. Unsubscribe instructions are also sent when first joining the list, and often in monthly list-membership reminders. In addition there a List-Unsubscribe header. So there's scant evince for the applicability of alleged requirement to add a footer. https://www.ftc.gov/tips-advice/business-center/guidance/can-spam-act-compliance-guide-business Despite its name, the CAN-SPAM Act doesn’t apply just to bulk email. It covers all commercial messages, which the law defines as “any electronic mail message the primary purpose of which is the commercial advertisement or promotion of a commercial product or service,” including email that promotes content on commercial websites. The law makes no exception for business-to-business email. That means all email – for example, a message to former customers announcing a new product line – must comply with the law. Group interest mailing lists seem rather clearly out of scope. -- Viktor. From michael at orlitzky.com Wed Dec 28 22:45:38 2016 From: michael at orlitzky.com (Michael Orlitzky) Date: Wed, 28 Dec 2016 17:45:38 -0500 Subject: [Haskell-cafe] many haskell's mails are detected as spam on gmail In-Reply-To: References: <20161225225936.GO13486@mournblade.imrryr.org> <57b81f6a-7c20-4aa6-333f-17fb87cbc579@durchholz.org> <541F412F-679B-406E-B9A4-913E39B42595@dukhovni.org> Message-ID: On 12/28/2016 04:59 PM, Yitzchak Gale wrote: > > I believe adding the unsubscribe link in the footer is > required by law in the US. > If you're referring to the CAN-SPAM act, then the first reason that it wouldn't apply is that these messages aren't commercial. The second would be that you've given consent to receive them. There are probably more. From hon.lianhung at gmail.com Thu Dec 29 00:05:16 2016 From: hon.lianhung at gmail.com (Lian Hung Hon) Date: Thu, 29 Dec 2016 08:05:16 +0800 Subject: [Haskell-cafe] threadDelay delays less time than expected (Windows) In-Reply-To: References: Message-ID: Dear Tom/Yitz, Just tested, returns False. I'm on 64 bit by the way. What should I do from here? Regards, Hon On 29 Dec 2016 03:47, "Yitzchak Gale" wrote: > Tom wrote: > > (86400000000 :: Integer) > (fromIntegral (maxBound :: Int)) > > > > If True, your machine (32-bit?) is probably overflowing the Int > > Good point. Even if False on Lian's Windows machine, it could > be there is some 32-bit value somewhere in the Windows > implementation that causes this. > > Yitz > -------------- next part -------------- An HTML attachment was scrubbed... URL: From thomas.dubuisson at gmail.com Thu Dec 29 00:47:52 2016 From: thomas.dubuisson at gmail.com (Thomas DuBuisson) Date: Wed, 28 Dec 2016 16:47:52 -0800 Subject: [Haskell-cafe] threadDelay delays less time than expected (Windows) In-Reply-To: References: Message-ID: Not to be infuriating, but I think you should check and re-check your tooling is not using 32 bit values at any particular point. Notice: (fromIntegral (86400000000 `mod` 2^32)) / 10^6 ~ 500 seconds which is your observation. Any time you depend on `Int` to represent numbers near or greater than 2^28, or perhaps 2^31 in practice, you should think hard about bounds and implications regarding portability anyway. -Thomas On Wed, Dec 28, 2016 at 4:05 PM, Lian Hung Hon wrote: > Dear Tom/Yitz, > > Just tested, returns False. I'm on 64 bit by the way. What should I do from > here? > > Regards, > Hon > > > On 29 Dec 2016 03:47, "Yitzchak Gale" wrote: >> >> Tom wrote: >> > (86400000000 :: Integer) > (fromIntegral (maxBound :: Int)) >> > >> > If True, your machine (32-bit?) is probably overflowing the Int >> >> Good point. Even if False on Lian's Windows machine, it could >> be there is some 32-bit value somewhere in the Windows >> implementation that causes this. >> >> Yitz > > > _______________________________________________ > 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 amindfv at gmail.com Thu Dec 29 02:47:33 2016 From: amindfv at gmail.com (amindfv at gmail.com) Date: Wed, 28 Dec 2016 20:47:33 -0600 Subject: [Haskell-cafe] threadDelay delays less time than expected (Windows) In-Reply-To: References: Message-ID: <0F552D60-CC24-45B8-8FE6-44145F64BEF1@gmail.com> If their supplied code sample is failing, couldn't that indicate a bug in the Windows threadDelay implementation for very large values? Hon: if you're looking for a short-term solution you can always: replicateM 48 $ threadDelay $ (half an hour) This way you only have to wait half an hour to be sure there's no overflow or incorrect timing. Tom > El 28 dic 2016, a las 18:47, Thomas DuBuisson escribió: > > Not to be infuriating, but I think you should check and re-check your > tooling is not using 32 bit values at any particular point. > > Notice: > > (fromIntegral (86400000000 `mod` 2^32)) / 10^6 ~ 500 seconds which is > your observation. Any time you depend on `Int` to represent numbers > near or greater than 2^28, or perhaps 2^31 in practice, you should > think hard about bounds and implications regarding portability anyway. > > -Thomas > >> On Wed, Dec 28, 2016 at 4:05 PM, Lian Hung Hon wrote: >> Dear Tom/Yitz, >> >> Just tested, returns False. I'm on 64 bit by the way. What should I do from >> here? >> >> Regards, >> Hon >> >> >>> On 29 Dec 2016 03:47, "Yitzchak Gale" wrote: >>> >>> Tom wrote: >>>> (86400000000 :: Integer) > (fromIntegral (maxBound :: Int)) >>>> >>>> If True, your machine (32-bit?) is probably overflowing the Int >>> >>> Good point. Even if False on Lian's Windows machine, it could >>> be there is some 32-bit value somewhere in the Windows >>> implementation that causes this. >>> >>> Yitz >> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view archives go to: >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> Only members subscribed via the mailman list are allowed to post. > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. From hon.lianhung at gmail.com Thu Dec 29 13:19:01 2016 From: hon.lianhung at gmail.com (Lian Hung Hon) Date: Thu, 29 Dec 2016 21:19:01 +0800 Subject: [Haskell-cafe] threadDelay delays less time than expected (Windows) In-Reply-To: <0F552D60-CC24-45B8-8FE6-44145F64BEF1@gmail.com> References: <0F552D60-CC24-45B8-8FE6-44145F64BEF1@gmail.com> Message-ID: Dear Tom, That is a good workaround, now I'm using divMod with the max value of Int, and things are working again :) So it really is because of int overflow somewhere.. Since a workaround is available I guess I won't file a bug report yet. Thomas' comment also got me second guessing myself.. Thank you everyone for your help and guidance! Regards, Hon On 29 Dec 2016 09:47, wrote: > If their supplied code sample is failing, couldn't that indicate a bug in > the Windows threadDelay implementation for very large values? > > Hon: if you're looking for a short-term solution you can always: > > replicateM 48 $ threadDelay $ > (half an hour) > > This way you only have to wait half an hour to be sure there's no overflow > or incorrect timing. > > Tom > > > > El 28 dic 2016, a las 18:47, Thomas DuBuisson < > thomas.dubuisson at gmail.com> escribió: > > > > Not to be infuriating, but I think you should check and re-check your > > tooling is not using 32 bit values at any particular point. > > > > Notice: > > > > (fromIntegral (86400000000 `mod` 2^32)) / 10^6 ~ 500 seconds which is > > your observation. Any time you depend on `Int` to represent numbers > > near or greater than 2^28, or perhaps 2^31 in practice, you should > > think hard about bounds and implications regarding portability anyway. > > > > -Thomas > > > >> On Wed, Dec 28, 2016 at 4:05 PM, Lian Hung Hon > wrote: > >> Dear Tom/Yitz, > >> > >> Just tested, returns False. I'm on 64 bit by the way. What should I do > from > >> here? > >> > >> Regards, > >> Hon > >> > >> > >>> On 29 Dec 2016 03:47, "Yitzchak Gale" wrote: > >>> > >>> Tom wrote: > >>>> (86400000000 :: Integer) > (fromIntegral (maxBound :: Int)) > >>>> > >>>> If True, your machine (32-bit?) is probably overflowing the Int > >>> > >>> Good point. Even if False on Lian's Windows machine, it could > >>> be there is some 32-bit value somewhere in the Windows > >>> implementation that causes this. > >>> > >>> Yitz > >> > >> > >> _______________________________________________ > >> 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 tanuki at gmail.com Thu Dec 29 13:28:12 2016 From: tanuki at gmail.com (Theodore Lief Gannon) Date: Thu, 29 Dec 2016 05:28:12 -0800 Subject: [Haskell-cafe] threadDelay delays less time than expected (Windows) In-Reply-To: References: <0F552D60-CC24-45B8-8FE6-44145F64BEF1@gmail.com> Message-ID: The existence of a workaround doesn't make it not a bug! Definitely report it anyway. Worst case, the bug is actually in Windows but is now known and centrally documented. For that matter, GCH could build the replicateM trick into the implementation on a platform-specific basis. On Dec 29, 2016 5:21 AM, "Lian Hung Hon" wrote: > Dear Tom, > > That is a good workaround, now I'm using divMod with the max value of Int, > and things are working again :) So it really is because of int overflow > somewhere.. > > Since a workaround is available I guess I won't file a bug report yet. > Thomas' comment also got me second guessing myself.. > > Thank you everyone for your help and guidance! > > Regards, > Hon > > On 29 Dec 2016 09:47, wrote: > >> If their supplied code sample is failing, couldn't that indicate a bug in >> the Windows threadDelay implementation for very large values? >> >> Hon: if you're looking for a short-term solution you can always: >> >> replicateM 48 $ threadDelay $ >> (half an hour) >> >> This way you only have to wait half an hour to be sure there's no >> overflow or incorrect timing. >> >> Tom >> >> >> > El 28 dic 2016, a las 18:47, Thomas DuBuisson < >> thomas.dubuisson at gmail.com> escribió: >> > >> > Not to be infuriating, but I think you should check and re-check your >> > tooling is not using 32 bit values at any particular point. >> > >> > Notice: >> > >> > (fromIntegral (86400000000 `mod` 2^32)) / 10^6 ~ 500 seconds which is >> > your observation. Any time you depend on `Int` to represent numbers >> > near or greater than 2^28, or perhaps 2^31 in practice, you should >> > think hard about bounds and implications regarding portability anyway. >> > >> > -Thomas >> > >> >> On Wed, Dec 28, 2016 at 4:05 PM, Lian Hung Hon >> wrote: >> >> Dear Tom/Yitz, >> >> >> >> Just tested, returns False. I'm on 64 bit by the way. What should I do >> from >> >> here? >> >> >> >> Regards, >> >> Hon >> >> >> >> >> >>> On 29 Dec 2016 03:47, "Yitzchak Gale" wrote: >> >>> >> >>> Tom wrote: >> >>>> (86400000000 :: Integer) > (fromIntegral (maxBound :: Int)) >> >>>> >> >>>> If True, your machine (32-bit?) is probably overflowing the Int >> >>> >> >>> Good point. Even if False on Lian's Windows machine, it could >> >>> be there is some 32-bit value somewhere in the Windows >> >>> implementation that causes this. >> >>> >> >>> Yitz >> >> >> >> >> >> _______________________________________________ >> >> Haskell-Cafe mailing list >> >> To (un)subscribe, modify options or view archives go to: >> >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> >> Only members subscribed via the mailman list are allowed to post. >> > _______________________________________________ >> > Haskell-Cafe mailing list >> > To (un)subscribe, modify options or view archives go to: >> > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> > Only members subscribed via the mailman list are allowed to post. >> > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dct25-561bs at mythic-beasts.com Thu Dec 29 14:23:15 2016 From: dct25-561bs at mythic-beasts.com (David Turner) Date: Thu, 29 Dec 2016 14:23:15 +0000 Subject: [Haskell-cafe] threadDelay delays less time than expected (Windows) In-Reply-To: References: <0F552D60-CC24-45B8-8FE6-44145F64BEF1@gmail.com> Message-ID: The unbounded-delays package should probably do what you want: https://hackage.haskell.org/package/unbounded-delays On 29 Dec 2016 13:29, "Theodore Lief Gannon" wrote: > The existence of a workaround doesn't make it not a bug! Definitely report > it anyway. Worst case, the bug is actually in Windows but is now known and > centrally documented. For that matter, GCH could build the replicateM trick > into the implementation on a platform-specific basis. > > On Dec 29, 2016 5:21 AM, "Lian Hung Hon" wrote: > >> Dear Tom, >> >> That is a good workaround, now I'm using divMod with the max value of >> Int, and things are working again :) So it really is because of int >> overflow somewhere.. >> >> Since a workaround is available I guess I won't file a bug report yet. >> Thomas' comment also got me second guessing myself.. >> >> Thank you everyone for your help and guidance! >> >> Regards, >> Hon >> >> On 29 Dec 2016 09:47, wrote: >> >>> If their supplied code sample is failing, couldn't that indicate a bug >>> in the Windows threadDelay implementation for very large values? >>> >>> Hon: if you're looking for a short-term solution you can always: >>> >>> replicateM 48 $ threadDelay $ >>> (half an hour) >>> >>> This way you only have to wait half an hour to be sure there's no >>> overflow or incorrect timing. >>> >>> Tom >>> >>> >>> > El 28 dic 2016, a las 18:47, Thomas DuBuisson < >>> thomas.dubuisson at gmail.com> escribió: >>> > >>> > Not to be infuriating, but I think you should check and re-check your >>> > tooling is not using 32 bit values at any particular point. >>> > >>> > Notice: >>> > >>> > (fromIntegral (86400000000 `mod` 2^32)) / 10^6 ~ 500 seconds which is >>> > your observation. Any time you depend on `Int` to represent numbers >>> > near or greater than 2^28, or perhaps 2^31 in practice, you should >>> > think hard about bounds and implications regarding portability anyway. >>> > >>> > -Thomas >>> > >>> >> On Wed, Dec 28, 2016 at 4:05 PM, Lian Hung Hon < >>> hon.lianhung at gmail.com> wrote: >>> >> Dear Tom/Yitz, >>> >> >>> >> Just tested, returns False. I'm on 64 bit by the way. What should I >>> do from >>> >> here? >>> >> >>> >> Regards, >>> >> Hon >>> >> >>> >> >>> >>> On 29 Dec 2016 03:47, "Yitzchak Gale" wrote: >>> >>> >>> >>> Tom wrote: >>> >>>> (86400000000 :: Integer) > (fromIntegral (maxBound :: Int)) >>> >>>> >>> >>>> If True, your machine (32-bit?) is probably overflowing the Int >>> >>> >>> >>> Good point. Even if False on Lian's Windows machine, it could >>> >>> be there is some 32-bit value somewhere in the Windows >>> >>> implementation that causes this. >>> >>> >>> >>> Yitz >>> >> >>> >> >>> >> _______________________________________________ >>> >> Haskell-Cafe mailing list >>> >> To (un)subscribe, modify options or view archives go to: >>> >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>> >> Only members subscribed via the mailman list are allowed to post. >>> > _______________________________________________ >>> > Haskell-Cafe mailing list >>> > To (un)subscribe, modify options or view archives go to: >>> > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>> > Only members subscribed via the mailman list are allowed to post. >>> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view archives go to: >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> Only members subscribed via the mailman list are allowed to post. >> > > _______________________________________________ > 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 ben at smart-cactus.org Thu Dec 29 14:44:12 2016 From: ben at smart-cactus.org (Ben Gamari) Date: Thu, 29 Dec 2016 09:44:12 -0500 Subject: [Haskell-cafe] threadDelay delays less time than expected (Windows) In-Reply-To: References: Message-ID: <7C946502-90B3-44EA-AFE9-01335A47B757@smart-cactus.org> On December 28, 2016 9:20:50 AM EST, Lian Hung Hon wrote: >Dear Haskellers, > >I am baffled by a strange bug (?) with threadDelay on Windows. It >delays >for less time than expected (500 seconds vs expected 24 hours), and is >consistently reproducible on my system. Can someone have a look (need >some >patience, ~8 minutes waiting), just to be sure? I glanced around trac >but >didn't find any related issues. > I believe I fixed this bug a few weeks ago. Indeed there was an integer overflow in then non-threaded Windows RTS. This should be fixed in GHC 8.2. See Trac #7325. Cheers, - Ben From id at joeyh.name Thu Dec 29 16:27:41 2016 From: id at joeyh.name (Joey Hess) Date: Thu, 29 Dec 2016 12:27:41 -0400 Subject: [Haskell-cafe] threadDelay delays less time than expected (Windows) In-Reply-To: References: Message-ID: <20161229162741.jjc3fdmjkjwr5k5o@kitenet.net> Thomas DuBuisson wrote: > Not to be infuriating, but I think you should check and re-check your > tooling is not using 32 bit values at any particular point. Eg, 32 bit ghc can run on 64 bit Windows. > (fromIntegral (86400000000 `mod` 2^32)) / 10^6 ~ 500 seconds which is > your observation. Any time you depend on `Int` to represent numbers > near or greater than 2^28, or perhaps 2^31 in practice, you should > think hard about bounds and implications regarding portability anyway. It's easy to write something like threadDelay (24*60*60*msPerSec) and not realize that's overflowed. The numbers involved seem small. And when if you're developing on 64 bit, it's easy to ship code with that bug and not realize until someone tries it on 32 bit. Since Haskell time types generally avoid problems with overflow (eg DiffTime isn't bounded), one can become complacent that this is another class of problems that the good data types in Haskell prevent, and stop worrying about time overflows, and then get bitten by this. It would perhaps be good for the documentation for threadDelay to point out that it can delay for a maximum of 71 minutes on 32 bit systems, and point to the unbounded-delays package. -- see shy jo -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: From simon at joyful.com Thu Dec 29 16:53:36 2016 From: simon at joyful.com (Simon Michael) Date: Thu, 29 Dec 2016 08:53:36 -0800 Subject: [Haskell-cafe] hackagebot future ? In-Reply-To: References: <69EAC40D-191F-4010-8776-6BD6B091678D@joyful.com> Message-ID: On 12/27/16 10:07 PM, Chris Wong wrote: > Hi Simon, > > I maintain an analogous bot for the Rust community, [1] which also > happens to be written in Haskell (for frivolous reasons). I thought it > would be useful to share my experience. > >> ... As our community grows, upload activity increases, and more megaprojects with many uploads appear, I've seen more complaints about the noise, and noticed channel ops muting it temporarily. ... > To avoid drowning out discussion, we moved all the bots to their own > #rust-bots channel. This solution has worked well for us so far, and > lets my bot run with a looser rate limit (20 uploads per minute). We > announce compiler+stdlib changes and CI results on there as well. > >> Since then I've heard nothing. So, even though I personally like seeing the uploads, and the conversations and connections that sometimes result, I'm inclined to let hackagebot rest indefinitely. Or, would a new maintainer like to take it on ? If you have feelings about it one way or the other, please reply on-list. > I guess another solution could be to batch up these announcements, and > if there are too many of them, send them in a condensed form. > Something like this: > > [hackagebot] New: twilight-0.1, pinkie-0.0. Updated: > applejack-0.3.7, rarity-1.0.1.1, fluttershy-4.3.2. > [hackagebot] Read more at https://hackage.haskell.org/packages/recent > > This may be better than the "separate channel" solution if we want to > encourage conversation about these new packages. > > I would be happy to take on maintaining hackagebot. Since I'm already > running one package announcer, adding a second shouldn't be too much > of a burden 😉. It'd be interesting to see if the two code bases can > be merged, and if we could rewrite the bot to use irc-core [2] instead > of a home-grown thing. > > Chris > > [1] https://github.com/lfairy/hircine/tree/master/brigitte > [2] https://hackage.haskell.org/package/irc-core > Thanks for the replies all. Chris, thank you for your offer! I hereby transfer hackagebot to your care. Contact me directly (simon at joyful.com, sm on freenode) for any help needed. Best, Simon From svenpanne at gmail.com Thu Dec 29 18:54:59 2016 From: svenpanne at gmail.com (Sven Panne) Date: Thu, 29 Dec 2016 19:54:59 +0100 Subject: [Haskell-cafe] threadDelay delays less time than expected (Windows) In-Reply-To: <20161229162741.jjc3fdmjkjwr5k5o@kitenet.net> References: <20161229162741.jjc3fdmjkjwr5k5o@kitenet.net> Message-ID: 2016-12-29 17:27 GMT+01:00 Joey Hess : > [...] It would perhaps be good for the documentation for threadDelay to > point > out that it can delay for a maximum of 71 minutes on 32 bit systems, and > point to the unbounded-delays package. > ... or even better: Absorb the functions from unbounded-delays into base. In their current state, I would consider both threadDelay and timeout API bugs, see http://www.aristeia.com/Papers/IEEE_Software_JulAug_2004_revised.htm (*"**Make interfaces easy to use correctly and hard to use incorrectly."). *Perhaps we should add: genericThreadDelay :: Integral i => i -> IO () genericTimeout :: Integral i => i -> IO a -> IO (Maybe a) to their respective modules, following Data.List's example. The *real* fix IMHO would be having the equivalent of C++'s facilities in base, so we could use a duration data type here. -------------- next part -------------- An HTML attachment was scrubbed... URL: From amindfv at gmail.com Thu Dec 29 20:21:44 2016 From: amindfv at gmail.com (amindfv at gmail.com) Date: Thu, 29 Dec 2016 14:21:44 -0600 Subject: [Haskell-cafe] threadDelay delays less time than expected (Windows) In-Reply-To: References: <0F552D60-CC24-45B8-8FE6-44145F64BEF1@gmail.com> Message-ID: Hmm, I'm very confused that the Int maxBound wasn't smaller than the Integer, but that divMod with maxBound is working for you... Either way, I'd be happy to get rid of the Int-valued timeout and threadDelay. Tom > El 29 dic 2016, a las 07:19, Lian Hung Hon escribió: > > Dear Tom, > > That is a good workaround, now I'm using divMod with the max value of Int, and things are working again :) So it really is because of int overflow somewhere.. > > Since a workaround is available I guess I won't file a bug report yet. Thomas' comment also got me second guessing myself.. > > Thank you everyone for your help and guidance! > > Regards, > Hon > > >> On 29 Dec 2016 09:47, wrote: >> If their supplied code sample is failing, couldn't that indicate a bug in the Windows threadDelay implementation for very large values? >> >> Hon: if you're looking for a short-term solution you can always: >> >> replicateM 48 $ threadDelay $ >> (half an hour) >> >> This way you only have to wait half an hour to be sure there's no overflow or incorrect timing. >> >> Tom >> >> >> > El 28 dic 2016, a las 18:47, Thomas DuBuisson escribió: >> > >> > Not to be infuriating, but I think you should check and re-check your >> > tooling is not using 32 bit values at any particular point. >> > >> > Notice: >> > >> > (fromIntegral (86400000000 `mod` 2^32)) / 10^6 ~ 500 seconds which is >> > your observation. Any time you depend on `Int` to represent numbers >> > near or greater than 2^28, or perhaps 2^31 in practice, you should >> > think hard about bounds and implications regarding portability anyway. >> > >> > -Thomas >> > >> >> On Wed, Dec 28, 2016 at 4:05 PM, Lian Hung Hon wrote: >> >> Dear Tom/Yitz, >> >> >> >> Just tested, returns False. I'm on 64 bit by the way. What should I do from >> >> here? >> >> >> >> Regards, >> >> Hon >> >> >> >> >> >>> On 29 Dec 2016 03:47, "Yitzchak Gale" wrote: >> >>> >> >>> Tom wrote: >> >>>> (86400000000 :: Integer) > (fromIntegral (maxBound :: Int)) >> >>>> >> >>>> If True, your machine (32-bit?) is probably overflowing the Int >> >>> >> >>> Good point. Even if False on Lian's Windows machine, it could >> >>> be there is some 32-bit value somewhere in the Windows >> >>> implementation that causes this. >> >>> >> >>> Yitz >> >> >> >> >> >> _______________________________________________ >> >> 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 fa-ml at ariis.it Thu Dec 29 21:35:18 2016 From: fa-ml at ariis.it (Francesco Ariis) Date: Thu, 29 Dec 2016 22:35:18 +0100 Subject: [Haskell-cafe] Netwire woes: creating a wire with mkGen_ Message-ID: <20161229213518.GA7172@casa.casa> Hello -cafe, a few days ago I posted this [1] in beginners, I'll pester you too before giving up. tl;dr: I want to create a wire which outputs a stream of 'q's when the letter Q is pressed and a stream of 'a' when the letter A is pressed. What I wrote is not working and I suspect I am not using mkGen_ correctly. Any pointers appreciated! [1] https://mail.haskell.org/pipermail/beginners/2016-December/017276.html From spam at scientician.net Thu Dec 29 21:41:47 2016 From: spam at scientician.net (Bardur Arantsson) Date: Thu, 29 Dec 2016 22:41:47 +0100 Subject: [Haskell-cafe] threadDelay delays less time than expected (Windows) In-Reply-To: References: <20161229162741.jjc3fdmjkjwr5k5o@kitenet.net> Message-ID: On 2016-12-29 19:54, Sven Panne wrote: > 2016-12-29 17:27 GMT+01:00 Joey Hess >: > > [...] It would perhaps be good for the documentation for threadDelay > to point > out that it can delay for a maximum of 71 minutes on 32 bit systems, and > point to the unbounded-delays package. > > > .... or even better: Absorb the functions from unbounded-delays into > base. In their current state, I would consider both threadDelay and > timeout API bugs, > see http://www.aristeia.com/Papers/IEEE_Software_JulAug_2004_revised.htm > (/"//Make interfaces easy to use correctly and hard to use > incorrectly."). /Perhaps we should add: > +1. Another, perhaps better, alternative would be to have something like a "TimeDiff" type in base, but an actual *duration* in *physical* time (no leap seconds, no calendar nonsense, etc.). This is one of those big mistakes almost everyone made in the past[1]. *Physical* time is so much different from *calendar* time that it really needs completely different representations and operations. (Of course there must be *some* way to 'convert', but those conversions are inherently dangerous and should be clearly marked as such.) > genericThreadDelay :: Integral i => i -> IO () I would be much happier with a signature of threadDelay :: Duration -> IO () with a few safe constructors for Duration, e.g. "daysToDuration :: Int -> Duration" and "millisToDuration :: ..." (etc.). We might arguably want "Maybe Duration" as the return type, but that may be pushing it. *THAT* is how you make this particular API hard to misuse. I don't know about you, but I always end up counting zeroes multiple times when writing a "threadDelay ..." line. Regards, [1] Bascially before JodaTime made ordinary developers aware of just how complex this Time/Date stuff really is and the importance of clearly separating the concept of "calendar" time vs. "physical" time. From jo at durchholz.org Thu Dec 29 22:27:58 2016 From: jo at durchholz.org (Joachim Durchholz) Date: Thu, 29 Dec 2016 23:27:58 +0100 Subject: [Haskell-cafe] threadDelay delays less time than expected (Windows) In-Reply-To: References: <20161229162741.jjc3fdmjkjwr5k5o@kitenet.net> Message-ID: Am 29.12.2016 um 22:41 schrieb Bardur Arantsson: > (Of course > there must be *some* way to 'convert', but those conversions are > inherently dangerous and should be clearly marked as such.) Actually you don't convert, but you can add physical time to a calendar date. It's not really dangerous, just complicated - leap years which follow a rule, leap seconds that you have to look up in a table. You don't do historic calendars; it's even dubious that you need Islamic or other calendars unless you do either religious or historic dates, in which case domain-specific code would probably be appropriate. Leap seconds are "unsafe" in the IO sense: they occur at irregular times and are not predictable, so this addition is not referentially transparent. I can't think of a use case for this kind of addition in application code though: Either you do calendar calculations, and then you add calendar seconds to a date, with the usual 24:60:60 factors for days/hours/minutes/seconds. Or you do timing-related code: timers that go off, benchmarks, and in both cases you start with a timestamp and add physical seconds, which is trivial. (In system code, the NTP stack or some local driver needs to keep track how physical time relates to calendar time, but that's nothing you'd need or want in a standard library.) tl;dr: physical time and calendar time are different concepts, have different uses, and the use cases for mixing the two are so rare that conversion code shouldn't go into any kind of standard library. IMHO. > [1] Bascially before JodaTime made ordinary developers aware of just how > complex this Time/Date stuff really is and the importance of clearly > separating the concept of "calendar" time vs. "physical" time. Yeah, that's a really awesome library, and well worth looking at if you want fresh time API ideas. Regards, Jo From spam at scientician.net Fri Dec 30 00:14:04 2016 From: spam at scientician.net (Bardur Arantsson) Date: Fri, 30 Dec 2016 01:14:04 +0100 Subject: [Haskell-cafe] threadDelay delays less time than expected (Windows) In-Reply-To: References: <20161229162741.jjc3fdmjkjwr5k5o@kitenet.net> Message-ID: On 2016-12-29 23:27, Joachim Durchholz wrote: > Am 29.12.2016 um 22:41 schrieb Bardur Arantsson: >> (Of course >> there must be *some* way to 'convert', but those conversions are >> inherently dangerous and should be clearly marked as such.) > > Actually you don't convert, but you can add physical time to a calendar > date. > It's not really dangerous, just complicated - leap years which follow a > rule, leap seconds that you have to look up in a table. > True, but... it's *complicated*... which was my point. Add in the fact that the entries in that table may not even *exist* yet, depending on the duration! If you're programming with a Duration and you're counting on a machine to get leap seconds right -- you're doing something wrong. > You don't do historic calendars; it's even dubious that you need Islamic > or other calendars unless you do either religious or historic dates, in > which case domain-specific code would probably be appropriate. > My favorite observation is that there's actually a February 30th[1]... which anyone who *really* wants to be correct about calendar behavior has to observe. [1] https://en.wikipedia.org/wiki/February_30 > Leap seconds are "unsafe" in the IO sense: they occur at irregular times > and are not predictable, so this addition is not referentially transparent. > I can't think of a use case for this kind of addition in application > code though: Either you do calendar calculations, and then you add > calendar seconds to a date, with the usual 24:60:60 factors for > days/hours/minutes/seconds. Or you do timing-related code: timers that > go off, benchmarks, and in both cases you start with a timestamp and add > physical seconds, which is trivial. Exacly, so I don't think *physical* time (like a Duration) should even attempt this. Beause the leap second is entirely artifical, invented to keep the *calendar* ("Earth" time) in sync with *physical* time. > (In system code, the NTP stack or some local driver needs to keep track > how physical time relates to calendar time, but that's nothing you'd > need or want in a standard library.) We agree again! > > tl;dr: physical time and calendar time are different concepts, have > different uses, and the use cases for mixing the two are so rare that > conversion code shouldn't go into any kind of standard library. IMHO. > >> [1] Bascially before JodaTime made ordinary developers aware of just how >> complex this Time/Date stuff really is and the importance of clearly >> separating the concept of "calendar" time vs. "physical" time. > > Yeah, that's a really awesome library, and well worth looking at if you > want fresh time API ideas. > Actually, the Java 8 standard "time" library is -- in many ways -- even better, it's been simplified to account for the fact that 99% of people don't actually need to account for e.g. Julian (or $OTHER) chronologies. If you need that kind of functionality, you're already out in the weeds and you probably need to implement your own library *anyway*. (I'd argue that the 30th of July in Sweden falls into the same category, simply because going back to the 1700s is mostly *academic* to most people. I dunno. I know that it would take me a long time to flick through my Google Calendar to get back that far.) Regards, From lambda.fairy at gmail.com Fri Dec 30 06:55:15 2016 From: lambda.fairy at gmail.com (Chris Wong) Date: Fri, 30 Dec 2016 19:55:15 +1300 Subject: [Haskell-cafe] hackagebot future ? In-Reply-To: References: <69EAC40D-191F-4010-8776-6BD6B091678D@joyful.com> Message-ID: > Thanks for the replies all. Chris, thank you for your offer! I hereby transfer hackagebot to your care. Contact me directly (simon at joyful.com, sm on freenode) for any help needed. Sounds good to me! I assume the code is hosted at [1]. I'm busy with New Year stuff right now, so I'll give it a proper look through over the next few weeks. -- 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 dct25-561bs at mythic-beasts.com Fri Dec 30 09:09:14 2016 From: dct25-561bs at mythic-beasts.com (David Turner) Date: Fri, 30 Dec 2016 09:09:14 +0000 Subject: [Haskell-cafe] threadDelay delays less time than expected (Windows) In-Reply-To: References: <20161229162741.jjc3fdmjkjwr5k5o@kitenet.net> Message-ID: On 29 December 2016 at 22:27, Joachim Durchholz wrote: > > Actually you don't convert, but you can add physical time to a calendar > date. > It's not really dangerous, just complicated - leap years which follow a > rule, leap seconds that you have to look up in a table. > Hmm, I dunno, "complicated" implies it's at least possible to define a function which correctly add physical times to calendar times, which isn't true - you can't reliably calculate the calendar time exactly 400*86400 seconds from now because the result depends on whether there's a leap second or not and they're not announced that far ahead of time. I really think "dangerous" is a better word, although the word "unsafe" might be more Haskellish. I can't think of a use case for this kind of addition in application code > though: Either you do calendar calculations, and then you add calendar > seconds to a date, with the usual 24:60:60 factors for > days/hours/minutes/seconds. Or you do timing-related code: timers that go > off, benchmarks, and in both cases you start with a timestamp and add > physical seconds, which is trivial. > (In system code, the NTP stack or some local driver needs to keep track > how physical time relates to calendar time, but that's nothing you'd need > or want in a standard library.) > > tl;dr: physical time and calendar time are different concepts, have > different uses, and the use cases for mixing the two are so rare that > conversion code shouldn't go into any kind of standard library. IMHO. +1 to this. Note that the distinction goes all the way down to the OS - see the CLOCK_REALTIME and CLOCK_MONOTONIC options to https://linux.die.net/man/3/clock_gettime for instance, and there is similar functionality within Windows. Doing any kind of timing-based things with CLOCK_REALTIME (and derivatives) is kinda flawed because it can run slow and/or jump backwards if NTP is fiddling with it. CLOCK_MONOTONIC is the right thing to use for that. OTOH sometimes I want to say "sleep for 50 seconds" and sometimes I want to say "sleep until the current (calendar) time is X". As the delay API doesn't currently support both of these, you have to do the unsafe conversion between calendar times and durations to do both kinds of sleep. Fortunately it's rare to care about waking up at a particular second 6 months into the future so this mostly works just fine. Some of these thoughts are implemented here: https://hackage.haskell.org/package/alarmclock Cheers, David > > > [1] Bascially before JodaTime made ordinary developers aware of just how >> complex this Time/Date stuff really is and the importance of clearly >> separating the concept of "calendar" time vs. "physical" time. >> > > Yeah, that's a really awesome library, and well worth looking at if you > want fresh time API ideas. > > Regards, > Jo > > _______________________________________________ > 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 jo at durchholz.org Fri Dec 30 10:09:52 2016 From: jo at durchholz.org (Joachim Durchholz) Date: Fri, 30 Dec 2016 11:09:52 +0100 Subject: [Haskell-cafe] threadDelay delays less time than expected (Windows) In-Reply-To: References: <20161229162741.jjc3fdmjkjwr5k5o@kitenet.net> Message-ID: <09d7daa8-82ed-85a7-cfd8-e9119381ec1f@durchholz.org> Am 30.12.2016 um 01:14 schrieb Bardur Arantsson: > Beause the leap second is entirely artifical, invented to > keep the *calendar* ("Earth" time) in sync with *physical* time. Serving a practical purpose isn't "artificial" in my book. >>> [1] Bascially before JodaTime made ordinary developers aware of just how >>> complex this Time/Date stuff really is and the importance of clearly >>> separating the concept of "calendar" time vs. "physical" time. >> >> Yeah, that's a really awesome library, and well worth looking at if you >> want fresh time API ideas. > > Actually, the Java 8 standard "time" library is -- in many ways -- even > better, it's been simplified to account for the fact that 99% of people > don't actually need to account for e.g. Julian (or $OTHER) chronologies. > If you need that kind of functionality, you're already out in the weeds > and you probably need to implement your own library *anyway*. I haven't looked at Java 8 date/time yet, I hear it's heavily influenced by Jodatime so it's pretty likely that you can draw the same ideas from that. I'd still start with Jodatime, just to have a better chance of interoperability with needs for alternate calendar systems. Mostly to glean a list of potentially useful data types, and which data fields are relevant to each. From spam at scientician.net Fri Dec 30 10:36:58 2016 From: spam at scientician.net (Bardur Arantsson) Date: Fri, 30 Dec 2016 11:36:58 +0100 Subject: [Haskell-cafe] threadDelay delays less time than expected (Windows) In-Reply-To: <09d7daa8-82ed-85a7-cfd8-e9119381ec1f@durchholz.org> References: <20161229162741.jjc3fdmjkjwr5k5o@kitenet.net> <09d7daa8-82ed-85a7-cfd8-e9119381ec1f@durchholz.org> Message-ID: On 2016-12-30 11:09, Joachim Durchholz wrote: > Am 30.12.2016 um 01:14 schrieb Bardur Arantsson: >> Beause the leap second is entirely artifical, invented to >> keep the *calendar* ("Earth" time) in sync with *physical* time. > > Serving a practical purpose isn't "artificial" in my book. > I'm emphatically *not* saying that there's no such thing as "calendar time". I'm saying we need *separation* between "calendar" and "physical" time. (Which I thin we agree on?) > I haven't looked at Java 8 date/time yet, I hear it's heavily influenced > by Jodatime so it's pretty likely that you can draw the same ideas from > that. Same principal developer :). > I'd still start with Jodatime, just to have a better chance of > interoperability with needs for alternate calendar systems. Mostly to > glean a list of potentially useful data types, and which data fields are > relevant to each. The developer of both Joda and the jdk8 time.* system decided against, so there's that. (And I think it's pretty much undisputed that he *is* an expert and can actually make these trade-offs.) Regards, From esz at posteo.de Fri Dec 30 16:16:21 2016 From: esz at posteo.de (Ertugrul =?utf-8?Q?S=C3=B6ylemez?=) Date: Fri, 30 Dec 2016 17:16:21 +0100 Subject: [Haskell-cafe] Netwire woes: creating a wire with mkGen_ In-Reply-To: <20161229213518.GA7172@casa.casa> References: <20161229213518.GA7172@casa.casa> Message-ID: <86zijdcrze.fsf@posteo.de> Hi, > tl;dr: I want to create a wire which outputs a stream of 'q's when the > letter Q is pressed and a stream of 'a' when the letter A is pressed. > What I wrote is not working and I suspect I am not using mkGen_ > correctly. could you show us the source code of your event wires? I suspect that this is not a Netwire issue at all, but an issue of one of the event wires draining the MVar, so the other one never actually sees a full MVar. Greets, ertes -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 487 bytes Desc: not available URL: From damian.nadales at gmail.com Fri Dec 30 17:04:36 2016 From: damian.nadales at gmail.com (Damian Nadales) Date: Fri, 30 Dec 2016 18:04:36 +0100 Subject: [Haskell-cafe] Doing the course "Functional Systems in Haskell" Message-ID: Hi, I want to follow the material in this course: http://www.scs.stanford.edu/16wi-cs240h/ Is anybody interested in studying the course material and completing the exercises? Has anybody tried to complete earlier versions of the course? Cheers, Damian. From id at joeyh.name Fri Dec 30 17:06:00 2016 From: id at joeyh.name (Joey Hess) Date: Fri, 30 Dec 2016 13:06:00 -0400 Subject: [Haskell-cafe] threadDelay delays less time than expected (Windows) In-Reply-To: References: <20161229162741.jjc3fdmjkjwr5k5o@kitenet.net> Message-ID: <20161230170600.6y3ve4eeqtvmljba@kitenet.net> Sven Panne wrote: > ... or even better: Absorb the functions from unbounded-delays into base. In > their current state, I would consider both threadDelay and timeout API bugs, >    genericThreadDelay :: Integral i => i -> IO () There will be a speed difference between the current threadDelay and genericThreadDelay. If threadDelay is being used for a very small delay, such a speed difference could matter. That's the only reason I can see to keep the current threadDelay. I don't know if supporting Integral buys anything over supporting only Integer and Int. Seems like more opportunities for the user to use a type that overflows. -- see shy jo -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: From fa-ml at ariis.it Fri Dec 30 23:17:37 2016 From: fa-ml at ariis.it (Francesco Ariis) Date: Sat, 31 Dec 2016 00:17:37 +0100 Subject: [Haskell-cafe] Netwire woes: creating a wire with mkGen_ In-Reply-To: <86zijdcrze.fsf@posteo.de> References: <20161229213518.GA7172@casa.casa> <86zijdcrze.fsf@posteo.de> Message-ID: <20161230231737.GA1171@casa.casa> On Fri, Dec 30, 2016 at 05:16:21PM +0100, Ertugrul Söylemez wrote: > could you show us the source code of your event wires? I suspect that > this is not a Netwire issue at all, but an issue of one of the event > wires draining the MVar, so the other one never actually sees a full > MVar. Hello Ertes, the source code is attached to the original message [1]; I'll paste here the relevant bits. This is the wire where the events are generated: > keyEvent :: Wire s () IO (MVar Char) (Event Char) > keyEvent = mkGen_ f > where > f :: MVar Char -> IO (Either () (Event Char)) > f r = tryTakeMVar r >>= \mmv -> > case mmv of > Nothing -> return $ Right NoEvent > Just c -> putStrLn ("pop: " ++ [c]) >> > return (Right (Event c)) And these are the three wires which filter/merge `keyEvent`(s): > keyA, keyQ :: Wire s () IO (MVar Char) (Event Char) > keyQ = filterE (== 'q') . keyEvent > keyA = filterE (== 'a') . keyEvent > > testWire2 :: Wire s () IO (MVar Char) Char > testWire2 = hold . (keyQ &> keyA) `testWire2` is the function that is giving me headaches (works for Q keypresses but not A ones). [1] https://mail.haskell.org/pipermail/beginners/attachments/20161227/c0585a78/attachment.hs From palotai.robin at gmail.com Sat Dec 31 00:37:37 2016 From: palotai.robin at gmail.com (Robin Palotai) Date: Sat, 31 Dec 2016 01:37:37 +0100 Subject: [Haskell-cafe] Build base with stack In-Reply-To: References: Message-ID: Hello Cafe, Do you know a way to force a rebuild of base with stack? I don't want to modify it, just want to feed it through a customized ghc pipeline. Using stack is desirable for consistency with how other packages are run through that pipeline. When I download the appropriate base package and put it in a multi project stack directory, I see all the dependent packages are rebuilt, but not base. Thanks! Robin -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Sat Dec 31 00:45:46 2016 From: allbery.b at gmail.com (Brandon Allbery) Date: Fri, 30 Dec 2016 19:45:46 -0500 Subject: [Haskell-cafe] Build base with stack In-Reply-To: References: Message-ID: On Fri, Dec 30, 2016 at 7:37 PM, Robin Palotai wrote: > > Do you know a way to force a rebuild of base with stack? I don't want to > modify it, just want to feed it through a customized ghc pipeline. > base is part of ghc and must be built along with ghc. It cannot be built separately from ghc, regardless of tooling, if you want it to actually work. (If you want to see some examples of why it is this way, play around with RebindableSyntax a bit, paying attention to the ways in which it breaks if you do the wrong thing. You can also get some idea of it from the behavior of type roles. In short: ghc must know the precise identity *at machine level*, not just source, of various key types in base. It can only do this by ghc and base being built together so that various types' machine level representations can be wired into ghc as they are built.) -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From esz at posteo.de Sat Dec 31 00:50:28 2016 From: esz at posteo.de (Ertugrul =?utf-8?Q?S=C3=B6ylemez?=) Date: Sat, 31 Dec 2016 01:50:28 +0100 Subject: [Haskell-cafe] Netwire woes: creating a wire with mkGen_ In-Reply-To: <20161230231737.GA1171@casa.casa> References: <20161229213518.GA7172@casa.casa> <86zijdcrze.fsf@posteo.de> <20161230231737.GA1171@casa.casa> Message-ID: <86tw9kdiqz.fsf@posteo.de> > keyQ = filterE (== 'q') . keyEvent > keyA = filterE (== 'a') . keyEvent > > testWire2 = hold . (keyQ &> keyA) This is the problem. You actually have the 'keyEvent' wire twice in there, which means that both are trying to take from the 'MVar', which in turn means that in any frame if keyQ gets nothing, it's very unlikely that keyA will get something (because it runs pretty much directly after keyQ), and whenever keyQ gets something, it will clear the MVar, so keyA gets nothing again. The real solution is not to have keyEvent twice in there: proc _ -> do keys <- keyEvent -< () qKeys <- filterE (== 'q') -< keys aKeys <- filterE (== 'a') -< keys hold -< mergeL qKeys aKeys Perhaps you would like to try the new [wires] library, which has a much cleaner distinction between frameworks and the actual FRP description, so mistakes like this are far less likely. It's a cleaner library than Netwire in general. =) [wires]: https://hackage.haskell.org/package/wires Greets ertes -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 487 bytes Desc: not available URL: From esz at posteo.de Sat Dec 31 02:11:40 2016 From: esz at posteo.de (Ertugrul =?utf-8?Q?S=C3=B6ylemez?=) Date: Sat, 31 Dec 2016 03:11:40 +0100 Subject: [Haskell-cafe] ANN: rapid, rapid-term: Rapid prototyping for Haskell Message-ID: <86r34odezn.fsf@posteo.de> Hi everybody, I'd like to officially announce my rapid prototyping suite unimaginatively called [Rapid] along with a helper library called [rapid-term]. The traditional approach to rapid prototyping with Haskell is to have a process running in the background that listens for source code changes and then recompiles/reloads and restarts the application. I'll call this process the *watcher*. This approach has a few drawbacks: * The watcher is separate from the main GHCi instance used for development. This means that the only access to the application state you have is through the interfaces you have explicitly defined in your code. * Restarting the application entails losing all ephemeral state, all network connections, all computed in-memory data, etc. * The watcher typically doesn't understand individual application components, so it's impossible to restart them individually. Rapid uses Chris Done's [foreign-store] library to provide a rapid prototyping framework for GHCi that lets you reload just the relevant parts of your application while keeping everything else running untouched, including all state, database/network connections, etc. It runs directly in the GHCi instance used for development, so you can talk to Rapid as well as your application from the REPL as it runs; no need to define debugging interfaces. The goal is to shorten the development cycle as much as possible. Another example use case is the development of interactive GUI applications. You can keep the GUI window open and preserve all of its run-time state (text you have entered, list items you have created, etc.), while reloading your application logic. It can also be used by batch applications that don't run for extended periods of time, for example to keep expensive resources in memory. For example load and parse your giant data file once and just reuse the resulting value across reloads. There is a detailed [Rapid tutorial] in the documentation of the `Rapid` module. It also walks you through Emacs haskell-mode integration. Rapid-term is a helper library for the development of applications that require an actual terminal. It spawns a separate terminal and keeps it open for the duration of the GHCi session. The application can then access this terminal and reuse it across runs. There is a [rapid-term tutorial] in the documentation of the `Rapid.Term` module, which also explains how to use rapid-term for rapid prototyping of Vty applications (same story as for GUI applications, but for Vty: keep your UI running, preserve your state, reload your application logic). Feedback, bug reports and code contributions are highly welcome! Greets, ertes [foreign-store]: https://hackage.haskell.org/package/foreign-store [rapid tutorial]: https://hackage.haskell.org/package/rapid-0.1.3/docs/Rapid.html [rapid-term tutorial]: https://hackage.haskell.org/package/rapid-term-0.1.0/docs/Rapid-Term.html [rapid-term]: https://hackage.haskell.org/package/rapid-term [rapid]: https://hackage.haskell.org/package/rapid -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 487 bytes Desc: not available URL: From fa-ml at ariis.it Sat Dec 31 02:23:01 2016 From: fa-ml at ariis.it (Francesco Ariis) Date: Sat, 31 Dec 2016 03:23:01 +0100 Subject: [Haskell-cafe] Netwire woes: creating a wire with mkGen_ In-Reply-To: <86tw9kdiqz.fsf@posteo.de> References: <20161229213518.GA7172@casa.casa> <86zijdcrze.fsf@posteo.de> <20161230231737.GA1171@casa.casa> <86tw9kdiqz.fsf@posteo.de> Message-ID: <20161231022301.GA8486@casa.casa> On Sat, Dec 31, 2016 at 01:50:28AM +0100, Ertugrul Söylemez wrote: > This is the problem. You actually have the 'keyEvent' wire twice in > there, which means that both are trying to take from the 'MVar', which > in turn means that in any frame if keyQ gets nothing, it's very unlikely > that keyA will get something (because it runs pretty much directly after > keyQ), and whenever keyQ gets something, it will clear the MVar, so keyA > gets nothing again. The real solution is not to have keyEvent twice in > there: > > proc _ -> do > keys <- keyEvent -< () > qKeys <- filterE (== 'q') -< keys > aKeys <- filterE (== 'a') -< keys > hold -< mergeL qKeys aKeys Very helpful, it's clear now (pity we have to use arrow interface, I much preferred applicative). I'll check `wires` too as suggested. Thanks again -F From ezyang at mit.edu Sat Dec 31 02:28:02 2016 From: ezyang at mit.edu (Edward Z. Yang) Date: Fri, 30 Dec 2016 21:28:02 -0500 Subject: [Haskell-cafe] Build base with stack In-Reply-To: References: Message-ID: <1483150788-sup-3471@sabre> Excerpts from Brandon Allbery's message of 2016-12-30 19:45:46 -0500: > On Fri, Dec 30, 2016 at 7:37 PM, Robin Palotai > wrote: > > > > Do you know a way to force a rebuild of base with stack? I don't want to > > modify it, just want to feed it through a customized ghc pipeline. > > > > base is part of ghc and must be built along with ghc. It cannot be built > separately from ghc, regardless of tooling, if you want it to actually work. > > (If you want to see some examples of why it is this way, play around with > RebindableSyntax a bit, paying attention to the ways in which it breaks if > you do the wrong thing. You can also get some idea of it from the behavior > of type roles. In short: ghc must know the precise identity *at machine > level*, not just source, of various key types in base. It can only do this > by ghc and base being built together so that various types' machine level > representations can be wired into ghc as they are built.) Although it is true that GHC is closely tied to the particularities of base, you CAN swap out base, as long as the new version of base has all of the wired in entities that GHC expects to see. (This must be the case, because we build stage 1 GHC before we build base.) To answer OP's question, I don't know how to do it with Stack but I've rebuilt base with cabal-install new-build with a little patch. First you have to modify cabal-install/Distribution/Solver/Modular/Solver.hs, changing the invocation of P.requireInstalled so that "base" isn't on the list; this lets cabal-install decide that it can rebuild base. Then, in your cabal.project, add: packages: path/to/base constraints: base +integer-gmp (The integer-gmp flag is manual so you need to make sure you toggle it yourself.) Then cabal new-build will build it, and other packages will make use of it. Good luck! Edward From codygman.consulting at gmail.com Sat Dec 31 07:56:17 2016 From: codygman.consulting at gmail.com (Cody Goodman) Date: Sat, 31 Dec 2016 01:56:17 -0600 Subject: [Haskell-cafe] help with type variable escaping scope/passing lens as function argument Message-ID: I have the following code and error(also seen at https://github.com/codygman/frames-credit-card-trans-demo/blob/master/src/Main.hs#L28 ): -- between meaning on or after start but before end dateBetween :: _ -> Day -> Day -> Pipe (Record rs) (Record rs) IO r dateBetween target start end = P.filter go where go :: Record rs -> _ go r = let targetDate = rget target r :: Chicago targetDate' = chicagoToZoned targetDate :: ZonedTime targetDay = localDay (zonedTimeToLocalTime targetDate') :: Day in targetDay >= start && targetDay < end -- type error -- src/Main.hs:48:38: error: … -- • Couldn't match expected type ‘(Chicago -> f Chicago) -- -> Record rs1 -> f (Record rs1)’ -- with actual type ‘t’ -- because type variable ‘f’ would escape its scope -- This (rigid, skolem) type variable is bound by -- a type expected by the context: -- Functor f => (Chicago -> f Chicago) -> Record rs1 -> f (Record rs1) -- at /home/cody/source/frames-credit-card-trans-demo/src/Main.hs:48:33-45 -- • In the first argument of ‘rget’, namely ‘target’ -- In the expression: rget target r :: Chicago -- In an equation for ‘targetDate’: -- targetDate = rget target r :: Chicago -- • Relevant bindings include -- r :: Record rs1 -- (bound at /home/cody/source/frames-credit-card-trans-demo/src/Main.hs:48:12) -- go :: Record rs1 -> Bool -- (bound at /home/cody/source/frames-credit-card-trans-demo/src/Main.hs:48:9) -- target :: t -- (bound at /home/cody/source/frames-credit-card-trans-demo/src/Main.hs:46:13) -- dateBetween :: t -> Day -> Day -> Pipe (Record rs) (Record rs) IO r -- (bound at /home/cody/source/frames-credit-card-trans-demo/src/Main.hs:46:1) -- Compilation failed. Perhaps it's late, but I'm fairly sure I've done something like this before. Thanks, Cody -------------- next part -------------- An HTML attachment was scrubbed... URL: From li-yao.xia at ens.fr Sat Dec 31 09:59:46 2016 From: li-yao.xia at ens.fr (Li-yao Xia) Date: Sat, 31 Dec 2016 09:59:46 +0000 Subject: [Haskell-cafe] help with type variable escaping scope/passing lens as function argument In-Reply-To: References: <6e51473d-6d3b-3578-729a-2cdf28b63500@ens.fr> Message-ID: Hi Cody, I forgot to keep Haskell-cafe in copy. > Are you saying that my forall applies to both a and b, but not only a? And > that a is what (Lens (Record rs) Chicago -> (...)) expands to? That sounds about right. Try this: dateBetween :: (forall f. Functor f => (Chicago -> f Chicago) -> Record rs -> f (Record rs)) -> Day -> Day -> Pipe (Record rs) (Record rs) IO m Or, a bit refactored: type Lens s a = forall f. Functor f => (a -> f a) -> (s -> f s) dateBetween :: Lens (Record rs) Chicago -> Day -> Day -> Pipe (Record rs) (Record rs) IO m > Where does f1 come from? Does GHC just come up with it because my type > variable doesn't satisfy it? When you write this dateBetween :: forall (rs :: [*]) (m :: *) (f :: * -> *). (Functor f) => ((Chicago -> f Chicago) -> Record rs -> f (Record rs)) -> Day -> Day -> Pipe (Record rs) (Record rs) IO m dateBetween target start end = ... The parameter target is a monomorphic function, with f instantiated at the call site of dateBetween. This means that dateBetween can not assume anything about f apart from the fact that it is an instance of Functor, i.e., f must be abstract. Then we have: let targetDate = rget target r but this is the type of rget: rget :: (forall f . Functor f => (a -> f a) -> Record rs -> f (Record rs)) -> Record rs -> a rget expects a polymorphic function, while target is monomorphic. The compiler tries to unify "f" from the type signature of dateBetween, and "f" from the type signature of rget. To avoid confusion, the compiler does renaming, so that different variables (identified by where they are bound) have different names, and that's where "f1" comes from: rget :: forall a1 rs1. (forall f1 . Functor f1 => (a1 -> f1 a1) -> Record rs1 -> f1 (Record rs1)) -> Record rs1 -> a1 Applying rget to (target :: (Chicago -> f Chicago) -> Record rs -> f (Record rs)), the compiler tries to unify f and f1, and fails because they are "rigid", meaning, they can't be instantiated. f is rigid because it is abstract in the body of dateBetween, f1 is rigid because it is the type parameter of the polymorphic function rget expects. Li-yao On 12/31/2016 09:07 AM, Cody Goodman wrote: > Hi Li-yao, > > Are you saying that my forall applies to both a and b, but not only a? And > that a is what (Lens (Record rs) Chicago -> (...)) expands to? > > In either case, I don't understand what action I can take based on what was > you said and what I understand from it :/ > > Where does f1 come from? Does GHC just come up with it because my type > variable doesn't satisfy it? > > Thanks, > > Cody > > On Sat, Dec 31, 2016 at 2:54 AM, Li-yao Xia wrote: > >> Hi Cody, >> >> You wrote something of the shape >> >> forall f. Functor f => a -> b >> >> which means >> >> forall f. Functor f => (a -> b) >> >> but not >> >> (forall f. Functor f => a) -> b >> >> which would be what (Lens (Record rs) Chicago -> (...)) expands to. >> >> Regards, >> Li-yao >> >> >> On 12/31/2016 08:45 AM, Cody Goodman wrote: >> >>> Thanks for the help Li-yao, but I still have a type error after using Rank >>> N Types. I have updated my code on github >>> https://github.com/codygman/frames-credit-card-trans-demo/bl >>> ob/master/src/Main.hs#L45() >>> and pasted below: >>> >>> dateBetween :: forall (rs :: [*]) (m :: *) (f :: * -> *). >>> (Functor f) => >>> ((Chicago -> f Chicago) -> Record rs -> f (Record rs)) >>> -> Day >>> -> Day >>> -> Pipe (Record rs) (Record rs) IO m >>> dateBetween target start end = P.filter go >>> where go :: Record rs -> _ >>> go r = let targetDate = (rget target r) :: Chicago >>> targetDate' = chicagoToZoned targetDate :: ZonedTime >>> targetDay = localDay (zonedTimeToLocalTime targetDate') >>> :: Day >>> in >>> targetDay >= start && targetDay < end >>> -- type error >>> -- src/Main.hs:53:39: error: … >>> -- • Couldn't match type ‘f’ with ‘f1’ >>> -- ‘f’ is a rigid type variable bound by >>> -- the type signature for: >>> -- dateBetween :: forall (rs :: [*]) m (f :: * -> *). >>> -- Functor f => >>> -- ((Chicago -> f Chicago) -> Record rs -> f >>> (Record rs)) >>> -- -> Day -> Day -> Pipe (Record rs) (Record rs) >>> IO m >>> -- at >>> /home/cody/source/frames-credit-card-trans-demo/src/Main.hs:45:45 >>> -- ‘f1’ is a rigid type variable bound by >>> -- a type expected by the context: >>> -- forall (f1 :: * -> *). >>> -- Functor f1 => >>> -- (Chicago -> f1 Chicago) -> Record rs -> f1 (Record rs) >>> -- at >>> /home/cody/source/frames-credit-card-trans-demo/src/Main.hs:53:34 >>> -- Expected type: (Chicago -> f1 Chicago) >>> -- -> Record rs -> f1 (Record rs) >>> -- Actual type: (Chicago -> f Chicago) -> Record rs -> f (Record >>> rs) >>> -- • In the first argument of ‘rget’, namely ‘target’ >>> -- In the expression: (rget target r) :: Chicago >>> -- In an equation for ‘targetDate’: >>> -- targetDate = (rget target r) :: Chicago >>> -- • Relevant bindings include >>> -- target :: (Chicago -> f Chicago) -> Record rs -> f (Record rs) >>> -- (bound at >>> /home/cody/source/frames-credit-card-trans-demo/src/Main.hs:51:13) >>> -- dateBetween :: ((Chicago -> f Chicago) >>> -- -> Record rs -> f (Record rs)) >>> -- -> Day -> Day -> Pipe (Record rs) (Record rs) >>> IO m >>> -- (bound at >>> /home/cody/source/frames-credit-card-trans-demo/src/Main.hs:51:1) >>> -- Compilation failed. >>> >>> On Sat, Dec 31, 2016 at 2:21 AM, Li-yao Xia wrote: >>> >>> Hello Cody, >>>> >>>> Complete the type annotation, using RankNTypes >>>> >>>> dateBetween :: Lens Record Chicago -> ... >>>> >>>> GHC does not infer higher-rank types, because it is an undecidable >>>> problem >>>> in general, so you must annotate polymorphic parameters explicitly. >>>> >>>> Regards, >>>> Li-yao >>>> >>>> >>>> On 12/31/2016 07:56 AM, Cody Goodman wrote: >>>> >>>> I have the following code and error(also seen at >>>>> https://github.com/codygman/frames-credit-card-trans-demo/bl >>>>> ob/master/src/Main.hs#L28 >>>>> ): >>>>> >>>>> >>>>> -- between meaning on or after start but before end >>>>> dateBetween :: _ >>>>> -> Day >>>>> -> Day >>>>> -> Pipe (Record rs) (Record rs) IO r >>>>> dateBetween target start end = P.filter go >>>>> where go :: Record rs -> _ >>>>> go r = let targetDate = rget target r :: Chicago >>>>> targetDate' = chicagoToZoned targetDate :: ZonedTime >>>>> targetDay = localDay (zonedTimeToLocalTime >>>>> targetDate') >>>>> :: Day >>>>> in >>>>> targetDay >= start && targetDay < end >>>>> -- type error >>>>> -- src/Main.hs:48:38: error: … >>>>> -- • Couldn't match expected type ‘(Chicago -> f Chicago) >>>>> -- -> Record rs1 -> f (Record rs1)’ >>>>> -- with actual type ‘t’ >>>>> -- because type variable ‘f’ would escape its scope >>>>> -- This (rigid, skolem) type variable is bound by >>>>> -- a type expected by the context: >>>>> -- Functor f => (Chicago -> f Chicago) -> Record rs1 -> f >>>>> (Record >>>>> rs1) >>>>> -- at >>>>> /home/cody/source/frames-credit-card-trans-demo/src/Main.hs:48:33-45 >>>>> -- • In the first argument of ‘rget’, namely ‘target’ >>>>> -- In the expression: rget target r :: Chicago >>>>> -- In an equation for ‘targetDate’: >>>>> -- targetDate = rget target r :: Chicago >>>>> -- • Relevant bindings include >>>>> -- r :: Record rs1 >>>>> -- (bound at >>>>> /home/cody/source/frames-credit-card-trans-demo/src/Main.hs:48:12) >>>>> -- go :: Record rs1 -> Bool >>>>> -- (bound at >>>>> /home/cody/source/frames-credit-card-trans-demo/src/Main.hs:48:9) >>>>> -- target :: t >>>>> -- (bound at >>>>> /home/cody/source/frames-credit-card-trans-demo/src/Main.hs:46:13) >>>>> -- dateBetween :: t -> Day -> Day -> Pipe (Record rs) (Record >>>>> rs) >>>>> IO r >>>>> -- (bound at >>>>> /home/cody/source/frames-credit-card-trans-demo/src/Main.hs:46:1) >>>>> -- Compilation failed. >>>>> >>>>> Perhaps it's late, but I'm fairly sure I've done something like this >>>>> before. >>>>> >>>>> Thanks, >>>>> >>>>> Cody >>>>> >>>>> >>>>> >>>>> _______________________________________________ >>>>> 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 zhangjun.julian at gmail.com Sat Dec 31 14:43:03 2016 From: zhangjun.julian at gmail.com (jun zhang) Date: Sat, 31 Dec 2016 22:43:03 +0800 Subject: [Haskell-cafe] How to call python from haskell Message-ID: Dear cafe I had try to use the http://hackage.haskell.org/package/cpython package. I can call python function once by the package, but when I call function second time it will occur a "Segmentation fault”. Does there any stable package support call python from haskell? Thanks. Julian -------------- next part -------------- An HTML attachment was scrubbed... URL: From codygman.consulting at gmail.com Sat Dec 31 17:04:08 2016 From: codygman.consulting at gmail.com (Cody Goodman) Date: Sat, 31 Dec 2016 11:04:08 -0600 Subject: [Haskell-cafe] help with type variable escaping scope/passing lens as function argument In-Reply-To: References: <6e51473d-6d3b-3578-729a-2cdf28b63500@ens.fr> Message-ID: Thanks so much! You just taught me many things I didn't know! The code is working by the way. :) On Dec 31, 2016 3:59 AM, "Li-yao Xia" wrote: > Hi Cody, > > I forgot to keep Haskell-cafe in copy. > > > Are you saying that my forall applies to both a and b, but not only a? > And > > that a is what (Lens (Record rs) Chicago -> (...)) expands to? > > That sounds about right. > > Try this: > > dateBetween :: (forall f. Functor f => (Chicago -> f Chicago) -> > Record rs -> f (Record rs)) > -> Day > -> Day > -> Pipe (Record rs) (Record rs) IO m > > Or, a bit refactored: > > type Lens s a = forall f. Functor f => (a -> f a) -> (s -> f s) > > dateBetween :: Lens (Record rs) Chicago > -> Day -> Day -> Pipe (Record rs) (Record rs) IO m > > > Where does f1 come from? Does GHC just come up with it because my type > > variable doesn't satisfy it? > > When you write this > > dateBetween :: forall (rs :: [*]) (m :: *) (f :: * -> *). > (Functor f) => > ((Chicago -> f Chicago) -> Record rs -> f (Record rs)) > -> Day > -> Day > -> Pipe (Record rs) (Record rs) IO m > dateBetween target start end = ... > > The parameter target is a monomorphic function, with f instantiated at the > call site of dateBetween. This means that dateBetween can not assume > anything about f apart from the fact that it is an instance of Functor, > i.e., f must be abstract. > > Then we have: > > let targetDate = rget target r > > but this is the type of rget: > > rget :: (forall f . Functor f => (a -> f a) -> Record rs -> f (Record > rs)) -> Record rs -> a > > rget expects a polymorphic function, while target is monomorphic. The > compiler tries to unify "f" from the type signature of dateBetween, and "f" > from the type signature of rget. To avoid confusion, the compiler does > renaming, so that different variables (identified by where they are bound) > have different names, and that's where "f1" comes from: > > rget :: forall a1 rs1. (forall f1 . Functor f1 => (a1 -> f1 a1) -> > Record rs1 -> f1 (Record rs1)) -> Record rs1 -> a1 > > Applying rget to (target :: (Chicago -> f Chicago) -> Record rs -> f > (Record rs)), the compiler tries to unify f and f1, and fails because they > are "rigid", meaning, they can't be instantiated. f is rigid because it is > abstract in the body of dateBetween, f1 is rigid because it is the type > parameter of the polymorphic function rget expects. > > Li-yao > > On 12/31/2016 09:07 AM, Cody Goodman wrote: > >> Hi Li-yao, >> >> Are you saying that my forall applies to both a and b, but not only a? And >> that a is what (Lens (Record rs) Chicago -> (...)) expands to? >> >> In either case, I don't understand what action I can take based on what >> was >> you said and what I understand from it :/ >> >> Where does f1 come from? Does GHC just come up with it because my type >> variable doesn't satisfy it? >> >> Thanks, >> >> Cody >> >> On Sat, Dec 31, 2016 at 2:54 AM, Li-yao Xia wrote: >> >> Hi Cody, >>> >>> You wrote something of the shape >>> >>> forall f. Functor f => a -> b >>> >>> which means >>> >>> forall f. Functor f => (a -> b) >>> >>> but not >>> >>> (forall f. Functor f => a) -> b >>> >>> which would be what (Lens (Record rs) Chicago -> (...)) expands to. >>> >>> Regards, >>> Li-yao >>> >>> >>> On 12/31/2016 08:45 AM, Cody Goodman wrote: >>> >>> Thanks for the help Li-yao, but I still have a type error after using >>>> Rank >>>> N Types. I have updated my code on github >>>> https://github.com/codygman/frames-credit-card-trans-demo/bl >>>> ob/master/src/Main.hs#L45() >>>> and pasted below: >>>> >>>> dateBetween :: forall (rs :: [*]) (m :: *) (f :: * -> *). >>>> (Functor f) => >>>> ((Chicago -> f Chicago) -> Record rs -> f (Record rs)) >>>> -> Day >>>> -> Day >>>> -> Pipe (Record rs) (Record rs) IO m >>>> dateBetween target start end = P.filter go >>>> where go :: Record rs -> _ >>>> go r = let targetDate = (rget target r) :: Chicago >>>> targetDate' = chicagoToZoned targetDate :: ZonedTime >>>> targetDay = localDay (zonedTimeToLocalTime >>>> targetDate') >>>> :: Day >>>> in >>>> targetDay >= start && targetDay < end >>>> -- type error >>>> -- src/Main.hs:53:39: error: … >>>> -- • Couldn't match type ‘f’ with ‘f1’ >>>> -- ‘f’ is a rigid type variable bound by >>>> -- the type signature for: >>>> -- dateBetween :: forall (rs :: [*]) m (f :: * -> *). >>>> -- Functor f => >>>> -- ((Chicago -> f Chicago) -> Record rs -> f >>>> (Record rs)) >>>> -- -> Day -> Day -> Pipe (Record rs) (Record >>>> rs) >>>> IO m >>>> -- at >>>> /home/cody/source/frames-credit-card-trans-demo/src/Main.hs:45:45 >>>> -- ‘f1’ is a rigid type variable bound by >>>> -- a type expected by the context: >>>> -- forall (f1 :: * -> *). >>>> -- Functor f1 => >>>> -- (Chicago -> f1 Chicago) -> Record rs -> f1 (Record rs) >>>> -- at >>>> /home/cody/source/frames-credit-card-trans-demo/src/Main.hs:53:34 >>>> -- Expected type: (Chicago -> f1 Chicago) >>>> -- -> Record rs -> f1 (Record rs) >>>> -- Actual type: (Chicago -> f Chicago) -> Record rs -> f (Record >>>> rs) >>>> -- • In the first argument of ‘rget’, namely ‘target’ >>>> -- In the expression: (rget target r) :: Chicago >>>> -- In an equation for ‘targetDate’: >>>> -- targetDate = (rget target r) :: Chicago >>>> -- • Relevant bindings include >>>> -- target :: (Chicago -> f Chicago) -> Record rs -> f (Record >>>> rs) >>>> -- (bound at >>>> /home/cody/source/frames-credit-card-trans-demo/src/Main.hs:51:13) >>>> -- dateBetween :: ((Chicago -> f Chicago) >>>> -- -> Record rs -> f (Record rs)) >>>> -- -> Day -> Day -> Pipe (Record rs) (Record rs) >>>> IO m >>>> -- (bound at >>>> /home/cody/source/frames-credit-card-trans-demo/src/Main.hs:51:1) >>>> -- Compilation failed. >>>> >>>> On Sat, Dec 31, 2016 at 2:21 AM, Li-yao Xia wrote: >>>> >>>> Hello Cody, >>>> >>>>> >>>>> Complete the type annotation, using RankNTypes >>>>> >>>>> dateBetween :: Lens Record Chicago -> ... >>>>> >>>>> GHC does not infer higher-rank types, because it is an undecidable >>>>> problem >>>>> in general, so you must annotate polymorphic parameters explicitly. >>>>> >>>>> Regards, >>>>> Li-yao >>>>> >>>>> >>>>> On 12/31/2016 07:56 AM, Cody Goodman wrote: >>>>> >>>>> I have the following code and error(also seen at >>>>> >>>>>> https://github.com/codygman/frames-credit-card-trans-demo/bl >>>>>> ob/master/src/Main.hs#L28 >>>>>> ): >>>>>> >>>>>> >>>>>> -- between meaning on or after start but before end >>>>>> dateBetween :: _ >>>>>> -> Day >>>>>> -> Day >>>>>> -> Pipe (Record rs) (Record rs) IO r >>>>>> dateBetween target start end = P.filter go >>>>>> where go :: Record rs -> _ >>>>>> go r = let targetDate = rget target r :: Chicago >>>>>> targetDate' = chicagoToZoned targetDate :: >>>>>> ZonedTime >>>>>> targetDay = localDay (zonedTimeToLocalTime >>>>>> targetDate') >>>>>> :: Day >>>>>> in >>>>>> targetDay >= start && targetDay < end >>>>>> -- type error >>>>>> -- src/Main.hs:48:38: error: … >>>>>> -- • Couldn't match expected type ‘(Chicago -> f Chicago) >>>>>> -- -> Record rs1 -> f (Record >>>>>> rs1)’ >>>>>> -- with actual type ‘t’ >>>>>> -- because type variable ‘f’ would escape its scope >>>>>> -- This (rigid, skolem) type variable is bound by >>>>>> -- a type expected by the context: >>>>>> -- Functor f => (Chicago -> f Chicago) -> Record rs1 -> f >>>>>> (Record >>>>>> rs1) >>>>>> -- at >>>>>> /home/cody/source/frames-credit-card-trans-demo/src/Main.hs:48:33-45 >>>>>> -- • In the first argument of ‘rget’, namely ‘target’ >>>>>> -- In the expression: rget target r :: Chicago >>>>>> -- In an equation for ‘targetDate’: >>>>>> -- targetDate = rget target r :: Chicago >>>>>> -- • Relevant bindings include >>>>>> -- r :: Record rs1 >>>>>> -- (bound at >>>>>> /home/cody/source/frames-credit-card-trans-demo/src/Main.hs:48:12) >>>>>> -- go :: Record rs1 -> Bool >>>>>> -- (bound at >>>>>> /home/cody/source/frames-credit-card-trans-demo/src/Main.hs:48:9) >>>>>> -- target :: t >>>>>> -- (bound at >>>>>> /home/cody/source/frames-credit-card-trans-demo/src/Main.hs:46:13) >>>>>> -- dateBetween :: t -> Day -> Day -> Pipe (Record rs) (Record >>>>>> rs) >>>>>> IO r >>>>>> -- (bound at >>>>>> /home/cody/source/frames-credit-card-trans-demo/src/Main.hs:46:1) >>>>>> -- Compilation failed. >>>>>> >>>>>> Perhaps it's late, but I'm fairly sure I've done something like this >>>>>> before. >>>>>> >>>>>> Thanks, >>>>>> >>>>>> Cody >>>>>> >>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> 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: