From wojciech.danilo at gmail.com Wed Mar 1 02:29:17 2017 From: wojciech.danilo at gmail.com (Wojciech Danilo) Date: Tue, 28 Feb 2017 18:29:17 -0800 (PST) Subject: [Haskell-cafe] Looking for maintainers or comaintainers on my Haskell projects In-Reply-To: References: Message-ID: Chris, first of all, I'm sorry to hear about your problems and I hope you'll be getting better. Thank you for your input in Haskell community, we all know your libraries. I'd love to be co-maintainer of path package. I use it extensively and was already planning to make some pull requests (allowing for example for env variables expansion). All the best and thank you once again! Wojciech W dniu wtorek, 28 lutego 2017 18:21:18 UTC+1 użytkownik Christopher Done napisał: > > Hi all, > > The short version is: I’ve been battling RSI in my fingers for some years. > I’m doing various things to mitigate that problem, but I have very limited > finger bandwidth these days; enough to work at my usual pace at my job, but > not much in the evenings and weekends, and so I can’t manage to do much on > my hobby projects. I’m also not as motivated these days to work on my set > of open source projects, and am turning my attention to different things. > It’s not great, but that’s life. > > I don’t think that the users of my packages are getting the best > maintainership deal. Rather than be “the absentee maintainer”, I’d prefer a > straight-forward transition of maintainership or ownership to someone who > can put the right energy and time in. > > In terms of packages, there are really two that have a significant > maintenance burden and users aren’t being served very well: > > - HIndent has a significant > amount of issues opened for it regularly, and many of them require > discussion and debate. If someone would like to become a co-maintainer, let > me know. It may (eventually) make sense to move it to a more general GitHub > organization like commercialhaskell or haskell. > - Intero , which > seems to have been a success, has a pretty big maintenance burden on “this > doesn’t work” kind of issues which require investigation. There’s some > Emacs Lisp work to do on it, and some Haskell work on the intero binary, > and a whole lot of platform-specific problems or tooling not working > together. On the other hand people really like this project, and there’s a > lot of tooling potential. > > If you want to take xeno and make it > into a publishable package, please do so. > > The rest of my projects that are on Stackage are: labels > , ace > , ical > , check-email > , freenect > , frisby > , gd > , ini > , lucid > , osdkeys > , pdfinfo > , present > , pure-io > , scrobble > , shell-conduit > , sourcemap > , descriptive > , wrap > , path > , weigh > , haskell-docs > , and > structured-haskell-mode > . If you’re > interested in taking over or co-maintaining any of them, let me know. Some > are interesting, others are boring, some are trivial. > > I have other packages on Hackage, but they’re mostly dead or experiments > that don’t need maintenance anyway. > > I’ve started the process of adding or changing maintainers on my public > services: > > - Haskell News is now a GitHub > organization. Luke Murphy is a co-owner, and has full access to the > DigitalOcean account that is running the service. So if you want to work on > that project, I’m not in the way. > - lpaste has been moved to its own > DigitalOcean account too. If anyone is interested in taking over the > project or co-running it, let me know. > - tryhaskell doesn’t really > require any maintenance, but it’s also on its own DigitalOcean account now > too. > - IRCBrowse is now on its own > DigitalOcean account too. It requires maintenance once in a while. If > anyone is interested in taking over the project or co-running it, let me > know. > > Cheers! > ​ > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sibi at psibi.in Wed Mar 1 03:16:03 2017 From: sibi at psibi.in (Sibi) Date: Wed, 1 Mar 2017 08:46:03 +0530 Subject: [Haskell-cafe] Looking for maintainers or comaintainers on my Haskell projects In-Reply-To: References: Message-ID: Thanks for your effort. I'm interested in co-maintaining "shell-conduit" and "check-email". Regards, Sibi On Tue, Feb 28, 2017 at 10:48 PM, Christopher Done wrote: > Hi all, > > The short version is: I’ve been battling RSI in my fingers for some years. > I’m doing various things to mitigate that problem, but I have very limited > finger bandwidth these days; enough to work at my usual pace at my job, but > not much in the evenings and weekends, and so I can’t manage to do much on > my hobby projects. I’m also not as motivated these days to work on my set > of open source projects, and am turning my attention to different things. > It’s not great, but that’s life. > > I don’t think that the users of my packages are getting the best > maintainership deal. Rather than be “the absentee maintainer”, I’d prefer a > straight-forward transition of maintainership or ownership to someone who > can put the right energy and time in. > > In terms of packages, there are really two that have a significant > maintenance burden and users aren’t being served very well: > > - HIndent has a significant > amount of issues opened for it regularly, and many of them require > discussion and debate. If someone would like to become a co-maintainer, let > me know. It may (eventually) make sense to move it to a more general GitHub > organization like commercialhaskell or haskell. > - Intero , which > seems to have been a success, has a pretty big maintenance burden on “this > doesn’t work” kind of issues which require investigation. There’s some > Emacs Lisp work to do on it, and some Haskell work on the intero binary, > and a whole lot of platform-specific problems or tooling not working > together. On the other hand people really like this project, and there’s a > lot of tooling potential. > > If you want to take xeno and make it > into a publishable package, please do so. > > The rest of my projects that are on Stackage are: labels > , ace > , ical > , check-email > , freenect > , frisby > , gd > , ini > , lucid > , osdkeys > , pdfinfo > , present > , pure-io > , scrobble > , shell-conduit > , sourcemap > , descriptive > , wrap > , path > , weigh > , haskell-docs > , and > structured-haskell-mode > . If you’re > interested in taking over or co-maintaining any of them, let me know. Some > are interesting, others are boring, some are trivial. > > I have other packages on Hackage, but they’re mostly dead or experiments > that don’t need maintenance anyway. > > I’ve started the process of adding or changing maintainers on my public > services: > > - Haskell News is now a GitHub > organization. Luke Murphy is a co-owner, and has full access to the > DigitalOcean account that is running the service. So if you want to work on > that project, I’m not in the way. > - lpaste has been moved to its own > DigitalOcean account too. If anyone is interested in taking over the > project or co-running it, let me know. > - tryhaskell doesn’t really > require any maintenance, but it’s also on its own DigitalOcean account now > too. > - IRCBrowse is now on its own > DigitalOcean account too. It requires maintenance once in a while. If > anyone is interested in taking over the project or co-running it, let me > know. > > Cheers! > ​ > > _______________________________________________ > 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. > -- Sibi, sibi at psibi.in Software Engineer @ Inkmonk, Twitter/github/identi.ca: psibi GPG Fingerpint: A241 B3D6 F4FD D40D D7DE B1C6 D19E 3E0E BB55 7613 Registered Linux User ID: 534664 -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan.miljenovic at gmail.com Wed Mar 1 04:38:16 2017 From: ivan.miljenovic at gmail.com (Ivan Lazar Miljenovic) Date: Wed, 1 Mar 2017 15:38:16 +1100 Subject: [Haskell-cafe] Looking for maintainers or comaintainers on my Haskell projects In-Reply-To: References: Message-ID: And here I was thinking I was already the maintainer of haskell-docs... ;-) I'd like to help with structured-haskell-mode, but my elisp-fu is unsufficient :( On 1 March 2017 at 04:18, Christopher Done wrote: > Hi all, > > The short version is: I’ve been battling RSI in my fingers for some years. > I’m doing various things to mitigate that problem, but I have very limited > finger bandwidth these days; enough to work at my usual pace at my job, but > not much in the evenings and weekends, and so I can’t manage to do much on > my hobby projects. I’m also not as motivated these days to work on my set of > open source projects, and am turning my attention to different things. It’s > not great, but that’s life. > > I don’t think that the users of my packages are getting the best > maintainership deal. Rather than be “the absentee maintainer”, I’d prefer a > straight-forward transition of maintainership or ownership to someone who > can put the right energy and time in. > > In terms of packages, there are really two that have a significant > maintenance burden and users aren’t being served very well: > > HIndent has a significant amount of issues opened for it regularly, and many > of them require discussion and debate. If someone would like to become a > co-maintainer, let me know. It may (eventually) make sense to move it to a > more general GitHub organization like commercialhaskell or haskell. > Intero, which seems to have been a success, has a pretty big maintenance > burden on “this doesn’t work” kind of issues which require investigation. > There’s some Emacs Lisp work to do on it, and some Haskell work on the > intero binary, and a whole lot of platform-specific problems or tooling not > working together. On the other hand people really like this project, and > there’s a lot of tooling potential. > > If you want to take xeno and make it into a publishable package, please do > so. > > The rest of my projects that are on Stackage are: labels, ace, ical, > check-email, freenect, frisby, gd, ini, lucid, osdkeys, pdfinfo, present, > pure-io, scrobble, shell-conduit, sourcemap, descriptive, wrap, path, weigh, > haskell-docs, and structured-haskell-mode. If you’re interested in taking > over or co-maintaining any of them, let me know. Some are interesting, > others are boring, some are trivial. > > I have other packages on Hackage, but they’re mostly dead or experiments > that don’t need maintenance anyway. > > I’ve started the process of adding or changing maintainers on my public > services: > > Haskell News is now a GitHub organization. Luke Murphy is a co-owner, and > has full access to the DigitalOcean account that is running the service. So > if you want to work on that project, I’m not in the way. > lpaste has been moved to its own DigitalOcean account too. If anyone is > interested in taking over the project or co-running it, let me know. > tryhaskell doesn’t really require any maintenance, but it’s also on its own > DigitalOcean account now too. > IRCBrowse is now on its own DigitalOcean account too. It requires > maintenance once in a while. If anyone is interested in taking over the > project or co-running it, let me know. > > Cheers! > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -- Ivan Lazar Miljenovic Ivan.Miljenovic at gmail.com http://IvanMiljenovic.wordpress.com From chrisdone at gmail.com Wed Mar 1 10:13:13 2017 From: chrisdone at gmail.com (Christopher Done) Date: Wed, 1 Mar 2017 10:13:13 +0000 Subject: [Haskell-cafe] Looking for maintainers or comaintainers on my Haskell projects In-Reply-To: References: Message-ID: Thank you everyone for the support! I've received a number of offers of help which I'll be pursuing immediately. :-) On 28 February 2017 at 17:18, Christopher Done wrote: > Hi all, > > The short version is: I’ve been battling RSI in my fingers for some years. > I’m doing various things to mitigate that problem, but I have very limited > finger bandwidth these days; enough to work at my usual pace at my job, but > not much in the evenings and weekends, and so I can’t manage to do much on > my hobby projects. I’m also not as motivated these days to work on my set > of open source projects, and am turning my attention to different things. > It’s not great, but that’s life. > > I don’t think that the users of my packages are getting the best > maintainership deal. Rather than be “the absentee maintainer”, I’d prefer a > straight-forward transition of maintainership or ownership to someone who > can put the right energy and time in. > > In terms of packages, there are really two that have a significant > maintenance burden and users aren’t being served very well: > > - HIndent has a significant > amount of issues opened for it regularly, and many of them require > discussion and debate. If someone would like to become a co-maintainer, let > me know. It may (eventually) make sense to move it to a more general GitHub > organization like commercialhaskell or haskell. > - Intero , which > seems to have been a success, has a pretty big maintenance burden on “this > doesn’t work” kind of issues which require investigation. There’s some > Emacs Lisp work to do on it, and some Haskell work on the intero binary, > and a whole lot of platform-specific problems or tooling not working > together. On the other hand people really like this project, and there’s a > lot of tooling potential. > > If you want to take xeno and make it > into a publishable package, please do so. > > The rest of my projects that are on Stackage are: labels > , ace > , ical > , check-email > , freenect > , frisby > , gd > , ini > , lucid > , osdkeys > , pdfinfo > , present > , pure-io > , scrobble > , shell-conduit > , sourcemap > , descriptive > , wrap > , path > , weigh > , haskell-docs > , and > structured-haskell-mode > . If you’re > interested in taking over or co-maintaining any of them, let me know. Some > are interesting, others are boring, some are trivial. > > I have other packages on Hackage, but they’re mostly dead or experiments > that don’t need maintenance anyway. > > I’ve started the process of adding or changing maintainers on my public > services: > > - Haskell News is now a GitHub > organization. Luke Murphy is a co-owner, and has full access to the > DigitalOcean account that is running the service. So if you want to work on > that project, I’m not in the way. > - lpaste has been moved to its own > DigitalOcean account too. If anyone is interested in taking over the > project or co-running it, let me know. > - tryhaskell doesn’t really > require any maintenance, but it’s also on its own DigitalOcean account now > too. > - IRCBrowse is now on its own > DigitalOcean account too. It requires maintenance once in a while. If > anyone is interested in taking over the project or co-running it, let me > know. > > Cheers! > ​ > -------------- next part -------------- An HTML attachment was scrubbed... URL: From johannes.waldmann at htwk-leipzig.de Wed Mar 1 11:10:58 2017 From: johannes.waldmann at htwk-leipzig.de (Johannes Waldmann) Date: Wed, 1 Mar 2017 12:10:58 +0100 Subject: [Haskell-cafe] block comments in cabal files? Message-ID: I totally could not understand why "stack install" suddenly failed with "ghc: unrecognised flag: -" Then it dawned on me: you cannot use {- .. -} for block comments in cabal files. (the syntax has no block comments at all?) yes, Wadler's law and all, but still. - J. From sighingnow at 163.com Wed Mar 1 12:21:06 2017 From: sighingnow at 163.com (sighingnow at 163.com) Date: Wed, 1 Mar 2017 20:21:06 +0800 Subject: [Haskell-cafe] Looking for maintainers or comaintainers on my Haskell projects Message-ID: <58B6BCB0.F3AAB7.04474@m12-15.163.com> Hi! I’m interested in co-maintaining the Hindent project. I use Hindent extensively and I have submitted several patches to Hindent on github during the last year. I would like to contribute to improving Hindent and making it better. Thanks. Tao He -------------- next part -------------- An HTML attachment was scrubbed... URL: From gurudev.devanla at gmail.com Wed Mar 1 13:16:02 2017 From: gurudev.devanla at gmail.com (Guru Devanla) Date: Wed, 1 Mar 2017 05:16:02 -0800 Subject: [Haskell-cafe] Declaring Functors for Type constrained data types In-Reply-To: References: Message-ID: This problem I was solving is more of a re-implementation of some code I had in Python. In Python, I had a very class-based structure of this design. By class based structure, I mean we have class-level methods for each class (where each class is a type of Task), and all of them implement the same set of methods. This classes are never instantiated, but all methods are invoked on the class. WIth that perspective, the record patter @Patrick recommended directly maps to that design. The record data type here becomes a abstract-representation of my class(abstract base class in OO terms) and each task provides its methods. I see that relationship. Is that the approach I should be aiming for? Secondly, while choosing the type-class approach, I imagined all these required class methods to be an interface and therefore an interface could directly map to a type class in Haskell. Is that thinking usually an anti-pattern. The existential antipattern . link was very useful and made me re-asses my inclination to defining type classes and embedded types right away. On Tue, Feb 28, 2017 at 9:55 AM, Patrick Chilton wrote: > You could also consider representing tasks like this instead of using a > typeclass: > > data Task = Task > { process :: m () > , canRun :: m Bool > } > > The Taskable + existential GADT example seems like it could be an example > of the existential antipattern > > . > > If your GADT really does have a as a type parameter, it would be more > idiomatic to check for the typeclass when you use it: > > doStuffWithTasks :: Taskable a => Task a -> ... > > But then what's the point of the Task datatype? > > On Tue, Feb 28, 2017 at 1:48 AM, Guru Devanla > wrote: > >> Hello All, >> >> I am working on a program that will define a bunch of tasks. Each task >> will have to implement certain methods as part of a type class. >> >> -- task 1 >> data UpdateAcctsTask = UpdateAccts >> >> -- task 2 >> data EmailConfig = EmaiConfig {someattrs::String} >> data SendEmailTask = SendEmailsTask EmailConfig >> >> -- task 3 >> data GeneralWriterTask a = GeneralWriterTask a >> >> Each of these tasks implement a class, Taskable. The return >> values are simplified for this example. >> >> class Taskable a where >> process :: a -> Bool >> can_run :: a -> Bool >> >> >> This works fine. I can expand on these tasks and execute them. >> >> Now, I wanted to be able to defined dependencies between these >> (Taskable's). I decided >> I could create a data type for this dependency and may be also get a >> FreeMonad >> around this structure for further processing using a graph of Tasks. But, >> before that I wanted >> to create an wrapper for these Taskables and create a functor for it as >> follows >> >> The first thing I did was, define a Task, which generalizes over all >> the above defined (and future Taskables) >> >> data Task a where >> Task :: (Taskable a) => a -> Task a >> >> >> instance Functor Task where >> fmap:: (Taskable a, Taskable b) -> (a -> b) -> Task a -> Task b --- >> THIS DOES NOT WORK >> fmap f (Task a) = Task $ f a >> >> >> But, I realized that I cannot define an fmap over a type constraint. >> >> My questions are: >> >> 1. Is there any way to do this. I see there is an answer of SO. I wanted >> to make sure if there were any improvements to this since that answer' >> was posted. >> http://stackoverflow.com/questions/17157579/functor-instance >> -for-a-gadt-with-type-constraint >> >> 2. Secondly, I would like to know why this is not possible. Is it a >> current >> limitation of GHC or if there is some fundamental category theory >> concepts >> that dis-allows such declarations that I need to grok! >> >> Appreciate any help on this. Thank you! >> >> _______________________________________________ >> 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 chpatrick at gmail.com Wed Mar 1 13:24:05 2017 From: chpatrick at gmail.com (Patrick Chilton) Date: Wed, 1 Mar 2017 14:24:05 +0100 Subject: [Haskell-cafe] Declaring Functors for Type constrained data types In-Reply-To: References: Message-ID: > > Is that thinking usually an anti-pattern. Typeclasses choose between implementations of a method based on static *types* known at compile time. In OOP, which implementation of an interface method you get depends on the run-time object *instance*. They're not really related despite the similarities. For example, if you have a list of widgets and you want to do something different depending on what their run-time value is, a typeclass would be the wrong thing to use since it dispatches on types, not values. It's possible to make them work a little bit like OOP classes, but then you end up with the classic antipattern. On Wed, Mar 1, 2017 at 2:16 PM, Guru Devanla wrote: > This problem I was solving is more of a re-implementation of some code I > had in Python. In Python, I had a very class-based structure of this > design. By class based structure, I mean we have class-level methods for > each class (where each class is a type of Task), and all of them implement > the same set of methods. This classes are never instantiated, but all > methods are invoked on the class. > > WIth that perspective, the record patter @Patrick recommended directly > maps to that design. The record data type here becomes a > abstract-representation of my class(abstract base class in OO terms) and > each task provides its methods. I see that relationship. Is that the > approach I should be aiming for? > > Secondly, while choosing the type-class approach, I imagined all these > required class methods to be an interface and therefore an interface could > directly map to a type class in Haskell. Is that thinking usually an > anti-pattern. > > The existential antipattern > . > link was very useful and made me re-asses my inclination to defining type > classes and embedded types right away. > > On Tue, Feb 28, 2017 at 9:55 AM, Patrick Chilton > wrote: > >> You could also consider representing tasks like this instead of using a >> typeclass: >> >> data Task = Task >> { process :: m () >> , canRun :: m Bool >> } >> >> The Taskable + existential GADT example seems like it could be an example >> of the existential antipattern >> >> . >> >> If your GADT really does have a as a type parameter, it would be more >> idiomatic to check for the typeclass when you use it: >> >> doStuffWithTasks :: Taskable a => Task a -> ... >> >> But then what's the point of the Task datatype? >> >> On Tue, Feb 28, 2017 at 1:48 AM, Guru Devanla >> wrote: >> >>> Hello All, >>> >>> I am working on a program that will define a bunch of tasks. Each task >>> will have to implement certain methods as part of a type class. >>> >>> -- task 1 >>> data UpdateAcctsTask = UpdateAccts >>> >>> -- task 2 >>> data EmailConfig = EmaiConfig {someattrs::String} >>> data SendEmailTask = SendEmailsTask EmailConfig >>> >>> -- task 3 >>> data GeneralWriterTask a = GeneralWriterTask a >>> >>> Each of these tasks implement a class, Taskable. The return >>> values are simplified for this example. >>> >>> class Taskable a where >>> process :: a -> Bool >>> can_run :: a -> Bool >>> >>> >>> This works fine. I can expand on these tasks and execute them. >>> >>> Now, I wanted to be able to defined dependencies between these >>> (Taskable's). I decided >>> I could create a data type for this dependency and may be also get a >>> FreeMonad >>> around this structure for further processing using a graph of Tasks. >>> But, before that I wanted >>> to create an wrapper for these Taskables and create a functor for it as >>> follows >>> >>> The first thing I did was, define a Task, which generalizes over all >>> the above defined (and future Taskables) >>> >>> data Task a where >>> Task :: (Taskable a) => a -> Task a >>> >>> >>> instance Functor Task where >>> fmap:: (Taskable a, Taskable b) -> (a -> b) -> Task a -> Task b >>> --- THIS DOES NOT WORK >>> fmap f (Task a) = Task $ f a >>> >>> >>> But, I realized that I cannot define an fmap over a type constraint. >>> >>> My questions are: >>> >>> 1. Is there any way to do this. I see there is an answer of SO. I wanted >>> to make sure if there were any improvements to this since that answer' >>> was posted. >>> http://stackoverflow.com/questions/17157579/functor-instance >>> -for-a-gadt-with-type-constraint >>> >>> 2. Secondly, I would like to know why this is not possible. Is it a >>> current >>> limitation of GHC or if there is some fundamental category theory >>> concepts >>> that dis-allows such declarations that I need to grok! >>> >>> Appreciate any help on this. Thank you! >>> >>> _______________________________________________ >>> 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 gurudev.devanla at gmail.com Wed Mar 1 14:11:30 2017 From: gurudev.devanla at gmail.com (Guru Devanla) Date: Wed, 1 Mar 2017 06:11:30 -0800 Subject: [Haskell-cafe] Declaring Functors for Type constrained data types In-Reply-To: References: Message-ID: Just to make sure I understand. In my initial example, the following are all types and I wanted the dispatch to happen on this types once they are instances of the Taskable type class. -- task 1 data UpdateAcctsTask = UpdateAccts -- task 2 data EmailConfig = EmaiConfig {someattrs::String} data SendEmailTask = SendEmailsTask EmailConfig -- task 3 data GeneralWriterTask a = GeneralWriterTask a Now, later on I expect users to create more types which are all say, instances of Taskable typeclass. So, here I do not expect to have any dispatch based on value, but based on types. On Wed, Mar 1, 2017 at 5:24 AM, Patrick Chilton wrote: > Is that thinking usually an anti-pattern. > > > Typeclasses choose between implementations of a method based on static > *types* known at compile time. In OOP, which implementation of an > interface method you get depends on the run-time object *instance*. > They're not really related despite the similarities. > > For example, if you have a list of widgets and you want to do something > different depending on what their run-time value is, a typeclass would be > the wrong thing to use since it dispatches on types, not values. It's > possible to make them work a little bit like OOP classes, but then you end > up with the classic antipattern. > > On Wed, Mar 1, 2017 at 2:16 PM, Guru Devanla > wrote: > >> This problem I was solving is more of a re-implementation of some code I >> had in Python. In Python, I had a very class-based structure of this >> design. By class based structure, I mean we have class-level methods for >> each class (where each class is a type of Task), and all of them implement >> the same set of methods. This classes are never instantiated, but all >> methods are invoked on the class. >> >> WIth that perspective, the record patter @Patrick recommended directly >> maps to that design. The record data type here becomes a >> abstract-representation of my class(abstract base class in OO terms) and >> each task provides its methods. I see that relationship. Is that the >> approach I should be aiming for? >> >> Secondly, while choosing the type-class approach, I imagined all these >> required class methods to be an interface and therefore an interface could >> directly map to a type class in Haskell. Is that thinking usually an >> anti-pattern. >> >> The existential antipattern >> . >> link was very useful and made me re-asses my inclination to defining type >> classes and embedded types right away. >> >> On Tue, Feb 28, 2017 at 9:55 AM, Patrick Chilton >> wrote: >> >>> You could also consider representing tasks like this instead of using a >>> typeclass: >>> >>> data Task = Task >>> { process :: m () >>> , canRun :: m Bool >>> } >>> >>> The Taskable + existential GADT example seems like it could be an >>> example of the existential antipattern >>> >>> . >>> >>> If your GADT really does have a as a type parameter, it would be more >>> idiomatic to check for the typeclass when you use it: >>> >>> doStuffWithTasks :: Taskable a => Task a -> ... >>> >>> But then what's the point of the Task datatype? >>> >>> On Tue, Feb 28, 2017 at 1:48 AM, Guru Devanla >> > wrote: >>> >>>> Hello All, >>>> >>>> I am working on a program that will define a bunch of tasks. Each task >>>> will have to implement certain methods as part of a type class. >>>> >>>> -- task 1 >>>> data UpdateAcctsTask = UpdateAccts >>>> >>>> -- task 2 >>>> data EmailConfig = EmaiConfig {someattrs::String} >>>> data SendEmailTask = SendEmailsTask EmailConfig >>>> >>>> -- task 3 >>>> data GeneralWriterTask a = GeneralWriterTask a >>>> >>>> Each of these tasks implement a class, Taskable. The return >>>> values are simplified for this example. >>>> >>>> class Taskable a where >>>> process :: a -> Bool >>>> can_run :: a -> Bool >>>> >>>> >>>> This works fine. I can expand on these tasks and execute them. >>>> >>>> Now, I wanted to be able to defined dependencies between these >>>> (Taskable's). I decided >>>> I could create a data type for this dependency and may be also get a >>>> FreeMonad >>>> around this structure for further processing using a graph of Tasks. >>>> But, before that I wanted >>>> to create an wrapper for these Taskables and create a functor for it as >>>> follows >>>> >>>> The first thing I did was, define a Task, which generalizes over all >>>> the above defined (and future Taskables) >>>> >>>> data Task a where >>>> Task :: (Taskable a) => a -> Task a >>>> >>>> >>>> instance Functor Task where >>>> fmap:: (Taskable a, Taskable b) -> (a -> b) -> Task a -> Task b >>>> --- THIS DOES NOT WORK >>>> fmap f (Task a) = Task $ f a >>>> >>>> >>>> But, I realized that I cannot define an fmap over a type constraint. >>>> >>>> My questions are: >>>> >>>> 1. Is there any way to do this. I see there is an answer of SO. I wanted >>>> to make sure if there were any improvements to this since that >>>> answer' >>>> was posted. >>>> http://stackoverflow.com/questions/17157579/functor-instance >>>> -for-a-gadt-with-type-constraint >>>> >>>> 2. Secondly, I would like to know why this is not possible. Is it a >>>> current >>>> limitation of GHC or if there is some fundamental category theory >>>> concepts >>>> that dis-allows such declarations that I need to grok! >>>> >>>> Appreciate any help on this. Thank you! >>>> >>>> _______________________________________________ >>>> 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 chpatrick at gmail.com Wed Mar 1 14:19:15 2017 From: chpatrick at gmail.com (Patrick Chilton) Date: Wed, 1 Mar 2017 15:19:15 +0100 Subject: [Haskell-cafe] Declaring Functors for Type constrained data types In-Reply-To: References: Message-ID: But if you have for example a tree of heterogenous tasks as you said, you can no longer dispatch based on type because the implementation depends on the value of each task in the tree, so you're better off representing it like this: data Task = Task { doTask :: IO () , taskName :: String } class Taskable a where toTask :: a -> Task instance Taskable EmailConfig where toTask (EmailConfig ...) = Task { ... } type TaskTree = Tree Task -- easy On Wed, Mar 1, 2017 at 3:11 PM, Guru Devanla wrote: > Just to make sure I understand. In my initial example, the following are > all types and I wanted the dispatch to happen on this types once they are > instances of the Taskable type class. > > -- task 1 > data UpdateAcctsTask = UpdateAccts > > -- task 2 > data EmailConfig = EmaiConfig {someattrs::String} > data SendEmailTask = SendEmailsTask EmailConfig > > -- task 3 > data GeneralWriterTask a = GeneralWriterTask a > > > Now, later on I expect users to create more types which are all say, > instances of Taskable typeclass. So, here I do not expect to have any > dispatch based on value, but based on types. > > > > > > > On Wed, Mar 1, 2017 at 5:24 AM, Patrick Chilton > wrote: > >> Is that thinking usually an anti-pattern. >> >> >> Typeclasses choose between implementations of a method based on static >> *types* known at compile time. In OOP, which implementation of an >> interface method you get depends on the run-time object *instance*. >> They're not really related despite the similarities. >> >> For example, if you have a list of widgets and you want to do something >> different depending on what their run-time value is, a typeclass would be >> the wrong thing to use since it dispatches on types, not values. It's >> possible to make them work a little bit like OOP classes, but then you end >> up with the classic antipattern. >> >> On Wed, Mar 1, 2017 at 2:16 PM, Guru Devanla >> wrote: >> >>> This problem I was solving is more of a re-implementation of some code >>> I had in Python. In Python, I had a very class-based structure of this >>> design. By class based structure, I mean we have class-level methods for >>> each class (where each class is a type of Task), and all of them implement >>> the same set of methods. This classes are never instantiated, but all >>> methods are invoked on the class. >>> >>> WIth that perspective, the record patter @Patrick recommended directly >>> maps to that design. The record data type here becomes a >>> abstract-representation of my class(abstract base class in OO terms) and >>> each task provides its methods. I see that relationship. Is that the >>> approach I should be aiming for? >>> >>> Secondly, while choosing the type-class approach, I imagined all these >>> required class methods to be an interface and therefore an interface could >>> directly map to a type class in Haskell. Is that thinking usually an >>> anti-pattern. >>> >>> The existential antipattern >>> . >>> link was very useful and made me re-asses my inclination to defining type >>> classes and embedded types right away. >>> >>> On Tue, Feb 28, 2017 at 9:55 AM, Patrick Chilton >>> wrote: >>> >>>> You could also consider representing tasks like this instead of using a >>>> typeclass: >>>> >>>> data Task = Task >>>> { process :: m () >>>> , canRun :: m Bool >>>> } >>>> >>>> The Taskable + existential GADT example seems like it could be an >>>> example of the existential antipattern >>>> >>>> . >>>> >>>> If your GADT really does have a as a type parameter, it would be more >>>> idiomatic to check for the typeclass when you use it: >>>> >>>> doStuffWithTasks :: Taskable a => Task a -> ... >>>> >>>> But then what's the point of the Task datatype? >>>> >>>> On Tue, Feb 28, 2017 at 1:48 AM, Guru Devanla < >>>> gurudev.devanla at gmail.com> wrote: >>>> >>>>> Hello All, >>>>> >>>>> I am working on a program that will define a bunch of tasks. Each task >>>>> will have to implement certain methods as part of a type class. >>>>> >>>>> -- task 1 >>>>> data UpdateAcctsTask = UpdateAccts >>>>> >>>>> -- task 2 >>>>> data EmailConfig = EmaiConfig {someattrs::String} >>>>> data SendEmailTask = SendEmailsTask EmailConfig >>>>> >>>>> -- task 3 >>>>> data GeneralWriterTask a = GeneralWriterTask a >>>>> >>>>> Each of these tasks implement a class, Taskable. The return >>>>> values are simplified for this example. >>>>> >>>>> class Taskable a where >>>>> process :: a -> Bool >>>>> can_run :: a -> Bool >>>>> >>>>> >>>>> This works fine. I can expand on these tasks and execute them. >>>>> >>>>> Now, I wanted to be able to defined dependencies between these >>>>> (Taskable's). I decided >>>>> I could create a data type for this dependency and may be also get a >>>>> FreeMonad >>>>> around this structure for further processing using a graph of Tasks. >>>>> But, before that I wanted >>>>> to create an wrapper for these Taskables and create a functor for it >>>>> as follows >>>>> >>>>> The first thing I did was, define a Task, which generalizes over all >>>>> the above defined (and future Taskables) >>>>> >>>>> data Task a where >>>>> Task :: (Taskable a) => a -> Task a >>>>> >>>>> >>>>> instance Functor Task where >>>>> fmap:: (Taskable a, Taskable b) -> (a -> b) -> Task a -> Task b >>>>> --- THIS DOES NOT WORK >>>>> fmap f (Task a) = Task $ f a >>>>> >>>>> >>>>> But, I realized that I cannot define an fmap over a type constraint. >>>>> >>>>> My questions are: >>>>> >>>>> 1. Is there any way to do this. I see there is an answer of SO. I >>>>> wanted >>>>> to make sure if there were any improvements to this since that >>>>> answer' >>>>> was posted. >>>>> http://stackoverflow.com/questions/17157579/functor-instance >>>>> -for-a-gadt-with-type-constraint >>>>> >>>>> 2. Secondly, I would like to know why this is not possible. Is it a >>>>> current >>>>> limitation of GHC or if there is some fundamental category theory >>>>> concepts >>>>> that dis-allows such declarations that I need to grok! >>>>> >>>>> Appreciate any help on this. Thank you! >>>>> >>>>> _______________________________________________ >>>>> 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 hesselink at gmail.com Wed Mar 1 14:33:38 2017 From: hesselink at gmail.com (Erik Hesselink) Date: Wed, 1 Mar 2017 15:33:38 +0100 Subject: [Haskell-cafe] Declaring Functors for Type constrained data types In-Reply-To: References: Message-ID: Or even: data Task a = UpdateAcctsTask | SendEmailTask EmailConfig | GeneralWriterTask a process :: Task a -> Bool can_run :: Task a -> Bool In general, start with data types based on the structure of your data and functions that operate on that data. Type classes are not usually the right abstraction for domain specific code, in my experience. Erik On 1 March 2017 at 15:19, Patrick Chilton wrote: > But if you have for example a tree of heterogenous tasks as you said, you > can no longer dispatch based on type because the implementation depends on > the value of each task in the tree, so you're better off representing it > like this: > > data Task = Task > { doTask :: IO () > , taskName :: String > } > > class Taskable a where > toTask :: a -> Task > > instance Taskable EmailConfig where > toTask (EmailConfig ...) = Task { ... } > > type TaskTree = Tree Task -- easy > > On Wed, Mar 1, 2017 at 3:11 PM, Guru Devanla > wrote: > >> Just to make sure I understand. In my initial example, the following are >> all types and I wanted the dispatch to happen on this types once they are >> instances of the Taskable type class. >> >> -- task 1 >> data UpdateAcctsTask = UpdateAccts >> >> -- task 2 >> data EmailConfig = EmaiConfig {someattrs::String} >> data SendEmailTask = SendEmailsTask EmailConfig >> >> -- task 3 >> data GeneralWriterTask a = GeneralWriterTask a >> >> >> Now, later on I expect users to create more types which are all say, >> instances of Taskable typeclass. So, here I do not expect to have any >> dispatch based on value, but based on types. >> >> >> >> >> >> >> On Wed, Mar 1, 2017 at 5:24 AM, Patrick Chilton >> wrote: >> >>> Is that thinking usually an anti-pattern. >>> >>> >>> Typeclasses choose between implementations of a method based on static >>> *types* known at compile time. In OOP, which implementation of an >>> interface method you get depends on the run-time object *instance*. >>> They're not really related despite the similarities. >>> >>> For example, if you have a list of widgets and you want to do something >>> different depending on what their run-time value is, a typeclass would be >>> the wrong thing to use since it dispatches on types, not values. It's >>> possible to make them work a little bit like OOP classes, but then you end >>> up with the classic antipattern. >>> >>> On Wed, Mar 1, 2017 at 2:16 PM, Guru Devanla >>> wrote: >>> >>>> This problem I was solving is more of a re-implementation of some code >>>> I had in Python. In Python, I had a very class-based structure of this >>>> design. By class based structure, I mean we have class-level methods for >>>> each class (where each class is a type of Task), and all of them implement >>>> the same set of methods. This classes are never instantiated, but all >>>> methods are invoked on the class. >>>> >>>> WIth that perspective, the record patter @Patrick recommended directly >>>> maps to that design. The record data type here becomes a >>>> abstract-representation of my class(abstract base class in OO terms) and >>>> each task provides its methods. I see that relationship. Is that the >>>> approach I should be aiming for? >>>> >>>> Secondly, while choosing the type-class approach, I imagined all these >>>> required class methods to be an interface and therefore an interface could >>>> directly map to a type class in Haskell. Is that thinking usually an >>>> anti-pattern. >>>> >>>> The existential antipattern >>>> . >>>> link was very useful and made me re-asses my inclination to defining type >>>> classes and embedded types right away. >>>> >>>> On Tue, Feb 28, 2017 at 9:55 AM, Patrick Chilton >>>> wrote: >>>> >>>>> You could also consider representing tasks like this instead of using >>>>> a typeclass: >>>>> >>>>> data Task = Task >>>>> { process :: m () >>>>> , canRun :: m Bool >>>>> } >>>>> >>>>> The Taskable + existential GADT example seems like it could be an >>>>> example of the existential antipattern >>>>> >>>>> . >>>>> >>>>> If your GADT really does have a as a type parameter, it would be more >>>>> idiomatic to check for the typeclass when you use it: >>>>> >>>>> doStuffWithTasks :: Taskable a => Task a -> ... >>>>> >>>>> But then what's the point of the Task datatype? >>>>> >>>>> On Tue, Feb 28, 2017 at 1:48 AM, Guru Devanla < >>>>> gurudev.devanla at gmail.com> wrote: >>>>> >>>>>> Hello All, >>>>>> >>>>>> I am working on a program that will define a bunch of tasks. Each task >>>>>> will have to implement certain methods as part of a type class. >>>>>> >>>>>> -- task 1 >>>>>> data UpdateAcctsTask = UpdateAccts >>>>>> >>>>>> -- task 2 >>>>>> data EmailConfig = EmaiConfig {someattrs::String} >>>>>> data SendEmailTask = SendEmailsTask EmailConfig >>>>>> >>>>>> -- task 3 >>>>>> data GeneralWriterTask a = GeneralWriterTask a >>>>>> >>>>>> Each of these tasks implement a class, Taskable. The return >>>>>> values are simplified for this example. >>>>>> >>>>>> class Taskable a where >>>>>> process :: a -> Bool >>>>>> can_run :: a -> Bool >>>>>> >>>>>> >>>>>> This works fine. I can expand on these tasks and execute them. >>>>>> >>>>>> Now, I wanted to be able to defined dependencies between these >>>>>> (Taskable's). I decided >>>>>> I could create a data type for this dependency and may be also get a >>>>>> FreeMonad >>>>>> around this structure for further processing using a graph of Tasks. >>>>>> But, before that I wanted >>>>>> to create an wrapper for these Taskables and create a functor for it >>>>>> as follows >>>>>> >>>>>> The first thing I did was, define a Task, which generalizes over all >>>>>> the above defined (and future Taskables) >>>>>> >>>>>> data Task a where >>>>>> Task :: (Taskable a) => a -> Task a >>>>>> >>>>>> >>>>>> instance Functor Task where >>>>>> fmap:: (Taskable a, Taskable b) -> (a -> b) -> Task a -> Task b >>>>>> --- THIS DOES NOT WORK >>>>>> fmap f (Task a) = Task $ f a >>>>>> >>>>>> >>>>>> But, I realized that I cannot define an fmap over a type constraint. >>>>>> >>>>>> My questions are: >>>>>> >>>>>> 1. Is there any way to do this. I see there is an answer of SO. I >>>>>> wanted >>>>>> to make sure if there were any improvements to this since that >>>>>> answer' >>>>>> was posted. >>>>>> http://stackoverflow.com/questions/17157579/functor-instance >>>>>> -for-a-gadt-with-type-constraint >>>>>> >>>>>> 2. Secondly, I would like to know why this is not possible. Is it a >>>>>> current >>>>>> limitation of GHC or if there is some fundamental category theory >>>>>> concepts >>>>>> that dis-allows such declarations that I need to grok! >>>>>> >>>>>> Appreciate any help on this. Thank you! >>>>>> >>>>>> _______________________________________________ >>>>>> 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 esz at posteo.de Wed Mar 1 16:48:19 2017 From: esz at posteo.de (Ertugrul =?utf-8?Q?S=C3=B6ylemez?=) Date: Wed, 01 Mar 2017 17:48:19 +0100 Subject: [Haskell-cafe] Looking for maintainers or comaintainers on my Haskell projects In-Reply-To: References: Message-ID: <87h93daqp8.fsf@posteo.de> Hi Christopher, > The short version is: I’ve been battling RSI in my fingers for some > years. I’m doing various things to mitigate that problem, but I have > very limited finger bandwidth these days; enough to work at my usual > pace at my job, but not much in the evenings and weekends, and so I > can’t manage to do much on my hobby projects. I’m also not as > motivated these days to work on my set of open source projects, and am > turning my attention to different things. It’s not great, but that’s > life. Sorry to read that. Thank you for all of your contributions! > I have other packages on Hackage, but they’re mostly dead or experiments > that don’t need maintenance anyway. As a heavy user of the foreign-store package I wouldn't mind comaintaining or even maintaining it. It's the key dependency of Rapid. My Hackage username is 'esz', my GitHub username is 'esoeylemez'. Greets ertes -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 483 bytes Desc: not available URL: From david.sorokin at gmail.com Thu Mar 2 15:18:32 2017 From: david.sorokin at gmail.com (David Sorokin) Date: Thu, 2 Mar 2017 18:18:32 +0300 Subject: [Haskell-cafe] Inlinable (>>>) Message-ID: Hi Cafe, I offer to define the functions of the Control.Category module inlinable: -- | Right-to-left composition (<<<) :: Category cat => cat b c -> cat a b -> cat a c {-# INLINABLE (<<<) #-} (<<<) = (.) -- | Left-to-right composition (>>>) :: Category cat => cat a b -> cat b c -> cat a c {-# INLINABLE (>>>) #-} f >>> g = g . f Perhaps all functions from this module should be marked by this pragma as possible. I suppose that the current definition without the pragma is the cause why the execution slows down in my applications, when using monad parameters in the constraints. I noticed it yet two or three years ago, while playing with the monad transformers, but decided to write now. Best regards, David Sorokin From mblazevic at stilo.com Thu Mar 2 22:15:20 2017 From: mblazevic at stilo.com (=?UTF-8?Q?Mario_Bla=c5=beevi=c4=87?=) Date: Thu, 2 Mar 2017 17:15:20 -0500 Subject: [Haskell-cafe] Looking for maintainers or comaintainers on my Haskell projects In-Reply-To: References: Message-ID: <902b313f-c5d9-65ba-7bfb-a4f23a506219@stilo.com> I'm willing to take over the maintenance of frisby, as I already have some experience with parser combinator libraries. On 2017-02-28 12:18 PM, Christopher Done wrote: > Hi all, > > The short version is: I’ve been battling RSI in my fingers for some > years. I’m doing various things to mitigate that problem, but I have > very limited finger bandwidth these days; enough to work at my usual > pace at my job, but not much in the evenings and weekends, and so I > can’t manage to do much on my hobby projects. I’m also not as motivated > these days to work on my set of open source projects, and am turning my > attention to different things. It’s not great, but that’s life. > > I don’t think that the users of my packages are getting the best > maintainership deal. Rather than be “the absentee maintainer”, I’d > prefer a straight-forward transition of maintainership or ownership to > someone who can put the right energy and time in. > > In terms of packages, there are really two that have a significant > maintenance burden and users aren’t being served very well: > > * HIndent has a significant > amount of issues opened for it regularly, and many of them require > discussion and debate. If someone would like to become a > co-maintainer, let me know. It may (eventually) make sense to move > it to a more general GitHub organization like |commercialhaskell| or > |haskell|. > * Intero , which > seems to have been a success, has a pretty big maintenance burden on > “this doesn’t work” kind of issues which require investigation. > There’s some Emacs Lisp work to do on it, and some Haskell work on > the intero binary, and a whole lot of platform-specific problems or > tooling not working together. On the other hand people really like > this project, and there’s a lot of tooling potential. > > If you want to take xeno and make it > into a publishable package, please do so. > > The rest of my projects that are on Stackage are: labels > , ace > , ical > , check-email > , freenect > , frisby > , gd > , ini > , lucid > , osdkeys > , pdfinfo > , present > , pure-io > , scrobble > , shell-conduit > , sourcemap > , descriptive > , wrap > , path > , weigh > , haskell-docs > , and > structured-haskell-mode > . If you’re > interested in taking over or co-maintaining any of them, let me know. > Some are interesting, others are boring, some are trivial. > > I have other packages on Hackage, but they’re mostly dead or experiments > that don’t need maintenance anyway. > > I’ve started the process of adding or changing maintainers on my public > services: > > * Haskell News is now a GitHub > organization. Luke Murphy is a co-owner, and has full access to the > DigitalOcean account that is running the service. So if you want to > work on that project, I’m not in the way. > * lpaste has been moved to its own > DigitalOcean account too. If anyone is interested in taking over the > project or co-running it, let me know. > * tryhaskell doesn’t really > require any maintenance, but it’s also on its own DigitalOcean > account now too. > * IRCBrowse is now on its own > DigitalOcean account too. It requires maintenance once in a while. > If anyone is interested in taking over the project or co-running it, > let me know. > > Cheers! > > ​ > > > _______________________________________________ > 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 joehillen at gmail.com Fri Mar 3 05:19:34 2017 From: joehillen at gmail.com (Joe Hillenbrand) Date: Thu, 2 Mar 2017 21:19:34 -0800 Subject: [Haskell-cafe] Inlinable (>>>) In-Reply-To: References: Message-ID: CCing Libraries On Thu, Mar 2, 2017 at 7:18 AM, David Sorokin wrote: > Hi Cafe, > > I offer to define the functions of the Control.Category module inlinable: > > -- | Right-to-left composition > (<<<) :: Category cat => cat b c -> cat a b -> cat a c > {-# INLINABLE (<<<) #-} > (<<<) = (.) > > -- | Left-to-right composition > (>>>) :: Category cat => cat a b -> cat b c -> cat a c > {-# INLINABLE (>>>) #-} > f >>> g = g . f > > Perhaps all functions from this module should be marked by this pragma as possible. > > I suppose that the current definition without the pragma is the cause why the execution slows down in my applications, when using monad parameters in the constraints. I noticed it yet two or three years ago, while playing with the monad transformers, but decided to write now. > > Best regards, > David Sorokin > > > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. From mail at joachim-breitner.de Fri Mar 3 11:40:35 2017 From: mail at joachim-breitner.de (Joachim Breitner) Date: Fri, 03 Mar 2017 12:40:35 +0100 Subject: [Haskell-cafe] Inlinable (>>>) In-Reply-To: References: Message-ID: <1488541235.9440.1.camel@joachim-breitner.de> Hi, Am Donnerstag, den 02.03.2017, 18:18 +0300 schrieb David Sorokin: > I offer to define the functions of the Control.Category module > inlinable: > > -- | Right-to-left composition > (<<<) :: Category cat => cat b c -> cat a b -> cat a c > {-# INLINABLE (<<<) #-} > (<<<) = (.) > > -- | Left-to-right composition > (>>>) :: Category cat => cat a b -> cat b c -> cat a c > {-# INLINABLE (>>>) #-} > f >>> g = g . f > > Perhaps all functions from this module should be marked by this > pragma as possible. I am surprised that GHC does not consider these inlineable automatically. Maybe it should? Would be worth investigating, if someone is interested in some entry-level GHC hacking, why GHC does not treat them as `INLINEABLE` in the first place. They are certainly small enough, I would say… 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 matthewtpickering at gmail.com Fri Mar 3 12:04:42 2017 From: matthewtpickering at gmail.com (Matthew Pickering) Date: Fri, 3 Mar 2017 12:04:42 +0000 Subject: [Haskell-cafe] Inlinable (>>>) In-Reply-To: <1488541235.9440.1.camel@joachim-breitner.de> References: <1488541235.9440.1.camel@joachim-breitner.de> Message-ID: I suspect this is because GHC will not specialise functions when used in other modules unless they are marked INLINABLE. Matt On Fri, Mar 3, 2017 at 11:40 AM, Joachim Breitner wrote: > Hi, > > Am Donnerstag, den 02.03.2017, 18:18 +0300 schrieb David Sorokin: >> I offer to define the functions of the Control.Category module >> inlinable: >> >> -- | Right-to-left composition >> (<<<) :: Category cat => cat b c -> cat a b -> cat a c >> {-# INLINABLE (<<<) #-} >> (<<<) = (.) >> >> -- | Left-to-right composition >> (>>>) :: Category cat => cat a b -> cat b c -> cat a c >> {-# INLINABLE (>>>) #-} >> f >>> g = g . f >> >> Perhaps all functions from this module should be marked by this >> pragma as possible. > > I am surprised that GHC does not consider these inlineable > automatically. Maybe it should? Would be worth investigating, if > someone is interested in some entry-level GHC hacking, why GHC does not > treat them as `INLINEABLE` in the first place. They are certainly small > enough, I would say… > > Joachim > > -- > Joachim “nomeata” Breitner > mail at joachim-breitner.de • https://www.joachim-breitner.de/ > XMPP: nomeata at joachim-breitner.de • OpenPGP-Key: 0xF0FBF51F > Debian Developer: nomeata at debian.org > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. From hello at mario.net.au Sat Mar 4 12:23:59 2017 From: hello at mario.net.au (Mario Rogic) Date: Sat, 4 Mar 2017 12:23:59 +0000 Subject: [Haskell-cafe] Archival of community.haskell.org Message-ID: Hi all As announced back in 2015 we have started archiving community.haskell.org services. We've created https://archives.haskell.org/, and the old projects mailing lists have been the first to be archived. Next on the list is the remainder of projects.haskell.org, and the code.haskell.org site. As always, you can email admin at h.o or hop on the #haskell-infrastructure freenode channel to provide feedback / concerns. Thanks - Mario -------------- next part -------------- An HTML attachment was scrubbed... URL: From saurabhnanda at gmail.com Sat Mar 4 16:58:35 2017 From: saurabhnanda at gmail.com (Saurabh Nanda) Date: Sat, 4 Mar 2017 22:28:35 +0530 Subject: [Haskell-cafe] Inlinable (>>>) In-Reply-To: References: <1488541235.9440.1.camel@joachim-breitner.de> Message-ID: I had a similar WTF moment when I noticed that Lucid's HtmlT over IO was 2x slower than HtmlT over Reader/Identity. Discussions over this mailing list pointed to the lack of INLINE pragmas on various functions, like >>= It was finally resolved via a liberal sprinkling of INLINE -- https://github.com/chrisdone/lucid/pull/67/files Why can't GHC automatically consider *every* function as INLINABLE? Let the GHC heuristics decide what is worthy of being inlined. What's the downside? -- Saurabh. On 3 Mar 2017 5:36 pm, "Matthew Pickering" wrote: > I suspect this is because GHC will not specialise functions when used > in other modules unless they are marked INLINABLE. > > Matt > > On Fri, Mar 3, 2017 at 11:40 AM, Joachim Breitner > wrote: > > Hi, > > > > Am Donnerstag, den 02.03.2017, 18:18 +0300 schrieb David Sorokin: > >> I offer to define the functions of the Control.Category module > >> inlinable: > >> > >> -- | Right-to-left composition > >> (<<<) :: Category cat => cat b c -> cat a b -> cat a c > >> {-# INLINABLE (<<<) #-} > >> (<<<) = (.) > >> > >> -- | Left-to-right composition > >> (>>>) :: Category cat => cat a b -> cat b c -> cat a c > >> {-# INLINABLE (>>>) #-} > >> f >>> g = g . f > >> > >> Perhaps all functions from this module should be marked by this > >> pragma as possible. > > > > I am surprised that GHC does not consider these inlineable > > automatically. Maybe it should? Would be worth investigating, if > > someone is interested in some entry-level GHC hacking, why GHC does not > > treat them as `INLINEABLE` in the first place. They are certainly small > > enough, I would say… > > > > Joachim > > > > -- > > Joachim “nomeata” Breitner > > mail at joachim-breitner.de • https://www.joachim-breitner.de/ > > XMPP: nomeata at joachim-breitner.de • OpenPGP-Key: 0xF0FBF51F > > Debian Developer: nomeata at debian.org > > _______________________________________________ > > Haskell-Cafe mailing list > > To (un)subscribe, modify options or view archives go to: > > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > Only members subscribed via the mailman list are allowed to post. > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben.franksen at online.de Sat Mar 4 18:04:44 2017 From: ben.franksen at online.de (Ben Franksen) Date: Sat, 4 Mar 2017 19:04:44 +0100 Subject: [Haskell-cafe] Looking for maintainers or comaintainers on my Haskell projects In-Reply-To: <902b313f-c5d9-65ba-7bfb-a4f23a506219@stilo.com> References: <902b313f-c5d9-65ba-7bfb-a4f23a506219@stilo.com> Message-ID: Am 02.03.2017 um 23:15 schrieb Mario Blažević: > I'm willing to take over the maintenance of frisby, as I already have > some experience with parser combinator libraries. It has been a while since I looked at frisby. I do remember that I had several issues with it and found that the code was pretty hard to understand, due to numerous unsafe optimization hacks. I'd be glad if someone cleaned that up, so that it becomes easier to fix errors but I guess that would be a piece of work, probably amounting to a re-write of sorts. (To be clear, none of this is Chris' fault, of course, he just updated cabal stuff.) Cheers Ben From allbery.b at gmail.com Sat Mar 4 18:50:19 2017 From: allbery.b at gmail.com (Brandon Allbery) Date: Sat, 4 Mar 2017 13:50:19 -0500 Subject: [Haskell-cafe] Inlinable (>>>) In-Reply-To: References: <1488541235.9440.1.camel@joachim-breitner.de> Message-ID: On Sat, Mar 4, 2017 at 11:58 AM, Saurabh Nanda wrote: > Why can't GHC automatically consider *every* function as INLINABLE? Let > the GHC heuristics decide what is worthy of being inlined. What's the > downside? At a guess, performance of both .hi file handling and analysis for inlining. Don't people already gripe about how "slow" ghc is? Also, inlining the wrong thing can completely derail other optimizations (e.g. fusion). -- 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 mail at joachim-breitner.de Sat Mar 4 19:13:33 2017 From: mail at joachim-breitner.de (Joachim Breitner) Date: Sat, 04 Mar 2017 20:13:33 +0100 Subject: [Haskell-cafe] Inlinable (>>>) In-Reply-To: References: <1488541235.9440.1.camel@joachim-breitner.de> Message-ID: <1488654813.11972.1.camel@joachim-breitner.de> Hi, Am Samstag, den 04.03.2017, 22:28 +0530 schrieb Saurabh Nanda: > I had a similar WTF moment when I noticed that Lucid's HtmlT over IO > was 2x slower than HtmlT over Reader/Identity. Discussions over this > mailing list pointed to the lack of INLINE pragmas on various > functions, like >>= > > It was finally resolved via a liberal sprinkling of INLINE -- https:/ > /github.com/chrisdone/lucid/pull/67/files  > > Why can't GHC automatically consider *every* function as INLINABLE? > Let the GHC heuristics decide what is worthy of being inlined. What's > the downside? the original post was about INLINEABLE not INLINE – let’s keep these two apart. INLINEABLE says: „Dear compiler, keep the definition of this function in the interface so that you can, maybe, inline (or specialize) it later.“ INLINE implies INLINEABLE, but also says: „…, and really do inline it“. BTW, there is a flag -fexpose-all-unfoldings that effectively add INLINEABLE to all functions. 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 matthewtpickering at gmail.com Sat Mar 4 19:37:48 2017 From: matthewtpickering at gmail.com (Matthew Pickering) Date: Sat, 4 Mar 2017 19:37:48 +0000 Subject: [Haskell-cafe] Inlinable (>>>) In-Reply-To: <1488654813.11972.1.camel@joachim-breitner.de> References: <1488541235.9440.1.camel@joachim-breitner.de> <1488654813.11972.1.camel@joachim-breitner.de> Message-ID: -fexpose-all-unfoldings will allow all definitions to be inlined across modules but NOT specialised. If you want to turn on more aggressive specialisation then you can also use -fspecialise-aggressively. Using the two together would be more like marking everything as INLINABLE but not exactly the same. On Sat, Mar 4, 2017 at 7:13 PM, Joachim Breitner wrote: > Hi, > > Am Samstag, den 04.03.2017, 22:28 +0530 schrieb Saurabh Nanda: >> I had a similar WTF moment when I noticed that Lucid's HtmlT over IO >> was 2x slower than HtmlT over Reader/Identity. Discussions over this >> mailing list pointed to the lack of INLINE pragmas on various >> functions, like >>= >> >> It was finally resolved via a liberal sprinkling of INLINE -- https:/ >> /github.com/chrisdone/lucid/pull/67/files >> >> Why can't GHC automatically consider *every* function as INLINABLE? >> Let the GHC heuristics decide what is worthy of being inlined. What's >> the downside? > > the original post was about INLINEABLE not INLINE – let’s keep these > two apart. > > INLINEABLE says: „Dear compiler, keep the definition of this function > in the interface so that you can, maybe, inline (or specialize) it > later.“ > > INLINE implies INLINEABLE, but also says: „…, and really do inline it“. > > BTW, there is a flag -fexpose-all-unfoldings that effectively add > INLINEABLE to all functions. > > Greetings, > Joachim > > -- > Joachim “nomeata” Breitner > mail at joachim-breitner.de • https://www.joachim-breitner.de/ > XMPP: nomeata at joachim-breitner.de • OpenPGP-Key: 0xF0FBF51F > Debian Developer: nomeata at debian.org > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. From saurabhnanda at gmail.com Sun Mar 5 03:00:27 2017 From: saurabhnanda at gmail.com (Saurabh Nanda) Date: Sun, 5 Mar 2017 08:30:27 +0530 Subject: [Haskell-cafe] Inlinable (>>>) In-Reply-To: <1488654813.11972.1.camel@joachim-breitner.de> References: <1488541235.9440.1.camel@joachim-breitner.de> <1488654813.11972.1.camel@joachim-breitner.de> Message-ID: The original post was about INLINEABLE not INLINE – let’s keep these two apart I understand the difference between INLINE and INLINEABLE. However from a practical standpoint aren't the two highly correlated? I wouldn't need to bother with INLINE if GHC considered every function as INLINEABLE and had a good set of inlining heuristics. Also, as a newbie, I would prefer depending on the compiler's heuristics, rather than forcing it to inline functions (the impact of which I may not fully understand) -- Saurabh. -------------- next part -------------- An HTML attachment was scrubbed... URL: From saurabhnanda at gmail.com Sun Mar 5 03:03:10 2017 From: saurabhnanda at gmail.com (Saurabh Nanda) Date: Sun, 5 Mar 2017 08:33:10 +0530 Subject: [Haskell-cafe] Inlinable (>>>) In-Reply-To: References: <1488541235.9440.1.camel@joachim-breitner.de> Message-ID: .At a guess, performance of both .hi file handling and analysis for inlining. Don't people already gripe about how "slow" ghc is? In that case, an optional flag which people can turn-on only when preparing the final build to be pushed into production. -- Saurabh. -------------- next part -------------- An HTML attachment was scrubbed... URL: From zocca.marco at gmail.com Sun Mar 5 12:50:58 2017 From: zocca.marco at gmail.com (Marco Zocca) Date: Sun, 5 Mar 2017 13:50:58 +0100 Subject: [Haskell-cafe] Mailing list request for DataHaskell Message-ID: Dear all, I write on behalf of DataHaskell [0, 1], an open source community devoted to data science, scientific computing and machine learning. We would like haskell.org to host a mailing list for our community, to archive discussions that might otherwise get lost on the Gitter chatroom [2]. With this email I'd also like to extend the invitation to join to all interested people and companies. Thank you and kind regards, Marco Zocca (https://github.com/ocramz) [0] datahaskell.org [1] github.com/DataHaskell [2] https://gitter.im/dataHaskell/Lobby From blamario at ciktel.net Sun Mar 5 23:29:47 2017 From: blamario at ciktel.net (=?UTF-8?Q?Mario_Bla=c5=beevi=c4=87?=) Date: Sun, 5 Mar 2017 18:29:47 -0500 Subject: [Haskell-cafe] Looking for maintainers or comaintainers on my Haskell projects In-Reply-To: References: <902b313f-c5d9-65ba-7bfb-a4f23a506219@stilo.com> Message-ID: <3d9df2e1-da47-0445-9ba6-ec79f0509005@ciktel.net> On 04/03/17 01:04 PM, Ben Franksen wrote: > Am 02.03.2017 um 23:15 schrieb Mario Blažević: >> I'm willing to take over the maintenance of frisby, as I already have >> some experience with parser combinator libraries. > > It has been a while since I looked at frisby. I do remember that I had > several issues with it and found that the code was pretty hard to > understand, due to numerous unsafe optimization hacks. I'd be glad if > someone cleaned that up, so that it becomes easier to fix errors but I > guess that would be a piece of work, probably amounting to a re-write > of sorts. (To be clear, none of this is Chris' fault, of course, he > just updated cabal stuff.) I suppose the first order of business would then be to write a test and benchmark suite, to make sure that the modifications don't break something. Mind you, there are no dependencies for the library (apart from acme-everything of course). Is anybody using it privately? From sibi at psibi.in Mon Mar 6 10:35:57 2017 From: sibi at psibi.in (Sibi) Date: Mon, 6 Mar 2017 16:05:57 +0530 Subject: [Haskell-cafe] Maintaining fb, yesod-fb, yesod-auth-fb Message-ID: Posting here to share my intent on taking the maintainership of fb, yesod-fb and yesod-auth-fb packages. The packages has not been updated for quite some time and are currently not building in GHC 8.0.2. Also, I use this package at my day job and we are planning to switch to GHC 8 soon. Regards, Sibi -------------- next part -------------- An HTML attachment was scrubbed... URL: From fa-ml at ariis.it Mon Mar 6 10:39:42 2017 From: fa-ml at ariis.it (Francesco Ariis) Date: Mon, 6 Mar 2017 11:39:42 +0100 Subject: [Haskell-cafe] Mailing list request for DataHaskell In-Reply-To: References: Message-ID: <20170306103942.GA5437@casa.casa> On Sun, Mar 05, 2017 at 01:50:58PM +0100, Marco Zocca wrote: > I write on behalf of DataHaskell [0, 1], an open source community > devoted to data science, scientific computing and machine learning. > We would like haskell.org to host a mailing list for our community, to > archive discussions that might otherwise get lost on the Gitter > chatroom [2]. > > With this email I'd also like to extend the invitation to join to all > interested people and companies. > > Thank you and kind regards, > Marco Zocca > (https://github.com/ocramz) Hello Marco, nice initiative! I suggest you post on haskell-community [1] too, as the committee dwells there -F [1] https://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-community From jeanchristophe.mincke at gmail.com Mon Mar 6 11:31:21 2017 From: jeanchristophe.mincke at gmail.com (jean-christophe mincke) Date: Mon, 6 Mar 2017 12:31:21 +0100 Subject: [Haskell-cafe] Blast: a simple distributed computing library Message-ID: Hi everyone. Over the past few months, I have written Blast, a distributed computing library, inspired by Apache Spark. It is now open source and can be found on github: https://github.com/jcmincke/Blast Regards J-C -------------- next part -------------- An HTML attachment was scrubbed... URL: From simon.jakobi at googlemail.com Mon Mar 6 13:01:36 2017 From: simon.jakobi at googlemail.com (Simon Jakobi) Date: Mon, 6 Mar 2017 14:01:36 +0100 Subject: [Haskell-cafe] Maintaining fb, yesod-fb, yesod-auth-fb In-Reply-To: References: Message-ID: Have you already been in contact with the original author (cc'd)? 2017-03-06 11:35 GMT+01:00 Sibi : > Posting here to share my intent on taking the maintainership of fb, > yesod-fb and yesod-auth-fb packages. The packages has not been updated > for quite some time and are currently not building in GHC 8.0.2. > > Also, I use this package at my day job and we are planning to switch to > GHC 8 soon. > > Regards, > Sibi > > > > _______________________________________________ > 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 Mon Mar 6 19:55:00 2017 From: heraldhoi at gmail.com (Geraldus) Date: Mon, 06 Mar 2017 19:55:00 +0000 Subject: [Haskell-cafe] Yesod app uses wrong port when connecting to PostgreSQL Message-ID: Hi folks! I'm struggling with following error: libpq: failed (could not connect to server: Connection refused Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432? I see such messages in Keter's log (in app folder). The VPS where the app deployed running PostgreSQL 9.6 on port 5433. I have changed default port in: - config/settings - config/keter.yaml - /opt/keter/etc/postgres.yaml on server side None of these steps helped. I wasn't able to find other port configuration places. What else can I do? -------------- next part -------------- An HTML attachment was scrubbed... URL: From sibi at psibi.in Mon Mar 6 20:14:10 2017 From: sibi at psibi.in (Sibi) Date: Tue, 7 Mar 2017 01:44:10 +0530 Subject: [Haskell-cafe] Maintaining fb, yesod-fb, yesod-auth-fb In-Reply-To: References: Message-ID: No, but I sent a mail to Felipe some hours before posting it in the Cafe. I think he has been out of reach for quite some time now. Regards, On Mon, Mar 6, 2017 at 6:31 PM, Simon Jakobi wrote: > Have you already been in contact with the original author (cc'd)? > > 2017-03-06 11:35 GMT+01:00 Sibi : > >> Posting here to share my intent on taking the maintainership of fb, >> yesod-fb and yesod-auth-fb packages. The packages has not been updated >> for quite some time and are currently not building in GHC 8.0.2. >> >> Also, I use this package at my day job and we are planning to switch to >> GHC 8 soon. >> >> Regards, >> Sibi >> >> >> >> _______________________________________________ >> 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 Mon Mar 6 20:25:12 2017 From: dct25-561bs at mythic-beasts.com (David Turner) Date: Mon, 6 Mar 2017 20:25:12 +0000 Subject: [Haskell-cafe] Yesod app uses wrong port when connecting to PostgreSQL In-Reply-To: References: Message-ID: Hi, It may help to know that libpq also looks to environment variables to get its config: https://www.postgresql.org/docs/9.3/static/libpq-envars.html Cheers, David (Apologies for the double mail, I failed to CC the list in the first time) On 6 Mar 2017 19:55, "Geraldus" wrote: > Hi folks! > > I'm struggling with following error: > > libpq: failed (could not connect to server: Connection refused > Is the server running on host "localhost" (127.0.0.1) and accepting > TCP/IP connections on port 5432? > > I see such messages in Keter's log (in app folder). The VPS where the app > deployed running PostgreSQL 9.6 on port 5433. I have changed default port > in: > > - config/settings > - config/keter.yaml > - /opt/keter/etc/postgres.yaml on server side > > None of these steps helped. I wasn't able to find other port configuration > places. What else can I do? > > > _______________________________________________ > 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 Mon Mar 6 20:30:23 2017 From: heraldhoi at gmail.com (Geraldus) Date: Mon, 06 Mar 2017 20:30:23 +0000 Subject: [Haskell-cafe] Yesod app uses wrong port when connecting to PostgreSQL In-Reply-To: References: Message-ID: Thank you David! I've exported *PGPORT *variable and restarted Keter. Now everything works! -------------- next part -------------- An HTML attachment was scrubbed... URL: From olf at aatal-apotheke.de Mon Mar 6 20:42:57 2017 From: olf at aatal-apotheke.de (Olaf Klinke) Date: Mon, 6 Mar 2017 21:42:57 +0100 Subject: [Haskell-cafe] reading and writing Data.Ratio.Rational In-Reply-To: References: <150132315.26039.1487938673019@webmail.strato.de> Message-ID: Ah, thanks! That is something to build on. Olaf > Am 24.02.2017 um 15:35 schrieb Patrick Chilton : > > Prelude> import Numeric > Prelude Numeric> fst $ head $ readFloat "0.1234" :: Rational > 617 % 5000 > > On Fri, Feb 24, 2017 at 1:17 PM, Olaf Klinke wrote: > Dear cafe, > > when processing text files containing numbers of the form "xxxx.yyyy" I used to parse them into Double using that type's Read instance. Obviously, even with arithmetic no more complicated than the field operations the result might have ugly rounding errors like 12.000000000002 due to the fact that numbers like 0.7 are not dyadic rationals. The math in my program is not complicated and the numbers are not large, so I don't care about Rationals having potentially huge memory footprints. > > So here's my question. A literal like 0.7 has type Fractional a => a, but the Read instance of Rational rejects the string "0.7". Must it be this way? Do I have to go via toRational.(read :: String -> Data.Scientific.Scientific)? > > Note that the documentation of Data.Scientific explicitly states that using (/) is unsafe, so I'd rather stay with the field Rational. > > For the output as decimal expansion, there is of course long division as described here [1], but I wonder whether either this exists in some library or there is even a more efficient solution. > > Any pointers are appreciated. > Thanks, > Olaf > > [1] http://stackoverflow.com/questions/30931369/how-to-convert-a-rational-into-a-pretty-string > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > From david.feuer at gmail.com Mon Mar 6 20:46:58 2017 From: david.feuer at gmail.com (David Feuer) Date: Mon, 6 Mar 2017 15:46:58 -0500 Subject: [Haskell-cafe] reading and writing Data.Ratio.Rational In-Reply-To: References: <150132315.26039.1487938673019@webmail.strato.de> Message-ID: I think your best bet is probably to get your hands dirty and parse it yourself: first grab an integer, then optionally a decimal point, etc. On Mar 6, 2017 3:43 PM, "Olaf Klinke" wrote: > Ah, thanks! That is something to build on. > > Olaf > > Am 24.02.2017 um 15:35 schrieb Patrick Chilton : > > > > Prelude> import Numeric > > Prelude Numeric> fst $ head $ readFloat "0.1234" :: Rational > > 617 % 5000 > > > > On Fri, Feb 24, 2017 at 1:17 PM, Olaf Klinke > wrote: > > Dear cafe, > > > > when processing text files containing numbers of the form "xxxx.yyyy" I > used to parse them into Double using that type's Read instance. Obviously, > even with arithmetic no more complicated than the field operations the > result might have ugly rounding errors like 12.000000000002 due to the fact > that numbers like 0.7 are not dyadic rationals. The math in my program is > not complicated and the numbers are not large, so I don't care about > Rationals having potentially huge memory footprints. > > > > So here's my question. A literal like 0.7 has type Fractional a => a, > but the Read instance of Rational rejects the string "0.7". Must it be this > way? Do I have to go via toRational.(read :: String -> > Data.Scientific.Scientific)? > > > > Note that the documentation of Data.Scientific explicitly states that > using (/) is unsafe, so I'd rather stay with the field Rational. > > > > For the output as decimal expansion, there is of course long division as > described here [1], but I wonder whether either this exists in some library > or there is even a more efficient solution. > > > > Any pointers are appreciated. > > Thanks, > > Olaf > > > > [1] http://stackoverflow.com/questions/30931369/how-to- > convert-a-rational-into-a-pretty-string > > _______________________________________________ > > 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 ietf-dane at dukhovni.org Mon Mar 6 22:08:41 2017 From: ietf-dane at dukhovni.org (Viktor Dukhovni) Date: Mon, 6 Mar 2017 17:08:41 -0500 Subject: [Haskell-cafe] Yesod app uses wrong port when connecting to PostgreSQL In-Reply-To: References: Message-ID: > On Mar 6, 2017, at 2:55 PM, Geraldus wrote: > > Hi folks! > > I'm struggling with following error: > > libpq: failed (could not connect to server: Connection refused > Is the server running on host "localhost" (127.0.0.1) and accepting > TCP/IP connections on port 5432? > > I see such messages in Keter's log (in app folder). The VPS where the app deployed running PostgreSQL 9.6 on port 5433. I have changed default port in: > > • config/settings > • config/keter.yaml > • /opt/keter/etc/postgres.yaml on server side > None of these steps helped. I wasn't able to find other port configuration places. What else can I do? On my system: $ grep '543[23]' /etc/services postgresql 5432/tcp #PostgreSQL Database postgresql 5432/udp #PostgreSQL Database -- Viktor. From amindfv at gmail.com Tue Mar 7 01:24:03 2017 From: amindfv at gmail.com (amindfv at gmail.com) Date: Mon, 6 Mar 2017 19:24:03 -0600 Subject: [Haskell-cafe] reading and writing Data.Ratio.Rational In-Reply-To: References: <150132315.26039.1487938673019@webmail.strato.de> Message-ID: <1046187E-B06A-405B-90F9-809C6CDFC91D@gmail.com> There was a discussion recently on the list (started by me) about new versions of base parsing decimals as Rational. I think at this point someone just needs to roll their sleeves up and do it. I may be the one who ends up doing it, but don't have the bandwidth right now. Tom > El 6 mar 2017, a las 14:46, David Feuer escribió: > > I think your best bet is probably to get your hands dirty and parse it yourself: first grab an integer, then optionally a decimal point, etc. > >> On Mar 6, 2017 3:43 PM, "Olaf Klinke" wrote: >> Ah, thanks! That is something to build on. >> >> Olaf >> > Am 24.02.2017 um 15:35 schrieb Patrick Chilton : >> > >> > Prelude> import Numeric >> > Prelude Numeric> fst $ head $ readFloat "0.1234" :: Rational >> > 617 % 5000 >> > >> > On Fri, Feb 24, 2017 at 1:17 PM, Olaf Klinke wrote: >> > Dear cafe, >> > >> > when processing text files containing numbers of the form "xxxx.yyyy" I used to parse them into Double using that type's Read instance. Obviously, even with arithmetic no more complicated than the field operations the result might have ugly rounding errors like 12.000000000002 due to the fact that numbers like 0.7 are not dyadic rationals. The math in my program is not complicated and the numbers are not large, so I don't care about Rationals having potentially huge memory footprints. >> > >> > So here's my question. A literal like 0.7 has type Fractional a => a, but the Read instance of Rational rejects the string "0.7". Must it be this way? Do I have to go via toRational.(read :: String -> Data.Scientific.Scientific)? >> > >> > Note that the documentation of Data.Scientific explicitly states that using (/) is unsafe, so I'd rather stay with the field Rational. >> > >> > For the output as decimal expansion, there is of course long division as described here [1], but I wonder whether either this exists in some library or there is even a more efficient solution. >> > >> > Any pointers are appreciated. >> > Thanks, >> > Olaf >> > >> > [1] http://stackoverflow.com/questions/30931369/how-to-convert-a-rational-into-a-pretty-string >> > _______________________________________________ >> > 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 S.J.Thompson at kent.ac.uk Tue Mar 7 19:10:40 2017 From: S.J.Thompson at kent.ac.uk (Simon Thompson) Date: Tue, 7 Mar 2017 19:10:40 +0000 Subject: [Haskell-cafe] Professor of Cyber Security at Kent References: <58BE94BD.2010509@kent.ac.uk> Message-ID: We’re looking to appoint a professor of Cyber Security at Kent, to head up our existing group, with its Masters course and research activities. The Cyber Security group also sits alongside our Programming Languages and Systems group, and someone with strengths in PL aspects of security would fit very well. The advert for a Professor of Cyber Security is live at https://jobs.kent.ac.uk/fe/tpl_kent01.asp?s=4A515F4E5A565B1A&jobid=40739,2141233446&key=49639912&c=824734655621&pagestamp=sesmvkldtcboaxhswn and post has been advertised with an associated lectureship in security, so the successful candidate will have a chance to shape that appointment too. If you’re interested, do think about applying, or get in touch with us. I’d be happy to answer emails, as would Richard Jones, head of school: cs-hos AT kent DOT ac DOT uk Simon 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: From olf at aatal-apotheke.de Tue Mar 7 19:22:19 2017 From: olf at aatal-apotheke.de (Olaf Klinke) Date: Tue, 7 Mar 2017 20:22:19 +0100 Subject: [Haskell-cafe] reading and writing Data.Ratio.Rational In-Reply-To: References: <150132315.26039.1487938673019@webmail.strato.de> Message-ID: <7FE67A4E-5013-48C0-91C6-EE64CFA5E1AC@aatal-apotheke.de> Before asking on this list, I wrote my own version which did just what David suggested: Parse the integer before the decimal point, parse the part behind the decimal point and divide the latter by 10^length, then sum both parts. This function has type Fractional t => String -> t I thought that this was maybe very inefficient and therefore looked for prior art. If someone feels it is worth adding to some package, I'm happy to provide the code. Olaf > Am 06.03.2017 um 21:46 schrieb David Feuer : > > I think your best bet is probably to get your hands dirty and parse it yourself: first grab an integer, then optionally a decimal point, etc. > > On Mar 6, 2017 3:43 PM, "Olaf Klinke" wrote: > Ah, thanks! That is something to build on. > > Olaf > > Am 24.02.2017 um 15:35 schrieb Patrick Chilton : > > > > Prelude> import Numeric > > Prelude Numeric> fst $ head $ readFloat "0.1234" :: Rational > > 617 % 5000 > > > > On Fri, Feb 24, 2017 at 1:17 PM, Olaf Klinke wrote: > > Dear cafe, > > > > when processing text files containing numbers of the form "xxxx.yyyy" I used to parse them into Double using that type's Read instance. Obviously, even with arithmetic no more complicated than the field operations the result might have ugly rounding errors like 12.000000000002 due to the fact that numbers like 0.7 are not dyadic rationals. The math in my program is not complicated and the numbers are not large, so I don't care about Rationals having potentially huge memory footprints. > > > > So here's my question. A literal like 0.7 has type Fractional a => a, but the Read instance of Rational rejects the string "0.7". Must it be this way? Do I have to go via toRational.(read :: String -> Data.Scientific.Scientific)? > > > > Note that the documentation of Data.Scientific explicitly states that using (/) is unsafe, so I'd rather stay with the field Rational. > > > > For the output as decimal expansion, there is of course long division as described here [1], but I wonder whether either this exists in some library or there is even a more efficient solution. > > > > Any pointers are appreciated. > > Thanks, > > Olaf > > > > [1] http://stackoverflow.com/questions/30931369/how-to-convert-a-rational-into-a-pretty-string > > _______________________________________________ > > 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 eleventynine at gmail.com Wed Mar 8 04:25:17 2017 From: eleventynine at gmail.com (Mike Ledger) Date: Wed, 8 Mar 2017 15:25:17 +1100 Subject: [Haskell-cafe] reading and writing Data.Ratio.Rational In-Reply-To: References: <150132315.26039.1487938673019@webmail.strato.de> <7FE67A4E-5013-48C0-91C6-EE64CFA5E1AC@aatal-apotheke.de> Message-ID: I can never seem to remember to reply-all ... On Wed, Mar 8, 2017 at 3:24 PM, Mike Ledger wrote: > There is also the exact-real and numbers packages which provide exact > reals with their respective CReal types. > > On Wed, Mar 8, 2017 at 6:22 AM, Olaf Klinke wrote: > >> Before asking on this list, I wrote my own version which did just what >> David suggested: Parse the integer before the decimal point, parse the part >> behind the decimal point and divide the latter by 10^length, then sum both >> parts. This function has type >> >> Fractional t => String -> t >> >> I thought that this was maybe very inefficient and therefore looked for >> prior art. If someone feels it is worth adding to some package, I'm happy >> to provide the code. >> >> Olaf >> >> >> > Am 06.03.2017 um 21:46 schrieb David Feuer : >> > >> > I think your best bet is probably to get your hands dirty and parse it >> yourself: first grab an integer, then optionally a decimal point, etc. >> > >> > On Mar 6, 2017 3:43 PM, "Olaf Klinke" wrote: >> > Ah, thanks! That is something to build on. >> > >> > Olaf >> > > Am 24.02.2017 um 15:35 schrieb Patrick Chilton : >> > > >> > > Prelude> import Numeric >> > > Prelude Numeric> fst $ head $ readFloat "0.1234" :: Rational >> > > 617 % 5000 >> > > >> > > On Fri, Feb 24, 2017 at 1:17 PM, Olaf Klinke >> wrote: >> > > Dear cafe, >> > > >> > > when processing text files containing numbers of the form "xxxx.yyyy" >> I used to parse them into Double using that type's Read instance. >> Obviously, even with arithmetic no more complicated than the field >> operations the result might have ugly rounding errors like 12.000000000002 >> due to the fact that numbers like 0.7 are not dyadic rationals. The math in >> my program is not complicated and the numbers are not large, so I don't >> care about Rationals having potentially huge memory footprints. >> > > >> > > So here's my question. A literal like 0.7 has type Fractional a => a, >> but the Read instance of Rational rejects the string "0.7". Must it be this >> way? Do I have to go via toRational.(read :: String -> >> Data.Scientific.Scientific)? >> > > >> > > Note that the documentation of Data.Scientific explicitly states that >> using (/) is unsafe, so I'd rather stay with the field Rational. >> > > >> > > For the output as decimal expansion, there is of course long division >> as described here [1], but I wonder whether either this exists in some >> library or there is even a more efficient solution. >> > > >> > > Any pointers are appreciated. >> > > Thanks, >> > > Olaf >> > > >> > > [1] http://stackoverflow.com/questions/30931369/how-to-convert- >> a-rational-into-a-pretty-string >> > > _______________________________________________ >> > > 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 defigueiredo at ucdavis.edu Wed Mar 8 19:16:00 2017 From: defigueiredo at ucdavis.edu (Dimitri DeFigueiredo) Date: Wed, 8 Mar 2017 12:16:00 -0700 Subject: [Haskell-cafe] formal treatment of module dependencies In-Reply-To: References: Message-ID: <0c3fc4d0-38b6-85b3-cfaa-d560bcfaf662@ucdavis.edu> It seems to me that specifying and solving module dependencies is a ubiquitous problem in software development. All the languages that I know try to make the problem go away by using version numbers and maximizing backward compatibility. Does anyone know of references that formalize this problem for Haskell? Thanks, Dimitri -- 2E45 D376 A744 C671 5100 A261 210B 8461 0FB0 CA1F From johannes.waldmann at htwk-leipzig.de Wed Mar 8 20:48:13 2017 From: johannes.waldmann at htwk-leipzig.de (Johannes Waldmann) Date: Wed, 8 Mar 2017 21:48:13 +0100 Subject: [Haskell-cafe] formal treatment of module dependencies Message-ID: > specifying and solving module dependencies related: http://www.mancoosi.org/papers/ (not for Haskell modules, but for Debian-like package specs) PS: keep in mind that even the most elaborated versioned dependency mechanism is just a work-around - as long as we don't have *all* software properties in the types. Only then could we have a formal proof that a module A can use module B2 instead of module B1, etc. And, we do not "just" want correctness w.r.t. a specification, but also resource consumption. - J.W. From javran.c at gmail.com Thu Mar 9 00:21:09 2017 From: javran.c at gmail.com (Javran Cheng) Date: Wed, 8 Mar 2017 19:21:09 -0500 Subject: [Haskell-cafe] Parsing a bunch of strings without backtracking Message-ID: Hi all, I come across an idea about parsing a bunch of strings, just want to share this idea and looking for some comments and maybe pointing me to some related articles. The idea is when you have: 1 <$ string "aabb" <|> 2 <$ string "aacc" you can rewrite it as: string "aa" >> (1 <$ string "bb" <|> 2 <$ string "cc") so that you don't have to deal with the common prefix "aa" twice. Then I further extend this idea: if we have a set of strings (s1, s2, ...), whose element is not a prefix of any other set member, why don't we turn things like (v1 <$ string s1 <|> v2 <$ string s2 <|> ...) into a "tree-structure" so we don't need to deal with any common prefix more than once? So this motivates my little toy implementation at https://gist.github.com/Javran/1cbfe9897d9a5c8fae5d20a33fd83813 basically given a list [(s1,v1),(s2,v2)...], we want to generate a parser equivalent to (v1 <$ string s1 <|> v2 <$ string s2 <|> ...) but perhaps with less backtracking. My code does this by turning the set of strings into a tree structure (see function "compact") and using this "Compact" representation as a driver to generate the parser. I used ReadP to have a concrete parser for testing, but this should work with any parsing library supporting MonadPlus. I think they are bunch of things that can be improved: - for now every intermediate node of "Compact" contains just a char, so this will end up generating a parser that has branch `char 'f' >> char 'o' >> 'o'` in it instead of the slightly more efficient version `string "foo"` - we could further attach a weight to each string, this allows rearranging (<|>) chains so that a more frequent string parser appears earlier. - if the input [(s1,v1),(s2,v2)...] are all known constants at compile time, probably TemplateHaskell can be used for generating the parser at compile time (as a Haskell expression). I'm not sure how difficult this would be though, as I have very limited understanding of TH. but before I explore further, I want to collect some comments as I said in the beginning. Best, -- Javran (Fang) Cheng -------------- next part -------------- An HTML attachment was scrubbed... URL: From noughtmare at openmailbox.org Thu Mar 9 00:48:50 2017 From: noughtmare at openmailbox.org (Jaro) Date: Thu, 09 Mar 2017 01:48:50 +0100 Subject: [Haskell-cafe] Parsing a bunch of strings without backtracking In-Reply-To: References: Message-ID: <4FA95C53-C29C-4311-80C5-60CD87776C09@openmailbox.org> Have you seen uu-parsinglib (http://foswiki.cs.uu.nl/foswiki/HUT/ParserCombinators)? It implements a non-backtracking parser that works similarly to what you describe. On 9 March 2017 01:21:09 GMT+01:00, Javran Cheng wrote: >Hi all, > >I come across an idea about parsing a bunch of strings, >just want to share this idea and looking for some comments and maybe >pointing me to some related articles. > >The idea is when you have: > >1 <$ string "aabb" <|> 2 <$ string "aacc" > >you can rewrite it as: > >string "aa" >> (1 <$ string "bb" <|> 2 <$ string "cc") > >so that you don't have to deal with the common prefix "aa" twice. > >Then I further extend this idea: if we have a set of strings (s1, s2, >...), >whose element is not a prefix of any other set member, >why don't we turn things like (v1 <$ string s1 <|> v2 <$ string s2 <|> >...) >into a "tree-structure" so we don't need to deal with >any common prefix more than once? > >So this motivates my little toy implementation at >https://gist.github.com/Javran/1cbfe9897d9a5c8fae5d20a33fd83813 > >basically given a list [(s1,v1),(s2,v2)...], we want to generate a >parser >equivalent to (v1 <$ string s1 <|> v2 <$ string s2 <|> ...) >but perhaps with less backtracking. My code does this by turning the >set of >strings into a tree structure (see function "compact") and >using this "Compact" representation as a driver to generate the parser. >I used ReadP to have a concrete parser for testing, but this should >work >with any parsing library supporting MonadPlus. > >I think they are bunch of things that can be improved: > >- for now every intermediate node of "Compact" contains just a char, so >this will end up generating a parser that has branch `char 'f' >> char >'o' >>> 'o'` in it > instead of the slightly more efficient version `string "foo"` >- we could further attach a weight to each string, this allows >rearranging >(<|>) chains so that a more frequent string parser appears earlier. >- if the input [(s1,v1),(s2,v2)...] are all known constants at compile >time, probably TemplateHaskell can be used for generating the parser at >compile time (as a Haskell expression). >I'm not sure how difficult this would be though, as I have very limited >understanding of TH. > >but before I explore further, I want to collect some comments as I said >in >the beginning. > >Best, >-- >Javran (Fang) Cheng -- Sent from my Android device with K-9 Mail. Please excuse my brevity. -------------- next part -------------- An HTML attachment was scrubbed... URL: From javran.c at gmail.com Thu Mar 9 02:41:30 2017 From: javran.c at gmail.com (Javran Cheng) Date: Wed, 8 Mar 2017 21:41:30 -0500 Subject: [Haskell-cafe] Parsing a bunch of strings without backtracking In-Reply-To: <4FA95C53-C29C-4311-80C5-60CD87776C09@openmailbox.org> References: <4FA95C53-C29C-4311-80C5-60CD87776C09@openmailbox.org> Message-ID: Hi Jaro, thanks for the link, having worked with few parsing libs but uu-parsinglib sounds new to me and I'm definitely thinking about having a try. I'm taking a look but haven't yet found any part of code that attempts to factor common prefixes out. On Wed, Mar 8, 2017 at 7:48 PM, Jaro wrote: > Have you seen uu-parsinglib (http://foswiki.cs.uu.nl/ > foswiki/HUT/ParserCombinators)? It implements a non-backtracking parser > that works similarly to what you describe. > > > On 9 March 2017 01:21:09 GMT+01:00, Javran Cheng > wrote: >> >> Hi all, >> >> I come across an idea about parsing a bunch of strings, >> just want to share this idea and looking for some comments and maybe >> pointing me to some related articles. >> >> The idea is when you have: >> >> 1 <$ string "aabb" <|> 2 <$ string "aacc" >> >> you can rewrite it as: >> >> string "aa" >> (1 <$ string "bb" <|> 2 <$ string "cc") >> >> so that you don't have to deal with the common prefix "aa" twice. >> >> Then I further extend this idea: if we have a set of strings (s1, s2, >> ...), whose element is not a prefix of any other set member, >> why don't we turn things like (v1 <$ string s1 <|> v2 <$ string s2 <|> >> ...) into a "tree-structure" so we don't need to deal with >> any common prefix more than once? >> >> So this motivates my little toy implementation at >> https://gist.github.com/Javran/1cbfe9897d9a5c8fae5d20a33fd83813 >> >> basically given a list [(s1,v1),(s2,v2)...], we want to generate a parser >> equivalent to (v1 <$ string s1 <|> v2 <$ string s2 <|> ...) >> but perhaps with less backtracking. My code does this by turning the set >> of strings into a tree structure (see function "compact") and >> using this "Compact" representation as a driver to generate the parser. >> I used ReadP to have a concrete parser for testing, but this should work >> with any parsing library supporting MonadPlus. >> >> I think they are bunch of things that can be improved: >> >> - for now every intermediate node of "Compact" contains just a char, so >> this will end up generating a parser that has branch `char 'f' >> char 'o' >> >> 'o'` in it >> instead of the slightly more efficient version `string "foo"` >> - we could further attach a weight to each string, this allows >> rearranging (<|>) chains so that a more frequent string parser appears >> earlier. >> - if the input [(s1,v1),(s2,v2)...] are all known constants at compile >> time, probably TemplateHaskell can be used for generating the parser at >> compile time (as a Haskell expression). >> I'm not sure how difficult this would be though, as I have very >> limited understanding of TH. >> >> but before I explore further, I want to collect some comments as I said >> in the beginning. >> >> Best, >> -- >> Javran (Fang) Cheng >> > > -- > Sent from my Android device with K-9 Mail. Please excuse my brevity. > -- Javran (Fang) Cheng -------------- next part -------------- An HTML attachment was scrubbed... URL: From noughtmare at openmailbox.org Thu Mar 9 09:13:35 2017 From: noughtmare at openmailbox.org (Jaro) Date: Thu, 09 Mar 2017 10:13:35 +0100 Subject: [Haskell-cafe] Parsing a bunch of strings without backtracking In-Reply-To: References: <4FA95C53-C29C-4311-80C5-60CD87776C09@openmailbox.org> Message-ID: <961AB844-F26E-4090-87D3-E082864732EA@openmailbox.org> After thinking about it more (I still don't completely understand uu-parsinglib myself). I think achieves non-backtracking by running the parsers in parallel and then returning the first one that succeeds. So I guess it doesn't really optimize away prefixes. The 'best' function is the function that merges two "sequences" of the intermediate type 'Steps a' and that causes the parsers to be run in parallel. The source is here: https://hackage.haskell.org/package/uu-parsinglib-2.9.1.1/docs/src/Text-ParserCombinators-UU-Core.html#best. On 9 March 2017 03:41:30 GMT+01:00, Javran Cheng wrote: >Hi Jaro, thanks for the link, having worked with few parsing libs but >uu-parsinglib sounds new to me and I'm definitely thinking about having >a >try. >I'm taking a look but haven't yet found any part of code that attempts >to >factor common prefixes out. > >On Wed, Mar 8, 2017 at 7:48 PM, Jaro >wrote: > >> Have you seen uu-parsinglib (http://foswiki.cs.uu.nl/ >> foswiki/HUT/ParserCombinators)? It implements a non-backtracking >parser >> that works similarly to what you describe. >> >> >> On 9 March 2017 01:21:09 GMT+01:00, Javran Cheng >> wrote: >>> >>> Hi all, >>> >>> I come across an idea about parsing a bunch of strings, >>> just want to share this idea and looking for some comments and maybe >>> pointing me to some related articles. >>> >>> The idea is when you have: >>> >>> 1 <$ string "aabb" <|> 2 <$ string "aacc" >>> >>> you can rewrite it as: >>> >>> string "aa" >> (1 <$ string "bb" <|> 2 <$ string "cc") >>> >>> so that you don't have to deal with the common prefix "aa" twice. >>> >>> Then I further extend this idea: if we have a set of strings (s1, >s2, >>> ...), whose element is not a prefix of any other set member, >>> why don't we turn things like (v1 <$ string s1 <|> v2 <$ string s2 ><|> >>> ...) into a "tree-structure" so we don't need to deal with >>> any common prefix more than once? >>> >>> So this motivates my little toy implementation at >>> https://gist.github.com/Javran/1cbfe9897d9a5c8fae5d20a33fd83813 >>> >>> basically given a list [(s1,v1),(s2,v2)...], we want to generate a >parser >>> equivalent to (v1 <$ string s1 <|> v2 <$ string s2 <|> ...) >>> but perhaps with less backtracking. My code does this by turning the >set >>> of strings into a tree structure (see function "compact") and >>> using this "Compact" representation as a driver to generate the >parser. >>> I used ReadP to have a concrete parser for testing, but this should >work >>> with any parsing library supporting MonadPlus. >>> >>> I think they are bunch of things that can be improved: >>> >>> - for now every intermediate node of "Compact" contains just a char, >so >>> this will end up generating a parser that has branch `char 'f' >> >char 'o' >>> >> 'o'` in it >>> instead of the slightly more efficient version `string "foo"` >>> - we could further attach a weight to each string, this allows >>> rearranging (<|>) chains so that a more frequent string parser >appears >>> earlier. >>> - if the input [(s1,v1),(s2,v2)...] are all known constants at >compile >>> time, probably TemplateHaskell can be used for generating the parser >at >>> compile time (as a Haskell expression). >>> I'm not sure how difficult this would be though, as I have very >>> limited understanding of TH. >>> >>> but before I explore further, I want to collect some comments as I >said >>> in the beginning. >>> >>> Best, >>> -- >>> Javran (Fang) Cheng >>> >> >> -- >> Sent from my Android device with K-9 Mail. Please excuse my brevity. >> > > > >-- >Javran (Fang) Cheng -- Sent from my Android device with K-9 Mail. Please excuse my brevity. -------------- next part -------------- An HTML attachment was scrubbed... URL: From zocca.marco at gmail.com Thu Mar 9 09:48:45 2017 From: zocca.marco at gmail.com (Marco Zocca) Date: Thu, 9 Mar 2017 10:48:45 +0100 Subject: [Haskell-cafe] [ANN] DataHaskell mailing list Message-ID: Dear all, DataHaskell now has a mailing list hosted on haskell.org : https://mail.haskell.org/cgi-bin/mailman/listinfo/data-haskell This is an addition to our current Gitter chatroom ; the purpose is to host longer-form archived discussions on libraries, documentation and more. With kind regards, Marco Zocca (https://github.com/ocramz) From johannes.waldmann at htwk-leipzig.de Thu Mar 9 15:07:16 2017 From: johannes.waldmann at htwk-leipzig.de (Johannes Waldmann) Date: Thu, 9 Mar 2017 16:07:16 +0100 Subject: [Haskell-cafe] To [] Or Not To [] Message-ID: Dear Cafe, I wrote a text (well, you might call it a rant) on the tragic over-use of lists in Haskell, based on my experience in programming and teaching. http://www.imn.htwk-leipzig.de/~waldmann/etc/untutorial/list-or-not-list/ * If your program accesses a list by index (with the !! operator), then your program is wrong. * If your program uses the length function, then your program is wrong. * If your program sorts a list, then your program is wrong. * If you wrote this sort function yourself, then it is doubly wrong. * The ideal use of a list is such that will be removed by the compiler. * The enlightened programmer writes list-free code with Foldable. Have fun reading, and avoiding lists from here on! - J.W. From palotai.robin at gmail.com Thu Mar 9 15:24:50 2017 From: palotai.robin at gmail.com (Robin Palotai) Date: Thu, 9 Mar 2017 16:24:50 +0100 Subject: [Haskell-cafe] To [] Or Not To [] In-Reply-To: References: Message-ID: > Have fun reading, and avoiding lists from here on! Except maybe the haskell-cafe list. 2017-03-09 16:07 GMT+01:00 Johannes Waldmann < johannes.waldmann at htwk-leipzig.de>: > Dear Cafe, > > I wrote a text (well, you might call it a rant) > on the tragic over-use of lists in Haskell, > based on my experience in programming and teaching. > > http://www.imn.htwk-leipzig.de/~waldmann/etc/untutorial/list-or-not-list/ > > * If your program accesses a list by index (with the !! operator), > then your program is wrong. > * If your program uses the length function, then your program is wrong. > * If your program sorts a list, then your program is wrong. > * If you wrote this sort function yourself, then it is doubly wrong. > * The ideal use of a list is such that will be removed by the compiler. > * The enlightened programmer writes list-free code with Foldable. > > Have fun reading, and avoiding lists from here on! > > - J.W. > _______________________________________________ > 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 M.W.Wang at kent.ac.uk Thu Mar 9 15:39:17 2017 From: M.W.Wang at kent.ac.uk (Meng Wang) Date: Thu, 9 Mar 2017 15:39:17 +0000 Subject: [Haskell-cafe] Haskell-related PhD studentship Message-ID: <24376F85-F1AF-4A48-9109-B8C8BFD8771A@kent.ac.uk> Dear Haskellers, I am seeking a PhD student on Haskell-related projects, particularly in the area of bidirectional programming (lenses), property-based testing (QuickCheck) and refactoring. This would be a good opportunity for someone who is interested in applying Haskell ideas to real problems. The student will be part of the Programming Languages and Systems (PLAS) group in the School of Computing at the University of Kent. A major focus within the group is functional programming (FP), where it has had an international reputation for more than twenty five years. The group currently has 13 FTE academic staff, 4 RAs and 12 doctoral students. . The funding covers maintenance, EU student fees and research related expenses. But non-EU students are welcome to apply too. For Sep 2017 starting, the application deadline is 7 April 2017. If you are interested, please contact me at m.w.wang at kent.ac.uk. More information can be found at https://www.cs.kent.ac.uk/research/studyingforaphd/phd-wang-2017.html. Best wishes, Meng 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 | ☎ +44 (0)1227 827699 www.cs.kent.ac.uk/~mw516 -------------- next part -------------- An HTML attachment was scrubbed... URL: From chris at chrisdornan.com Thu Mar 9 19:06:32 2017 From: chris at chrisdornan.com (Chris Dornan) Date: Thu, 09 Mar 2017 19:06:32 +0000 Subject: [Haskell-cafe] regex and Regular Expressions Libraries Message-ID: Dear Haskell Cafe, With the regex announcement, I wanted to try get other folks' perspective on what has been happening with the Haskell regular expression libraries. I have been in turn impressed at how good the engineering of the Regex packages while gobsmacked by how difficult the traditional Text.Regex API is to use. In this blog post, http://engineers.irisconnect.net/posts/2017-03-07-regex.html I rather cheekily speculate that the Haskellers perhaps have been a bit disdainful of regular expressions (not important in a language capable of doing proper parsing, etc.). What do you think? Chris From allbery.b at gmail.com Thu Mar 9 19:21:32 2017 From: allbery.b at gmail.com (Brandon Allbery) Date: Thu, 9 Mar 2017 14:21:32 -0500 Subject: [Haskell-cafe] regex and Regular Expressions Libraries In-Reply-To: References: Message-ID: On Thu, Mar 9, 2017 at 2:06 PM, Chris Dornan wrote: > In this blog post, > > http://engineers.irisconnect.net/posts/2017-03-07-regex.html > > I rather cheekily speculate that the Haskellers perhaps have been a bit > disdainful of regular expressions (not important in a language capable > of doing proper parsing, etc.). > > What do you think? > I've voiced that opinion in #haskell a few times, that the API's designed to scare people toward parsers. -- 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 heraldhoi at gmail.com Thu Mar 9 20:14:17 2017 From: heraldhoi at gmail.com (Geraldus) Date: Thu, 09 Mar 2017 20:14:17 +0000 Subject: [Haskell-cafe] To [] Or Not To [] In-Reply-To: References: Message-ID: That was quite reasonable and very interesting and insightful reading. Thanks! P.S. Will you share something about Strings? -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Thu Mar 9 20:22:27 2017 From: allbery.b at gmail.com (Brandon Allbery) Date: Thu, 9 Mar 2017 15:22:27 -0500 Subject: [Haskell-cafe] To [] Or Not To [] In-Reply-To: References: Message-ID: On Thu, Mar 9, 2017 at 10:07 AM, Johannes Waldmann < johannes.waldmann at htwk-leipzig.de> wrote: > * The enlightened programmer writes list-free code with Foldable. I'd like to point out that FTP is still very recent and there are quite a few learning resources that know nothing of it. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From olf at aatal-apotheke.de Thu Mar 9 20:51:28 2017 From: olf at aatal-apotheke.de (Olaf Klinke) Date: Thu, 9 Mar 2017 21:51:28 +0100 Subject: [Haskell-cafe] Parsing a bunch of strings without backtracking Message-ID: <64E1678C-E54E-4885-AFEB-A5C7410161EA@aatal-apotheke.de> The tree with internal nodes of type Char and leaves of type v is a representation of a finite state machine, a common tool in parsing certain grammars. I'm not sure your type Compact v captures exactly this, since a value v may be followed by more Chars down in the tree. You'd want type Compact v = [Either (More v) v] -- akin to Data.Tree.Forest data More v = More Char (Compact v) -- akin to Data.Tree.Tree What you may want to look at is a so-called trie [1,2]. In textbooks, it is common to assume that there is a charcter '$' not element of your alphabet. Then '$' is appended to each string before compressing all into a tree structure. This way, one can put both a string and a prefix of it into the same tree. A special kind of trie is the suffix trie. It holds all suffixes of a string and facilitates fast full-text search. More efficient variants are extensively used in bioinformatics [3]. Olaf [1] http://hackage.haskell.org/package/word-trie-0.3.0/docs/Data-Trie.html [2] https://en.wikipedia.org/wiki/Trie [3] http://mummer.sourceforge.net From johannes.waldmann at htwk-leipzig.de Thu Mar 9 20:54:26 2017 From: johannes.waldmann at htwk-leipzig.de (Johannes Waldmann) Date: Thu, 9 Mar 2017 21:54:26 +0100 Subject: [Haskell-cafe] To [] Or Not To [] In-Reply-To: References: Message-ID: <520debd3-06e0-954e-4482-fbe07e03f850@htwk-leipzig.de> > P.S. Will you share something about Strings? there is a short section on string(like) data types at http://www.imn.htwk-leipzig.de/~waldmann/etc/untutorial/data/ but I am really not an expert on the finer points. - J.W. From ok at cs.otago.ac.nz Thu Mar 9 21:37:40 2017 From: ok at cs.otago.ac.nz (Richard A. O'Keefe) Date: Fri, 10 Mar 2017 10:37:40 +1300 Subject: [Haskell-cafe] To [] Or Not To [] In-Reply-To: References: Message-ID: <674C7560-9D60-4CFE-88B4-49668D9617FA@cs.otago.ac.nz> > On 10/03/2017, at 4:07 AM, Johannes Waldmann wrote: > > * If your program sorts a list, then your program is wrong. This seems a very strange claim. The whole thing is an abuse of the word "wrong". A program can be all of ugly, inefficient, unidiomatic, &c &c without being WRONG. From maksymilian.owsianny at gmail.com Thu Mar 9 21:52:38 2017 From: maksymilian.owsianny at gmail.com (Maksymilian Owsianny) Date: Thu, 9 Mar 2017 21:52:38 +0000 Subject: [Haskell-cafe] CEF3 bindings and game dev in Haskell Message-ID: Hey I'm interested in making gamedev in haskell more viable and one thing that I believe is missing in that part of the environment is a good GUI story. So I decided to create proper bindings to cef3, you can check out what I've done so far [here][1]. In this current version I basically took the work done by Daniel Austin [here][2] split it into parts to prevent my machine from dying from lack of memory and packed it up with some nix glue for convenient usage. Now all this doesn't look like much but it sill took me much more time then I'm willing to admit in public. That's one of the eternal truths of software development, that everything always takes an order of magnitude more time then you suspect it would. Anyway, what I would like to do here is add support for all platforms. Create some nice scripts that help with automatizing building, developing and deployment of code with this library for users. Possibly write a script that automatically generates bindings from c headers to bring this lib up to speed with the current version of cef. Write some proper guides on using this lib for creating game GUI or standalone desktop application. All of that is nice and well to wish for but it is quite a lot of frankly not very fun work. If I had to choose I would rather spend my time working on either something fun or something that pays the rent, so usually at this point I stop and walk away. But this time I decided to go about it differently, and ask for community support. I have set up a BountySource campaign [here][3] so I could focus on making this happen. Alternatively, if that's your thing, I have set up a bitcoin address [4]. Depending on how well this campaign will go I'm also planing on creating a full 2D game engine... but yeah, that's in the future. So yeah, if you'd like to help me build this please support me. Thanks, Max. [1]: https://github.com/haskell-ui/cef3-raw [2]: https://github.com/fluffynukeit/bindings-cef3 [3]: https://salt.bountysource.com/teams/haskell-ui [4]: 1LskxSUyLDLpMCBfUUnqcRT8mEFMW511Eq PS. I have also created a reddit thread for this proposal here . -------------- next part -------------- An HTML attachment was scrubbed... URL: From monkleyon at gmail.com Thu Mar 9 23:53:51 2017 From: monkleyon at gmail.com (MarLinn) Date: Fri, 10 Mar 2017 00:53:51 +0100 Subject: [Haskell-cafe] CEF3 bindings and game dev in Haskell In-Reply-To: References: Message-ID: [Ack. Forgot to reply-to-list, and ran into the list's bad handling of gmail addresses again. So sorry for possible multi-posts.] I agree that our GUI story is still bad. But I don't understand what chromium has to do with either game dev or a good GUI story? If I want to write a real game, I use /SDL2/ bindings. If I want to write a website, I use something like /Yesod/. If I want to write browser games or "dynamic web sites", I throw JavaScript libraries at the walls, see what sticks, call it "modern coding", go to the liquor store and reconsider my life. All joking aside, it's nice to see someone take a different path than usual, organization-wise. I do disagree on the technical path though. We already have a lot of bindings to several cross-platform frameworks and libraries, including QT, GTK, FLTK, and the aforementioned SDL2. But they suffer from impedance mismatch and lack of use and thus, community support. To solve that I would say what we need is a nice middle layer to translate functional thinking into framework models. We do have the /diagrams/ package for describing static diagrams in a functional way, but it largely lacks dynamic behavior. (There's some support for animations, but it doesn't fill me with confidence.) We also have several attempts at FRP libraries for dynamic behavior, but few interactions with bindings. What is still missing is something like a dynamic version of /diagrams/ that is based on one of these FRP libraries and that can work with one or several of the bindings as a back-end – possibly with a Haskell-side widget library. Possibly with css-like runtime styling And if we have that, yeah, we can add chromium bindings or whatever. Or write our own browser engine for fun. As far as I know there were several attempts but all fizzled out at some point. My own favorite approach goes even further. I propose that many of the problems arise because the existing frameworks impose too many non-functional ideas, so the "purest" way to go forward would be a fresh framework on the basis of only /SDL/ and /reactive banana/. That might sound like overkill for a simple non-game GUI, but is it really if the alternative is a whole browser? And what's more, that approach could be pursued in a way that might be turned into the one mentioned above later on. What these approaches need is not more c tools or more cross-platform shenanigans, but some ideas how to handle a complex dynamic tangle of widget trees in a generic, functional fashion. Which to me has the added benefit of sounding much more like "fun". So I'm still working on that second approach whenever I have some time, but like yours, my time is limited. Be assured, I don't want to diminish your work, it's probably useful to a certain subset of programmers. What I'm disputing is just if it's the single best way forward. Cheers, MarLinn On 2017-03-09 22:52, Maksymilian Owsianny wrote: > Hey > > I'm interested in making gamedev in haskell more viable and one thing > that I believe is missing in that part of the environment is a good > GUI story. So I decided to create proper bindings to cef3, you can > check out what I've done so far [here][1]. In this current version > I basically took the work done by Daniel Austin [here][2] split it > into parts to prevent my machine from dying from lack of memory and > packed it up with some nix glue for convenient usage. Now all this > doesn't look like much but it sill took me much more time then I'm > willing to admit in public. That's one of the eternal truths of > software development, that everything always takes an order of > magnitude more time then you suspect it would. > > Anyway, what I would like to do here is add support for all platforms. > Create some nice scripts that help with automatizing building, > developing and deployment of code with this library for users. > Possibly write a script that automatically generates bindings from > c headers to bring this lib up to speed with the current version of > cef. Write some proper guides on using this lib for creating game GUI > or standalone desktop application. All of that is nice and well to > wish for but it is quite a lot of frankly not very fun work. If I had > to choose I would rather spend my time working on either something fun > or something that pays the rent, so usually at this point I stop and > walk away. But this time I decided to go about it differently, and ask > for community support. I have set up a BountySource campaign [here][3] > so I could focus on making this happen. Alternatively, if that's your > thing, I have set up a bitcoin address [4]. > > Depending on how well this campaign will go I'm also planing on > creating a full 2D game engine... but yeah, that's in the future. > > So yeah, if you'd like to help me build this please support me. > > Thanks, > Max. > > [1]:https://github.com/haskell-ui/cef3-raw > [2]:https://github.com/fluffynukeit/bindings-cef3 > [3]:https://salt.bountysource.com/teams/haskell-ui > [4]: 1LskxSUyLDLpMCBfUUnqcRT8mEFMW511Eq > > > PS. I have also created a reddit thread for this proposalhere > . > > > _______________________________________________ > 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 maksymilian.owsianny at gmail.com Fri Mar 10 00:19:12 2017 From: maksymilian.owsianny at gmail.com (Maksymilian Owsianny) Date: Fri, 10 Mar 2017 00:19:12 +0000 Subject: [Haskell-cafe] CEF3 bindings and game dev in Haskell In-Reply-To: References: Message-ID: The thing about this solution is, its simplicity. You can use the skills of front end (HTML/CSS) people to design your GUI, you can then build it using something like threepenny and render it to texture using cef. You can use the skills and tools that already exist. I agree that this solution is sub optimal, that including a whole browser inside your application can be a bit much. But I believe that at least having an option will be much better for the community then not. Cheers, Max. On Thu, Mar 9, 2017 at 11:53 PM, MarLinn wrote: > [Ack. Forgot to reply-to-list, and ran into the list's bad handling of > gmail addresses again. So sorry for possible multi-posts.] > > I agree that our GUI story is still bad. > > But I don't understand what chromium has to do with either game dev or a > good GUI story? If I want to write a real game, I use *SDL2* bindings. If > I want to write a website, I use something like *Yesod*. If I want to > write browser games or "dynamic web sites", I throw JavaScript libraries at > the walls, see what sticks, call it "modern coding", go to the liquor store > and reconsider my life. > > All joking aside, it's nice to see someone take a different path than > usual, organization-wise. I do disagree on the technical path though. We > already have a lot of bindings to several cross-platform frameworks and > libraries, including QT, GTK, FLTK, and the aforementioned SDL2. But they > suffer from impedance mismatch and lack of use and thus, community support. > To solve that I would say what we need is a nice middle layer to translate > functional thinking into framework models. We do have the *diagrams* > package for describing static diagrams in a functional way, but it largely > lacks dynamic behavior. (There's some support for animations, but it > doesn't fill me with confidence.) We also have several attempts at FRP > libraries for dynamic behavior, but few interactions with bindings. What is > still missing is something like a dynamic version of *diagrams* that is > based on one of these FRP libraries and that can work with one or several > of the bindings as a back-end – possibly with a Haskell-side widget > library. Possibly with css-like runtime styling And if we have that, yeah, > we can add chromium bindings or whatever. Or write our own browser engine > for fun. As far as I know there were several attempts but all fizzled out > at some point. > My own favorite approach goes even further. I propose that many of the > problems arise because the existing frameworks impose too many > non-functional ideas, so the "purest" way to go forward would be a fresh > framework on the basis of only *SDL* and *reactive banana*. That might > sound like overkill for a simple non-game GUI, but is it really if the > alternative is a whole browser? And what's more, that approach could be > pursued in a way that might be turned into the one mentioned above later on. > > What these approaches need is not more c tools or more cross-platform > shenanigans, but some ideas how to handle a complex dynamic tangle of > widget trees in a generic, functional fashion. Which to me has the added > benefit of sounding much more like "fun". So I'm still working on that > second approach whenever I have some time, but like yours, my time is > limited. > > Be assured, I don't want to diminish your work, it's probably useful to a > certain subset of programmers. What I'm disputing is just if it's the > single best way forward. > > Cheers, > MarLinn > > On 2017-03-09 22:52, Maksymilian Owsianny wrote: > > Hey > > I'm interested in making gamedev in haskell more viable and one thing > that I believe is missing in that part of the environment is a good > GUI story. So I decided to create proper bindings to cef3, you can > check out what I've done so far [here][1]. In this current version > I basically took the work done by Daniel Austin [here][2] split it > into parts to prevent my machine from dying from lack of memory and > packed it up with some nix glue for convenient usage. Now all this > doesn't look like much but it sill took me much more time then I'm > willing to admit in public. That's one of the eternal truths of > software development, that everything always takes an order of > magnitude more time then you suspect it would. > > Anyway, what I would like to do here is add support for all platforms. > Create some nice scripts that help with automatizing building, > developing and deployment of code with this library for users. > Possibly write a script that automatically generates bindings from > c headers to bring this lib up to speed with the current version of > cef. Write some proper guides on using this lib for creating game GUI > or standalone desktop application. All of that is nice and well to > wish for but it is quite a lot of frankly not very fun work. If I had > to choose I would rather spend my time working on either something fun > or something that pays the rent, so usually at this point I stop and > walk away. But this time I decided to go about it differently, and ask > for community support. I have set up a BountySource campaign [here][3] > so I could focus on making this happen. Alternatively, if that's your > thing, I have set up a bitcoin address [4]. > > Depending on how well this campaign will go I'm also planing on > creating a full 2D game engine... but yeah, that's in the future. > > So yeah, if you'd like to help me build this please support me. > > Thanks, > Max. > > [1]: https://github.com/haskell-ui/cef3-raw > [2]: https://github.com/fluffynukeit/bindings-cef3 > [3]: https://salt.bountysource.com/teams/haskell-ui > [4]: 1LskxSUyLDLpMCBfUUnqcRT8mEFMW511Eq > > > > PS. I have also created a reddit thread for this proposal here . > > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to:http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From monkleyon at gmail.com Fri Mar 10 04:36:08 2017 From: monkleyon at gmail.com (MarLinn) Date: Fri, 10 Mar 2017 05:36:08 +0100 Subject: [Haskell-cafe] CEF3 bindings and game dev in Haskell In-Reply-To: References: Message-ID: <55220ebd-b8b5-866e-ce51-fbf8e1ad8ecf@gmail.com> On 2017-03-10 01:19, Maksymilian Owsianny wrote: > The thing about this solution is, its simplicity. You can use the > skills of front end (HTML/CSS) people to design your GUI, you can then > build it using something like threepenny and render it to texture > using cef. You can use the skills and tools that already exist. > I agree that this solution is sub optimal, that including a whole > browser inside your application can be a bit much. But I believe that > at least having an option will be much better for the community then > not. > > Cheers, > Max. Mhh… I get what you're getting at. But what can you really do with HTML+CSS without scripts? Ok, admittedly you can do a lot via crude tricks. You can create tabs, menus, pop-ups and loads of other stuff with pseudo-classes and pseudo-elements if you really want. But your average front-end-web-dev will not be used to using such tricks because on the web, everything is JS. And such hacks are an abuse of the tools anyway. So basically what you will get in practice with HTML+CSS are static pages or forms that you have to tie together somehow. So far so good, it's better than nothing. But we already have a really great, convenient library for static "pictures" with loads of existing back-ends – diagrams! Diagrams can even carry generic queries that you could fill with stuff like FRP endpoints. What's missing to fulfill your goal is a Parser that creates diagrams from HTML+CSS – which, of course, is basically a variation of one of the main purposes of a browser engine. While that brings me back to the beginning, it seems to open a perspective for the future. Would you say it might be possible to start with chromium integration and then push it out again bit by bit by replacing it with the existing tools? For example would it be possible in the mid-term to "only" use the chromium parser but not the presentation layer, or vice-versa? I feel there might even be a hidden path to a solution to our core web dev problems hidden here, but for now I fail to see specifics. Cheers, MarLinn > On Thu, Mar 9, 2017 at 11:53 PM, MarLinn > wrote: > > [Ack. Forgot to reply-to-list, and ran into the list's bad > handling of gmail addresses again. So sorry for possible multi-posts.] > > I agree that our GUI story is still bad. > > But I don't understand what chromium has to do with either game > dev or a good GUI story? If I want to write a real game, I use > /SDL2/ bindings. If I want to write a website, I use something > like /Yesod/. If I want to write browser games or "dynamic web > sites", I throw JavaScript libraries at the walls, see what > sticks, call it "modern coding", go to the liquor store and > reconsider my life. > > All joking aside, it's nice to see someone take a different path > than usual, organization-wise. I do disagree on the technical path > though. We already have a lot of bindings to several > cross-platform frameworks and libraries, including QT, GTK, FLTK, > and the aforementioned SDL2. But they suffer from impedance > mismatch and lack of use and thus, community support. To solve > that I would say what we need is a nice middle layer to translate > functional thinking into framework models. We do have the > /diagrams/ package for describing static diagrams in a functional > way, but it largely lacks dynamic behavior. (There's some support > for animations, but it doesn't fill me with confidence.) We also > have several attempts at FRP libraries for dynamic behavior, but > few interactions with bindings. What is still missing is something > like a dynamic version of /diagrams/ that is based on one of these > FRP libraries and that can work with one or several of the > bindings as a back-end – possibly with a Haskell-side widget > library. Possibly with css-like runtime styling And if we have > that, yeah, we can add chromium bindings or whatever. Or write our > own browser engine for fun. As far as I know there were several > attempts but all fizzled out at some point. > > My own favorite approach goes even further. I propose that many of > the problems arise because the existing frameworks impose too many > non-functional ideas, so the "purest" way to go forward would be a > fresh framework on the basis of only /SDL/ and /reactive banana/. > That might sound like overkill for a simple non-game GUI, but is > it really if the alternative is a whole browser? And what's more, > that approach could be pursued in a way that might be turned into > the one mentioned above later on. > > What these approaches need is not more c tools or more > cross-platform shenanigans, but some ideas how to handle a complex > dynamic tangle of widget trees in a generic, functional fashion. > Which to me has the added benefit of sounding much more like > "fun". So I'm still working on that second approach whenever I > have some time, but like yours, my time is limited. > > Be assured, I don't want to diminish your work, it's probably > useful to a certain subset of programmers. What I'm disputing is > just if it's the single best way forward. > > Cheers, > MarLinn > > On 2017-03-09 22:52, Maksymilian Owsianny wrote: >> Hey >> >> I'm interested in making gamedev in haskell more viable and one thing >> that I believe is missing in that part of the environment is a good >> GUI story. So I decided to create proper bindings to cef3, you can >> check out what I've done so far [here][1]. In this current version >> I basically took the work done by Daniel Austin [here][2] split it >> into parts to prevent my machine from dying from lack of memory and >> packed it up with some nix glue for convenient usage. Now all this >> doesn't look like much but it sill took me much more time then I'm >> willing to admit in public. That's one of the eternal truths of >> software development, that everything always takes an order of >> magnitude more time then you suspect it would. >> >> Anyway, what I would like to do here is add support for all platforms. >> Create some nice scripts that help with automatizing building, >> developing and deployment of code with this library for users. >> Possibly write a script that automatically generates bindings from >> c headers to bring this lib up to speed with the current version of >> cef. Write some proper guides on using this lib for creating game GUI >> or standalone desktop application. All of that is nice and well to >> wish for but it is quite a lot of frankly not very fun work. If I had >> to choose I would rather spend my time working on either something fun >> or something that pays the rent, so usually at this point I stop and >> walk away. But this time I decided to go about it differently, and ask >> for community support. I have set up a BountySource campaign [here][3] >> so I could focus on making this happen. Alternatively, if that's your >> thing, I have set up a bitcoin address [4]. >> >> Depending on how well this campaign will go I'm also planing on >> creating a full 2D game engine... but yeah, that's in the future. >> >> So yeah, if you'd like to help me build this please support me. >> >> Thanks, >> Max. >> >> [1]:https://github.com/haskell-ui/cef3-raw >> >> [2]:https://github.com/fluffynukeit/bindings-cef3 >> >> [3]:https://salt.bountysource.com/teams/haskell-ui >> >> [4]: 1LskxSUyLDLpMCBfUUnqcRT8mEFMW511Eq >> >> >> PS. I have also created a reddit thread for this proposalhere >> . >> >> _______________________________________________ >> 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 qdunkan at gmail.com Fri Mar 10 05:12:48 2017 From: qdunkan at gmail.com (Evan Laforge) Date: Thu, 9 Mar 2017 21:12:48 -0800 Subject: [Haskell-cafe] regex and Regular Expressions Libraries In-Reply-To: References: Message-ID: That's always been my canonical example about how you can overuse typeclasses to make a simple job into an impenetrable documentation hunt. Long ago I wrapped it in a simple API and have always used that. Much later, pcre-heavy showed up and I just switched my wrapper to use that, since it was still a little too typeclass happy for my taste. On Thu, Mar 9, 2017 at 11:06 AM, Chris Dornan wrote: > Dear Haskell Cafe, > > With the regex announcement, I wanted to try get other folks' perspective > on what has been happening with the Haskell regular expression libraries. > > I have been in turn impressed at how good the engineering of the Regex > packages while gobsmacked by how difficult the traditional Text.Regex API > is to use. > > In this blog post, > > http://engineers.irisconnect.net/posts/2017-03-07-regex.html > > I rather cheekily speculate that the Haskellers perhaps have been a bit > disdainful of regular expressions (not important in a language capable > of doing proper parsing, etc.). > > What do you think? > > 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 doug at cs.dartmouth.edu Fri Mar 10 05:41:37 2017 From: doug at cs.dartmouth.edu (Doug McIlroy) Date: Fri, 10 Mar 2017 00:41:37 -0500 Subject: [Haskell-cafe] To [] Or Not To [] Message-ID: <201703100541.v2A5fbvK015715@coolidge.cs.Dartmouth.EDU> This stirred ancient memories in praise of wrong programs: > > * If your program sorts a list, then your program is wrong. > > This seems a very strange claim. > > The whole thing is an abuse of the word "wrong". > A program can be all of ugly, inefficient, unidiomatic, > &c &c without being WRONG. Fifty-plus years ago, when computing was 1000 times slower and cost $600/hour, it was typical for professional programmers to mediate between scientists and computers so that those expensive machines would be used efficiently. At Bell Labs, though, Dick Hamming insisted on open-shop computing because "It is more important to have the right problem done the wrong way, than to have the wrong problem done the right way." Doug From maksymilian.owsianny at gmail.com Fri Mar 10 06:03:12 2017 From: maksymilian.owsianny at gmail.com (Maksymilian Owsianny) Date: Fri, 10 Mar 2017 06:03:12 +0000 Subject: [Haskell-cafe] CEF3 bindings and game dev in Haskell In-Reply-To: <55220ebd-b8b5-866e-ce51-fbf8e1ad8ecf@gmail.com> References: <55220ebd-b8b5-866e-ce51-fbf8e1ad8ecf@gmail.com> Message-ID: I... I'm not sure I follow... What I am talking about in that example is using the threepenny-gui[1]. And yes I believe that there is a bit of javascript involved to manipulate the DOM, but the thing is that the user (of that library) doesn't need to know this. The user writes all of the logic in haskell. Cheers, Max. [1]: https://hackage.haskell.org/package/threepenny-gui On Fri, Mar 10, 2017 at 4:36 AM, MarLinn wrote: > On 2017-03-10 01:19, Maksymilian Owsianny wrote: > > The thing about this solution is, its simplicity. You can use the > skills of front end (HTML/CSS) people to design your GUI, you can then > build it using something like threepenny and render it to texture > using cef. You can use the skills and tools that already exist. > I agree that this solution is sub optimal, that including a whole > browser inside your application can be a bit much. But I believe that > at least having an option will be much better for the community then > not. > > Cheers, > Max. > > > Mhh… I get what you're getting at. But what can you really do with > HTML+CSS without scripts? Ok, admittedly you can do a lot via crude tricks. > You can create tabs, menus, pop-ups and loads of other stuff with > pseudo-classes and pseudo-elements if you really want. But your average > front-end-web-dev will not be used to using such tricks because on the web, > everything is JS. And such hacks are an abuse of the tools anyway. So > basically what you will get in practice with HTML+CSS are static pages or > forms that you have to tie together somehow. So far so good, it's better > than nothing. But we already have a really great, convenient library for > static "pictures" with loads of existing back-ends – diagrams! Diagrams can > even carry generic queries that you could fill with stuff like FRP > endpoints. What's missing to fulfill your goal is a Parser that creates > diagrams from HTML+CSS – which, of course, is basically a variation of one > of the main purposes of a browser engine. > > While that brings me back to the beginning, it seems to open a perspective > for the future. Would you say it might be possible to start with chromium > integration and then push it out again bit by bit by replacing it with the > existing tools? For example would it be possible in the mid-term to "only" > use the chromium parser but not the presentation layer, or vice-versa? > > I feel there might even be a hidden path to a solution to our core web dev > problems hidden here, but for now I fail to see specifics. > > Cheers, > MarLinn > > > On Thu, Mar 9, 2017 at 11:53 PM, MarLinn wrote: > >> [Ack. Forgot to reply-to-list, and ran into the list's bad handling of >> gmail addresses again. So sorry for possible multi-posts.] >> >> I agree that our GUI story is still bad. >> >> But I don't understand what chromium has to do with either game dev or a >> good GUI story? If I want to write a real game, I use *SDL2* bindings. >> If I want to write a website, I use something like *Yesod*. If I want to >> write browser games or "dynamic web sites", I throw JavaScript libraries at >> the walls, see what sticks, call it "modern coding", go to the liquor store >> and reconsider my life. >> >> All joking aside, it's nice to see someone take a different path than >> usual, organization-wise. I do disagree on the technical path though. We >> already have a lot of bindings to several cross-platform frameworks and >> libraries, including QT, GTK, FLTK, and the aforementioned SDL2. But they >> suffer from impedance mismatch and lack of use and thus, community support. >> To solve that I would say what we need is a nice middle layer to translate >> functional thinking into framework models. We do have the *diagrams* >> package for describing static diagrams in a functional way, but it largely >> lacks dynamic behavior. (There's some support for animations, but it >> doesn't fill me with confidence.) We also have several attempts at FRP >> libraries for dynamic behavior, but few interactions with bindings. What is >> still missing is something like a dynamic version of *diagrams* that is >> based on one of these FRP libraries and that can work with one or several >> of the bindings as a back-end – possibly with a Haskell-side widget >> library. Possibly with css-like runtime styling And if we have that, yeah, >> we can add chromium bindings or whatever. Or write our own browser engine >> for fun. As far as I know there were several attempts but all fizzled out >> at some point. >> My own favorite approach goes even further. I propose that many of the >> problems arise because the existing frameworks impose too many >> non-functional ideas, so the "purest" way to go forward would be a fresh >> framework on the basis of only *SDL* and *reactive banana*. That might >> sound like overkill for a simple non-game GUI, but is it really if the >> alternative is a whole browser? And what's more, that approach could be >> pursued in a way that might be turned into the one mentioned above later on. >> >> What these approaches need is not more c tools or more cross-platform >> shenanigans, but some ideas how to handle a complex dynamic tangle of >> widget trees in a generic, functional fashion. Which to me has the added >> benefit of sounding much more like "fun". So I'm still working on that >> second approach whenever I have some time, but like yours, my time is >> limited. >> >> Be assured, I don't want to diminish your work, it's probably useful to a >> certain subset of programmers. What I'm disputing is just if it's the >> single best way forward. >> >> Cheers, >> MarLinn >> >> On 2017-03-09 22:52, Maksymilian Owsianny wrote: >> >> Hey >> >> I'm interested in making gamedev in haskell more viable and one thing >> that I believe is missing in that part of the environment is a good >> GUI story. So I decided to create proper bindings to cef3, you can >> check out what I've done so far [here][1]. In this current version >> I basically took the work done by Daniel Austin [here][2] split it >> into parts to prevent my machine from dying from lack of memory and >> packed it up with some nix glue for convenient usage. Now all this >> doesn't look like much but it sill took me much more time then I'm >> willing to admit in public. That's one of the eternal truths of >> software development, that everything always takes an order of >> magnitude more time then you suspect it would. >> >> Anyway, what I would like to do here is add support for all platforms. >> Create some nice scripts that help with automatizing building, >> developing and deployment of code with this library for users. >> Possibly write a script that automatically generates bindings from >> c headers to bring this lib up to speed with the current version of >> cef. Write some proper guides on using this lib for creating game GUI >> or standalone desktop application. All of that is nice and well to >> wish for but it is quite a lot of frankly not very fun work. If I had >> to choose I would rather spend my time working on either something fun >> or something that pays the rent, so usually at this point I stop and >> walk away. But this time I decided to go about it differently, and ask >> for community support. I have set up a BountySource campaign [here][3] >> so I could focus on making this happen. Alternatively, if that's your >> thing, I have set up a bitcoin address [4]. >> >> Depending on how well this campaign will go I'm also planing on >> creating a full 2D game engine... but yeah, that's in the future. >> >> So yeah, if you'd like to help me build this please support me. >> >> Thanks, >> Max. >> >> [1]: https://github.com/haskell-ui/cef3-raw >> [2]: https://github.com/fluffynukeit/bindings-cef3 >> [3]: https://salt.bountysource.com/teams/haskell-ui >> [4]: 1LskxSUyLDLpMCBfUUnqcRT8mEFMW511Eq >> >> >> >> PS. I have also created a reddit thread for this proposal here . >> >> _______________________________________________ >> 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 jo at durchholz.org Fri Mar 10 07:05:44 2017 From: jo at durchholz.org (Joachim Durchholz) Date: Fri, 10 Mar 2017 08:05:44 +0100 Subject: [Haskell-cafe] CEF3 bindings and game dev in Haskell In-Reply-To: References: Message-ID: <98890800-942f-8fce-6cad-88c0f9f7bd69@durchholz.org> Am 10.03.2017 um 00:53 schrieb MarLinn: > If I want to > write browser games or "dynamic web sites", I throw JavaScript libraries > at the walls, see what sticks, call it "modern coding", go to the liquor > store and reconsider my life. YMMD! > My own favorite approach goes even further. I propose that many of the > problems arise because the existing frameworks impose too many > non-functional ideas, so the "purest" way to go forward would be a fresh > framework on the basis of only /SDL/ and /reactive banana/. That might > sound like overkill for a simple non-game GUI, There is no such thing as a simple GUI, game or otherwise. Look at whatever GUI toolkit you like, be it QT, Java's approaches, or WWW apps: It took *two decades* (on the average) to get from "barely workable" to "simple commercial form filling is actually simple for the developer". I looked into the all-new Vaadin 8 release just yesterday, and now, after 15 years of development, they're proud to add type safety to some APIs. And that's not because they don't know what they're doing, Vaadin is considered one of the best frameworks for building cross-platform commercial applications. So: Whatever you're doing GUI-wise, /nothing/ is going to be overkill. (For cross-platform stuff, you need expertise in SDL, GTK+, or whatever you use on the desktop, Javascript in Browsers, and about the specific shenanigans for both Android and IOS for which most people use Javascript anyway.) > Be assured, I don't want to diminish your work, it's probably useful to > a certain subset of programmers. What I'm disputing is just if it's the > single best way forward. Even then it can be be useful lessons learned for the full approach I think. Regards, Jo From heraldhoi at gmail.com Fri Mar 10 07:19:54 2017 From: heraldhoi at gmail.com (Geraldus) Date: Fri, 10 Mar 2017 07:19:54 +0000 Subject: [Haskell-cafe] To [] Or Not To [] In-Reply-To: <201703100541.v2A5fbvK015715@coolidge.cs.Dartmouth.EDU> References: <201703100541.v2A5fbvK015715@coolidge.cs.Dartmouth.EDU> Message-ID: "It is more important to have the right problem done the wrong way, than to have the wrong problem done the right way." Sounds like a nonsense. Does "problem done the wrong way" implies the problem indeed isn't solved at all, doesn't it? пт, 10 мар. 2017 г. в 10:42, Doug McIlroy : > This stirred ancient memories in praise of wrong programs: > > > > * If your program sorts a list, then your program is wrong. > > > > This seems a very strange claim. > > > > The whole thing is an abuse of the word "wrong". > > A program can be all of ugly, inefficient, unidiomatic, > > &c &c without being WRONG. > > Fifty-plus years ago, when computing was 1000 times slower > and cost $600/hour, it was typical for professional programmers > to mediate between scientists and computers so that > those expensive machines would be used efficiently. At Bell > Labs, though, Dick Hamming insisted on open-shop computing > because "It is more important to have the right problem > done the wrong way, than to have the wrong problem done > the right way." > > Doug > _______________________________________________ > 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 Mar 10 07:34:53 2017 From: jo at durchholz.org (Joachim Durchholz) Date: Fri, 10 Mar 2017 08:34:53 +0100 Subject: [Haskell-cafe] To [] Or Not To [] In-Reply-To: References: <201703100541.v2A5fbvK015715@coolidge.cs.Dartmouth.EDU> Message-ID: <6bd6eda6-55ba-e769-391e-7b3708fdd2be@durchholz.org> Am 10.03.2017 um 08:19 schrieb Geraldus: > "It is more important to have the right problem > done the wrong way, than to have the wrong problem done > the right way." > > Sounds like a nonsense. Does "problem done the wrong way" implies the > problem indeed isn't solved at all, doesn't it? No, in that context, "done the wrong way" meant that Spaghetti code and similar abominations are okay if the program delivers. For which even today a case can be made if the program is just a one-shot explorative thing where nobody will ever spend a second look at the results or at the program code. Scientific computing often means fiddling with code to fiddle with data; you do dozens of throwaway programs, and if something of interest comes out, you can still write a reviewable one. Or not release the code at all because anybody in the community will write his/her own data validation code anyway. From chris at chrisdornan.com Fri Mar 10 10:24:16 2017 From: chris at chrisdornan.com (Chris Dornan) Date: Fri, 10 Mar 2017 10:24:16 +0000 Subject: [Haskell-cafe] regex and Regular Expressions Libraries In-Reply-To: References: Message-ID: Hi Evan, By the sounds of it regex should help with this – each match operator being available in an un-overloaded format. Does this API work for you? Chris On 2017-03-10, 05:12, "Evan Laforge" wrote: That's always been my canonical example about how you can overuse typeclasses to make a simple job into an impenetrable documentation hunt. Long ago I wrapped it in a simple API and have always used that. Much later, pcre-heavy showed up and I just switched my wrapper to use that, since it was still a little too typeclass happy for my taste. On Thu, Mar 9, 2017 at 11:06 AM, Chris Dornan wrote: > Dear Haskell Cafe, > > With the regex announcement, I wanted to try get other folks' perspective > on what has been happening with the Haskell regular expression libraries. > > I have been in turn impressed at how good the engineering of the Regex > packages while gobsmacked by how difficult the traditional Text.Regex API > is to use. > > In this blog post, > > http://engineers.irisconnect.net/posts/2017-03-07-regex.html > > I rather cheekily speculate that the Haskellers perhaps have been a bit > disdainful of regular expressions (not important in a language capable > of doing proper parsing, etc.). > > What do you think? > > 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 monkleyon at gmail.com Fri Mar 10 12:05:02 2017 From: monkleyon at gmail.com (MarLinn) Date: Fri, 10 Mar 2017 13:05:02 +0100 Subject: [Haskell-cafe] CEF3 bindings and game dev in Haskell In-Reply-To: References: <55220ebd-b8b5-866e-ce51-fbf8e1ad8ecf@gmail.com> Message-ID: <187f0052-900f-7590-4c43-f8fb95fcecc7@gmail.com> On 2017-03-10 07:03, Maksymilian Owsianny wrote: > I... I'm not sure I follow... What I am talking about in that example > is using the threepenny-gui[1]. And yes I believe that there is a bit > of javascript involved to manipulate the DOM, but the thing is that > the user (of that library) doesn't need to know this. The user writes > all of the logic in haskell. Sorry to confuse. Ok, let's ask in a different way. Simplifying massively, a browser engine seems to offer four things a GUI can use: A set of parsers, a complex model of the interface layout, a set of tools to render said model, and a system to get a stream of meaningful user events related to the model. There's more but let's pretend that's all that's needed. Let's further say you had implemented all the bindings and tools you're imagining. Would it be possible to replace one of the four parts with a pure Haskell solution without changing the others? In other words, will it be possible to merge the engine into a bigger tool system as a set of tools, or will it likely stay a monolith? Cheers, MarLinn > On Fri, Mar 10, 2017 at 4:36 AM, MarLinn > wrote: > > On 2017-03-10 01:19, Maksymilian Owsianny wrote: >> The thing about this solution is, its simplicity. You can use the >> skills of front end (HTML/CSS) people to design your GUI, you can then >> build it using something like threepenny and render it to texture >> using cef. You can use the skills and tools that already exist. >> I agree that this solution is sub optimal, that including a whole >> browser inside your application can be a bit much. But I believe that >> at least having an option will be much better for the community then >> not. >> >> Cheers, >> Max. > > Mhh… I get what you're getting at. But what can you really do with > HTML+CSS without scripts? Ok, admittedly you can do a lot via > crude tricks. You can create tabs, menus, pop-ups and loads of > other stuff with pseudo-classes and pseudo-elements if you really > want. But your average front-end-web-dev will not be used to using > such tricks because on the web, everything is JS. And such hacks > are an abuse of the tools anyway. So basically what you will get > in practice with HTML+CSS are static pages or forms that you have > to tie together somehow. So far so good, it's better than nothing. > But we already have a really great, convenient library for static > "pictures" with loads of existing back-ends – diagrams! Diagrams > can even carry generic queries that you could fill with stuff like > FRP endpoints. What's missing to fulfill your goal is a Parser > that creates diagrams from HTML+CSS – which, of course, is > basically a variation of one of the main purposes of a browser engine. > > While that brings me back to the beginning, it seems to open a > perspective for the future. Would you say it might be possible to > start with chromium integration and then push it out again bit by > bit by replacing it with the existing tools? For example would it > be possible in the mid-term to "only" use the chromium parser but > not the presentation layer, or vice-versa? > > I feel there might even be a hidden path to a solution to our core > web dev problems hidden here, but for now I fail to see specifics. > > Cheers, > MarLinn > > >> On Thu, Mar 9, 2017 at 11:53 PM, MarLinn > > wrote: >> >> [Ack. Forgot to reply-to-list, and ran into the list's bad >> handling of gmail addresses again. So sorry for possible >> multi-posts.] >> >> I agree that our GUI story is still bad. >> >> But I don't understand what chromium has to do with either >> game dev or a good GUI story? If I want to write a real game, >> I use /SDL2/ bindings. If I want to write a website, I use >> something like /Yesod/. If I want to write browser games or >> "dynamic web sites", I throw JavaScript libraries at the >> walls, see what sticks, call it "modern coding", go to the >> liquor store and reconsider my life. >> >> All joking aside, it's nice to see someone take a different >> path than usual, organization-wise. I do disagree on the >> technical path though. We already have a lot of bindings to >> several cross-platform frameworks and libraries, including >> QT, GTK, FLTK, and the aforementioned SDL2. But they suffer >> from impedance mismatch and lack of use and thus, community >> support. To solve that I would say what we need is a nice >> middle layer to translate functional thinking into framework >> models. We do have the /diagrams/ package for describing >> static diagrams in a functional way, but it largely lacks >> dynamic behavior. (There's some support for animations, but >> it doesn't fill me with confidence.) We also have several >> attempts at FRP libraries for dynamic behavior, but few >> interactions with bindings. What is still missing is >> something like a dynamic version of /diagrams/ that is based >> on one of these FRP libraries and that can work with one or >> several of the bindings as a back-end – possibly with a >> Haskell-side widget library. Possibly with css-like runtime >> styling And if we have that, yeah, we can add chromium >> bindings or whatever. Or write our own browser engine for >> fun. As far as I know there were several attempts but all >> fizzled out at some point. >> >> My own favorite approach goes even further. I propose that >> many of the problems arise because the existing frameworks >> impose too many non-functional ideas, so the "purest" way to >> go forward would be a fresh framework on the basis of only >> /SDL/ and /reactive banana/. That might sound like overkill >> for a simple non-game GUI, but is it really if the >> alternative is a whole browser? And what's more, that >> approach could be pursued in a way that might be turned into >> the one mentioned above later on. >> >> What these approaches need is not more c tools or more >> cross-platform shenanigans, but some ideas how to handle a >> complex dynamic tangle of widget trees in a generic, >> functional fashion. Which to me has the added benefit of >> sounding much more like "fun". So I'm still working on that >> second approach whenever I have some time, but like yours, my >> time is limited. >> >> Be assured, I don't want to diminish your work, it's probably >> useful to a certain subset of programmers. What I'm disputing >> is just if it's the single best way forward. >> >> Cheers, >> MarLinn >> >> On 2017-03-09 22:52, Maksymilian Owsianny wrote: >>> Hey >>> >>> I'm interested in making gamedev in haskell more viable and one thing >>> that I believe is missing in that part of the environment is a good >>> GUI story. So I decided to create proper bindings to cef3, you can >>> check out what I've done so far [here][1]. In this current version >>> I basically took the work done by Daniel Austin [here][2] split it >>> into parts to prevent my machine from dying from lack of memory and >>> packed it up with some nix glue for convenient usage. Now all this >>> doesn't look like much but it sill took me much more time then I'm >>> willing to admit in public. That's one of the eternal truths of >>> software development, that everything always takes an order of >>> magnitude more time then you suspect it would. >>> >>> Anyway, what I would like to do here is add support for all platforms. >>> Create some nice scripts that help with automatizing building, >>> developing and deployment of code with this library for users. >>> Possibly write a script that automatically generates bindings from >>> c headers to bring this lib up to speed with the current version of >>> cef. Write some proper guides on using this lib for creating game GUI >>> or standalone desktop application. All of that is nice and well to >>> wish for but it is quite a lot of frankly not very fun work. If I had >>> to choose I would rather spend my time working on either something fun >>> or something that pays the rent, so usually at this point I stop and >>> walk away. But this time I decided to go about it differently, and ask >>> for community support. I have set up a BountySource campaign [here][3] >>> so I could focus on making this happen. Alternatively, if that's your >>> thing, I have set up a bitcoin address [4]. >>> >>> Depending on how well this campaign will go I'm also planing on >>> creating a full 2D game engine... but yeah, that's in the future. >>> >>> So yeah, if you'd like to help me build this please support me. >>> >>> Thanks, >>> Max. >>> >>> [1]:https://github.com/haskell-ui/cef3-raw >>> >>> [2]:https://github.com/fluffynukeit/bindings-cef3 >>> >>> [3]:https://salt.bountysource.com/teams/haskell-ui >>> >>> [4]: 1LskxSUyLDLpMCBfUUnqcRT8mEFMW511Eq >>> >>> >>> PS. I have also created a reddit thread for this proposalhere >>> . >>> >>> _______________________________________________ >>> 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 jo at durchholz.org Fri Mar 10 12:54:05 2017 From: jo at durchholz.org (Joachim Durchholz) Date: Fri, 10 Mar 2017 13:54:05 +0100 Subject: [Haskell-cafe] CEF3 bindings and game dev in Haskell In-Reply-To: <187f0052-900f-7590-4c43-f8fb95fcecc7@gmail.com> References: <55220ebd-b8b5-866e-ce51-fbf8e1ad8ecf@gmail.com> <187f0052-900f-7590-4c43-f8fb95fcecc7@gmail.com> Message-ID: <8f27cc22-8261-8e65-bb25-d4c6b2c7cdb1@durchholz.org> Am 10.03.2017 um 13:05 schrieb MarLinn: > Simplifying massively, a browser engine seems to offer four things a GUI > can use: A set of parsers, a complex model of the interface layout, a > set of tools to render said model, and a system to get a stream of > meaningful user events related to the model. There's more but let's > pretend that's all that's needed. Let's further say you had implemented > all the bindings and tools you're imagining. Would it be possible to > replace one of the four parts with a pure Haskell solution without > changing the others? Not for the usual browser engines, not easily, and not very usefully either because of interdependencies. I.e. any Haskell solution that replaced just one part would have its design massively constrained by having to server all the other parts. I think Maksymilian is targetting the usual design: Use some Javascript to establish whatever GUI model you want to see implemented (vanilla HTML elements usually aren't good enough), use some more Javascript to establish a smooth communication mechanism between backend and frontend, and write a library on the backend side that drives the whole thing. It's tremendously complicated, but it's well-isolated because the program sees only a socket interface through which it drives the GUI and receives events - which is pretty similar to any existing GUI toolkit where you have an outgoing interface (function calls) and a stream of incoming events. I wouldn't have recommended doing such a thing a decade ago, but this approach has become pretty well-understood so you can expect to see solutions to any architectural decisions, though maybe a tad "too imperative" for the Haskellish mind so you may want to design the socket interface to make it easier to deal with on the Haskell side. BTW on the Javascript side, you can do thinks in a pretty functional mindset. People may not be doing it because they do not have enough FPL experience, so there's enough interesting stuff to do on that side. From qdunkan at gmail.com Fri Mar 10 17:08:34 2017 From: qdunkan at gmail.com (Evan Laforge) Date: Fri, 10 Mar 2017 09:08:34 -0800 Subject: [Haskell-cafe] regex and Regular Expressions Libraries In-Reply-To: References: Message-ID: On Fri, Mar 10, 2017 at 2:24 AM, Chris Dornan wrote: > By the sounds of it regex should help with this – each match operator being > available in an un-overloaded format. Does this API work for you? I looked at the tutorial and.... maybe not so much? I hardcode to Text + PCRE since that's all I need, but that combination seems to be unsupported. As a light user of regexes, I won't remember much of the API between uses, so I'm just looking to find the 'Regex -> Text -> Bool' function as fast as possible, and a bunch of polymorphic operators I'll never remember would just get in the way. Also for the same reason I'd be worried about any deviation from "standard" PCRE, e.g. $(..) for groups. However, I'm a lightweight user, so don't take me too seriously, and I made my own tiny little bikeshed anyway. Which is to say don't let me rain on your parade :) For what it's worth, I mostly used regexes in python, and it gets along fine with hardcoded Text + PCRE, no operators, and basically three functions: match, get groups, and substitute groups. So it's no surprise my wrapper basically looks like that: compileOptions :: [Option] -> String -> Either String Regex matches :: Regex -> Text -> Bool -- | Return (complete_match, [group_match]). groups :: Regex -> Text -> [(Text, [Text])] -- | Half-open ranges of where the regex matches. groupRanges :: Regex -> Text -> [((Int, Int), [(Int, Int)])] -- ^ (entire, [group]) substitute :: Regex -> (Text -> [Text] -> Text) -- ^ (complete_match -> groups -> replacement) -> Text -> Text I also added a Show instance that shows the regex rather than hex and the mysteriously missing: -- | Escape a string so the regex matches it literally. escape :: String -> String The QuasiQuote stuff seems neat, but I'm sort of scared of TH, and if the regex gets complicated enough that would make it worth it, I probably already switched to a parser. Or I get regexes from user input because of how succinct they are and that's runtime anyway. From allbery.b at gmail.com Fri Mar 10 17:10:45 2017 From: allbery.b at gmail.com (Brandon Allbery) Date: Fri, 10 Mar 2017 12:10:45 -0500 Subject: [Haskell-cafe] To [] Or Not To [] In-Reply-To: References: <201703100541.v2A5fbvK015715@coolidge.cs.Dartmouth.EDU> Message-ID: On Fri, Mar 10, 2017 at 2:19 AM, Geraldus wrote: > Sounds like a nonsense. Does "problem done the wrong way" implies the > problem indeed isn't solved at all, doesn't it? > Inefficiently. (Although yours is the extreme case of that.) -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From jun.lambda at gmail.com Fri Mar 10 17:28:12 2017 From: jun.lambda at gmail.com (Jun Inoue) Date: Sat, 11 Mar 2017 02:28:12 +0900 Subject: [Haskell-cafe] Package Management with Stack? Message-ID: I've gotten fed up with Cabal+Hackage build errors and I want a more stable way to manage Haskell packages. I'm NOT trying to build a Haskell project of my own, but I just want a system-wide (or at least user-wide) installation of GHC "with batteries", along with some Haskell programs that other people have written. I need xmonad installed somewhere on my $PATH and I need lens available with :m+ when I fire up ghci. I do NOT want a bunch of sandboxes scattered throughout my file system, some of which have these things installed while others don't. I was hoping Stack+Stackage would fit that bill, but going through the instructions on https://haskell-lang.org/get-started, it seems that stack is meant really for setting up sandboxes for particular projects. When I tried using it as a system-wide (or rather, user-wide) package manager, it fails. For instance, as suggested on that page, I created /tmp/HelloWorld.hs and type $ stack HelloWorld.hs which seemed to successfully download the lts-8.4 build plan and ghc-nopie-8.0.2. So far so good. But then when I typed $ stack install xmonad-contrib it said Error: While constructing the build plan, the following exceptions were encountered: In the dependencies for xmonad-contrib-0.13: X11-xft must match >=0.2, but the stack configuration has no specified version (latest applicable is 0.3.1) Recommended action: try adding the following to your extra-deps in /home/jun/.stack/global-project/stack.yaml: - X11-xft-0.3.1 You may also want to try the 'stack solver' command Plan construction failed. I've tried going down the "stack solver" rabbit hole, to no avail; it just tells me I need to register a directory containing a .cabal file. IIUC, that's a directory containing some project I'm developing? But I have no such project! (At the moment.) Am I fundamentally misunderstanding how stack is supposed to be used? Is stack usable as a package manager in the way cabal sort of was, and in the way apt-get or emerge can be used? If not, what do people recommend I use for that purpose? Nix? Or, perhaps, do the errors above indicate misconfiguration? I don't want to install haskell-platform because it's too outdated. I need at least GHC >= 8. I'm on the latest stable release of Ubuntu if that makes a difference. -- Jun Inoue From chris at chrisdornan.com Fri Mar 10 17:30:13 2017 From: chris at chrisdornan.com (Chris Dornan) Date: Fri, 10 Mar 2017 17:30:13 +0000 Subject: [Haskell-cafe] regex and Regular Expressions Libraries In-Reply-To: References: Message-ID: <9263F485-2F6A-4DC1-8B74-F040AC4F227C@chrisdornan.com> Thanks Evan, That feedback is really valuable and I understand why you would have no reason to switch to regex. On the use of ‘$’, as far as I know this extension will not clash with any of the PCRE extensions (if anybody knows of any problems please give me shout), though for sure you will have to fill out the numbers when converting between the two text-replacement schemes. As for Text and PCRE – that is on the top my list but it will need some coordination with the upstream regex-pcre maintainers. I do have escape functions though I haven’t included them in the tutorial yet. Being able to recover the text of the REs would be great and I would like to include it in a future release, but again that will need some coordination with the regex-base maintainers. I will raise those issues. Fantastic feedback! Cheers, Chris On 10/03/2017, 17:08, "Evan Laforge" wrote: On Fri, Mar 10, 2017 at 2:24 AM, Chris Dornan wrote: > By the sounds of it regex should help with this – each match operator being > available in an un-overloaded format. Does this API work for you? I looked at the tutorial and.... maybe not so much? I hardcode to Text + PCRE since that's all I need, but that combination seems to be unsupported. As a light user of regexes, I won't remember much of the API between uses, so I'm just looking to find the 'Regex -> Text -> Bool' function as fast as possible, and a bunch of polymorphic operators I'll never remember would just get in the way. Also for the same reason I'd be worried about any deviation from "standard" PCRE, e.g. $(..) for groups. However, I'm a lightweight user, so don't take me too seriously, and I made my own tiny little bikeshed anyway. Which is to say don't let me rain on your parade :) For what it's worth, I mostly used regexes in python, and it gets along fine with hardcoded Text + PCRE, no operators, and basically three functions: match, get groups, and substitute groups. So it's no surprise my wrapper basically looks like that: compileOptions :: [Option] -> String -> Either String Regex matches :: Regex -> Text -> Bool -- | Return (complete_match, [group_match]). groups :: Regex -> Text -> [(Text, [Text])] -- | Half-open ranges of where the regex matches. groupRanges :: Regex -> Text -> [((Int, Int), [(Int, Int)])] -- ^ (entire, [group]) substitute :: Regex -> (Text -> [Text] -> Text) -- ^ (complete_match -> groups -> replacement) -> Text -> Text I also added a Show instance that shows the regex rather than hex and the mysteriously missing: -- | Escape a string so the regex matches it literally. escape :: String -> String The QuasiQuote stuff seems neat, but I'm sort of scared of TH, and if the regex gets complicated enough that would make it worth it, I probably already switched to a parser. Or I get regexes from user input because of how succinct they are and that's runtime anyway. From allbery.b at gmail.com Fri Mar 10 17:33:56 2017 From: allbery.b at gmail.com (Brandon Allbery) Date: Fri, 10 Mar 2017 12:33:56 -0500 Subject: [Haskell-cafe] Package Management with Stack? In-Reply-To: References: Message-ID: On Fri, Mar 10, 2017 at 12:28 PM, Jun Inoue wrote: > Am I fundamentally misunderstanding how stack is supposed to be used? Stack is not a package manager. It is a reproducible builds tool. Ad hoc usage like you are doing is outside of its purview. Also, last I checked, for some reason xmonad-contrib wasn't in stackage, so stack's primary mechanism for avoiding conflicts fails. -- 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 qdunkan at gmail.com Fri Mar 10 17:50:31 2017 From: qdunkan at gmail.com (Evan Laforge) Date: Fri, 10 Mar 2017 09:50:31 -0800 Subject: [Haskell-cafe] regex and Regular Expressions Libraries In-Reply-To: <9263F485-2F6A-4DC1-8B74-F040AC4F227C@chrisdornan.com> References: <9263F485-2F6A-4DC1-8B74-F040AC4F227C@chrisdornan.com> Message-ID: On Fri, Mar 10, 2017 at 9:30 AM, Chris Dornan wrote: > On the use of ‘$’, as far as I know this extension will not clash with any of > the PCRE extensions (if anybody knows of any problems please give me shout), > though for sure you will have to fill out the numbers when converting between > the two text-replacement schemes. Oh ok, I was worried that ()s would become non-capturing and you'd have to use $() to capture. I think your scheme with $() for groups and replacement is actually nicer than the traditional (xyz) and (?:xyz) and \# for replacement, but you know tradition hangs heavy on the minds of us regex cargo-culters :) > As for Text and PCRE – that is on the top my list but it will need some > coordination with the upstream regex-pcre maintainers. Nowadays I inherit that from pcre-heavy, but of course if you're already on another backend then maybe not so simple. libpcre takes bytestrings, so I'll bet the "Text interface" amounts to sticking ". encodeUtf8" on the front and turning on the UTF8 flag. From parsonsmatt at gmail.com Fri Mar 10 17:52:38 2017 From: parsonsmatt at gmail.com (Matt) Date: Fri, 10 Mar 2017 10:52:38 -0700 Subject: [Haskell-cafe] Package Management with Stack? In-Reply-To: References: Message-ID: Stack does have a notion of a global project, which it uses if you're not in a project directory. The error message you received: Error: While constructing the build plan, the following exceptions were encountered: In the dependencies for xmonad-contrib-0.13: X11-xft must match >=0.2, but the stack configuration has no specified version (latest applicable is 0.3.1) Recommended action: try adding the following to your extra-deps in /home/jun/.stack/global-project/stack.yaml: - X11-xft-0.3.1 tells you how to make X11-xft-0.3.1 available to the global project, which should allow you to install xmonad-contrib into this global package. Matt Parsons On Fri, Mar 10, 2017 at 10:33 AM, Brandon Allbery wrote: > > On Fri, Mar 10, 2017 at 12:28 PM, Jun Inoue wrote: > >> Am I fundamentally misunderstanding how stack is supposed to be used? > > > Stack is not a package manager. It is a reproducible builds tool. Ad hoc > usage like you are doing is outside of its purview. > > Also, last I checked, for some reason xmonad-contrib wasn't in stackage, > so stack's primary mechanism for avoiding conflicts fails. > > -- > 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 chris at chrisdornan.com Fri Mar 10 18:04:14 2017 From: chris at chrisdornan.com (Chris Dornan) Date: Fri, 10 Mar 2017 18:04:14 +0000 Subject: [Haskell-cafe] regex and Regular Expressions Libraries In-Reply-To: <9263F485-2F6A-4DC1-8B74-F040AC4F227C@chrisdornan.com> References: <9263F485-2F6A-4DC1-8B74-F040AC4F227C@chrisdornan.com> Message-ID: I must correct myself. I said: > Being able to recover the text of the REs would be great and I would like to include > it in a future release, but again that will need some coordination with the regex-base > maintainers. Sorry, that isn’t right at all. Regex already allows you to recover the text from a compiled RE via the reSource function: reSource :: RE -> String Evans said: > Nowadays I inherit that from pcre-heavy, but of course if you're > already on another backend then maybe not so simple. Yes, regex is built on top of regex-base and the regex-tdfa + regex-pcre back ends. > but you know tradition hangs heavy Indeed so! Chris From adam at bergmark.nl Fri Mar 10 19:11:26 2017 From: adam at bergmark.nl (Adam Bergmark) Date: Fri, 10 Mar 2017 19:11:26 +0000 Subject: [Haskell-cafe] Package Management with Stack? In-Reply-To: References: Message-ID: I use the global stack environment to install most executables, it works best when the package is in a snapshot of course. There is no need to change the global config, try this: stack install xmonad-contrib X11-xft-0.3.1 --resolver lts-8.4 You can also look for a stack.yaml in the repo of the executable and use that resolver + any extra deps on the command line, that'll most likely work even if the package isn't in a snapshot. HTH, Adam On Fri, 10 Mar 2017 at 18:56 Matt wrote: > Stack does have a notion of a global project, which it uses if you're not > in a project directory. The error message you received: > > Error: While constructing the build plan, the following exceptions > were encountered: > > In the dependencies for xmonad-contrib-0.13: > X11-xft must match >=0.2, but the stack configuration has no > specified version (latest applicable is 0.3.1) > > Recommended action: try adding the following to your extra-deps in > /home/jun/.stack/global-project/stack.yaml: > - X11-xft-0.3.1 > > tells you how to make X11-xft-0.3.1 available to the global project, which > should allow you to install xmonad-contrib into this global package. > > Matt Parsons > > On Fri, Mar 10, 2017 at 10:33 AM, Brandon Allbery > wrote: > > > On Fri, Mar 10, 2017 at 12:28 PM, Jun Inoue wrote: > > Am I fundamentally misunderstanding how stack is supposed to be used? > > > Stack is not a package manager. It is a reproducible builds tool. Ad hoc > usage like you are doing is outside of its purview. > > Also, last I checked, for some reason xmonad-contrib wasn't in stackage, > so stack's primary mechanism for avoiding conflicts fails. > > -- > 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. > > > _______________________________________________ > 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 Mar 10 19:25:07 2017 From: allbery.b at gmail.com (Brandon Allbery) Date: Fri, 10 Mar 2017 14:25:07 -0500 Subject: [Haskell-cafe] Package Management with Stack? In-Reply-To: References: Message-ID: On Fri, Mar 10, 2017 at 2:11 PM, Adam Bergmark wrote: > You can also look for a stack.yaml in the repo of the executable and use > that resolver + any extra deps on the command line, that'll most likely > work even if the package isn't in a snapshot. "most likely" --- but it can fail. The point of having projects is to ensure they can't conflict with each other. If you install something in one and it's compatible with others, you can use it without redownloading/recompiling (in effect it gets mirrored into the new project). But if you slam everything into the global project, you can set up conflicts similar to those you get with cabal-install without sandboxes. -- 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 adam at bergmark.nl Fri Mar 10 19:31:55 2017 From: adam at bergmark.nl (Adam Bergmark) Date: Fri, 10 Mar 2017 19:31:55 +0000 Subject: [Haskell-cafe] regex and Regular Expressions Libraries In-Reply-To: References: <9263F485-2F6A-4DC1-8B74-F040AC4F227C@chrisdornan.com> Message-ID: Hi Chris, The combination of parser combinators and the old regex libraries have meant I've avoided regexes as much as possible. regex looks very promising so I'm sure to try it out next time i need something similar! Will you add regex to stackage? Having to muck around with extra-deps gets tiring. I would also like to see Text support, but having to pack/unpack wouldn't be a dealbreaker for me. Have you considered doing anything fancy to make capture groups safer to use? If i could get a compile error when i'm using the wrong number/wrongly named groups I'd be very excited. Cheers, Adam On Fri, 10 Mar 2017 at 19:06 Chris Dornan wrote: > I must correct myself. I said: > > > Being able to recover the text of the REs would be great and I would > like to include > > it in a future release, but again that will need some coordination with > the regex-base > > maintainers. > > Sorry, that isn’t right at all. Regex already allows you to recover the > text from a compiled > RE via the reSource function: > > reSource :: RE -> String > > Evans said: > > > Nowadays I inherit that from pcre-heavy, but of course if you're > > already on another backend then maybe not so simple. > > Yes, regex is built on top of regex-base and the regex-tdfa + regex-pcre > back ends. > > > but you know tradition hangs heavy > > Indeed so! > > 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 adam at bergmark.nl Fri Mar 10 19:34:01 2017 From: adam at bergmark.nl (Adam Bergmark) Date: Fri, 10 Mar 2017 19:34:01 +0000 Subject: [Haskell-cafe] Package Management with Stack? In-Reply-To: References: Message-ID: How can you get these conflicts in the global stack project? I've never had such issues. Packages are still sandboxed on a per-snapshot basis, I'm not sure how extra-deps are handled here but they don't seem to cause any conflicts. On Fri, 10 Mar 2017 at 20:25 Brandon Allbery wrote: > > On Fri, Mar 10, 2017 at 2:11 PM, Adam Bergmark wrote: > > You can also look for a stack.yaml in the repo of the executable and use > that resolver + any extra deps on the command line, that'll most likely > work even if the package isn't in a snapshot. > > > "most likely" --- but it can fail. > > The point of having projects is to ensure they can't conflict with each > other. If you install something in one and it's compatible with others, you > can use it without redownloading/recompiling (in effect it gets mirrored > into the new project). But if you slam everything into the global project, > you can set up conflicts similar to those you get with cabal-install > without sandboxes. > > -- > 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 Mar 10 19:38:11 2017 From: allbery.b at gmail.com (Brandon Allbery) Date: Fri, 10 Mar 2017 14:38:11 -0500 Subject: [Haskell-cafe] Package Management with Stack? In-Reply-To: References: Message-ID: On Fri, Mar 10, 2017 at 2:34 PM, Adam Bergmark wrote: > How can you get these conflicts in the global stack project? I've never > had such issues. Packages are still sandboxed on a per-snapshot basis, I'm > not sure how extra-deps are handled here but they don't seem to cause any > conflicts. I couldn't tell you internal details but every so often we see in #haskell someone who's put a few too many things in there and ends up resetting stack (removing ~/.stack and/or ~/.stack-work) to undo the damage. I *think* it's partially hidden by packages being managed per resolver/snapshot, but extra-deps can still get you in trouble if they conflict. -- 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 chris at chrisdornan.com Fri Mar 10 19:45:20 2017 From: chris at chrisdornan.com (Chris Dornan) Date: Fri, 10 Mar 2017 19:45:20 +0000 Subject: [Haskell-cafe] regex and Regular Expressions Libraries In-Reply-To: References: <9263F485-2F6A-4DC1-8B74-F040AC4F227C@chrisdornan.com> Message-ID: <45A6FD61-742A-496F-80D3-260995B815C1@chrisdornan.com> Adam Bergmark sez: > Will you add regex to stackage? Absolutely – on my list for this weekend. > Have you considered doing anything fancy to make capture groups safer to use? If i could get a compile error > when i'm using the wrong number/wrongly named groups I'd be very excited. I totally agree! The only reason this has not been done is because it is not easy to do with the current structure of regex and the way it fits into regex-base. I am open to suggestions though – just opened an issue for it https://github.com/iconnect/regex/issues/60. Cheers, Chris From zemyla at gmail.com Fri Mar 10 22:25:12 2017 From: zemyla at gmail.com (Zemyla) Date: Fri, 10 Mar 2017 16:25:12 -0600 Subject: [Haskell-cafe] Is this a "monad" for contravariant functors? Message-ID: There originally seems like there shouldn't be one, because it's impossible to, for any permutation of the arguments of (>>=), get the covariances/contravariances right on the arguments. However, based on the fact that there is a mapping: a -> ((a -> r) -> r) and what seems like an isomorphism: (a -> r) -> (((a -> r) -> r) -> r) (((a -> r) -> r) -> r) -> (a -> r) then this looks like it might be some kind of monad-like structure: class Contravariant f => Contramonad f where contrareturn :: a -> f (f a) contrabind :: (a -> f (f b)) -> f b -> f a I have no idea what the laws should be for it, though. So is this worth pursuing, or have I just stumbled down a blind alley? -------------- next part -------------- An HTML attachment was scrubbed... URL: From migmit at gmail.com Fri Mar 10 22:37:37 2017 From: migmit at gmail.com (MigMit) Date: Fri, 10 Mar 2017 23:37:37 +0100 Subject: [Haskell-cafe] Is this a "monad" for contravariant functors? In-Reply-To: References: Message-ID: <9D4E31FF-BAEA-497C-8E9F-0C674B76DBCB@gmail.com> Answered it here: http://stackoverflow.com/questions/30641500/are-there-contravariant-monads/30642831#30642831 > On 10 Mar 2017, at 23:25, Zemyla wrote: > > There originally seems like there shouldn't be one, because it's impossible to, for any permutation of the arguments of (>>=), get the covariances/contravariances right on the arguments. However, based on the fact that there is a mapping: > > a -> ((a -> r) -> r) > > and what seems like an isomorphism: > > (a -> r) -> (((a -> r) -> r) -> r) > (((a -> r) -> r) -> r) -> (a -> r) > > then this looks like it might be some kind of monad-like structure: > > class Contravariant f => Contramonad f where > contrareturn :: a -> f (f a) > contrabind :: (a -> f (f b)) -> f b -> f a > > I have no idea what the laws should be for it, though. So is this worth pursuing, or have I just stumbled down a blind alley? > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. From olf at aatal-apotheke.de Fri Mar 10 23:28:49 2017 From: olf at aatal-apotheke.de (Olaf Klinke) Date: Sat, 11 Mar 2017 00:28:49 +0100 Subject: [Haskell-cafe] To [] Or Not To [] Message-ID: <3D33FF16-5F5C-4E9D-8615-7BC3D1A88CE0@aatal-apotheke.de> Johannes, Thanks for writing this. Actually, your negative abstract turns out to be for a quite positive article. List are like iterators, that's the essence, and as long as you are iterating, it's fine to use []. The prominence of singly linked lists in Haskell has tought me to write my data processing programs in a streaming style. To think about what data must be held in memory (use Maps or whatever for this) and read the other data in as a list. I'd be interested whether there is a way to check which of my lists in the source code the compiler managed to "deforest" away. Which intermediate files should I look at? What are the tools to inspect? Olaf From jun.lambda at gmail.com Sat Mar 11 00:22:57 2017 From: jun.lambda at gmail.com (Jun Inoue) Date: Sat, 11 Mar 2017 09:22:57 +0900 Subject: [Haskell-cafe] Package Management with Stack? In-Reply-To: References: Message-ID: I see. That explains a lot of things, esp. that xmonad-contrib isn't on stackage... Is there anything else I could use the way I'm trying to do, preferably leveraging the stability of the curated package list on Stackage for those packages that have been curated? On Sat, Mar 11, 2017 at 2:33 AM, Brandon Allbery wrote: > > On Fri, Mar 10, 2017 at 12:28 PM, Jun Inoue wrote: >> >> Am I fundamentally misunderstanding how stack is supposed to be used? > > > Stack is not a package manager. It is a reproducible builds tool. Ad hoc > usage like you are doing is outside of its purview. > > Also, last I checked, for some reason xmonad-contrib wasn't in stackage, so > stack's primary mechanism for avoiding conflicts fails. > > -- > brandon s allbery kf8nh sine nomine associates > allbery.b at gmail.com ballbery at sinenomine.net > unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -- Jun Inoue From jun.lambda at gmail.com Sat Mar 11 00:37:48 2017 From: jun.lambda at gmail.com (Jun Inoue) Date: Sat, 11 Mar 2017 09:37:48 +0900 Subject: [Haskell-cafe] Package Management with Stack? In-Reply-To: References: Message-ID: Thanks for the suggestion, Adam. That does it for xmonad-contrib. Unfortunately, it fails when I go on to add xmonad-extras, probably because the version of xmonad already installed can't be resolved with the available version(s) of xmonad-extras. (I forgot to note exactly which packages I had before, so I'm installing these things one by one, based on compilation errors of ~/.xmonad/xmonad.hs.) $ stack install xmonad-extras hint-0.6.0 libmpd-0.9.0.6 --resolver lts-8.4 Error: While constructing the build plan, the following exceptions were encountered: In the dependencies for xmonad-extras-0.12.1: hint-0.6.0 must match >=0.3.3.3 && <0.5 (latest applicable is 0.4.3) libmpd-0.9.0.6 must match >=0.8 && <0.9 (latest applicable is 0.8.0.5) xmonad-0.13 must match >=0.10 && <0.13 (latest applicable is 0.12) xmonad-contrib must match >=0.10 && <0.13, but the stack configuration has no specified version (latest applicable is 0.12) Recommended action: try adding the following to your extra-deps in /home/jun/.stack/global-project/stack.yaml: - xmonad-contrib-0.12 You may also want to try the 'stack solver' command Plan construction failed. Adding the fact that I seem to have to list a lot of deps on the command line or in stack.yaml and Brandon's suggestion that I'm using this tool for the wrong purpose, this seems like a deal breaker for me :( On Sat, Mar 11, 2017 at 4:11 AM, Adam Bergmark wrote: > I use the global stack environment to install most executables, it works > best when the package is in a snapshot of course. There is no need to change > the global config, try this: stack install xmonad-contrib X11-xft-0.3.1 > --resolver lts-8.4 > > You can also look for a stack.yaml in the repo of the executable and use > that resolver + any extra deps on the command line, that'll most likely work > even if the package isn't in a snapshot. > > HTH, > Adam > > > On Fri, 10 Mar 2017 at 18:56 Matt wrote: >> >> Stack does have a notion of a global project, which it uses if you're not >> in a project directory. The error message you received: >> >> Error: While constructing the build plan, the following exceptions >> were encountered: >> >> In the dependencies for xmonad-contrib-0.13: >> X11-xft must match >=0.2, but the stack configuration has no >> specified version (latest applicable is 0.3.1) >> >> Recommended action: try adding the following to your extra-deps in >> /home/jun/.stack/global-project/stack.yaml: >> - X11-xft-0.3.1 >> >> tells you how to make X11-xft-0.3.1 available to the global project, which >> should allow you to install xmonad-contrib into this global package. >> >> Matt Parsons >> >> On Fri, Mar 10, 2017 at 10:33 AM, Brandon Allbery >> wrote: >>> >>> >>> On Fri, Mar 10, 2017 at 12:28 PM, Jun Inoue wrote: >>>> >>>> Am I fundamentally misunderstanding how stack is supposed to be used? >>> >>> >>> Stack is not a package manager. It is a reproducible builds tool. Ad hoc >>> usage like you are doing is outside of its purview. >>> >>> Also, last I checked, for some reason xmonad-contrib wasn't in stackage, >>> so stack's primary mechanism for avoiding conflicts fails. >>> >>> -- >>> 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. >> >> >> _______________________________________________ >> 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. -- Jun Inoue From allbery.b at gmail.com Sat Mar 11 00:39:31 2017 From: allbery.b at gmail.com (Brandon Allbery) Date: Fri, 10 Mar 2017 19:39:31 -0500 Subject: [Haskell-cafe] Package Management with Stack? In-Reply-To: References: Message-ID: On Fri, Mar 10, 2017 at 7:37 PM, Jun Inoue wrote: > because the version of xmonad already installed can't be resolved with > the available version(s) of xmonad-extras. > I think we have a PR for that already, don't recall if it's been applied or not, certainly there has not been a release of it. -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From jerzy.karczmarczuk at unicaen.fr Sat Mar 11 00:42:07 2017 From: jerzy.karczmarczuk at unicaen.fr (JK) Date: Sat, 11 Mar 2017 01:42:07 +0100 Subject: [Haskell-cafe] To [] Or Not To [] In-Reply-To: <3D33FF16-5F5C-4E9D-8615-7BC3D1A88CE0@aatal-apotheke.de> References: <3D33FF16-5F5C-4E9D-8615-7BC3D1A88CE0@aatal-apotheke.de> Message-ID: <45baa886-d4d0-2dd6-0f04-bbc2c1bf471c@unicaen.fr> Hi. Le 11/03/2017 à 00:28, Olaf Klinke a écrit : > Actually, your negative abstract turns out to be for a quite positive article. List are like iterators, that's the essence, and as long as you are iterating, it's fine to use []. The prominence of singly linked lists in Haskell has tought me to write my data processing programs in a streaming style. *Yes.* I've been teaching not just "data processing" - after all almost everything we program is "data processing", no?... but such concrete stuff as physics simulation (diff. eqs.), some other numerics (asymptotic expansions, etc.) signal processing (including sound generation), and I liked to present several examples in a *dataflow style* with plenty of co-recursive contraptions. Haskell lazy lists were natural, concise, and easy to manipulate. We enjoyed it, wrong or not. Nothing is perfect, not only mister Nobody; calling ANY approach to programming "wrong" is sectarian. A professional coder working on a concrete project may say bad words about anything he wishes, but for a teacher this is a pedagogical sin, and inefficient programs can be more inspiring than some "correct" doctrines. Jerzy Karczmarczuk --- L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast. https://www.avast.com/antivirus -------------- next part -------------- An HTML attachment was scrubbed... URL: From deywos at mit.edu Sat Mar 11 00:58:01 2017 From: deywos at mit.edu (Deven Lahoti) Date: Fri, 10 Mar 2017 19:58:01 -0500 Subject: [Haskell-cafe] To [] Or Not To [] In-Reply-To: <45baa886-d4d0-2dd6-0f04-bbc2c1bf471c@unicaen.fr> References: <3D33FF16-5F5C-4E9D-8615-7BC3D1A88CE0@aatal-apotheke.de> <45baa886-d4d0-2dd6-0f04-bbc2c1bf471c@unicaen.fr> Message-ID: I think you are missing the point of the article, as that is pretty much exactly the type of situation where it recommends lists be used. On Mar 10, 2017 7:45 PM, "JK" wrote: > Hi. > Le 11/03/2017 à 00:28, Olaf Klinke a écrit : > > Actually, your negative abstract turns out to be for a quite positive article. List are like iterators, that's the essence, and as long as you are iterating, it's fine to use []. The prominence of singly linked lists in Haskell has tought me to write my data processing programs in a streaming style. > > *Yes.* I've been teaching not just "data processing" - after all almost > everything we program is "data processing", no?... but such concrete stuff > as physics simulation (diff. eqs.), some other numerics (asymptotic > expansions, etc.) signal processing (including sound generation), and I > liked to present several examples in a *dataflow style* with plenty of > co-recursive contraptions. Haskell lazy lists were natural, concise, and > easy to manipulate. We enjoyed it, wrong or not. > > Nothing is perfect, not only mister Nobody; calling ANY approach to > programming "wrong" is sectarian. A professional coder working on a > concrete project may say bad words about anything he wishes, but for a > teacher this is a pedagogical sin, and inefficient programs can be more > inspiring than some "correct" doctrines. > > Jerzy Karczmarczuk > > > Garanti > sans virus. www.avast.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 adam at bergmark.nl Sat Mar 11 12:21:14 2017 From: adam at bergmark.nl (Adam Bergmark) Date: Sat, 11 Mar 2017 12:21:14 +0000 Subject: [Haskell-cafe] Package Management with Stack? In-Reply-To: References: Message-ID: On Sat, 11 Mar 2017 at 01:38 Jun Inoue wrote: > Thanks for the suggestion, Adam. That does it for xmonad-contrib. > Unfortunately, it fails when I go on to add xmonad-extras, probably > because the version of xmonad already installed can't be resolved with > the available version(s) of xmonad-extras. (I forgot to note exactly > which packages I had before, so I'm installing these things one by > one, based on compilation errors of ~/.xmonad/xmonad.hs.) > > $ stack install xmonad-extras hint-0.6.0 libmpd-0.9.0.6 --resolver > lts-8.4 > > Error: While constructing the build plan, the following exceptions > were encountered: > > In the dependencies for xmonad-extras-0.12.1: > hint-0.6.0 must match >=0.3.3.3 && <0.5 (latest applicable is 0.4.3) > libmpd-0.9.0.6 must match >=0.8 && <0.9 (latest applicable is > 0.8.0.5) > xmonad-0.13 must match >=0.10 && <0.13 (latest applicable is 0.12) > xmonad-contrib must match >=0.10 && <0.13, but the stack > configuration has no specified version > (latest applicable is 0.12) > > Recommended action: try adding the following to your extra-deps in > /home/jun/.stack/global-project/stack.yaml: > - xmonad-contrib-0.12 > > You may also want to try the 'stack solver' command > Plan construction failed. > > Adding the fact that I seem to have to list a lot of deps on the > command line or in stack.yaml and Brandon's suggestion that I'm using > this tool for the wrong purpose, this seems like a deal breaker for me > :( > > It's not that you are using the wrong tool, there is no tool that would let you install incompatible versions together! (There is --allow-newer in stack and cabal-install but then you are even less likely to end up with something that works) But once you get these mismatches I find cabal-install (in an empty sandbox) easier to use for debugging: ``` $ cabal install xmonad xmonad-contrib xmonad-extras --dry Resolving dependencies... In order, the following would be installed (use -v for more details): data-default-class-0.1.2.0 data-default-instances-containers-0.0.1 dlist-0.8.0.2 data-default-instances-dlist-0.0.1 extensible-exceptions-0.1.1.4 mtl-2.2.1 old-locale-1.0.0.7 data-default-instances-old-locale-0.0.1 data-default-0.7.1.1 X11-1.6.1.2 (latest: 1.8) old-time-1.1.0.3 random-1.1 regex-base-0.93.2 regex-posix-0.95.2 setlocale-1.0.0.4 split-0.2.3.1 text-1.2.2.1 parsec-3.1.11 utf8-string-1.0.1.1 X11-xft-0.3.1 xmonad-0.12 (latest: 0.13) xmonad-contrib-0.12 (latest: 0.13) xmonad-extras-0.12.1 ``` cabal-install always tries to pick the latest versions so this implies that xmonad-extras can't use the latest xmonad & xmonad-contrib. So if you are fine using older versions of those: there you go! You can verify this further by adding constraints: ``` $ cabal install 'xmonad>=0.13' 'xmonad-contrib>=0.13' xmonad-extras --dry Resolving dependencies... cabal: Could not resolve dependencies: trying: xmonad-0.13 (user goal) trying: base-4.9.1.0/installed-4.9... (dependency of xmonad-0.13) next goal: xmonad-extras (user goal) rejecting: xmonad-extras-0.12.1, xmonad-extras-0.12 (conflict: xmonad==0.13, xmonad-extras => xmonad>=0.10 && <0.13) rejecting: xmonad-extras-0.11 (conflict: xmonad==0.13, xmonad-extras => xmonad>=0.10 && <0.12) rejecting: xmonad-extras-0.10.1.2, xmonad-extras-0.10.1.1, xmonad-extras-0.10.1, xmonad-extras-0.10 (conflict: xmonad==0.13, xmonad-extras => xmonad>=0.10 && <0.11) rejecting: xmonad-extras-0.9.2, xmonad-extras-0.9.1 (conflict: xmonad==0.13, xmonad-extras => xmonad>=0.9 && <0.10) rejecting: xmonad-extras-0.9, xmonad-extras-0.0 (conflict: base==4.9.1.0/installed-4.9..., xmonad-extras => base>=3 && <4 || <3) Dependency tree exhaustively searched. ``` What you really want is some blessed combination of packages that work together, and this is exactly what a stackage snapshot would give you if these packages were all part of stackage... But it's true that stack isn't a package manager and there is no active effort within stackage to make as many executables as possible installable. > On Sat, Mar 11, 2017 at 4:11 AM, Adam Bergmark wrote: > > I use the global stack environment to install most executables, it works > > best when the package is in a snapshot of course. There is no need to > change > > the global config, try this: stack install xmonad-contrib X11-xft-0.3.1 > > --resolver lts-8.4 > > > > You can also look for a stack.yaml in the repo of the executable and use > > that resolver + any extra deps on the command line, that'll most likely > work > > even if the package isn't in a snapshot. > > > > HTH, > > Adam > > > > > > On Fri, 10 Mar 2017 at 18:56 Matt wrote: > >> > >> Stack does have a notion of a global project, which it uses if you're > not > >> in a project directory. The error message you received: > >> > >> Error: While constructing the build plan, the following exceptions > >> were encountered: > >> > >> In the dependencies for xmonad-contrib-0.13: > >> X11-xft must match >=0.2, but the stack configuration has no > >> specified version (latest applicable is 0.3.1) > >> > >> Recommended action: try adding the following to your extra-deps in > >> /home/jun/.stack/global-project/stack.yaml: > >> - X11-xft-0.3.1 > >> > >> tells you how to make X11-xft-0.3.1 available to the global project, > which > >> should allow you to install xmonad-contrib into this global package. > >> > >> Matt Parsons > >> > >> On Fri, Mar 10, 2017 at 10:33 AM, Brandon Allbery > >> wrote: > >>> > >>> > >>> On Fri, Mar 10, 2017 at 12:28 PM, Jun Inoue > wrote: > >>>> > >>>> Am I fundamentally misunderstanding how stack is supposed to be used? > >>> > >>> > >>> Stack is not a package manager. It is a reproducible builds tool. Ad > hoc > >>> usage like you are doing is outside of its purview. > >>> > >>> Also, last I checked, for some reason xmonad-contrib wasn't in > stackage, > >>> so stack's primary mechanism for avoiding conflicts fails. > >>> > >>> -- > >>> 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. > >> > >> > >> _______________________________________________ > >> 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. > > > > -- > Jun Inoue > -------------- next part -------------- An HTML attachment was scrubbed... URL: From olf at aatal-apotheke.de Sat Mar 11 20:26:13 2017 From: olf at aatal-apotheke.de (Olaf Klinke) Date: Sat, 11 Mar 2017 21:26:13 +0100 Subject: [Haskell-cafe] To [] Or Not To [] Message-ID: And I was merely pointing that out: That there are recommended use cases in the article, while the abstract given by the author on this list was quite negative. (Possibly it had to be, in order to gain the necessary attention.) I was not arguing against the syntactic preference Haskell gives to singly linked lists over other data structures. If Haskell was designed from scratch, what would take the place of []? Possibly Data.Sequence? Mildly complex data processing programs are somewhat special: You read in and parse one or more input files, do some transformation on the parsed data and write some results back to disk. As the article explained, the Haskell compiler will be able to optimise away the intermediate list structure (at least in simple cases). If data dependency is local, you'll be fine with data input to String rather than Text or ByteString, with map rather than fmap or foldl', and you'll be fine to use a mapM_ on a list for output. Olaf > I think you are missing the point of the article, as that is pretty much > exactly the type of situation where it recommends lists be used. > > On Mar 10, 2017 7:45 PM, "JK" wrote: > >> Hi. >> Le 11/03/2017 à 00:28, Olaf Klinke a écrit : >> >> Actually, your negative abstract turns out to be for a quite positive article. List are like iterators, that's the essence, and as long as you are iterating, it's fine to use []. The prominence of singly linked lists in Haskell has tought me to write my data processing programs in a streaming style. >> >> *Yes.* I've been teaching not just "data processing" - after all almost >> everything we program is "data processing", no?... but such concrete stuff >> as physics simulation (diff. eqs.), some other numerics (asymptotic >> expansions, etc.) signal processing (including sound generation), and I >> liked to present several examples in a *dataflow style* with plenty of >> co-recursive contraptions. Haskell lazy lists were natural, concise, and >> easy to manipulate. We enjoyed it, wrong or not. >> >> Nothing is perfect, not only mister Nobody; calling ANY approach to >> programming "wrong" is sectarian. A professional coder working on a >> concrete project may say bad words about anything he wishes, but for a >> teacher this is a pedagogical sin, and inefficient programs can be more >> inspiring than some "correct" doctrines. >> >> Jerzy Karczmarczuk From winterkoninkje at gmail.com Sun Mar 12 23:21:21 2017 From: winterkoninkje at gmail.com (wren romano) Date: Sun, 12 Mar 2017 16:21:21 -0700 Subject: [Haskell-cafe] reading and writing Data.Ratio.Rational In-Reply-To: References: <150132315.26039.1487938673019@webmail.strato.de> <7FE67A4E-5013-48C0-91C6-EE64CFA5E1AC@aatal-apotheke.de> Message-ID: If you're concerned about performance, you should take a look at bytestring-lexing[1]. The `readDecimal` function does the basic "parse as a pair of ints then divide" trick, whereas `readDecimalLimited` does some other tricks to take advantage of types with limited precision— but which can still give massive performance improvements for types with unlimited precision, in certain circumstances. If you want to read the exponential notation rather than just the decimal notation, then there's also `readExponential` and `readExponentialLimited`. And there are benchmarks[2] comparing them to other parsing/lexing libraries. [1] [2] -- Live well, ~wren From ivan.miljenovic at gmail.com Mon Mar 13 00:20:08 2017 From: ivan.miljenovic at gmail.com (Ivan Lazar Miljenovic) Date: Mon, 13 Mar 2017 11:20:08 +1100 Subject: [Haskell-cafe] Authenticated APIs in Servant Message-ID: I'm needing to write and deploy a web API with authenticated endpoints. I was planning on using Servant, but it looks like there is still no in-built support for OAuth-style token-based APIs. Is that correct, or did I miss something? (That said, the actual API is of a "submit one POST and get a response back" style rather than continuing to do more requests, so a username/password basic authentication approach may also work if all else fails.) -- Ivan Lazar Miljenovic Ivan.Miljenovic at gmail.com http://IvanMiljenovic.wordpress.com From hafnersimon at gmail.com Mon Mar 13 00:30:44 2017 From: hafnersimon at gmail.com (Simon Hafner) Date: Mon, 13 Mar 2017 01:30:44 +0100 Subject: [Haskell-cafe] Authenticated APIs in Servant In-Reply-To: References: Message-ID: I have a bunch of changes based on hoauth2 lying around, and some connector code to servant. It will need some cleaning up before I can release it. I'll have a go at it tomorrow. 2017-03-13 1:20 GMT+01:00 Ivan Lazar Miljenovic : > I'm needing to write and deploy a web API with authenticated > endpoints. I was planning on using Servant, but it looks like there > is still no in-built support for OAuth-style token-based APIs. Is > that correct, or did I miss something? > > (That said, the actual API is of a "submit one POST and get a response > back" style rather than continuing to do more requests, so a > username/password basic authentication approach may also work if all > else fails.) > > -- > Ivan Lazar Miljenovic > Ivan.Miljenovic at gmail.com > http://IvanMiljenovic.wordpress.com > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. From ivan.miljenovic at gmail.com Mon Mar 13 00:40:48 2017 From: ivan.miljenovic at gmail.com (Ivan Lazar Miljenovic) Date: Mon, 13 Mar 2017 11:40:48 +1100 Subject: [Haskell-cafe] Authenticated APIs in Servant In-Reply-To: References: Message-ID: Thanks! On 13 March 2017 at 11:30, Simon Hafner wrote: > I have a bunch of changes based on hoauth2 lying around, and some > connector code to servant. It will need some cleaning up before I can > release it. I'll have a go at it tomorrow. > > 2017-03-13 1:20 GMT+01:00 Ivan Lazar Miljenovic : >> I'm needing to write and deploy a web API with authenticated >> endpoints. I was planning on using Servant, but it looks like there >> is still no in-built support for OAuth-style token-based APIs. Is >> that correct, or did I miss something? >> >> (That said, the actual API is of a "submit one POST and get a response >> back" style rather than continuing to do more requests, so a >> username/password basic authentication approach may also work if all >> else fails.) >> >> -- >> Ivan Lazar Miljenovic >> Ivan.Miljenovic at gmail.com >> http://IvanMiljenovic.wordpress.com >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view archives go to: >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> Only members subscribed via the mailman list are allowed to post. > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -- Ivan Lazar Miljenovic Ivan.Miljenovic at gmail.com http://IvanMiljenovic.wordpress.com From ok at cs.otago.ac.nz Mon Mar 13 01:22:30 2017 From: ok at cs.otago.ac.nz (Richard A. O'Keefe) Date: Mon, 13 Mar 2017 14:22:30 +1300 Subject: [Haskell-cafe] To [] Or Not To [] In-Reply-To: References: <201703100541.v2A5fbvK015715@coolidge.cs.Dartmouth.EDU> Message-ID: > On 10/03/2017, at 8:19 PM, Geraldus wrote: > > "It is more important to have the right problem > done the wrong way, than to have the wrong problem done > the right way." > > Sounds like a nonsense. Does "problem done the wrong way" implies the problem indeed isn't solved at all, doesn't it? Absolutely not. I remember back in about 1979 reading a procedure published in an engineering journal and noticing at once that it took O(n**5) time when simple manipulations familiar to any good programmer would have made it O(n**2). To my way of thought that was "done the wrong way", but the engineers who wrote it were happy with what it did for them and the reviewers are apparently happy that it gave the right answers. Similarly, a program that needs 2MB of temporary data and opens a connection to Oracle, stuffs the data into a scratch table, and pulls it back later (without needing ACID and without using anything more than SELECT * FROM TABLE) is again to my mind doing it the wrong way, but if it gives the right answers fast enough, the goal donor may not care. The classic example from Java, bringing us back to the topic of lists and strings, is String dumpMap(HashMap map) { String s = ""; for (Map.Entry e : map.entrySet()) { s += "\t" + e.getKey() + "='" + e.getValue().toString() + "'\n"; } return s; } which takes quadratic time -- assuming Thing::toString() is cheap -- when using a StringBuilder would make it linear. This is taken from a real program I have been trying to clean up to make Java 1.8 stop complaining about it. Not my code, I hasten to add. The result is the result that the author intended -- at least that's true of the original rather messier code -- but it is done the wrong way. I have known something not unlike this make the difference between a program taking 0.5 seconds and the same program taking 5 minutes, so "done the wrong way" but not "wrong answers". At 5 minutes, the program was still in fact useful. This happened just last week and that one *was* my code. (Not in Java, and not string concatenation. Failing to purge useless but logically harmless data from a collection.) From eraker at gmail.com Mon Mar 13 02:18:22 2017 From: eraker at gmail.com (erik) Date: Sun, 12 Mar 2017 19:18:22 -0700 Subject: [Haskell-cafe] Authenticated APIs in Servant In-Reply-To: References: Message-ID: I don't know if this will be useful to you (and it may be poorly done), but I've been slowly cobbling together my personal profile site using servant and elm for the frontend, just for fun. I have an admin/cms-type thing I've been doing a hack job of building (I often get distracted by other projects). Anyway, here's the login for it, which sets an auth cookie (and relies on the *users* library) and uses a form: https://github.com/pellagic-puffbomb/simpleservantblog/blob/master/src/Api/Admin/Login.hs Here are the actual auth-protected APIs: https://github.com/pellagic-puffbomb/simpleservantblog/blob/master/src/Api/Admin/Admin.hs I'm not sure if it'll help much, but there it is. Erik On Mar 12, 2017 5:42 PM, "Ivan Lazar Miljenovic" wrote: Thanks! On 13 March 2017 at 11:30, Simon Hafner wrote: > I have a bunch of changes based on hoauth2 lying around, and some > connector code to servant. It will need some cleaning up before I can > release it. I'll have a go at it tomorrow. > > 2017-03-13 1:20 GMT+01:00 Ivan Lazar Miljenovic : >> I'm needing to write and deploy a web API with authenticated >> endpoints. I was planning on using Servant, but it looks like there >> is still no in-built support for OAuth-style token-based APIs. Is >> that correct, or did I miss something? >> >> (That said, the actual API is of a "submit one POST and get a response >> back" style rather than continuing to do more requests, so a >> username/password basic authentication approach may also work if all >> else fails.) >> >> -- >> Ivan Lazar Miljenovic >> Ivan.Miljenovic at gmail.com >> http://IvanMiljenovic.wordpress.com >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view archives go to: >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> Only members subscribed via the mailman list are allowed to post. > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -- Ivan Lazar Miljenovic Ivan.Miljenovic at gmail.com http://IvanMiljenovic.wordpress.com _______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From anton.kholomiov at gmail.com Mon Mar 13 07:27:15 2017 From: anton.kholomiov at gmail.com (Anton Kholomiov) Date: Mon, 13 Mar 2017 10:27:15 +0300 Subject: [Haskell-cafe] What is a good way to test library on several ghc's? Message-ID: Someone asked to add support in my lib for older version of GHC. I know that there are GHC-version specific pragmas to activate the code on specific version. I'm not quite sure how to setup the environment to use several GHCs. How do you do that kind of thing? Cheers! Anton -------------- next part -------------- An HTML attachment was scrubbed... URL: From ezyang at mit.edu Mon Mar 13 07:36:18 2017 From: ezyang at mit.edu (Edward Z. Yang) Date: Mon, 13 Mar 2017 00:36:18 -0700 Subject: [Haskell-cafe] What is a good way to test library on several ghc's? In-Reply-To: References: Message-ID: <1489390545-sup-1929@sabre> If you are on Ubuntu, check out hvr's PPA: https://launchpad.net/~hvr/+archive/ubuntu/ghc https://github.com/hvr/multi-ghc-travis may also be of interest Excerpts from Anton Kholomiov's message of 2017-03-13 10:27:15 +0300: > Someone asked to add support in my lib for older version of GHC. > I know that there are GHC-version specific pragmas to > activate the code on specific version. > > I'm not quite sure how to setup the environment to use several GHCs. > How do you do that kind of thing? > > Cheers! > Anton From esz at posteo.de Mon Mar 13 08:28:07 2017 From: esz at posteo.de (Ertugrul =?utf-8?Q?S=C3=B6ylemez?=) Date: Mon, 13 Mar 2017 09:28:07 +0100 Subject: [Haskell-cafe] What is a good way to test library on several ghc's? In-Reply-To: References: Message-ID: <87innda8dk.fsf@posteo.de> > Someone asked to add support in my lib for older version of GHC. > I know that there are GHC-version specific pragmas to activate the > code on specific version. > > I'm not quite sure how to setup the environment to use several GHCs. > How do you do that kind of thing? You can do it quite easily with Nix (which you can use alongside your normal package manager without interference, if you're not on NixOS). Type in your package's root directory: cabal2nix --shell > shell.nix Then you can build your package with various compiler versions: nix-build shell.nix --argstr compiler ghc803 nix-build shell.nix --argstr compiler ghc7103 nix-build shell.nix --argstr compiler ghcjs If a build is successful, you will get a symlink called 'result', which points to an installed version if your package including documentation. Once you're done testing, just delete that link. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 487 bytes Desc: not available URL: From alan.zimm at gmail.com Mon Mar 13 08:34:37 2017 From: alan.zimm at gmail.com (Alan & Kim Zimmerman) Date: Mon, 13 Mar 2017 10:34:37 +0200 Subject: [Haskell-cafe] What is a good way to test library on several ghc's? In-Reply-To: <87innda8dk.fsf@posteo.de> References: <87innda8dk.fsf@posteo.de> Message-ID: Once you have installed the various GHC compilers from HVR's PPA, you can do cabal configure --with-compiler=ghc-7.10.3 etc Alan On 13 March 2017 at 10:28, Ertugrul Söylemez wrote: > > Someone asked to add support in my lib for older version of GHC. > > I know that there are GHC-version specific pragmas to activate the > > code on specific version. > > > > I'm not quite sure how to setup the environment to use several GHCs. > > How do you do that kind of thing? > > You can do it quite easily with Nix (which you can use alongside your > normal package manager without interference, if you're not on NixOS). > Type in your package's root directory: > > cabal2nix --shell > shell.nix > > Then you can build your package with various compiler versions: > > nix-build shell.nix --argstr compiler ghc803 > nix-build shell.nix --argstr compiler ghc7103 > nix-build shell.nix --argstr compiler ghcjs > > If a build is successful, you will get a symlink called 'result', which > points to an installed version if your package including documentation. > Once you're done testing, just delete that link. > > _______________________________________________ > 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 alan.zimm at gmail.com Mon Mar 13 08:35:43 2017 From: alan.zimm at gmail.com (Alan & Kim Zimmerman) Date: Mon, 13 Mar 2017 10:35:43 +0200 Subject: [Haskell-cafe] What is a good way to test library on several ghc's? In-Reply-To: References: <87innda8dk.fsf@posteo.de> Message-ID: See also https://github.com/edsko/ghc-dump-tree/blob/master/buildall.sh On 13 March 2017 at 10:34, Alan & Kim Zimmerman wrote: > Once you have installed the various GHC compilers from HVR's PPA, you can > do > > cabal configure --with-compiler=ghc-7.10.3 > > etc > > Alan > > On 13 March 2017 at 10:28, Ertugrul Söylemez wrote: > >> > Someone asked to add support in my lib for older version of GHC. >> > I know that there are GHC-version specific pragmas to activate the >> > code on specific version. >> > >> > I'm not quite sure how to setup the environment to use several GHCs. >> > How do you do that kind of thing? >> >> You can do it quite easily with Nix (which you can use alongside your >> normal package manager without interference, if you're not on NixOS). >> Type in your package's root directory: >> >> cabal2nix --shell > shell.nix >> >> Then you can build your package with various compiler versions: >> >> nix-build shell.nix --argstr compiler ghc803 >> nix-build shell.nix --argstr compiler ghc7103 >> nix-build shell.nix --argstr compiler ghcjs >> >> If a build is successful, you will get a symlink called 'result', which >> points to an installed version if your package including documentation. >> Once you're done testing, just delete that link. >> >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view archives go to: >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> Only members subscribed via the mailman list are allowed to post. >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From adam at bergmark.nl Mon Mar 13 10:16:57 2017 From: adam at bergmark.nl (Adam Bergmark) Date: Mon, 13 Mar 2017 10:16:57 +0000 Subject: [Haskell-cafe] What is a good way to test library on several ghc's? In-Reply-To: References: <87innda8dk.fsf@posteo.de> Message-ID: There are a bunch of compat libraries such as base-compat and transformers-compat that will make your life a lot easier, having to maintain CPP yourself is very error prone. HTH, Adam On Mon, 13 Mar 2017 at 09:41 Alan & Kim Zimmerman wrote: > See also https://github.com/edsko/ghc-dump-tree/blob/master/buildall.sh > > On 13 March 2017 at 10:34, Alan & Kim Zimmerman > wrote: > > Once you have installed the various GHC compilers from HVR's PPA, you can > do > > cabal configure --with-compiler=ghc-7.10.3 > > etc > > Alan > > On 13 March 2017 at 10:28, Ertugrul Söylemez wrote: > > > Someone asked to add support in my lib for older version of GHC. > > I know that there are GHC-version specific pragmas to activate the > > code on specific version. > > > > I'm not quite sure how to setup the environment to use several GHCs. > > How do you do that kind of thing? > > You can do it quite easily with Nix (which you can use alongside your > normal package manager without interference, if you're not on NixOS). > Type in your package's root directory: > > cabal2nix --shell > shell.nix > > Then you can build your package with various compiler versions: > > nix-build shell.nix --argstr compiler ghc803 > nix-build shell.nix --argstr compiler ghc7103 > nix-build shell.nix --argstr compiler ghcjs > > If a build is successful, you will get a symlink called 'result', which > points to an installed version if your package including documentation. > Once you're done testing, just delete that link. > > _______________________________________________ > 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 johannes.waldmann at htwk-leipzig.de Mon Mar 13 10:43:02 2017 From: johannes.waldmann at htwk-leipzig.de (Johannes Waldmann) Date: Mon, 13 Mar 2017 11:43:02 +0100 Subject: [Haskell-cafe] To [] Or Not To [] In-Reply-To: <3D33FF16-5F5C-4E9D-8615-7BC3D1A88CE0@aatal-apotheke.de> References: <3D33FF16-5F5C-4E9D-8615-7BC3D1A88CE0@aatal-apotheke.de> Message-ID: Hi Olaf - > I'd be interested whether there is a way to check > which of my lists in the source code the compiler managed to "deforest" away. > Which intermediate files should I look at? What are the tools to inspect? Good question, and I don't know an easy answer. The general advice is running ghc with "-ddump-simpl" but I find it quite challenging to scan the output. Here is a simple case where it works: $ cat Fuse.hs main = print $ sum $ map (^2) [1 .. 1000 :: Int] $ ghc -fforce-recomp -ddump-simpl -O0 Fuse.hs no optimisation - shows that "main" calls "map" etc. $ ghc -fforce-recomp -ddump-simpl -O2 Fuse.hs fusion works - nice non-allocating inner loop (lists gone, and Int replaced by Int#) Rec { -- RHS size: {terms: 18, types: 3, coercions: 0} Main.$wgo [InlPrag=[0], Occ=LoopBreaker] :: GHC.Prim.Int# -> GHC.Prim.Int# -> GHC.Prim.Int# [GblId, Arity=2, Caf=NoCafRefs, Str=DmdType ] Main.$wgo = \ (w_s5kV :: GHC.Prim.Int#) (ww_s5kZ :: GHC.Prim.Int#) -> case w_s5kV of wild_Xn { __DEFAULT -> Main.$wgo (GHC.Prim.+# wild_Xn 1#) (GHC.Prim.+# ww_s5kZ (GHC.Prim.*# wild_Xn wild_Xn)); 1000# -> GHC.Prim.+# ww_s5kZ 1000000# } end Rec } but the challenge is to find the path from "main" to that, wading through several other functions that may or may not be related. I can imagine a source annotation like "in the code compiled from this function f, that constructor C should never be called" but this is certainly not easy. Do we really mean "never", or do we mean "only a bounded number of times" (that is, not in the inner loop). Perhaps there is no code for f itself, because it gets inlined. But yes, *some* automated analysis (and human-readable print-out) of the code after simplification would be nice. This could be done as a compiler plug-in? https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/extending_ghc.html#compiler-plugins - J. From nicolas.wu at bristol.ac.uk Mon Mar 13 10:55:36 2017 From: nicolas.wu at bristol.ac.uk (Nicolas Wu) Date: Mon, 13 Mar 2017 10:55:36 +0000 Subject: [Haskell-cafe] 3 Lectureships in Computer Science at University of Bristol Message-ID: Dear all, The University of Bristol is currently advertising three lectureships that you may be interested in: 2 x Lecturer or Senior Lecturer in the Department of Computer Science [1] 1 x Lecturer or Senior Lecturer in Computer Science – Software Engineering [2] These roles would be a good fit for candidates interested in Software Engineering and Programming Languages. The University of Bristol was ranked 5th on research intensity by the Research Excellence Framework (REF 2014) [3], and in Computer Science and Informatics was ranked 4th on research intensity [4]. Bristol has had a long tradition of teaching Haskell to its first year undergraduates in their first term, and attracts strong students. If you're interested, then do consider applying and feel free to get in touch! Best wishes, Nick Links: [1] http://www.bristol.ac.uk/jobs/find/details.html?nPostingID=5674&nPostingTargetID=21366 [2] http://www.bristol.ac.uk/jobs/find/details.html?nPostingID=5737&nPostingTargetID=21596 [3] https://www.timeshighereducation.com/sites/default/files/Attachments/2014/12/30/i/w/k/institutions-on-intensity.pdf [4] https://www.timeshighereducation.com/sites/default/files/Attachments/2014/12/30/a/b/i/subject-ranking-on-intensity.pdf Dr Nicolas Wu Department of Computer Science University of Bristol From tikhon at jelv.is Mon Mar 13 18:00:46 2017 From: tikhon at jelv.is (Tikhon Jelvis) Date: Mon, 13 Mar 2017 11:00:46 -0700 Subject: [Haskell-cafe] To [] Or Not To [] In-Reply-To: References: <3D33FF16-5F5C-4E9D-8615-7BC3D1A88CE0@aatal-apotheke.de> Message-ID: Personally, I disagree with the whole premise. Lists are simple and elegant; you *should* use them most of them time. I'm not saying you should use lists as the data structure for an in-memory database or whatever, but that's the point—most applications only have a handful of data structures that "matter", and lists are great everywhere else. I actually went through and replaced [] with Vector in all of the types we parse from JSON at work, some of which get relatively large. It made the code uglier and didn't meaningfully affect the performance. I undid that change, even though it's exactly the sort of thing this article recommends. In this day and age, simple things *scale*. That's enough most of the time; if you can get away with it you *should*. The real advantage of lists comes at an intersection of two points: lists are effective in place of iterators in Haskell and, even misused as data structures, they're *not that bad* most of the time. This means that a good 80% of the time, the advantage of using a type that's compatible with the rest of my code and APIs that use lists "correctly" as iterators easily outweighs any small performance penalty. A list has to get pretty large—or my usage pattern pretty convoluted—before another type is worth the complexity. On Mon, Mar 13, 2017 at 3:43 AM, Johannes Waldmann < johannes.waldmann at htwk-leipzig.de> wrote: > Hi Olaf - > > > > I'd be interested whether there is a way to check > > which of my lists in the source code the compiler managed to "deforest" > away. > > Which intermediate files should I look at? What are the tools to inspect? > > Good question, and I don't know an easy answer. > > The general advice is running ghc with "-ddump-simpl" > but I find it quite challenging to scan the output. > > > Here is a simple case where it works: > > $ cat Fuse.hs > > main = print $ sum $ map (^2) [1 .. 1000 :: Int] > > > $ ghc -fforce-recomp -ddump-simpl -O0 Fuse.hs > > no optimisation - shows that "main" calls "map" etc. > > > $ ghc -fforce-recomp -ddump-simpl -O2 Fuse.hs > > fusion works - nice non-allocating inner loop > (lists gone, and Int replaced by Int#) > > Rec { > -- RHS size: {terms: 18, types: 3, coercions: 0} > Main.$wgo [InlPrag=[0], Occ=LoopBreaker] > :: GHC.Prim.Int# -> GHC.Prim.Int# -> GHC.Prim.Int# > [GblId, Arity=2, Caf=NoCafRefs, Str=DmdType ] > Main.$wgo = > \ (w_s5kV :: GHC.Prim.Int#) (ww_s5kZ :: GHC.Prim.Int#) -> > case w_s5kV of wild_Xn { > __DEFAULT -> > Main.$wgo > (GHC.Prim.+# wild_Xn 1#) > (GHC.Prim.+# ww_s5kZ (GHC.Prim.*# wild_Xn wild_Xn)); > 1000# -> GHC.Prim.+# ww_s5kZ 1000000# > } > end Rec } > > but the challenge is to find the path from "main" to that, > wading through several other functions that may or may not be related. > > > I can imagine a source annotation like "in the code compiled > from this function f, that constructor C should never be called" > but this is certainly not easy. Do we really mean "never", or do we mean > "only a bounded number of times" (that is, not in the inner loop). > Perhaps there is no code for f itself, because it gets inlined. > > But yes, *some* automated analysis (and human-readable print-out) > of the code after simplification would be nice. > > This could be done as a compiler plug-in? > https://downloads.haskell.org/~ghc/latest/docs/html/users_ > guide/extending_ghc.html#compiler-plugins > > > - J. > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From qdunkan at gmail.com Tue Mar 14 03:16:25 2017 From: qdunkan at gmail.com (Evan Laforge) Date: Mon, 13 Mar 2017 20:16:25 -0700 Subject: [Haskell-cafe] To [] Or Not To [] In-Reply-To: References: <3D33FF16-5F5C-4E9D-8615-7BC3D1A88CE0@aatal-apotheke.de> Message-ID: I've also had this experience, though on a smaller scale. The things I thought were big were not that big, and the slow things were different from what I predicted. So far it hasn't turned out to be lists (except via Strings, I'm happy to use Text). Also I rely on persistence and lists are about the simplest persistent data structure. On Mon, Mar 13, 2017 at 11:00 AM, Tikhon Jelvis wrote: > Personally, I disagree with the whole premise. Lists are simple and elegant; > you *should* use them most of them time. I'm not saying you should use lists > as the data structure for an in-memory database or whatever, but that's the > point—most applications only have a handful of data structures that > "matter", and lists are great everywhere else. > > I actually went through and replaced [] with Vector in all of the types we > parse from JSON at work, some of which get relatively large. It made the > code uglier and didn't meaningfully affect the performance. I undid that > change, even though it's exactly the sort of thing this article recommends. > In this day and age, simple things *scale*. That's enough most of the time; > if you can get away with it you *should*. > > The real advantage of lists comes at an intersection of two points: lists > are effective in place of iterators in Haskell and, even misused as data > structures, they're *not that bad* most of the time. This means that a good > 80% of the time, the advantage of using a type that's compatible with the > rest of my code and APIs that use lists "correctly" as iterators easily > outweighs any small performance penalty. A list has to get pretty large—or > my usage pattern pretty convoluted—before another type is worth the > complexity. > > On Mon, Mar 13, 2017 at 3:43 AM, Johannes Waldmann > wrote: >> >> Hi Olaf - >> >> >> > I'd be interested whether there is a way to check >> > which of my lists in the source code the compiler managed to "deforest" >> > away. >> > Which intermediate files should I look at? What are the tools to >> > inspect? >> >> Good question, and I don't know an easy answer. >> >> The general advice is running ghc with "-ddump-simpl" >> but I find it quite challenging to scan the output. >> >> >> Here is a simple case where it works: >> >> $ cat Fuse.hs >> >> main = print $ sum $ map (^2) [1 .. 1000 :: Int] >> >> >> $ ghc -fforce-recomp -ddump-simpl -O0 Fuse.hs >> >> no optimisation - shows that "main" calls "map" etc. >> >> >> $ ghc -fforce-recomp -ddump-simpl -O2 Fuse.hs >> >> fusion works - nice non-allocating inner loop >> (lists gone, and Int replaced by Int#) >> >> Rec { >> -- RHS size: {terms: 18, types: 3, coercions: 0} >> Main.$wgo [InlPrag=[0], Occ=LoopBreaker] >> :: GHC.Prim.Int# -> GHC.Prim.Int# -> GHC.Prim.Int# >> [GblId, Arity=2, Caf=NoCafRefs, Str=DmdType ] >> Main.$wgo = >> \ (w_s5kV :: GHC.Prim.Int#) (ww_s5kZ :: GHC.Prim.Int#) -> >> case w_s5kV of wild_Xn { >> __DEFAULT -> >> Main.$wgo >> (GHC.Prim.+# wild_Xn 1#) >> (GHC.Prim.+# ww_s5kZ (GHC.Prim.*# wild_Xn wild_Xn)); >> 1000# -> GHC.Prim.+# ww_s5kZ 1000000# >> } >> end Rec } >> >> but the challenge is to find the path from "main" to that, >> wading through several other functions that may or may not be related. >> >> >> I can imagine a source annotation like "in the code compiled >> from this function f, that constructor C should never be called" >> but this is certainly not easy. Do we really mean "never", or do we mean >> "only a bounded number of times" (that is, not in the inner loop). >> Perhaps there is no code for f itself, because it gets inlined. >> >> But yes, *some* automated analysis (and human-readable print-out) >> of the code after simplification would be nice. >> >> This could be done as a compiler plug-in? >> >> https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/extending_ghc.html#compiler-plugins >> >> >> - J. >> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view archives go to: >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> Only members subscribed via the mailman list are allowed to post. > > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. From jeffbrown.the at gmail.com Tue Mar 14 03:53:21 2017 From: jeffbrown.the at gmail.com (Jeffrey Brown) Date: Mon, 13 Mar 2017 20:53:21 -0700 Subject: [Haskell-cafe] Has anyone used Graql in Haskell? Message-ID: Graql[1] is a (and stands for) graph query language. It is unusually expressive, allowing relationships to be members of other relationships[2] -- effectively, allowing one edge to be an endpoint of another edge. Someone named Felix posted a Haskell library for generating Graql queries[3]. Does anyone have a Haskell program that not only generates but uses such a query? [1] https://hackage.haskell.org/package/graql [2] https://discuss.grakn.ai/t/nested-relationships/ [3] https://discuss.grakn.ai/t/graql-haskell-how-to-run-the-test-program/ -- Jeff Brown | Jeffrey Benjamin Brown Website | Facebook | LinkedIn (spammy, so I often miss messages here) | Github -------------- next part -------------- An HTML attachment was scrubbed... URL: From johannes.waldmann at htwk-leipzig.de Tue Mar 14 10:06:42 2017 From: johannes.waldmann at htwk-leipzig.de (Johannes Waldmann) Date: Tue, 14 Mar 2017 11:06:42 +0100 Subject: [Haskell-cafe] To [] Or Not To [] In-Reply-To: References: <3D33FF16-5F5C-4E9D-8615-7BC3D1A88CE0@aatal-apotheke.de> Message-ID: On 14.03.2017 04:16, Evan Laforge wrote: > .. The things > I thought were big were not that big, and the slow things were > different from what I predicted. recent project (by Chris Done) to collect performance information for data structures from standard libraries: https://github.com/haskell-perf https://reddit.com/r/haskell/comments/5ym276/haskell_performance_benchmarks/ - J. From tobias.grosser at inf.ethz.ch Tue Mar 14 11:20:56 2017 From: tobias.grosser at inf.ethz.ch (Tobias Grosser) Date: Tue, 14 Mar 2017 12:20:56 +0100 Subject: [Haskell-cafe] PLDI ACM Student Research Competition (SRC) Message-ID: <1489490456.3087057.910702872.2CFDB8D2@webmail.messagingengine.com> The ACM Student Research Competition (SRC), sponsored by Microsoft Research, offers a unique forum for undergraduate and graduate students to present their original research on programming language design, implementation, theory, applications, and performance at PLDI 2017. The goal is to give students a place to discuss their research with experts in their field and to help them sharpen their research and communication skills. Please find more information at http://pldi17.sigplan.org/track/pldi-2017-student-research-competition Deadline for submission of the extended abstracts: Friday April 7th, 2017. ## Rounds Three rounds of competition will take place before and during PLDI 2017. All rounds are held in two categories: Undergraduate Students and Graduate Students (Masters and PhD level). Winners of the third round will be invited to participate in the SRC Grand Finals competition hosted by the ACM. The PLDI rounds are: * Extended abstract round. All students are encouraged to submit an extended abstract outlining their research. * Poster session. Based on the abstracts, a panel of judges will select the most promising authors to participate in the poster session which will take place at PLDI. In the poster session, students will have the opportunity to present their work to the judges, who will select a group of semi-finalists in each category to advance to the next round. * PLDI presentation. The last PLDI round will consist of an oral presentation at the conference to compete for the three top places. ## Prizes Winners of the three top places in each category receive prizes of $500 for the first place winner, $300 for the second place winner and $200 for the third place winner, respectively. The top three undergraduate and graduate winners receive an award medal and a one-year complimentary ACM student membership with a subscription to ACM’s Digital Library. ## ACM SRC Grand Finals First place winners in each category will be invited to participate in the ACM SRC Grand Finals, an on-line round of competition between first-place SRC winners from different ACM conferences held in 2017. Grand Finals will be judged by a different, ACM-appointed panel of judges. Winners of the three top Grand Finals places in each category will receive additional prizes of $500 for the first place winner, $300 for the second place winner and $200 for the third place winner, respectively. They will be also invited to the annual ACM Award Banquet along with prestigious ACM award winners, including the winner of the Turing Award. ## Eligibility criteria Current student status, either graduate or undergraduate, at the time of submission deadline. In order to advance to the poster session round, participants of the SRC must be current ACM (student) members. ## Extended Abstract Submission Details Each submission should include the student author’s name, institutional affiliation, e-mail address, and postal address; research advisor’s name; ACM student member number; category (undergraduate or graduate); research title; and an extended abstract addressing the following: The extended abstract must not exceed 1000 words and must not be longer than 2 pages. Reference lists do not count towards these limits. ## SRC Panel Xavier Martorell, BSC and UPC (chair). Tobias Grosser, ETH Zurich Sandrine Blazy, IRISA Martin Kong, RICE University Timothy Bourke, INRIA Cole Schlesinger, Barefoot Networks, Inc. From gershomb at gmail.com Tue Mar 14 20:51:23 2017 From: gershomb at gmail.com (Gershom B) Date: Tue, 14 Mar 2017 16:51:23 -0400 Subject: [Haskell-cafe] Looking for maintainers or comaintainers on my Haskell projects In-Reply-To: References: Message-ID: On March 1, 2017 at 5:17:21 AM, Christopher Done (chrisdone at gmail.com) wrote: > Thank you everyone for the support! I've received a number of offers of > help which I'll be pursuing immediately. :-) Has anyone offered to help with tryhaskell.org? And, if not, would anyone like to? :-) There are a few tickets in the haskell repo pertaining to it, so it would probably be good to share the work around a bit to keep the machine humming in decent shape. Thanks for your work on all these resources for all these years Chris, and thanks for being proactive about transition of maintainership. Cheers, Gershom > On 28 February 2017 at 17:18, Christopher Done wrote: > > > Hi all, > > > > The short version is: I’ve been battling RSI in my fingers for some years. > > I’m doing various things to mitigate that problem, but I have very limited > > finger bandwidth these days; enough to work at my usual pace at my job, but > > not much in the evenings and weekends, and so I can’t manage to do much on > > my hobby projects. I’m also not as motivated these days to work on my set > > of open source projects, and am turning my attention to different things. > > It’s not great, but that’s life. > > > > I don’t think that the users of my packages are getting the best > > maintainership deal. Rather than be “the absentee maintainer”, I’d prefer a > > straight-forward transition of maintainership or ownership to someone who > > can put the right energy and time in. > > > > In terms of packages, there are really two that have a significant > > maintenance burden and users aren’t being served very well: > > > > - HIndent has a significant > > amount of issues opened for it regularly, and many of them require > > discussion and debate. If someone would like to become a co-maintainer, let > > me know. It may (eventually) make sense to move it to a more general GitHub > > organization like commercialhaskell or haskell. > > - Intero , which > > seems to have been a success, has a pretty big maintenance burden on “this > > doesn’t work” kind of issues which require investigation. There’s some > > Emacs Lisp work to do on it, and some Haskell work on the intero binary, > > and a whole lot of platform-specific problems or tooling not working > > together. On the other hand people really like this project, and there’s a > > lot of tooling potential. > > > > If you want to take xeno and make it > > into a publishable package, please do so. > > > > The rest of my projects that are on Stackage are: labels > > , ace > > , ical > > , check-email > > , freenect > > , frisby > > , gd > > , ini > > , lucid > > , osdkeys > > , pdfinfo > > , present > > , pure-io > > , scrobble > > , shell-conduit > > , sourcemap > > , descriptive > > , wrap > > , path > > , weigh > > , haskell-docs > > , and > > structured-haskell-mode > > . If you’re > > interested in taking over or co-maintaining any of them, let me know. Some > > are interesting, others are boring, some are trivial. > > > > I have other packages on Hackage, but they’re mostly dead or experiments > > that don’t need maintenance anyway. > > > > I’ve started the process of adding or changing maintainers on my public > > services: > > > > - Haskell News is now a GitHub > > organization. Luke Murphy is a co-owner, and has full access to the > > DigitalOcean account that is running the service. So if you want to work on > > that project, I’m not in the way. > > - lpaste has been moved to its own > > DigitalOcean account too. If anyone is interested in taking over the > > project or co-running it, let me know. > > - tryhaskell doesn’t really > > require any maintenance, but it’s also on its own DigitalOcean account now > > too. > > - IRCBrowse is now on its own > > DigitalOcean account too. It requires maintenance once in a while. If > > anyone is interested in taking over the project or co-running it, let me > > know. > > > > Cheers! > > > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. From mail at joachim-breitner.de Wed Mar 15 01:54:58 2017 From: mail at joachim-breitner.de (Joachim Breitner) Date: Tue, 14 Mar 2017 21:54:58 -0400 Subject: [Haskell-cafe] To [] Or Not To [] In-Reply-To: <3D33FF16-5F5C-4E9D-8615-7BC3D1A88CE0@aatal-apotheke.de> References: <3D33FF16-5F5C-4E9D-8615-7BC3D1A88CE0@aatal-apotheke.de> Message-ID: <1489542898.8081.2.camel@joachim-breitner.de> Hi, Am Samstag, den 11.03.2017, 00:28 +0100 schrieb Olaf Klinke: > I'd be interested whether there is a way to check which of my lists > in the source code the compiler managed to "deforest" away. Which > intermediate files should I look at? What are the tools to inspect? you might find my package http://hackage.haskell.org/package/list-fusion-probe useful. 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 danburton.email at gmail.com Wed Mar 15 02:37:51 2017 From: danburton.email at gmail.com (Dan Burton) Date: Tue, 14 Mar 2017 19:37:51 -0700 Subject: [Haskell-cafe] Register for BayHac 2017 Message-ID: Registration form: https://goo.gl/forms/GWShzl5m2icmhf8L2 [image: Inline image 1] All attendees are requested to register for the event via the registration form. Registration form: https://goo.gl/forms/GWShzl5m2icmhf8L2 More info: https://wiki.haskell.org/BayHac2017 -- Dan Burton -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: BayHac-v2e.jpg Type: image/jpeg Size: 272952 bytes Desc: not available URL: From defigueiredo at ucdavis.edu Wed Mar 15 05:12:13 2017 From: defigueiredo at ucdavis.edu (Dimitri DeFigueiredo) Date: Tue, 14 Mar 2017 23:12:13 -0600 Subject: [Haskell-cafe] Lazy vs Strict ByteStrings Message-ID: <4cd51a4e-626f-8ea9-e438-b9fcb65de9f0@ucdavis.edu> I just noticed that I avoid using ByteStrings because I tend to spend a huge amount of time reading GHC output and trying to figure out if I am/should be using the strict or the lazy version. I have to use both lazy/strict because different libraries use different versions. Maybe having different names would have helped. Am I doing something wrong or is the interface to ByteStrings a poor design? Cheers, Dimitri -- 2E45 D376 A744 C671 5100 A261 210B 8461 0FB0 CA1F From chrisdone at gmail.com Wed Mar 15 14:20:49 2017 From: chrisdone at gmail.com (Christopher Done) Date: Wed, 15 Mar 2017 14:20:49 +0000 Subject: [Haskell-cafe] Looking for maintainers or comaintainers on my Haskell projects In-Reply-To: <3d9df2e1-da47-0445-9ba6-ec79f0509005@ciktel.net> References: <902b313f-c5d9-65ba-7bfb-a4f23a506219@stilo.com> <3d9df2e1-da47-0445-9ba6-ec79f0509005@ciktel.net> Message-ID: I'm not sure that anyone's using it. I originally found it on John Meacham's web site and offered to push it to Hackage. It hasn't been touched since. I once decided to sit down and modernize it, but realized I don't actually understand any of the laziness tricks in it. Anybody's welcome to pick it up and take it to the cleaners! On 5 March 2017 at 23:29, Mario Blažević wrote: > On 04/03/17 01:04 PM, Ben Franksen wrote: > >> Am 02.03.2017 um 23:15 schrieb Mario Blažević: >> >>> I'm willing to take over the maintenance of frisby, as I already have >>> some experience with parser combinator libraries. >>> >> >> It has been a while since I looked at frisby. I do remember that I had >> several issues with it and found that the code was pretty hard to >> understand, due to numerous unsafe optimization hacks. I'd be glad if >> someone cleaned that up, so that it becomes easier to fix errors but I >> guess that would be a piece of work, probably amounting to a re-write of >> sorts. (To be clear, none of this is Chris' fault, of course, he just >> updated cabal stuff.) >> > > I suppose the first order of business would then be to write a test and > benchmark suite, to make sure that the modifications don't break something. > Mind you, there are no dependencies for the library (apart from > acme-everything of course). Is anybody using it privately? > > > > _______________________________________________ > 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 chrisdone at gmail.com Wed Mar 15 14:32:12 2017 From: chrisdone at gmail.com (Christopher Done) Date: Wed, 15 Mar 2017 14:32:12 +0000 Subject: [Haskell-cafe] Looking for maintainers or comaintainers on my Haskell projects In-Reply-To: References: Message-ID: Two people offered to help on tryhaskell maintenance. They now have ssh access and commit access! =) On 14 March 2017 at 20:51, Gershom B wrote: > On March 1, 2017 at 5:17:21 AM, Christopher Done (chrisdone at gmail.com) > wrote: > > Thank you everyone for the support! I've received a number of offers of > > help which I'll be pursuing immediately. :-) > > Has anyone offered to help with tryhaskell.org? And, if not, would anyone > like to? :-) > > There are a few tickets in the haskell repo pertaining to it, so it would > probably be good to share the work around a bit to keep the machine humming > in decent shape. > > Thanks for your work on all these resources for all these years Chris, and > thanks for being proactive about transition of maintainership. > > Cheers, > Gershom > > > On 28 February 2017 at 17:18, Christopher Done wrote: > > > > > Hi all, > > > > > > The short version is: I’ve been battling RSI in my fingers for some > years. > > > I’m doing various things to mitigate that problem, but I have very > limited > > > finger bandwidth these days; enough to work at my usual pace at my > job, but > > > not much in the evenings and weekends, and so I can’t manage to do > much on > > > my hobby projects. I’m also not as motivated these days to work on my > set > > > of open source projects, and am turning my attention to different > things. > > > It’s not great, but that’s life. > > > > > > I don’t think that the users of my packages are getting the best > > > maintainership deal. Rather than be “the absentee maintainer”, I’d > prefer a > > > straight-forward transition of maintainership or ownership to someone > who > > > can put the right energy and time in. > > > > > > In terms of packages, there are really two that have a significant > > > maintenance burden and users aren’t being served very well: > > > > > > - HIndent has a significant > > > amount of issues opened for it regularly, and many of them require > > > discussion and debate. If someone would like to become a > co-maintainer, let > > > me know. It may (eventually) make sense to move it to a more general > GitHub > > > organization like commercialhaskell or haskell. > > > - Intero , which > > > seems to have been a success, has a pretty big maintenance burden on > “this > > > doesn’t work” kind of issues which require investigation. There’s some > > > Emacs Lisp work to do on it, and some Haskell work on the intero > binary, > > > and a whole lot of platform-specific problems or tooling not working > > > together. On the other hand people really like this project, and > there’s a > > > lot of tooling potential. > > > > > > If you want to take xeno and make it > > > into a publishable package, please do so. > > > > > > The rest of my projects that are on Stackage are: labels > > > , ace > > > , ical > > > , check-email > > > , freenect > > > , frisby > > > , gd > > > , ini > > > , lucid > > > , osdkeys > > > , pdfinfo > > > , present > > > , pure-io > > > , scrobble > > > , shell-conduit > > > , sourcemap > > > , descriptive > > > , wrap > > > , path > > > , weigh > > > , haskell-docs > > > , and > > > structured-haskell-mode > > > . If you’re > > > interested in taking over or co-maintaining any of them, let me know. > Some > > > are interesting, others are boring, some are trivial. > > > > > > I have other packages on Hackage, but they’re mostly dead or > experiments > > > that don’t need maintenance anyway. > > > > > > I’ve started the process of adding or changing maintainers on my public > > > services: > > > > > > - Haskell News is now a GitHub > > > organization. Luke Murphy is a co-owner, and has full access to the > > > DigitalOcean account that is running the service. So if you want to > work on > > > that project, I’m not in the way. > > > - lpaste has been moved to its own > > > DigitalOcean account too. If anyone is interested in taking over the > > > project or co-running it, let me know. > > > - tryhaskell doesn’t really > > > require any maintenance, but it’s also on its own DigitalOcean account > now > > > too. > > > - IRCBrowse is now on its own > > > DigitalOcean account too. It requires maintenance once in a while. If > > > anyone is interested in taking over the project or co-running it, let > me > > > know. > > > > > > Cheers! > > > > > > > > _______________________________________________ > > 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 mblazevic at stilo.com Wed Mar 15 16:15:22 2017 From: mblazevic at stilo.com (=?UTF-8?Q?Mario_Bla=c5=beevi=c4=87?=) Date: Wed, 15 Mar 2017 12:15:22 -0400 Subject: [Haskell-cafe] Looking for maintainers or comaintainers on my Haskell projects In-Reply-To: References: <902b313f-c5d9-65ba-7bfb-a4f23a506219@stilo.com> <3d9df2e1-da47-0445-9ba6-ec79f0509005@ciktel.net> Message-ID: <80730a19-af97-f27b-7a98-10c8b750ee28@stilo.com> On 2017-03-15 10:20 AM, Christopher Done wrote: > I'm not sure that anyone's using it. I originally found it on John > Meacham's web site and offered to push it to Hackage. It hasn't been > touched since. I once decided to sit down and modernize it, but realized > I don't actually understand any of the laziness tricks in it. I'm comfortable with laziness tricks, somewhat less so with "numerous unsafe optimization hacks". > Anybody's welcome to pick it up and take it to the cleaners! Ok, I'll take it. My GitHub account is blamario. I don't suppose John Meacham would be interested? > > On 5 March 2017 at 23:29, Mario Blažević > wrote: > > On 04/03/17 01:04 PM, Ben Franksen wrote: > > Am 02.03.2017 um 23:15 schrieb Mario Blažević: > > I'm willing to take over the maintenance of frisby, as I > already have > some experience with parser combinator libraries. > > > It has been a while since I looked at frisby. I do remember that > I had several issues with it and found that the code was pretty > hard to understand, due to numerous unsafe optimization hacks. > I'd be glad if someone cleaned that up, so that it becomes > easier to fix errors but I guess that would be a piece of work, > probably amounting to a re-write of sorts. (To be clear, none of > this is Chris' fault, of course, he just updated cabal stuff.) > > > I suppose the first order of business would then be to write a test > and benchmark suite, to make sure that the modifications don't break > something. Mind you, there are no dependencies for the library > (apart from acme-everything of course). Is anybody using it privately? > > > > _______________________________________________ > 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 gershomb at gmail.com Wed Mar 15 17:12:47 2017 From: gershomb at gmail.com (Gershom B) Date: Wed, 15 Mar 2017 13:12:47 -0400 Subject: [Haskell-cafe] Looking for maintainers or comaintainers on my Haskell projects In-Reply-To: References: Message-ID: Great! It seems that the issue tracker on https://github.com/tryhaskell/tryhaskell is disabled? I wanted to create a ticket to reference https://github.com/haskell-infra/hl/issues/203 but couldn't see how. Cheers, Gershom On Wed, Mar 15, 2017 at 10:32 AM, Christopher Done wrote: > Two people offered to help on tryhaskell maintenance. They now have ssh > access and commit access! =) > > On 14 March 2017 at 20:51, Gershom B wrote: >> >> On March 1, 2017 at 5:17:21 AM, Christopher Done (chrisdone at gmail.com) >> wrote: >> > Thank you everyone for the support! I've received a number of offers of >> > help which I'll be pursuing immediately. :-) >> >> Has anyone offered to help with tryhaskell.org? And, if not, would anyone >> like to? :-) >> >> There are a few tickets in the haskell repo pertaining to it, so it would >> probably be good to share the work around a bit to keep the machine humming >> in decent shape. >> >> Thanks for your work on all these resources for all these years Chris, and >> thanks for being proactive about transition of maintainership. >> >> Cheers, >> Gershom >> >> > On 28 February 2017 at 17:18, Christopher Done wrote: >> > >> > > Hi all, >> > > >> > > The short version is: I’ve been battling RSI in my fingers for some >> > > years. >> > > I’m doing various things to mitigate that problem, but I have very >> > > limited >> > > finger bandwidth these days; enough to work at my usual pace at my >> > > job, but >> > > not much in the evenings and weekends, and so I can’t manage to do >> > > much on >> > > my hobby projects. I’m also not as motivated these days to work on my >> > > set >> > > of open source projects, and am turning my attention to different >> > > things. >> > > It’s not great, but that’s life. >> > > >> > > I don’t think that the users of my packages are getting the best >> > > maintainership deal. Rather than be “the absentee maintainer”, I’d >> > > prefer a >> > > straight-forward transition of maintainership or ownership to someone >> > > who >> > > can put the right energy and time in. >> > > >> > > In terms of packages, there are really two that have a significant >> > > maintenance burden and users aren’t being served very well: >> > > >> > > - HIndent has a significant >> > > amount of issues opened for it regularly, and many of them require >> > > discussion and debate. If someone would like to become a >> > > co-maintainer, let >> > > me know. It may (eventually) make sense to move it to a more general >> > > GitHub >> > > organization like commercialhaskell or haskell. >> > > - Intero , which >> > > seems to have been a success, has a pretty big maintenance burden on >> > > “this >> > > doesn’t work” kind of issues which require investigation. There’s some >> > > Emacs Lisp work to do on it, and some Haskell work on the intero >> > > binary, >> > > and a whole lot of platform-specific problems or tooling not working >> > > together. On the other hand people really like this project, and >> > > there’s a >> > > lot of tooling potential. >> > > >> > > If you want to take xeno and make it >> > > into a publishable package, please do so. >> > > >> > > The rest of my projects that are on Stackage are: labels >> > > , ace >> > > , ical >> > > , check-email >> > > , freenect >> > > , frisby >> > > , gd >> > > , ini >> > > , lucid >> > > , osdkeys >> > > , pdfinfo >> > > , present >> > > , pure-io >> > > , scrobble >> > > , shell-conduit >> > > , sourcemap >> > > , descriptive >> > > , wrap >> > > , path >> > > , weigh >> > > , haskell-docs >> > > , and >> > > structured-haskell-mode >> > > . If you’re >> > > interested in taking over or co-maintaining any of them, let me know. >> > > Some >> > > are interesting, others are boring, some are trivial. >> > > >> > > I have other packages on Hackage, but they’re mostly dead or >> > > experiments >> > > that don’t need maintenance anyway. >> > > >> > > I’ve started the process of adding or changing maintainers on my >> > > public >> > > services: >> > > >> > > - Haskell News is now a GitHub >> > > organization. Luke Murphy is a co-owner, and has full access to the >> > > DigitalOcean account that is running the service. So if you want to >> > > work on >> > > that project, I’m not in the way. >> > > - lpaste has been moved to its own >> > > DigitalOcean account too. If anyone is interested in taking over the >> > > project or co-running it, let me know. >> > > - tryhaskell doesn’t really >> > > require any maintenance, but it’s also on its own DigitalOcean account >> > > now >> > > too. >> > > - IRCBrowse is now on its own >> > > DigitalOcean account too. It requires maintenance once in a while. If >> > > anyone is interested in taking over the project or co-running it, let >> > > me >> > > know. >> > > >> > > Cheers! >> > > >> > > >> > _______________________________________________ >> > Haskell-Cafe mailing list >> > To (un)subscribe, modify options or view archives go to: >> > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> > Only members subscribed via the mailman list are allowed to post. >> > From olf at aatal-apotheke.de Wed Mar 15 18:27:21 2017 From: olf at aatal-apotheke.de (Olaf Klinke) Date: Wed, 15 Mar 2017 19:27:21 +0100 Subject: [Haskell-cafe] To [] Or Not To [] Message-ID: <706B3D19-44A0-4D1C-AC2F-C398061C3B8C@aatal-apotheke.de> Well, Joachim, it certainly can not get easier than that. Thanks a lot! Olaf From lucas.dicioccio at gmail.com Wed Mar 15 20:53:03 2017 From: lucas.dicioccio at gmail.com (lucas di cioccio) Date: Wed, 15 Mar 2017 21:53:03 +0100 Subject: [Haskell-cafe] [ANN] Haskell Paris meetup on 2017-03-27 Message-ID: Dear cafe readers, The next Haskell Paris Meetup will take place on 2017-03-27 at Murex near Trocadéro in Paris. There will be two entry-level/intermediary-level talks (in French) as well as some time for socializing. You'll find more details about the event as well as a registration form at https://www.meetup.com/haskell-paris/events/238394643/ . Best, -- Lucas DiCioccio -------------- next part -------------- An HTML attachment was scrubbed... URL: From defigueiredo at ucdavis.edu Wed Mar 15 20:57:44 2017 From: defigueiredo at ucdavis.edu (Dimitri DeFigueiredo) Date: Wed, 15 Mar 2017 14:57:44 -0600 Subject: [Haskell-cafe] Lazy vs Strict ByteStrings In-Reply-To: References: Message-ID: I think I need to be more specific here. My gripe with ByteString is that there are two distinct ByteString types disguised as one. There are “disguised” simply by having the same name. This leads me to think the use of ByteString will be simpler than it usually turns out to be. I fear Backpack may soon make this worse. Obviously, this is not exclusive to ByteString. Using the same name for strict and lazy versions is all over the place. Here is another example: https://hackage.haskell.org/package/unordered-containers/docs/Data-HashMap-Lazy.html https://hackage.haskell.org/package/unordered-containers/docs/Data-HashMap-Strict.html But the problem is specially insidious with BytStrings because of their usage patterns and also because the process of finding out which version is which through GHC error messages is very inefficient. Here is a very ugly example where I believe I was misled by both ByteString types having the same name. I needed to make a “random looking but secretly not random” number and package it up in a 128-bit UUID. In other words, I wanted to mark the random numbers I create, but in a way that nobody else knows they are mine. The `hash` function from the cryptonite library accepts ByteString and its output can be converted to ByteString. The UUID type also has a function `fromByteString`. What could be easier? Here’s what I ended up with: import System.Random import Data.Maybe import Data.Word import Data.UUID import Crypto.Hash import Crypto.Hash.Algorithms import Data.ByteArray import Data.ByteString.Builder import qualified Data.ByteString as BS import Data.ByteString.Lazy as BSL -- Ugly! Step-by-step markAsSelf :: Word64 -> Word64 -> UUID markAsSelf selfDetectKey rand = let selfKeyAsLazyBS = toLazyByteString (word64BE selfDetectKey) randAsLazyBS = toLazyByteString (word64BE rand) hashInput = BSL.concat [randAsLazyBS, selfKeyAsLazyBS] digest = hash (toStrict hashInput) :: Digest SHA256 hashBitsStrict = BS.take 8 (convert digest) halfAndHalf = BSL.concat [randAsLazyBS, fromStrict hashBitsStrict] in fromJust (fromByteString halfAndHalf) secret :: Word64 secret = 12345 main = do r <- randomIO print (markAsSelf secret r) --------- end --------- in Data.ByteString.Builder toLazyByteString :: Builder -> ByteString -- exists toStrictByteString :: Builder -> ByteString -- was not found Similarly, in Data.UUID fromByteString :: ByteString -> Maybe UUID — only exists for lazy I think this lack of a common interface makes the code above a type conversion disaster and the process of debugging it painfully inefficient. Is there a better approach to go about doing this? Cheers, Dimitri -- 2E45 D376 A744 C671 5100 A261 210B 8461 0FB0 CA1F From alex at kazik.de Thu Mar 16 08:47:08 2017 From: alex at kazik.de (ALeX Kazik) Date: Thu, 16 Mar 2017 09:47:08 +0100 Subject: [Haskell-cafe] Lazy vs Strict ByteStrings In-Reply-To: References: Message-ID: Hi, > Obviously, this is not exclusive to ByteString. Using the same name for > strict and lazy versions is all over the place. Here is another example: > > https://hackage.haskell.org/package/unordered-containers/docs/Data-HashMap-Lazy.html > https://hackage.haskell.org/package/unordered-containers/docs/Data-HashMap-Strict.html HashMaps and Maps lazy and strict do have the same type! Only the function which work on them are different. Yes, you can use a Data.HashMap.Lazy.HashMap with the Data.HashMap.Strict functions. Text however has a different type for lazy and strict (like ByteString). And yes, I agree that it's confusing. ALeX. From ivanperezdominguez at gmail.com Thu Mar 16 15:00:28 2017 From: ivanperezdominguez at gmail.com (Ivan Perez) Date: Thu, 16 Mar 2017 15:00:28 +0000 Subject: [Haskell-cafe] Looking for maintainers or comaintainers on my Haskell projects In-Reply-To: References: Message-ID: I'm happy taking over freenect for now. Ivan On 1 March 2017 at 10:13, Christopher Done wrote: > Thank you everyone for the support! I've received a number of offers of > help which I'll be pursuing immediately. :-) > > On 28 February 2017 at 17:18, Christopher Done > wrote: > >> Hi all, >> >> The short version is: I’ve been battling RSI in my fingers for some >> years. I’m doing various things to mitigate that problem, but I have very >> limited finger bandwidth these days; enough to work at my usual pace at my >> job, but not much in the evenings and weekends, and so I can’t manage to do >> much on my hobby projects. I’m also not as motivated these days to work on >> my set of open source projects, and am turning my attention to different >> things. It’s not great, but that’s life. >> >> I don’t think that the users of my packages are getting the best >> maintainership deal. Rather than be “the absentee maintainer”, I’d prefer a >> straight-forward transition of maintainership or ownership to someone who >> can put the right energy and time in. >> >> In terms of packages, there are really two that have a significant >> maintenance burden and users aren’t being served very well: >> >> - HIndent has a significant >> amount of issues opened for it regularly, and many of them require >> discussion and debate. If someone would like to become a co-maintainer, let >> me know. It may (eventually) make sense to move it to a more general GitHub >> organization like commercialhaskell or haskell. >> - Intero , which >> seems to have been a success, has a pretty big maintenance burden on “this >> doesn’t work” kind of issues which require investigation. There’s some >> Emacs Lisp work to do on it, and some Haskell work on the intero binary, >> and a whole lot of platform-specific problems or tooling not working >> together. On the other hand people really like this project, and there’s a >> lot of tooling potential. >> >> If you want to take xeno and make it >> into a publishable package, please do so. >> >> The rest of my projects that are on Stackage are: labels >> , ace >> , ical >> , check-email >> , freenect >> , frisby >> , gd >> , ini >> , lucid >> , osdkeys >> , pdfinfo >> , present >> , pure-io >> , scrobble >> , shell-conduit >> , sourcemap >> , descriptive >> , wrap >> , path >> , weigh >> , haskell-docs >> , and >> structured-haskell-mode >> . If you’re >> interested in taking over or co-maintaining any of them, let me know. Some >> are interesting, others are boring, some are trivial. >> >> I have other packages on Hackage, but they’re mostly dead or experiments >> that don’t need maintenance anyway. >> >> I’ve started the process of adding or changing maintainers on my public >> services: >> >> - Haskell News is now a GitHub >> organization. Luke Murphy is a co-owner, and has full access to the >> DigitalOcean account that is running the service. So if you want to work on >> that project, I’m not in the way. >> - lpaste has been moved to its own >> DigitalOcean account too. If anyone is interested in taking over the >> project or co-running it, let me know. >> - tryhaskell doesn’t really >> require any maintenance, but it’s also on its own DigitalOcean account now >> too. >> - IRCBrowse is now on its >> own DigitalOcean account too. It requires maintenance once in a while. If >> anyone is interested in taking over the project or co-running it, let me >> know. >> >> Cheers! >> ​ >> > > > _______________________________________________ > 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.franksen at online.de Thu Mar 16 21:26:41 2017 From: ben.franksen at online.de (Ben Franksen) Date: Thu, 16 Mar 2017 22:26:41 +0100 Subject: [Haskell-cafe] Looking for maintainers or comaintainers on my Haskell projects In-Reply-To: <80730a19-af97-f27b-7a98-10c8b750ee28@stilo.com> References: <902b313f-c5d9-65ba-7bfb-a4f23a506219@stilo.com> <3d9df2e1-da47-0445-9ba6-ec79f0509005@ciktel.net> <80730a19-af97-f27b-7a98-10c8b750ee28@stilo.com> Message-ID: Am 15.03.2017 um 17:15 schrieb Mario Blažević: > On 2017-03-15 10:20 AM, Christopher Done wrote: >> I'm not sure that anyone's using it. I originally found it on John >> Meacham's web site and offered to push it to Hackage. It hasn't been >> touched since. I once decided to sit down and modernize it, but realized >> I don't actually understand any of the laziness tricks in it. > > I'm comfortable with laziness tricks, somewhat less so with > "numerous unsafe optimization hacks". > >> Anybody's welcome to pick it up and take it to the cleaners! > > Ok, I'll take it. My GitHub account is blamario. I don't suppose > John Meacham would be interested? I am glad my remark didn't scare you off, in retrospect my wording was perhaps a bit strong. Yes, John did a lot to make things as lazy as possible to avoid excessive memory consumption (cool to say that, isn't it). There is also some ugly type casting (unsafeCoerce) going on, since the parser keeps the alternatives in an array (remember that this is a packrat parser). Unfortunately I can't spare the time to work on this ATM. But I would be glad if you would revive the project. PEGs offer some unique advantages for day-to-day parsing tasks, where you can't be bothered to write a separate lexer or mess around with 'try' until your harmless looking grammar actually accepts the source language. A fair portion of these can nowadays be handled nicely with regex-applicative (many file formats are actually regular) but now and again there is one where you need the power of a CFG. Cheers Ben From ben.franksen at online.de Thu Mar 16 21:50:51 2017 From: ben.franksen at online.de (Ben Franksen) Date: Thu, 16 Mar 2017 22:50:51 +0100 Subject: [Haskell-cafe] Parsing a bunch of strings without backtracking In-Reply-To: References: Message-ID: Am 09.03.2017 um 01:21 schrieb Javran Cheng: > I come across an idea about parsing a bunch of strings, > just want to share this idea and looking for some comments and maybe > pointing me to some related articles. > > The idea is when you have: > > 1 <$ string "aabb" <|> 2 <$ string "aacc" > > you can rewrite it as: > > string "aa" >> (1 <$ string "bb" <|> 2 <$ string "cc") > > so that you don't have to deal with the common prefix "aa" twice. In the parsing literature this is called "left factoring (a grammar)". Left factoring is known to improve efficiency and there are published algorithms to do it automatically; but -- as you observed -- to perform it you need an explicit representation of the grammar, so you can transform it before turning it into a parser; some would call this a "deep embedding". > Then I further extend this idea: if we have a set of strings (s1, s2, ...), > whose element is not a prefix of any other set member, > why don't we turn things like (v1 <$ string s1 <|> v2 <$ string s2 <|> ...) > into a "tree-structure" so we don't need to deal with > any common prefix more than once? The problem is how to represent the grammar in a statically typed way and then to transform it preserving the well-typing. This can be done, but the price is high. Look for packages (and papers) named 'christmastree' and 'tttas' to get an idea. Even the authors admit that their approach is extremely involved and that offline methods (such as TH which you mentioned) may be more practical. Cheers Ben From ben.franksen at online.de Thu Mar 16 22:10:35 2017 From: ben.franksen at online.de (Ben Franksen) Date: Thu, 16 Mar 2017 23:10:35 +0100 Subject: [Haskell-cafe] Package Management with Stack? In-Reply-To: References: Message-ID: Am 11.03.2017 um 13:21 schrieb Adam Bergmark: > It's not that you are using the wrong tool, there is no tool that would let > you install incompatible versions together! (There is --allow-newer in > stack and cabal-install but then you are even less likely to end up with > something that works) What about the cabal new-build? Works like a charm for me. Cheers Ben From ben.franksen at online.de Thu Mar 16 22:22:16 2017 From: ben.franksen at online.de (Ben Franksen) Date: Thu, 16 Mar 2017 23:22:16 +0100 Subject: [Haskell-cafe] To [] Or Not To [] In-Reply-To: <45baa886-d4d0-2dd6-0f04-bbc2c1bf471c@unicaen.fr> References: <3D33FF16-5F5C-4E9D-8615-7BC3D1A88CE0@aatal-apotheke.de> <45baa886-d4d0-2dd6-0f04-bbc2c1bf471c@unicaen.fr> Message-ID: Am 11.03.2017 um 01:42 schrieb JK: > Le 11/03/2017 à 00:28, Olaf Klinke a écrit : >> Actually, your negative abstract turns out to be for a quite positive >> article. List are like iterators, that's the essence, and as long as >> you are iterating, it's fine to use []. The prominence of singly >> linked lists in Haskell has tought me to write my data processing >> programs in a streaming style. > *Yes.* I've been teaching not just "data processing" - after all almost > everything we program is "data processing", no?... but such concrete > stuff as physics simulation (diff. eqs.), some other numerics > (asymptotic expansions, etc.) signal processing (including sound > generation), and I liked to present several examples in a *dataflow > style* with plenty of co-recursive contraptions. Haskell lazy lists were > natural, concise, and easy to manipulate. We enjoyed it, wrong or not. > > Nothing is perfect, not only mister Nobody; calling ANY approach to > programming "wrong" is sectarian. A professional coder working on a > concrete project may say bad words about anything he wishes, but for a > teacher this is a pedagogical sin, and inefficient programs can be more > inspiring than some "correct" doctrines. Jerzy, i have always liked your style and i am very glad you wrote this response, the attitude of which i find refreshingly unconventional. (Note i am not free of the sin of, sometimes hastily, condemning what i find distasteful.) Cheers Ben From allbery.b at gmail.com Thu Mar 16 22:38:43 2017 From: allbery.b at gmail.com (Brandon Allbery) Date: Thu, 16 Mar 2017 18:38:43 -0400 Subject: [Haskell-cafe] To [] Or Not To [] In-Reply-To: References: <3D33FF16-5F5C-4E9D-8615-7BC3D1A88CE0@aatal-apotheke.de> <45baa886-d4d0-2dd6-0f04-bbc2c1bf471c@unicaen.fr> Message-ID: On Thu, Mar 16, 2017 at 6:22 PM, Ben Franksen wrote: > Am 11.03.2017 um 01:42 schrieb JK: > >> *Yes.* I've been teaching not just "data processing" - after all almost >> everything we program is "data processing", no?... but such concrete >> stuff as physics simulation (diff. eqs.), some other numerics >> (asymptotic expansions, etc.) signal processing (including sound >> generation), and I liked to present several examples in a *dataflow >> style* with plenty of co-recursive contraptions. Haskell lazy lists were >> natural, concise, and easy to manipulate. We enjoyed it, wrong or not. >> > Jerzy, i have always liked your style and i am very glad you wrote this > response, the attitude of which i find refreshingly unconventional. (Note i > am not free of the sin of, sometimes hastily, condemning what i find > distasteful.) > I'd just like to add: - if it gets the job done, it's not wrong. - it's my opinion that programs are best written for clarity; the *compiler* should be optimizing, not the programmer, whenever possible. Yes, there are exceptions. But how many programs really *need* something like Duff's Device? Save the cleverness for those. This doesn't necessarily justify using an inherently wrong data structure (e.g. alist for a large keyed map), but if the flow is best understood via lists, that counts for more. (Consider that it may be *your* sanity that will be saved a year down the road when you have to revise it.) -- brandon s allbery kf8nh sine nomine associates allbery.b at gmail.com ballbery at sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From litchard.michael at gmail.com Fri Mar 17 01:51:27 2017 From: litchard.michael at gmail.com (Michael Litchard) Date: Thu, 16 Mar 2017 18:51:27 -0700 Subject: [Haskell-cafe] amortized time and space for set operations Message-ID: What's the best way to calculate the amortized time and space complexity for the operations in "Implementing Sets Efficiently in a Functional Language". http://groups.csail.mit.edu/mac/users/adams/BB/92-10.ps -------------- next part -------------- An HTML attachment was scrubbed... URL: From jerzy.karczmarczuk at unicaen.fr Fri Mar 17 03:04:54 2017 From: jerzy.karczmarczuk at unicaen.fr (JK) Date: Fri, 17 Mar 2017 04:04:54 +0100 Subject: [Haskell-cafe] To [] Or Not To [] In-Reply-To: References: <3D33FF16-5F5C-4E9D-8615-7BC3D1A88CE0@aatal-apotheke.de> <45baa886-d4d0-2dd6-0f04-bbc2c1bf471c@unicaen.fr> Message-ID: <9407a40c-56d3-2dde-f3a0-1961aeadc454@unicaen.fr> /Sorry, a looong message./ Le 16/03/2017 à 23:38, Brandon Allbery a écrit : > programs are best written for clarity; the *compiler* should be > optimizing, not the programmer, whenever possible. A historical anecdote... When something called 'cybernetics' ceased to be in the Soviet Union a bourgeois pseudo-science whose aim was to enslave the the Class of Workers, etc., and Russians and their satellites began to manufacture computers, they managed quite fast to master the main idea of interesting algorithms, exquisite data structures and their processing. They COULD have invented some nice programming languages (we are at the end of '50-ties...), but among many other calamities, their forerunners said that they had some wonderful teams of very competent mathematicians, who, once instructed how to program computers, would do Wonders, in the name of the True Proletarian Science. It was partly true (mathematicians, Andrey Markov Jr., Andrey Ershov, etc., not necessarily the Proletarian Science...) . So, when the ideal personage of THE Programmer became in US a cliché in some science-fiction books (e.g., Asimov's), in the world of the True Proletarian Science, very decent humans wasted a horrible amont of time producing low-level codes, and neglecting completely the domain of compilation... They managed to put Sputnik and Gagarin above our heads, but programming languages did not evolve... [[Although the Snobol language invented by Ralph Griswold, was partly based on the Markov algorithm concept]]. Now, the morale of this story?... Wait a bit. Second round. There is a pedagogical initiative, called the International Olympiad in Informatics. ( http://www.ioinformatics.org/index.shtml ). The evolution of this contest, participating countries, etc., is a very interesting story, but here I want just to tell you something different. In Wikipedia you will read that/*it is an annual competitive programming competition for secondary school students. It is the second largest olympiad, after International Mathematical Olympiad *//* *//*The contest consists of two days of computer programming and problem-solving of algorithmic nature. To deal with problems involving very large amounts of data, it is necessary to have not only programmers, "but also creative coders, who can dream up what it is that the programmers need to tell the computer to do. The hard part isn't the programming, but the mathematics underneath it.... " */Nice. And now: the TRUTH.*The only languages which are permitted are C, C++, and Java*. Sorry, recently also Pascal, the Eastern Europe insisted upon it. I looked through the proposed tasks. A good percentage of them were puzzles of logical kind. But no logical languages were allowed. Something which can be coded in 12 lines of CLP, has to be ceeplusjavaised on 8 pages, and the Jury acknowledges the speed and efficiency of such programs... Laugh or weep?... Functional languages? Anybody heard of them?... Don't blame the Soviets, please... Look up the *British Informatics Olympiad*. The rules I found randomly for the 2000 contest stipulated: /*"The languages available will be Turbo Pascal and Turbo C/C++." */Yes, not just C++, but compulsory Borland dialect. More? Let's see the *ACM International Collegiate Programming Contest*. Rules: /*"... They must submit solutions as programs in C, C++, Java or Python (although it is not guaranteed every problem is solvable in Python)." */(Most probably the author doesn't know what Python is...) This is the way we teach our youth to be creative ! In such a way we inspire them to became "creative coders". You may think whatever you wish, but I am convinced that the best part of the responsibility for such a calamitous picture of the CS pedagogy, falls upon those feeble-minded "professionals" who know better what is good, what is the "main stream" which should be promoted, and what is "wrong", which should be severely punished. The totalitarian (or fundamentalist) doctrines are everywhere. Let's build some more huge screening walls, and forbid the presence of people who think otherwise, and we shall be Great Again. Jerzy Karczmarczuk /Caen, France/ /* */ --- L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast. https://www.avast.com/antivirus -------------- next part -------------- An HTML attachment was scrubbed... URL: From ok at cs.otago.ac.nz Fri Mar 17 04:44:31 2017 From: ok at cs.otago.ac.nz (Richard A. O'Keefe) Date: Fri, 17 Mar 2017 17:44:31 +1300 Subject: [Haskell-cafe] To [] Or Not To [] In-Reply-To: <9407a40c-56d3-2dde-f3a0-1961aeadc454@unicaen.fr> References: <3D33FF16-5F5C-4E9D-8615-7BC3D1A88CE0@aatal-apotheke.de> <45baa886-d4d0-2dd6-0f04-bbc2c1bf471c@unicaen.fr> <9407a40c-56d3-2dde-f3a0-1961aeadc454@unicaen.fr> Message-ID: <3DE5217F-E93B-4FB7-B282-D0FFA2C860C2@cs.otago.ac.nz> This department has participated in regional and international programming contests at tertiary levels about as long as it has been possible to do so. One of the major problems for the organisers of such events is ensuring that working environments for all permitted programming languages are installed (and compatible) on the machines the contestants will use. These days with things like Docker it should be straightforward to set this up once and just push it out to all the machines, but it was not always so. With respect to schools, the sad fact of the matter is that school IT syllabi are often set without the input of any really clued-up programmers. The NZ curriculum was revised not that long ago, and we had some input into it, as a result of which I *think* Python is used in some classrooms. I remember one programming contest where I was supposed to be a local judge, but was ever so glad that nobody needed me, as I spent the entire period *trying* to write and run "Hello World" with Visual Age for Java, which I had never previously seen, and never wish to see again. Pity any contestant who hadn't seen it... So, if we want Haskell (or F#, or whatever) allowed, - it has to be taught by enough schools, - we have to make it easy for the organisers to install the same environment that the pupils will have used. From clintonmead at gmail.com Fri Mar 17 10:14:08 2017 From: clintonmead at gmail.com (Clinton Mead) Date: Fri, 17 Mar 2017 21:14:08 +1100 Subject: [Haskell-cafe] Tools to assist with development cycle of hackage packages Message-ID: I've only just started uploading packages to hackage (my package listing is here ) but currently there's a lot of repetitive activities for creating and updating packages. For example, here's the steps in creating a package: 1. Initialise a repository on github 2. Initialise git repository locally 3. Set github repository as remote 4. Add a LICENSE file 5. Add a standard ".gitignore file" 6. Create a cabal file with the appropriate files that hackage requires including: 1. Git repository source 2. Issues page 3. Licence 4. Licence file 7. Run multi-ghc-travis to create a ".travis.yml" file 8. Make an initial commit and push 9. Refresh travis-ci.org's repository list so it detects the new repository There's also the stack stuff, but the GUI I'm using, IntelliJ with a Haskell plugin, handles most of that. It also creates a cabal file, but it's missing a number of key fields as mentioned above. When I actually want to upload the package I go though these steps: 1. Push to github 2. Wait for Travis-CI to compile the package (this is a test to ensure it builds in a clean remote environment). 3. Run "cabal sdist 2>&1" 4. Parse the output of sdist to see where the dist file is. 5. Run "hup packup fileFromSDist" to upload the package, putting in my hackage user/pass 6. Run "hup docboth", to both build and upload the documentation. 7. Tag the commit as a release Currently, I've got two scripts with help with a lot of this, but it's a bit adhoc, and it's not fully automated (for example, I still have to manually ensure all the correct fields are in the cabal file, usually by copy/pasting from another package and modifying). Are there any tools that I haven't found that make this process a bit more painless? I'm a bit new to this area, and I've only started using git recently as a prelude to uploading my Haskell packages, so admittedly I may have missed something obvious or perhaps I'm just doing it all wrong. But if other people do find it painful like me, perhaps I'll put some effort into rewriting my perl scripts into nice haskell packages and executables for others to use. -------------- next part -------------- An HTML attachment was scrubbed... URL: From adam at bergmark.nl Fri Mar 17 10:40:45 2017 From: adam at bergmark.nl (Adam Bergmark) Date: Fri, 17 Mar 2017 10:40:45 +0000 Subject: [Haskell-cafe] Tools to assist with development cycle of hackage packages In-Reply-To: References: Message-ID: The stack templates are quite nice. The default is missing #1 #5 #6.2 #7 #8 #9. Setting up external services is of course a bit more involved but maybe that can be added to an external tool extending stack? But dot ask the stack maintainers as well for their opinion! The others I think should be fine to add, possibly as options. But I haven't looked into customizing templates or much other than the default template so maybe some of this is already in there somewhere. I'm slowly moving away from local .gitignore files, in ~/.gitconfig you can ignoring globally by specify e.g. [core] excludesfile = /Users/adam.bergmark/.gitignore-global `stack upload` does sdist + upload and can store your hackage credentials. Sounds like hup or a tool extending it might be a good starting place to do take care of the release process. I'd for instance want it to check that the travis build for the tag (or commit hash which would happen first) succeeded before uploading. I'm not aware of other work in this area but I haven't looked. Cheers, Adam On Fri, 17 Mar 2017 at 11:17 Clinton Mead wrote: > I've only just started uploading packages to hackage (my package listing > is here ) but currently there's > a lot of repetitive activities for creating and updating packages. > > For example, here's the steps in creating a package: > > > 1. Initialise a repository on github > 2. Initialise git repository locally > 3. Set github repository as remote > 4. Add a LICENSE file > 5. Add a standard ".gitignore file" > 6. Create a cabal file with the appropriate files that hackage > requires including: > 1. Git repository source > 2. Issues page > 3. Licence > 4. Licence file > 7. Run multi-ghc-travis to > create a ".travis.yml" file > 8. Make an initial commit and push > 9. Refresh travis-ci.org's repository list so it detects the new > repository > > There's also the stack stuff, but the GUI I'm using, IntelliJ with a > Haskell plugin, handles most of that. It also creates a cabal file, but > it's missing a number of key fields as mentioned above. > > When I actually want to upload the package I go though these steps: > > > 1. Push to github > 2. Wait for Travis-CI to compile the package (this is a test to ensure > it builds in a clean remote environment). > 3. Run "cabal sdist 2>&1" > 4. Parse the output of sdist to see where the dist file is. > 5. Run "hup packup > fileFromSDist" to upload the package, putting in my hackage user/pass > 6. Run "hup docboth", to both build and upload the documentation. > 7. Tag the commit as a release > > Currently, I've got two scripts with help with a lot of this, but it's a > bit adhoc, and it's not fully automated (for example, I still have to > manually ensure all the correct fields are in the cabal file, usually by > copy/pasting from another package and modifying). > > Are there any tools that I haven't found that make this process a bit more > painless? I'm a bit new to this area, and I've only started using git > recently as a prelude to uploading my Haskell packages, so admittedly I may > have missed something obvious or perhaps I'm just doing it all wrong. > > But if other people do find it painful like me, perhaps I'll put some > effort into rewriting my perl scripts into nice haskell packages and > executables for others to use. > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From svenpanne at gmail.com Fri Mar 17 11:14:49 2017 From: svenpanne at gmail.com (Sven Panne) Date: Fri, 17 Mar 2017 12:14:49 +0100 Subject: [Haskell-cafe] Tools to assist with development cycle of hackage packages In-Reply-To: References: Message-ID: 2017-03-17 11:40 GMT+01:00 Adam Bergmark : > [...] I'm slowly moving away from local .gitignore files, in ~/.gitconfig > you can ignoring globally by specify e.g. > > [core] > excludesfile = /Users/adam.bergmark/.gitignore-global > [...] > Just a small remark about this: IMHO this is a bit unfriendly to people checking out and building your package. They neither have your global ~/.gitignore-global nor your local repository configuration. So in my opinion .gitignore files really belong *into* any project, maintaining them is not really that hard... -------------- next part -------------- An HTML attachment was scrubbed... URL: From clintonmead at gmail.com Fri Mar 17 11:29:58 2017 From: clintonmead at gmail.com (Clinton Mead) Date: Fri, 17 Mar 2017 11:29:58 +0000 Subject: [Haskell-cafe] Tools to assist with development cycle of hackage packages In-Reply-To: References: Message-ID: Does "stack upload" build and upload the docs or will I still need "hup" for that? On Fri, 17 Mar 2017 at 9:40 pm, Adam Bergmark wrote: > The stack templates are quite nice. The default is missing #1 #5 #6.2 #7 > #8 #9. Setting up external services is of course a bit more involved but > maybe that can be added to an external tool extending stack? But dot ask > the stack maintainers as well for their opinion! The others I think should > be fine to add, possibly as options. But I haven't looked into customizing > templates or much other than the default template so maybe some of this is > already in there somewhere. > > > I'm slowly moving away from local .gitignore files, in ~/.gitconfig you > can ignoring globally by specify e.g. > > [core] > excludesfile = /Users/adam.bergmark/.gitignore-global > > > `stack upload` does sdist + upload and can store your hackage credentials. > > > Sounds like hup or a tool extending it might be a good starting place to > do take care of the release process. I'd for instance want it to check that > the travis build for the tag (or commit hash which would happen first) > succeeded before uploading. I'm not aware of other work in this area but I > haven't looked. > > Cheers, > Adam > > > On Fri, 17 Mar 2017 at 11:17 Clinton Mead wrote: > > I've only just started uploading packages to hackage (my package listing > is here ) but currently there's > a lot of repetitive activities for creating and updating packages. > > For example, here's the steps in creating a package: > > > 1. Initialise a repository on github > 2. Initialise git repository locally > 3. Set github repository as remote > 4. Add a LICENSE file > 5. Add a standard ".gitignore file" > 6. Create a cabal file with the appropriate files that hackage > requires including: > 1. Git repository source > 2. Issues page > 3. Licence > 4. Licence file > 7. Run multi-ghc-travis to > create a ".travis.yml" file > 8. Make an initial commit and push > 9. Refresh travis-ci.org's repository list so it detects the new > repository > > There's also the stack stuff, but the GUI I'm using, IntelliJ with a > Haskell plugin, handles most of that. It also creates a cabal file, but > it's missing a number of key fields as mentioned above. > > When I actually want to upload the package I go though these steps: > > > 1. Push to github > 2. Wait for Travis-CI to compile the package (this is a test to ensure > it builds in a clean remote environment). > 3. Run "cabal sdist 2>&1" > 4. Parse the output of sdist to see where the dist file is. > 5. Run "hup packup > fileFromSDist" to upload the package, putting in my hackage user/pass > 6. Run "hup docboth", to both build and upload the documentation. > 7. Tag the commit as a release > > Currently, I've got two scripts with help with a lot of this, but it's a > bit adhoc, and it's not fully automated (for example, I still have to > manually ensure all the correct fields are in the cabal file, usually by > copy/pasting from another package and modifying). > > Are there any tools that I haven't found that make this process a bit more > painless? I'm a bit new to this area, and I've only started using git > recently as a prelude to uploading my Haskell packages, so admittedly I may > have missed something obvious or perhaps I'm just doing it all wrong. > > But if other people do find it painful like me, perhaps I'll put some > effort into rewriting my perl scripts into nice haskell packages and > executables for others to use. > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From esz at posteo.de Fri Mar 17 11:31:54 2017 From: esz at posteo.de (Ertugrul =?utf-8?Q?S=C3=B6ylemez?=) Date: Fri, 17 Mar 2017 12:31:54 +0100 Subject: [Haskell-cafe] Tools to assist with development cycle of hackage packages In-Reply-To: References: Message-ID: <87bmt09m1h.fsf@posteo.de> > Are there any tools that I haven't found that make this process a bit > more painless? I'm a bit new to this area, and I've only started using > git recently as a prelude to uploading my Haskell packages, so > admittedly I may have missed something obvious or perhaps I'm just > doing it all wrong. Yes. Instead of creating a new repo, clone a template repo, then just replace every instance of "SKELETON" by the new project's name -- a script can do that. Bonus: if you have to make a change to all your projects, just change the template and then merge. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 487 bytes Desc: not available URL: From adam at adamsteen.com.au Fri Mar 17 11:47:21 2017 From: adam at adamsteen.com.au (Adam Steen) Date: Fri, 17 Mar 2017 19:47:21 +0800 Subject: [Haskell-cafe] =?utf-8?b?SG93IGNhbiBJIHVzZSDigJxjYWJhbCByZXBs4oCd?= =?utf-8?q?_without_base?= Message-ID: Hi How can I use cabal repl (ghci) without base? The following contrived example shows the error -- minimal.hsmodule Minimal where myId :: a -> a myId x = x and -- minimal.cabal name: minimal version: 0.0.1 build-type: Simple cabal-version: >= 1.10 library exposed-modules: Minimal --build-depends: base default-language: Haskell2010 default-extensions: NoImplicitPrelude cabal build succeeds $ cabal build Building minimal-0.0.1... Preprocessing library minimal-0.0.1...[1 of 1] Compiling Minimal ( Minimal.hs, dist\build\Minimal.o ) but cabal repl fails $ cabal repl Preprocessing library minimal-0.0.1... GHCi, version 8.0.2: http://www.haskell.org/ghc/ :? for help :1:6: error: Not in scope: `System.IO.hSetBuffering' No module named `System.IO' is imported. :1:30: error: Not in scope: `System.IO.stdin' No module named `System.IO' is imported. :1:46: error: Not in scope: data constructor `System.IO.NoBuffering' No module named `System.IO' is imported. :1:70: error: Not in scope: `System.IO.hSetBuffering' No module named `System.IO' is imported. :1:94: error: Not in scope: `System.IO.stdout' No module named `System.IO' is imported. :1:111: error: Not in scope: data constructor `System.IO.NoBuffering' No module named `System.IO' is imported. :1:135: error: Not in scope: `System.IO.hSetBuffering' No module named `System.IO' is imported. :1:159: error: Not in scope: `System.IO.stderr' No module named `System.IO' is imported. :1:176: error: Not in scope: data constructor `System.IO.NoBuffering' No module named `System.IO' is imported. if i restore "build-depends: base" if works as expected. $ cabal repl Preprocessing library minimal-0.0.1... GHCi, version 8.0.2: http://www.haskell.org/ghc/ :? for help[1 of 1] Compiling Minimal ( Minimal.hs, interpreted ) Ok, modules loaded: Minimal.*Minimal> i know just keeping "build-depends: base" will make it work, but thats not what i am asking. Note: this also applies for stack Cheers Adam ps this is cross posted from stackoverflow -------------- next part -------------- An HTML attachment was scrubbed... URL: From adam at bergmark.nl Fri Mar 17 12:00:44 2017 From: adam at bergmark.nl (Adam Bergmark) Date: Fri, 17 Mar 2017 12:00:44 +0000 Subject: [Haskell-cafe] Tools to assist with development cycle of hackage packages In-Reply-To: <87bmt09m1h.fsf@posteo.de> References: <87bmt09m1h.fsf@posteo.de> Message-ID: That's a very good idea, thanks! On Fri, 17 Mar 2017 at 12:44, Ertugrul Söylemez wrote: > > Are there any tools that I haven't found that make this process a bit > > more painless? I'm a bit new to this area, and I've only started using > > git recently as a prelude to uploading my Haskell packages, so > > admittedly I may have missed something obvious or perhaps I'm just > > doing it all wrong. > > Yes. Instead of creating a new repo, clone a template repo, then just > replace every instance of "SKELETON" by the new project's name -- a > script can do that. Bonus: if you have to make a change to all your > projects, just change the template and then merge. > _______________________________________________ > 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 toad3k at gmail.com Fri Mar 17 12:18:25 2017 From: toad3k at gmail.com (David McBride) Date: Fri, 17 Mar 2017 08:18:25 -0400 Subject: [Haskell-cafe] Tools to assist with development cycle of hackage packages In-Reply-To: References: Message-ID: Stack upload doesn't seem to upload docs itself. But hackage seemed to build docs for my project without much of a hitch. I know that it has been backed up at some points in the past, but as of yesterday it seems to be working fine. On Fri, Mar 17, 2017 at 7:29 AM, Clinton Mead wrote: > Does "stack upload" build and upload the docs or will I still need "hup" for > that? > > On Fri, 17 Mar 2017 at 9:40 pm, Adam Bergmark wrote: >> >> The stack templates are quite nice. The default is missing #1 #5 #6.2 #7 >> #8 #9. Setting up external services is of course a bit more involved but >> maybe that can be added to an external tool extending stack? But dot ask the >> stack maintainers as well for their opinion! The others I think should be >> fine to add, possibly as options. But I haven't looked into customizing >> templates or much other than the default template so maybe some of this is >> already in there somewhere. >> >> >> I'm slowly moving away from local .gitignore files, in ~/.gitconfig you >> can ignoring globally by specify e.g. >> >> [core] >> excludesfile = /Users/adam.bergmark/.gitignore-global >> >> >> `stack upload` does sdist + upload and can store your hackage credentials. >> >> >> Sounds like hup or a tool extending it might be a good starting place to >> do take care of the release process. I'd for instance want it to check that >> the travis build for the tag (or commit hash which would happen first) >> succeeded before uploading. I'm not aware of other work in this area but I >> haven't looked. >> >> Cheers, >> Adam >> >> >> On Fri, 17 Mar 2017 at 11:17 Clinton Mead wrote: >>> >>> I've only just started uploading packages to hackage (my package listing >>> is here) but currently there's a lot of repetitive activities for creating >>> and updating packages. >>> >>> For example, here's the steps in creating a package: >>> >>> Initialise a repository on github >>> Initialise git repository locally >>> Set github repository as remote >>> Add a LICENSE file >>> Add a standard ".gitignore file" >>> Create a cabal file with the appropriate files that hackage requires >>> including: >>> >>> Git repository source >>> Issues page >>> Licence >>> Licence file >>> >>> Run multi-ghc-travis to create a ".travis.yml" file >>> Make an initial commit and push >>> Refresh travis-ci.org's repository list so it detects the new repository >>> >>> There's also the stack stuff, but the GUI I'm using, IntelliJ with a >>> Haskell plugin, handles most of that. It also creates a cabal file, but it's >>> missing a number of key fields as mentioned above. >>> >>> When I actually want to upload the package I go though these steps: >>> >>> Push to github >>> Wait for Travis-CI to compile the package (this is a test to ensure it >>> builds in a clean remote environment). >>> Run "cabal sdist 2>&1" >>> Parse the output of sdist to see where the dist file is. >>> Run "hup packup fileFromSDist" to upload the package, putting in my >>> hackage user/pass >>> Run "hup docboth", to both build and upload the documentation. >>> Tag the commit as a release >>> >>> Currently, I've got two scripts with help with a lot of this, but it's a >>> bit adhoc, and it's not fully automated (for example, I still have to >>> manually ensure all the correct fields are in the cabal file, usually by >>> copy/pasting from another package and modifying). >>> >>> Are there any tools that I haven't found that make this process a bit >>> more painless? I'm a bit new to this area, and I've only started using git >>> recently as a prelude to uploading my Haskell packages, so admittedly I may >>> have missed something obvious or perhaps I'm just doing it all wrong. >>> >>> But if other people do find it painful like me, perhaps I'll put some >>> effort into rewriting my perl scripts into nice haskell packages and >>> executables for others to use. >>> >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> To (un)subscribe, modify options or view archives go to: >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>> Only members subscribed via the mailman list are allowed to post. > > > _______________________________________________ > 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 adam at bergmark.nl Fri Mar 17 12:19:59 2017 From: adam at bergmark.nl (Adam Bergmark) Date: Fri, 17 Mar 2017 12:19:59 +0000 Subject: [Haskell-cafe] =?utf-8?b?SG93IGNhbiBJIHVzZSDigJxjYWJhbCByZXBs4oCd?= =?utf-8?q?_without_base?= In-Reply-To: References: Message-ID: This is needed for ghci to print results so i dont' think there's a workaround. You could use a cabal flag to configure your lib for repl use base conditionally, or so i assume. Or use an exe or test suite that adds the dep. HTH, Adam On Fri, 17 Mar 2017 at 12:51, Adam Steen wrote: > Hi > > How can I use cabal repl (ghci) without base? > > The following contrived example shows the error > > -- minimal.hsmodule Minimal where > > myId :: a -> a > myId x = x > > and > > -- minimal.cabal > name: minimal > version: 0.0.1 > build-type: Simple > cabal-version: >= 1.10 > > library > exposed-modules: Minimal > --build-depends: base > default-language: Haskell2010 > default-extensions: NoImplicitPrelude > > cabal build succeeds > > $ cabal build > Building minimal-0.0.1... > Preprocessing library minimal-0.0.1...[1 of 1] Compiling Minimal ( Minimal.hs, dist\build\Minimal.o ) > > but cabal repl fails > > $ cabal repl > Preprocessing library minimal-0.0.1... > GHCi, version 8.0.2: http://www.haskell.org/ghc/ :? for help > :1:6: error: > Not in scope: `System.IO.hSetBuffering' > No module named `System.IO' is imported. > :1:30: error: > Not in scope: `System.IO.stdin' > No module named `System.IO' is imported. > :1:46: error: > Not in scope: data constructor `System.IO.NoBuffering' > No module named `System.IO' is imported. > :1:70: error: > Not in scope: `System.IO.hSetBuffering' > No module named `System.IO' is imported. > :1:94: error: > Not in scope: `System.IO.stdout' > No module named `System.IO' is imported. > :1:111: error: > Not in scope: data constructor `System.IO.NoBuffering' > No module named `System.IO' is imported. > :1:135: error: > Not in scope: `System.IO.hSetBuffering' > No module named `System.IO' is imported. > :1:159: error: > Not in scope: `System.IO.stderr' > No module named `System.IO' is imported. > :1:176: error: > Not in scope: data constructor `System.IO.NoBuffering' > No module named `System.IO' is imported. > > if i restore "build-depends: base" if works as expected. > > $ cabal repl > Preprocessing library minimal-0.0.1... > GHCi, version 8.0.2: http://www.haskell.org/ghc/ :? for help[1 of 1] Compiling Minimal ( Minimal.hs, interpreted ) > Ok, modules loaded: Minimal.*Minimal> > > i know just keeping "build-depends: base" will make it work, but thats not > what i am asking. > > Note: this also applies for stack > > Cheers > > Adam > > > ps this is cross posted from stackoverflow > > _______________________________________________ > 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 mblazevic at stilo.com Fri Mar 17 14:27:40 2017 From: mblazevic at stilo.com (=?UTF-8?Q?Mario_Bla=c5=beevi=c4=87?=) Date: Fri, 17 Mar 2017 10:27:40 -0400 Subject: [Haskell-cafe] Looking for maintainers or comaintainers on my Haskell projects In-Reply-To: References: <902b313f-c5d9-65ba-7bfb-a4f23a506219@stilo.com> <3d9df2e1-da47-0445-9ba6-ec79f0509005@ciktel.net> <80730a19-af97-f27b-7a98-10c8b750ee28@stilo.com> Message-ID: <8ade67d6-ef9b-a47c-c227-0b4003ec9fc7@stilo.com> On 2017-03-16 05:26 PM, Ben Franksen wrote: > I am glad my remark didn't scare you off, in retrospect my wording was > perhaps a bit strong. Yes, John did a lot to make things as lazy as > possible to avoid excessive memory consumption (cool to say that, isn't > it). There is also some ugly type casting (unsafeCoerce) going on, since > the parser keeps the alternatives in an array (remember that this is a > packrat parser). I should be able to replace the array with a user-defined record, I submitted a paper to this year's ICFP demonstrating this. The only problem would be backward compatibility, but if there are no current users there's no problem. > Unfortunately I can't spare the time to work on this ATM. But I would be > glad if you would revive the project. PEGs offer some unique advantages > for day-to-day parsing tasks, where you can't be bothered to write a > separate lexer or mess around with 'try' until your harmless looking > grammar actually accepts the source language. A fair portion of these > can nowadays be handled nicely with regex-applicative (many file formats > are actually regular) but now and again there is one where you need the > power of a CFG. We're on the same page here. I have a solution in mind that would allow one to choose a parsing algorithm, from Parsec-style to Packrat to parallel-parsing CFGs, and apply it to a single grammar specification written with little syntactic overhead compared to Parsec. Some of it is written up, some half-implemented. From monkleyon at gmail.com Fri Mar 17 14:31:14 2017 From: monkleyon at gmail.com (MarLinn) Date: Fri, 17 Mar 2017 15:31:14 +0100 Subject: [Haskell-cafe] Has anyone used Graql in Haskell? In-Reply-To: References: Message-ID: Hi Jeffrey, at least two of the pages you link to reference the github of the package, which has a very short example. That alone is not very useful, but the magic seems to happen in the runMatchfunction. That function obviously comes from is the package you linked to, so we know where to find the source code. There you can see that runMatch basically just callsrunGraql. (And it also presents the results in a somewhat nicer form than pure json, but that's not relevant.) The runGraql function in turn is just a few lines below in the source code and exposes thatit does nothing more than call the graql.sh shell script. So all the library does is to add a bit of Haskell type checking on top of the Java+JavaScript+Bash proprietary behemoth. That means even if someone has a Haskell program, the core question is how to use the graql.sh script – which is outside the scope of a Haskell mailing list I suppose, but I hope the Grakn project has some documentation about that. The Grakn approach to modeling a knowledge graph looks good, but I'm not even sure if we have something equivalent Haskell-side. We do have the necessary hypergraph libraries and all, and it's a fun area, so we probably do. But I highly doubt whatever we do have supports Graql. After all, why use an extra language if you can use functions directly? Sorry I have to disappoint you there. Cheers, MarLinn On 2017-03-14 04:53, Jeffrey Brown wrote: > Graql[1] is a (and stands for) graph query language. It is unusually > expressive, allowing relationships to be members of other > relationships[2] -- effectively, allowing one edge to be an endpoint > of another edge. > > Someone named Felix posted a Haskell library for generating Graql > queries[3]. > > Does anyone have a Haskell program that not only generates but uses > such a query? > > > [1] https://hackage.haskell.org/package/graql > [2] https://discuss.grakn.ai/t/nested-relationships/ > [3] https://discuss.grakn.ai/t/graql-haskell-how-to-run-the-test-program/ > > > -- > Jeff Brown | Jeffrey Benjamin Brown > Website | Facebook > | LinkedIn > (spammy, so I often > miss messages here) |Github > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Fri Mar 17 15:28:39 2017 From: allbery.b at gmail.com (Brandon Allbery) Date: Fri, 17 Mar 2017 11:28:39 -0400 Subject: [Haskell-cafe] Tools to assist with development cycle of hackage packages In-Reply-To: References: Message-ID: Hackage doc building was broken for close to a year, and a lot of people seem to have concluded that it is therefore permanently broken. But quite a lot of work was put into (a) fixing problems (b) adding monitoring so the problems can be detected quickly and fixed if they recur; it's been working for at least 6 months now, and seems fairly stable. (That said, at this point I will not be surprised if the consensus of the community is "no no it is broken forever! always work around it!") On Fri, Mar 17, 2017 at 8:18 AM, David McBride wrote: > Stack upload doesn't seem to upload docs itself. But hackage seemed > to build docs for my project without much of a hitch. I know that it > has been backed up at some points in the past, but as of yesterday it > seems to be working fine. > > On Fri, Mar 17, 2017 at 7:29 AM, Clinton Mead > wrote: > > Does "stack upload" build and upload the docs or will I still need "hup" > for > > that? > > > > On Fri, 17 Mar 2017 at 9:40 pm, Adam Bergmark wrote: > >> > >> The stack templates are quite nice. The default is missing #1 #5 #6.2 #7 > >> #8 #9. Setting up external services is of course a bit more involved but > >> maybe that can be added to an external tool extending stack? But dot > ask the > >> stack maintainers as well for their opinion! The others I think should > be > >> fine to add, possibly as options. But I haven't looked into customizing > >> templates or much other than the default template so maybe some of this > is > >> already in there somewhere. > >> > >> > >> I'm slowly moving away from local .gitignore files, in ~/.gitconfig you > >> can ignoring globally by specify e.g. > >> > >> [core] > >> excludesfile = /Users/adam.bergmark/.gitignore-global > >> > >> > >> `stack upload` does sdist + upload and can store your hackage > credentials. > >> > >> > >> Sounds like hup or a tool extending it might be a good starting place to > >> do take care of the release process. I'd for instance want it to check > that > >> the travis build for the tag (or commit hash which would happen first) > >> succeeded before uploading. I'm not aware of other work in this area > but I > >> haven't looked. > >> > >> Cheers, > >> Adam > >> > >> > >> On Fri, 17 Mar 2017 at 11:17 Clinton Mead > wrote: > >>> > >>> I've only just started uploading packages to hackage (my package > listing > >>> is here) but currently there's a lot of repetitive activities for > creating > >>> and updating packages. > >>> > >>> For example, here's the steps in creating a package: > >>> > >>> Initialise a repository on github > >>> Initialise git repository locally > >>> Set github repository as remote > >>> Add a LICENSE file > >>> Add a standard ".gitignore file" > >>> Create a cabal file with the appropriate files that hackage requires > >>> including: > >>> > >>> Git repository source > >>> Issues page > >>> Licence > >>> Licence file > >>> > >>> Run multi-ghc-travis to create a ".travis.yml" file > >>> Make an initial commit and push > >>> Refresh travis-ci.org's repository list so it detects the new > repository > >>> > >>> There's also the stack stuff, but the GUI I'm using, IntelliJ with a > >>> Haskell plugin, handles most of that. It also creates a cabal file, > but it's > >>> missing a number of key fields as mentioned above. > >>> > >>> When I actually want to upload the package I go though these steps: > >>> > >>> Push to github > >>> Wait for Travis-CI to compile the package (this is a test to ensure it > >>> builds in a clean remote environment). > >>> Run "cabal sdist 2>&1" > >>> Parse the output of sdist to see where the dist file is. > >>> Run "hup packup fileFromSDist" to upload the package, putting in my > >>> hackage user/pass > >>> Run "hup docboth", to both build and upload the documentation. > >>> Tag the commit as a release > >>> > >>> Currently, I've got two scripts with help with a lot of this, but it's > a > >>> bit adhoc, and it's not fully automated (for example, I still have to > >>> manually ensure all the correct fields are in the cabal file, usually > by > >>> copy/pasting from another package and modifying). > >>> > >>> Are there any tools that I haven't found that make this process a bit > >>> more painless? I'm a bit new to this area, and I've only started using > git > >>> recently as a prelude to uploading my Haskell packages, so admittedly > I may > >>> have missed something obvious or perhaps I'm just doing it all wrong. > >>> > >>> But if other people do find it painful like me, perhaps I'll put some > >>> effort into rewriting my perl scripts into nice haskell packages and > >>> executables for others to use. > >>> > >>> _______________________________________________ > >>> Haskell-Cafe mailing list > >>> To (un)subscribe, modify options or view archives go to: > >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > >>> Only members subscribed via the mailman list are allowed to post. > > > > > > _______________________________________________ > > 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. > -- 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 vasiliy.l at gmail.com Fri Mar 17 17:14:37 2017 From: vasiliy.l at gmail.com (Vasiliy) Date: Fri, 17 Mar 2017 20:14:37 +0300 Subject: [Haskell-cafe] Has anyone used Graql in Haskell? In-Reply-To: References: Message-ID: <3e94654b-b474-4a18-029e-a63725e4cdc6@gmail.com> Hi Grakn.ai data model looks very much like RDF[1] with SPARQL[2] as a query language. There are quite a few data stores, owl reasoners and various libraries to work with rdf. There are haskell packages as well: rdf4h[3] for data representation, hsparql[4] to create and submit queries to sparql stores, swish[5] is a semantic web toolkit. Hope that would be helpful for you. [1] https://www.w3.org/TR/rdf11-concepts/ [2] https://www.w3.org/TR/sparql11-query/ [3] https://hackage.haskell.org/package/rdf4h [4] https://hackage.haskell.org/package/hsparql [5] https://hackage.haskell.org/package/swish -- Best Regards Vasiliy On 03/14/2017 06:53 AM, Jeffrey Brown wrote: > Graql[1] is a (and stands for) graph query language. It is unusually > expressive, allowing relationships to be members of other relationships[2] > -- effectively, allowing one edge to be an endpoint of another edge. > > Someone named Felix posted a Haskell library for generating Graql > queries[3]. > > Does anyone have a Haskell program that not only generates but uses such a > query? > > > [1] https://hackage.haskell.org/package/graql > [2] https://discuss.grakn.ai/t/nested-relationships/ > [3] https://discuss.grakn.ai/t/graql-haskell-how-to-run-the-test-program/ > > > > > _______________________________________________ > 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 jeffbrown.the at gmail.com Fri Mar 17 18:32:45 2017 From: jeffbrown.the at gmail.com (Jeffrey Brown) Date: Fri, 17 Mar 2017 11:32:45 -0700 Subject: [Haskell-cafe] Has anyone used Graql in Haskell? In-Reply-To: <3e94654b-b474-4a18-029e-a63725e4cdc6@gmail.com> References: <3e94654b-b474-4a18-029e-a63725e4cdc6@gmail.com> Message-ID: Thanks, Vasiliy and MarLinn! I didn't realize the underlying behemoth was proprietary. That's a deal-killer for me. I was excited about Graql because they say it makes nested relationships easy to represent. I once wrote a toolkit in Haskell for that[1], using the Functional Graph Library. Below I've included a demo of it, in case anyone is interested. I would like to integrate it with Sparql and other semweb tools. [1] https://github.com/JeffreyBenjaminBrown/digraphs-with-text/ -- make an empty graph > let g = empty :: RSLT -- add three words to it > g <- pure $ foldl (flip insWord) g ["the cat","water","living organism"] -- add three relationship templates. -- Templates resemble edge labels, but with arbitrary arity and nesting. > g <- pure $ foldl (flip insTplt) g ["_ needs _", "_ is a _","_ because _"] -- view the graph so far > view g $ nodes g (0,"the cat") -- Expressions 0, 1 and 2 are "Words" (1,"water") (2,"living organism") (3,"_ #needs _") -- Expressions 3, 4 and 5 are "Tplts" (relationship templates) (4,"_ #(is a) _") (5,"_ #because _") -- use the relationship templates to create two relationships > g <- pure $ fromRight $ insRel 3 [0,1] g > g <- pure $ fromRight $ insRel 4 [0,2] g > view g $ nodes g (0,"the cat") (1,"water") (2,"living organism") (3,"_ #needs _") (4,"_ #(is a) _") (5,"_ #because _") (6,"the cat ##needs water") -- nodes 6 and 7 are the new relationships (7,"the cat ##(is a) living organism") -- nesting! create a "because" relationship between relationships 6 and 7 > g <- pure $ fromRight $ insRel 5 [6,7] g > view g $ nodes g (0,"the cat") (1,"water") (2,"living organism") (3,"_ #needs _") (4,"_ #(is a) _") (5,"_ #because _") (6,"the cat ##needs water") (7,"the cat ##(is a) living organism") (8,"the cat ##needs water ####because the cat ##(is a) living organism") > On Fri, Mar 17, 2017 at 10:14 AM, Vasiliy wrote: > Hi > > Grakn.ai data model looks very much like RDF[1] with SPARQL[2] as a query > language. There are quite a few data stores, owl reasoners and various > libraries to work with rdf. There are haskell packages as well: rdf4h[3] > for > data representation, hsparql[4] to create and submit queries to sparql > stores, > swish[5] is a semantic web toolkit. > > Hope that would be helpful for you. > > > [1] https://www.w3.org/TR/rdf11-concepts/ > [2] https://www.w3.org/TR/sparql11-query/ > [3] https://hackage.haskell.org/package/rdf4h > [4] https://hackage.haskell.org/package/hsparql > [5] https://hackage.haskell.org/package/swish > > -- > Best Regards > Vasiliy > > On 03/14/2017 06:53 AM, Jeffrey Brown wrote: > >> Graql[1] is a (and stands for) graph query language. It is unusually >> expressive, allowing relationships to be members of other relationships[2] >> -- effectively, allowing one edge to be an endpoint of another edge. >> >> Someone named Felix posted a Haskell library for generating Graql >> queries[3]. >> >> Does anyone have a Haskell program that not only generates but uses such a >> query? >> >> >> [1] https://hackage.haskell.org/package/graql >> [2] https://discuss.grakn.ai/t/nested-relationships/ >> [3] https://discuss.grakn.ai/t/graql-haskell-how-to-run-the-test-program/ >> >> >> >> >> _______________________________________________ >> 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. > -- Jeff Brown | Jeffrey Benjamin Brown Website | Facebook | LinkedIn (spammy, so I often miss messages here) | Github -------------- next part -------------- An HTML attachment was scrubbed... URL: From szymonpajzert at gmail.com Fri Mar 17 19:10:52 2017 From: szymonpajzert at gmail.com (Szymon Pajzert) Date: Fri, 17 Mar 2017 20:10:52 +0100 Subject: [Haskell-cafe] Ideas for Haskell Summer of Code In-Reply-To: References: Message-ID: Hello, Do you participate this year in SoC? I don't see Haskell nor GHC listed. Best, Szymon On 2 February 2017 at 15:41, Niki Vazou wrote: > Hello, > > As a preparation for the 2017 edition of Haskell Summer of Code, we are > crowdsourcing project ideas. > > Compiler optimizations, new libraries, desired features, or any other > ideas you would like to see in the Haskell ecosystem. > > You can submit tickets to the Haskell Summer of Code Ideas page: > > https://ghc.haskell.org/trac/summer-of-code/report/1 > > Alternatively, you can tell us your SoC idea by responding to this thread > (and I can generate the ticket). > > Best, > Niki > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gershomb at gmail.com Fri Mar 17 19:25:11 2017 From: gershomb at gmail.com (Gershom B) Date: Fri, 17 Mar 2017 15:25:11 -0400 Subject: [Haskell-cafe] Ideas for Haskell Summer of Code In-Reply-To: References: Message-ID: Unfortunately we weren’t accepted into GSOC. But we _will_ be running our own summer of Haskell! https://www.reddit.com/r/haskell/comments/5wpwkq/summer_of_haskell_2017/ Crowdsourced ideas are still important and welcomed, and we’ll hopefully be puttting up a new webpage at summer.haskell.org shortly and getting the process underway. Cheers, Gershom On March 17, 2017 at 3:12:42 PM, Szymon Pajzert (szymonpajzert at gmail.com) wrote: > Hello, > > Do you participate this year in SoC? I don't see Haskell nor GHC listed. > > Best, > Szymon > > On 2 February 2017 at 15:41, Niki Vazou wrote: > > > Hello, > > > > As a preparation for the 2017 edition of Haskell Summer of Code, we are > > crowdsourcing project ideas. > > > > Compiler optimizations, new libraries, desired features, or any other > > ideas you would like to see in the Haskell ecosystem. > > > > You can submit tickets to the Haskell Summer of Code Ideas page: > > > > https://ghc.haskell.org/trac/summer-of-code/report/1 > > > > Alternatively, you can tell us your SoC idea by responding to this thread > > (and I can generate the ticket). > > > > Best, > > Niki > > > > _______________________________________________ > > 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 monkleyon at gmail.com Fri Mar 17 19:35:44 2017 From: monkleyon at gmail.com (MarLinn) Date: Fri, 17 Mar 2017 20:35:44 +0100 Subject: [Haskell-cafe] Has anyone used Graql in Haskell? In-Reply-To: References: <3e94654b-b474-4a18-029e-a63725e4cdc6@gmail.com> Message-ID: <6bad3008-3538-594e-dbf7-bfade57e3311@gmail.com> > Thanks, Vasiliy and MarLinn! I didn't realize the underlying behemoth > was proprietary. That's a deal-killer for me. Don't just take my word for it. I didn't look at licensing terms or anything. The thing is, it seems to be a startup company, but nowhere did I find what they actually sell. No company can survive without income and there's no mention of support contracts, so I just assumed it must be the software itself, somehow. I just called it "proprietary" because for me there would be no difference: a company that doesn't tell me where the catch is is trying to catch me off guard, so they're working on the level of thugs. Ergo, without me, no matter how interesting the product looks. But I'm a harsh customer and it might be an unintentional blunder seeing how they're a startup, so YMMV. That being said, I don't see a problem representing nested relationships in RDF. And with how simple Graql is, even if Sparql shouldn't fit your needs you might be able to adapt something Graql-like? Sounds like an interesting project in any case! Cheers, MarLinn > I was excited about Graql because they say it makes nested > relationships easy to represent. I once wrote a toolkit in Haskell for > that[1], using the Functional Graph Library. Below I've included a > demo of it, in case anyone is interested. I would like to integrate it > with Sparql and other semweb tools. > > [1] https://github.com/JeffreyBenjaminBrown/digraphs-with-text/ > > -- make an empty graph > > let g = empty :: RSLT > > -- add three words to it > > g <- pure $ foldl (flip insWord) g ["the cat","water","living organism"] > > -- add three relationship templates. > -- Templates resemble edge labels, but with arbitrary arity and nesting. > > g <- pure $ foldl (flip insTplt) g ["_ needs _", "_ is a _","_ > because _"] > > -- view the graph so far > > view g $ nodes g > (0,"the cat") -- Expressions 0, 1 and 2 are "Words" > (1,"water") > (2,"living organism") > (3,"_ #needs _") -- Expressions 3, 4 and 5 are "Tplts" (relationship > templates) > (4,"_ #(is a) _") > (5,"_ #because _") > > -- use the relationship templates to create two relationships > > g <- pure $ fromRight $ insRel 3 [0,1] g > > g <- pure $ fromRight $ insRel 4 [0,2] g > > > view g $ nodes g > (0,"the cat") > (1,"water") > (2,"living organism") > (3,"_ #needs _") > (4,"_ #(is a) _") > (5,"_ #because _") > (6,"the cat ##needs water") -- nodes 6 and 7 are the new relationships > (7,"the cat ##(is a) living organism") > > -- nesting! create a "because" relationship between relationships 6 and 7 > > g <- pure $ fromRight $ insRel 5 [6,7] g > > > view g $ nodes g > (0,"the cat") > (1,"water") > (2,"living organism") > (3,"_ #needs _") > (4,"_ #(is a) _") > (5,"_ #because _") > (6,"the cat ##needs water") > (7,"the cat ##(is a) living organism") > (8,"the cat ##needs water ####because the cat ##(is a) living organism") > > > > > > > On Fri, Mar 17, 2017 at 10:14 AM, Vasiliy > wrote: > > Hi > > Grakn.ai data model looks very much like RDF[1] with SPARQL[2] as > a query > language. There are quite a few data stores, owl reasoners and various > libraries to work with rdf. There are haskell packages as well: > rdf4h[3] for > data representation, hsparql[4] to create and submit queries to > sparql stores, > swish[5] is a semantic web toolkit. > > Hope that would be helpful for you. > > > [1] https://www.w3.org/TR/rdf11-concepts/ > > [2] https://www.w3.org/TR/sparql11-query/ > > [3] https://hackage.haskell.org/package/rdf4h > > [4] https://hackage.haskell.org/package/hsparql > > [5] https://hackage.haskell.org/package/swish > > > -- > Best Regards > Vasiliy > > On 03/14/2017 06:53 AM, Jeffrey Brown wrote: > > Graql[1] is a (and stands for) graph query language. It is > unusually > expressive, allowing relationships to be members of other > relationships[2] > -- effectively, allowing one edge to be an endpoint of another > edge. > > Someone named Felix posted a Haskell library for generating Graql > queries[3]. > > Does anyone have a Haskell program that not only generates but > uses such a > query? > > > [1] https://hackage.haskell.org/package/graql > > [2] https://discuss.grakn.ai/t/nested-relationships/ > > [3] > https://discuss.grakn.ai/t/graql-haskell-how-to-run-the-test-program/ > > > > > > _______________________________________________ > 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. > > > > > -- > Jeff Brown | Jeffrey Benjamin Brown > Website | Facebook > | LinkedIn > (spammy, so I often > miss messages here) |Github > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From blaze at ruddy.ru Fri Mar 17 20:05:59 2017 From: blaze at ruddy.ru (Andrey Sverdlichenko) Date: Fri, 17 Mar 2017 20:05:59 +0000 Subject: [Haskell-cafe] Package takeover: dbus Message-ID: I'd like to take over maintenance of the package dbus. It depends on several other packaged with upper bounds too restrictive for the latest versions. I tried to contact owner a few times weeks ago, but to no avail. My hackage username is blaze. -------------- next part -------------- An HTML attachment was scrubbed... URL: From clintonmead at gmail.com Fri Mar 17 21:29:55 2017 From: clintonmead at gmail.com (Clinton Mead) Date: Fri, 17 Mar 2017 21:29:55 +0000 Subject: [Haskell-cafe] Tools to assist with development cycle of hackage packages In-Reply-To: References: Message-ID: Doc building didn't work for me about two weeks ago, although I only waited for above half an hour. Have things improved since then, or was I just not patient enough? (these are for docs that take seconds to build locally) On Sat, 18 Mar 2017 at 2:28 am, Brandon Allbery wrote: > Hackage doc building was broken for close to a year, and a lot of people > seem to have concluded that it is therefore permanently broken. But quite a > lot of work was put into (a) fixing problems (b) adding monitoring so the > problems can be detected quickly and fixed if they recur; it's been working > for at least 6 months now, and seems fairly stable. > > (That said, at this point I will not be surprised if the consensus of the > community is "no no it is broken forever! always work around it!") > > On Fri, Mar 17, 2017 at 8:18 AM, David McBride wrote: > > Stack upload doesn't seem to upload docs itself. But hackage seemed > to build docs for my project without much of a hitch. I know that it > has been backed up at some points in the past, but as of yesterday it > seems to be working fine. > > On Fri, Mar 17, 2017 at 7:29 AM, Clinton Mead > wrote: > > Does "stack upload" build and upload the docs or will I still need "hup" > for > > that? > > > > On Fri, 17 Mar 2017 at 9:40 pm, Adam Bergmark wrote: > >> > >> The stack templates are quite nice. The default is missing #1 #5 #6.2 #7 > >> #8 #9. Setting up external services is of course a bit more involved but > >> maybe that can be added to an external tool extending stack? But dot > ask the > >> stack maintainers as well for their opinion! The others I think should > be > >> fine to add, possibly as options. But I haven't looked into customizing > >> templates or much other than the default template so maybe some of this > is > >> already in there somewhere. > >> > >> > >> I'm slowly moving away from local .gitignore files, in ~/.gitconfig you > >> can ignoring globally by specify e.g. > >> > >> [core] > >> excludesfile = /Users/adam.bergmark/.gitignore-global > >> > >> > >> `stack upload` does sdist + upload and can store your hackage > credentials. > >> > >> > >> Sounds like hup or a tool extending it might be a good starting place to > >> do take care of the release process. I'd for instance want it to check > that > >> the travis build for the tag (or commit hash which would happen first) > >> succeeded before uploading. I'm not aware of other work in this area > but I > >> haven't looked. > >> > >> Cheers, > >> Adam > >> > >> > >> On Fri, 17 Mar 2017 at 11:17 Clinton Mead > wrote: > >>> > >>> I've only just started uploading packages to hackage (my package > listing > >>> is here) but currently there's a lot of repetitive activities for > creating > >>> and updating packages. > >>> > >>> For example, here's the steps in creating a package: > >>> > >>> Initialise a repository on github > >>> Initialise git repository locally > >>> Set github repository as remote > >>> Add a LICENSE file > >>> Add a standard ".gitignore file" > >>> Create a cabal file with the appropriate files that hackage requires > >>> including: > >>> > >>> Git repository source > >>> Issues page > >>> Licence > >>> Licence file > >>> > >>> Run multi-ghc-travis to create a ".travis.yml" file > >>> Make an initial commit and push > >>> Refresh travis-ci.org's repository list so it detects the new > repository > >>> > >>> There's also the stack stuff, but the GUI I'm using, IntelliJ with a > >>> Haskell plugin, handles most of that. It also creates a cabal file, > but it's > >>> missing a number of key fields as mentioned above. > >>> > >>> When I actually want to upload the package I go though these steps: > >>> > >>> Push to github > >>> Wait for Travis-CI to compile the package (this is a test to ensure it > >>> builds in a clean remote environment). > >>> Run "cabal sdist 2>&1" > >>> Parse the output of sdist to see where the dist file is. > >>> Run "hup packup fileFromSDist" to upload the package, putting in my > >>> hackage user/pass > >>> Run "hup docboth", to both build and upload the documentation. > >>> Tag the commit as a release > >>> > >>> Currently, I've got two scripts with help with a lot of this, but it's > a > >>> bit adhoc, and it's not fully automated (for example, I still have to > >>> manually ensure all the correct fields are in the cabal file, usually > by > >>> copy/pasting from another package and modifying). > >>> > >>> Are there any tools that I haven't found that make this process a bit > >>> more painless? I'm a bit new to this area, and I've only started using > git > >>> recently as a prelude to uploading my Haskell packages, so admittedly > I may > >>> have missed something obvious or perhaps I'm just doing it all wrong. > >>> > >>> But if other people do find it painful like me, perhaps I'll put some > >>> effort into rewriting my perl scripts into nice haskell packages and > >>> executables for others to use. > >>> > >>> _______________________________________________ > >>> Haskell-Cafe mailing list > >>> To (un)subscribe, modify options or view archives go to: > >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > >>> Only members subscribed via the mailman list are allowed to post. > > > > > > _______________________________________________ > > 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. > > > > > -- > 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 svenpanne at gmail.com Fri Mar 17 21:41:31 2017 From: svenpanne at gmail.com (Sven Panne) Date: Fri, 17 Mar 2017 22:41:31 +0100 Subject: [Haskell-cafe] Tools to assist with development cycle of hackage packages In-Reply-To: References: Message-ID: 2017-03-17 22:29 GMT+01:00 Clinton Mead : > Doc building didn't work for me about two weeks ago, although I only > waited for above half an hour. Have things improved since then, or was I > just not patient enough? (these are for docs that take seconds to build > locally) > In the past it took several hours to build the docs, but I've got no recent numbers. How long it takes locally is largely irrelevant, the main problem on Hackage seemed to be the scheduling of the doc building task (or the absence of it ;-)... Cheers, S. -------------- next part -------------- An HTML attachment was scrubbed... URL: From p75213 at gmail.com Sat Mar 18 05:52:12 2017 From: p75213 at gmail.com (p75213 at gmail.com) Date: Sat, 18 Mar 2017 15:52:12 +1000 Subject: [Haskell-cafe] Loop with the StateT monad In-Reply-To: References: Message-ID: <06db6532-d386-4a71-5695-6fc09dc55e0e@gmail.com> This is an exercise to learn the StateT monad. The program implements the game Morra. The two players are the computer and a person. The state accumulates the score of the computer and player. The program works for one iteration of function morra only. However I am at a loss how to loop it. I have tried a few things but nothing seems to work. I have narrowed the problem down to the "p <- liftIO getChar" statement. The second time through the loop it isn't executed. I have bracketed the statement with "liftIO $ putStrLn "before" and liftIO $ putStrLn "after". This is the program: module Morra where import Control.Monad.Trans.State.Lazy import Control.Monad.IO.Class import Data.Char (isDigit, digitToInt) import System.Random (randomRIO) import Control.Monad (when) morra :: StateT (Int, Int) IO () morra = do liftIO $ putStrLn "before" p <- liftIO getChar liftIO $ putStrLn "after" when (isDigit p) $ do let p' = digitToInt p c <- liftIO $ randomRIO (1, 2) liftIO $ putStrLn ("P: " ++ [p]) liftIO $ putStrLn ("C: " ++ show c) (pt, ct) <- get if even (c + p') then do liftIO $ putStrLn "Computer Wins" put (pt, ct + 1) else do liftIO $ putStrLn "Player Wins" put (pt + 1, ct) morra main :: IO () main = do putStrLn "-- p is Player" putStrLn "-- c is Computer" putStrLn "-- Player is odds, Computer is evens." (personS,compS) <- execStateT morra (0,0) putStrLn ("Person Score: " ++ show personS) putStrLn ("Computer Score: " ++ show compS) if personS > compS then putStrLn "Winner is Person" else putStrLn "Winner is Computer" and this is the output: *Morra> main -- p is Player -- c is Computer -- Player is odds, Computer is evens. before 1 after P: 1 C: 2 Player Wins before after Person Score: 1 Computer Score: 0 Winner is Person *Morra> From allbery.b at gmail.com Sat Mar 18 06:45:16 2017 From: allbery.b at gmail.com (Brandon Allbery) Date: Sat, 18 Mar 2017 02:45:16 -0400 Subject: [Haskell-cafe] Loop with the StateT monad In-Reply-To: <06db6532-d386-4a71-5695-6fc09dc55e0e@gmail.com> References: <06db6532-d386-4a71-5695-6fc09dc55e0e@gmail.com> Message-ID: On Sat, Mar 18, 2017 at 1:52 AM, wrote: > I have narrowed > the problem down to the "p <- liftIO getChar" statement. > It does run the second time, and gets the newline following the entered character. You should probably use getLine, or learn how your platform switches between default line-oriented input and character-oriented --- and how to switch it back afterward. (In C on Unix-like systems, this involves termios.) -- 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 rae at cs.brynmawr.edu Sat Mar 18 17:32:16 2017 From: rae at cs.brynmawr.edu (Richard Eisenberg) Date: Sat, 18 Mar 2017 13:32:16 -0400 Subject: [Haskell-cafe] benchmarking a function that returns an unlifted type Message-ID: Apologies for a newbie question, but I am seeking advice on how to benchmark a pure function that returns an unlifted type. I've heard tell that `criterion` is good for benchmarking, and so I'm using that library (but have no particular allegiance to it, if something else is better). Specifically, I'm comparing a function over unlifted types with the same function written over lifted types, trying to observe how much we pay for the boxing/unboxing. To benchmark the lifted version, I just use criterion's whnf function. That seems to be working splendidly. Of course, whnf doesn't work over unlifted types, so I found its source code and inlined it. This compiles. But it doesn't work! No matter what I do, the unlifted version measures in the nanoseconds. I'm guessing that GHC "cleverly" is avoiding recomputation. How can I stop this? Here is my code: > main :: IO () > main = do > initializeTime > let lifted = whnf fastSumPrimes 100000 > > unlifted = Benchmarkable go > where > go n > | n <= 0 = return () > | otherwise = let x = fastSumPrimes# 100000# in go (n-1) > > benchmark lifted > benchmark unlifted I've tried increasing the argument in the unlifted case, to no avail. I've also tried using `case` instead of `let`. -ddump-simpl suggests that fastSumPrimes# is really being called, but I'm dubious. Can anyone offer advice? Thanks! Richard From oleg.grenrus at iki.fi Sat Mar 18 17:41:35 2017 From: oleg.grenrus at iki.fi (Oleg Grenrus) Date: Sat, 18 Mar 2017 19:41:35 +0200 Subject: [Haskell-cafe] benchmarking a function that returns an unlifted type In-Reply-To: References: Message-ID: Won't boxing at the end work, that should have only single unboxing/boxing action: unlifted = whnf (\Int# n -> Int# (fastSumPrimes# n)) 100000 - Oleg On 18.03.2017 19:32, Richard Eisenberg wrote: > Apologies for a newbie question, but I am seeking advice on how to benchmark a pure function that returns an unlifted type. I've heard tell that `criterion` is good for benchmarking, and so I'm using that library (but have no particular allegiance to it, if something else is better). > > Specifically, I'm comparing a function over unlifted types with the same function written over lifted types, trying to observe how much we pay for the boxing/unboxing. To benchmark the lifted version, I just use criterion's whnf function. That seems to be working splendidly. Of course, whnf doesn't work over unlifted types, so I found its source code and inlined it. This compiles. But it doesn't work! No matter what I do, the unlifted version measures in the nanoseconds. I'm guessing that GHC "cleverly" is avoiding recomputation. How can I stop this? > > Here is my code: > >> main :: IO () >> main = do >> initializeTime >> let lifted = whnf fastSumPrimes 100000 >> >> unlifted = Benchmarkable go >> where >> go n >> | n <= 0 = return () >> | otherwise = let x = fastSumPrimes# 100000# in go (n-1) >> >> benchmark lifted >> benchmark unlifted > I've tried increasing the argument in the unlifted case, to no avail. I've also tried using `case` instead of `let`. -ddump-simpl suggests that fastSumPrimes# is really being called, but I'm dubious. > > Can anyone offer advice? > > Thanks! > Richard > _______________________________________________ > 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: 819 bytes Desc: OpenPGP digital signature URL: From david.feuer at gmail.com Sat Mar 18 20:11:08 2017 From: david.feuer at gmail.com (David Feuer) Date: Sat, 18 Mar 2017 16:11:08 -0400 Subject: [Haskell-cafe] benchmarking a function that returns an unlifted type In-Reply-To: References: Message-ID: The critical feature of whnf (as I understand it) is that GHC does not use the static argument transformation. The function passed to "go" therefore doesn't inline into it. So you'll have to write your version in some fashion that similarly prevents undesirable inlining. Could you just copy the code and specialize it to the desired type? On Mar 18, 2017 1:32 PM, "Richard Eisenberg" wrote: Apologies for a newbie question, but I am seeking advice on how to benchmark a pure function that returns an unlifted type. I've heard tell that `criterion` is good for benchmarking, and so I'm using that library (but have no particular allegiance to it, if something else is better). Specifically, I'm comparing a function over unlifted types with the same function written over lifted types, trying to observe how much we pay for the boxing/unboxing. To benchmark the lifted version, I just use criterion's whnf function. That seems to be working splendidly. Of course, whnf doesn't work over unlifted types, so I found its source code and inlined it. This compiles. But it doesn't work! No matter what I do, the unlifted version measures in the nanoseconds. I'm guessing that GHC "cleverly" is avoiding recomputation. How can I stop this? Here is my code: > main :: IO () > main = do > initializeTime > let lifted = whnf fastSumPrimes 100000 > > unlifted = Benchmarkable go > where > go n > | n <= 0 = return () > | otherwise = let x = fastSumPrimes# 100000# in go (n-1) > > benchmark lifted > benchmark unlifted I've tried increasing the argument in the unlifted case, to no avail. I've also tried using `case` instead of `let`. -ddump-simpl suggests that fastSumPrimes# is really being called, but I'm dubious. Can anyone offer advice? Thanks! Richard _______________________________________________ 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.franksen at online.de Sat Mar 18 22:27:35 2017 From: ben.franksen at online.de (Ben Franksen) Date: Sat, 18 Mar 2017 23:27:35 +0100 Subject: [Haskell-cafe] Loop with the StateT monad In-Reply-To: References: <06db6532-d386-4a71-5695-6fc09dc55e0e@gmail.com> Message-ID: Am 18.03.2017 um 07:45 schrieb Brandon Allbery: > On Sat, Mar 18, 2017 at 1:52 AM, wrote: > >> I have narrowed >> the problem down to the "p <- liftIO getChar" statement. >> > > It does run the second time, and gets the newline following the entered > character. You should probably use getLine, or learn how your platform > switches between default line-oriented input and character-oriented --- and > how to switch it back afterward. (In C on Unix-like systems, this involves > termios.) System.IO.hSetBuffering is your friend ben at yuiitsu1:~> ghci Prelude> import System.IO Prelude System.IO> :info hSetBuffering hSetBuffering :: Handle -> BufferMode -> IO () Prelude System.IO> :info BufferMode data BufferMode = NoBuffering | LineBuffering | BlockBuffering (Maybe Int) Prelude System.IO> hSetBuffering stdin NoBuffering Prelude System.IO> getChar >> getChar Prelude System.IO> getChar >> getChar xy'y' # prompt returns immediately after i hit 'y' Prelude System.IO> From allbery.b at gmail.com Sat Mar 18 22:34:30 2017 From: allbery.b at gmail.com (Brandon Allbery) Date: Sat, 18 Mar 2017 18:34:30 -0400 Subject: [Haskell-cafe] Loop with the StateT monad In-Reply-To: References: <06db6532-d386-4a71-5695-6fc09dc55e0e@gmail.com> Message-ID: On Sat, Mar 18, 2017 at 6:27 PM, Ben Franksen wrote: > System.IO.hSetBuffering is your friend Except when it's your enemy: https://github.com/commercialhaskell/stack/issues/2884 see also http://tunes.org/~nef/logs/haskell/17.03.18 at 02:48:19 and following. This conflation is stupid, prone to cause problems when multiple processes are involved, and needs to go away. Trying to hide the difference between buffering and tty mode from users just causes problems, because buffering is process local but the tty mode is shared between all processes using the tty. -- 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 ben.franksen at online.de Sat Mar 18 22:51:57 2017 From: ben.franksen at online.de (Ben Franksen) Date: Sat, 18 Mar 2017 23:51:57 +0100 Subject: [Haskell-cafe] Loop with the StateT monad In-Reply-To: References: <06db6532-d386-4a71-5695-6fc09dc55e0e@gmail.com> Message-ID: Am 18.03.2017 um 23:34 schrieb Brandon Allbery: > On Sat, Mar 18, 2017 at 6:27 PM, Ben Franksen > wrote: > >> System.IO.hSetBuffering is your friend > > > Except when it's your enemy: > https://github.com/commercialhaskell/stack/issues/2884 see also > http://tunes.org/~nef/logs/haskell/17.03.18 at 02:48:19 and following. > > This conflation is stupid, prone to cause problems when multiple processes > are involved, and needs to go away. Trying to hide the difference between > buffering and tty mode from users just causes problems, because buffering > is process local but the tty mode is shared between all processes using the > tty. I don't understand. """ geekosaur commented on 30 Dec 2016 some ghc versions back, ghc's Unix runtime started conflating NoBuffering with stty -icanon """ What exactly is meant here with "conflate"? When you turn off buffering for stdin, then of course backspace cannot work. That should be clear. Cheers Ben From allbery.b at gmail.com Sat Mar 18 23:08:50 2017 From: allbery.b at gmail.com (Brandon Allbery) Date: Sat, 18 Mar 2017 19:08:50 -0400 Subject: [Haskell-cafe] Loop with the StateT monad In-Reply-To: References: <06db6532-d386-4a71-5695-6fc09dc55e0e@gmail.com> Message-ID: On Sat, Mar 18, 2017 at 6:51 PM, Ben Franksen wrote: > What exactly is meant here with "conflate"? > Confusing two distinct mechanisms that appear on the surface to be similar. See below for why this is an inappropriate conflation. > > When you turn off buffering for stdin, then of course backspace cannot > work. That should be clear. > Except that is not true anywhere but recent versions of ghc's runtime, and (specifically because they use readline or editline) things like Python's REPL. Try it in a simple C program. Buffering means the program reads in chunks instead of character at a time. This is an attribute of a program, specifically of whatever I/O library it is using. It does not include line editing (you don't generally want to interpret a backspace in a text file you are reading. You *certainly* don't want to interpret control-C or control-D). Things like backspace *do not live in the program*, unless you are using a library like readline or editline. For most programs, they rely on the tty driver to do this. This is why stty works from the shell, not as instrumentation for whatever program. The default on Unixlikes is line mode (stty icanon), which implements basic line editing and only sends a line to the program when you press Enter or the EOF character (in the middle of a line, this will send the incomplete line; press it a second time, or on an empty line, and the program gets a zero-character read response, which is the standard Unix EOF indication). In ghc this is complicated by two things: - ghci uses haskeline, a readline alternative, so the tty is always in -icanon. Compiled ghc programs do not use haskeline unless specifically written to do so. - At some point, the ghc runtime started tweaking termios settings in hSetBuffering. This is incomplete (per the IRC log I mentioned, apparently nothing at all is done with LineBuffering), and causes confusion when multiple ghc-compiled programs are involved (the program starts out in LineBuffering and assumes stty icanon, but whether the tty is in icanon or -icanon depends on what the invoking program did; this is the stack bug I linked). On Windows, this works differently; IIRC, whether you see "character mode" or "line mode" depends on which API you use for reads, and line editing indeed lives within the program. -- 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 ben.franksen at online.de Sat Mar 18 23:12:14 2017 From: ben.franksen at online.de (Ben Franksen) Date: Sun, 19 Mar 2017 00:12:14 +0100 Subject: [Haskell-cafe] Looking for maintainers or comaintainers on my Haskell projects In-Reply-To: <8ade67d6-ef9b-a47c-c227-0b4003ec9fc7@stilo.com> References: <902b313f-c5d9-65ba-7bfb-a4f23a506219@stilo.com> <3d9df2e1-da47-0445-9ba6-ec79f0509005@ciktel.net> <80730a19-af97-f27b-7a98-10c8b750ee28@stilo.com> <8ade67d6-ef9b-a47c-c227-0b4003ec9fc7@stilo.com> Message-ID: Am 17.03.2017 um 15:27 schrieb Mario Blažević: > On 2017-03-16 05:26 PM, Ben Franksen wrote: >> I am glad my remark didn't scare you off, in retrospect my wording was >> perhaps a bit strong. Yes, John did a lot to make things as lazy as >> possible to avoid excessive memory consumption (cool to say that, isn't >> it). There is also some ugly type casting (unsafeCoerce) going on, since >> the parser keeps the alternatives in an array (remember that this is a >> packrat parser). > > I should be able to replace the array with a user-defined record, I > submitted a paper to this year's ICFP demonstrating this. That sounds interesting. Looking forward to read that. > The only > problem would be backward compatibility, but if there are no current > users there's no problem. >> Unfortunately I can't spare the time to work on this ATM. But I would be >> glad if you would revive the project. PEGs offer some unique advantages >> for day-to-day parsing tasks, where you can't be bothered to write a >> separate lexer or mess around with 'try' until your harmless looking >> grammar actually accepts the source language. A fair portion of these >> can nowadays be handled nicely with regex-applicative (many file formats >> are actually regular) but now and again there is one where you need the >> power of a CFG. > > We're on the same page here. I have a solution in mind that would > allow one to choose a parsing algorithm, from Parsec-style to Packrat to > parallel-parsing CFGs, and apply it to a single grammar specification > written with little syntactic overhead compared to Parsec. Some of it is > written up, some half-implemented. My gut feeling would be so say that this can't work because they all build on a different (though /almost/ the same) set of primitives. For instance, IIRC the semantics of 'many' differs in subtle ways between implementations (greedy vs. maximum munch -- but don't ask me about the details its been a while since I studied these things). Cheers Ben From ben.franksen at online.de Sat Mar 18 23:57:35 2017 From: ben.franksen at online.de (Ben Franksen) Date: Sun, 19 Mar 2017 00:57:35 +0100 Subject: [Haskell-cafe] Loop with the StateT monad In-Reply-To: References: <06db6532-d386-4a71-5695-6fc09dc55e0e@gmail.com> Message-ID: Am 19.03.2017 um 00:08 schrieb Brandon Allbery: > On Sat, Mar 18, 2017 at 6:51 PM, Ben Franksen > wrote: > >> What exactly is meant here with "conflate"? > > Confusing two distinct mechanisms that appear on the surface to be similar. > See below for why this is an inappropriate conflation. My question was meant as "technically, how exactly do they do the conflation". So IIUC you say that when I use hSetBuffering, nowadays it does /more/ then just change buffering mode, it /also/ (sometimes) reconfigures the terminal. And this is the reason it can be used for the purpose of the OP but it is a bad idea to rely on that because that 'feature' was a bad idea in the first place. >> When you turn off buffering for stdin, then of course backspace cannot >> work. That should be clear. > > Except that is not true anywhere but recent versions of ghc's runtime, and > (specifically because they use readline or editline) things like Python's > REPL. Try it in a simple C program. I was not aware of that. I just tried it in C and it turns out you are right. > Buffering means the program reads in chunks instead of character at a time. > This is an attribute of a program, specifically of whatever I/O library it > is using. Of course. > It does not include line editing (you don't generally want to > interpret a backspace in a text file you are reading. You *certainly* don't > want to interpret control-C or control-D). Hm, no, probably not. > Things like backspace *do not live in the program*, unless you are using a > library like readline or editline. As long as you leave control over these things to the terminal, yes. But what if your program wants to control that itself? E.g. react to keystrokes, rather than edited lines, as the OP seemed to want? I guess what I want to say/ask is: if it is a bad idea to conflate terminal configuration and buffering (and i agree it is: it mis-educated me to think this is how it works in Unix), could and should not Haskell still offer a simple and portable way to configure this (explicitly) from inside the program? Should I import haskeline just to turn off the terminal's line editing mode? Cheers Ben From allbery.b at gmail.com Sun Mar 19 00:27:29 2017 From: allbery.b at gmail.com (Brandon Allbery) Date: Sat, 18 Mar 2017 20:27:29 -0400 Subject: [Haskell-cafe] Loop with the StateT monad In-Reply-To: References: <06db6532-d386-4a71-5695-6fc09dc55e0e@gmail.com> Message-ID: On Sat, Mar 18, 2017 at 7:57 PM, Ben Franksen wrote: > As long as you leave control over these things to the terminal, yes. But > what if your program wants to control that itself? E.g. react to > keystrokes, rather than edited lines, as the OP seemed to want? > https://downloads.haskell.org/~ghc/8.0.2/docs/html/libraries/unix-2.7.2.1/System-Posix-Terminal.html Admittedly some wrappers would be nice... but with care, lest you reproduce the same issues stack is having. -- 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 ben.franksen at online.de Sun Mar 19 10:33:41 2017 From: ben.franksen at online.de (Ben Franksen) Date: Sun, 19 Mar 2017 11:33:41 +0100 Subject: [Haskell-cafe] Loop with the StateT monad In-Reply-To: References: <06db6532-d386-4a71-5695-6fc09dc55e0e@gmail.com> Message-ID: Am 19.03.2017 um 01:27 schrieb Brandon Allbery: > On Sat, Mar 18, 2017 at 7:57 PM, Ben Franksen > wrote: > >> As long as you leave control over these things to the terminal, yes. But >> what if your program wants to control that itself? E.g. react to >> keystrokes, rather than edited lines, as the OP seemed to want? >> > > https://downloads.haskell.org/~ghc/8.0.2/docs/html/libraries/unix-2.7.2.1/System-Posix-Terminal.html Can System.Posix.Terminal be used on Windows? > Admittedly some wrappers would be nice... but with care, lest you reproduce > the same issues stack is having. Right. With hindsight it seems obvious how to do this right: save the initial terminal settings and restore them when the program exits. Let's see if haskeline does the right thing. The following seems to work: import System.Console.Haskeline getKey = runInputT defaultSettings (getInputChar "") main = getKey >>= print Now we want to see if this leaves the terminal in the same state as it was before. Unfortunately the obvious thing doesn't work: import System.Console.Haskeline import System.Posix.Terminal getKey = runInputT defaultSettings (getInputChar "") main = do before <- getTerminalAttributes 0 getKey >>= print after <- getTerminalAttributes 0 print (before == after) because there is no Eq instance for TerminalAttributes. So I asked stty: before=$(stty -a) ./test after=$(stty -a) if test "$before" = "$after"; then echo good; else echo bad; fi and that reports "good". So, perhaps a better answer to the OP would have been: import System.Console.Haskeline then define getKey = runInputT defaultSettings (getInputChar "") and use that instead of getChar. Cheers Ben From adam at bergmark.nl Sun Mar 19 16:19:42 2017 From: adam at bergmark.nl (Adam Bergmark) Date: Sun, 19 Mar 2017 16:19:42 +0000 Subject: [Haskell-cafe] Best practices for linting wrt performance Message-ID: I'd like to make aeson hlint clean. aeson contains a lot of performance optimizations which made me wonder; Which linting refactorings should you think twice about when it comes to performance? The best way to find an answer to this for aeson is of course to run the benchmarks, but are there any rules-of-thumb that you take into account when linting? Here's the default hlint output for the current aeson master: https://gist.github.com/bergmark/5dd63c24fe6bdcf67eae0e88495a24e7 Cheers, Adam -------------- next part -------------- An HTML attachment was scrubbed... URL: From mail at joachim-breitner.de Sun Mar 19 16:32:59 2017 From: mail at joachim-breitner.de (Joachim Breitner) Date: Sun, 19 Mar 2017 12:32:59 -0400 Subject: [Haskell-cafe] Best practices for linting wrt performance In-Reply-To: References: Message-ID: <1489941179.31214.4.camel@joachim-breitner.de> Hi, Am Sonntag, den 19.03.2017, 16:19 +0000 schrieb Adam Bergmark: > The best way to find an answer to this for aeson is of course to run > the benchmarks, but are there any rules-of-thumb that you take into > account when linting? eta-reduction can increase sharing but can also increase the cost of a function call, so that’s something to be careful about. Greetings, Joachim -- Joachim Breitner mail at joachim-breitner.de http://www.joachim-breitner.de/ -------------- 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 adam at bergmark.nl Sun Mar 19 19:36:36 2017 From: adam at bergmark.nl (Adam Bergmark) Date: Sun, 19 Mar 2017 19:36:36 +0000 Subject: [Haskell-cafe] Best practices for linting wrt performance In-Reply-To: <1489941179.31214.4.camel@joachim-breitner.de> References: <1489941179.31214.4.camel@joachim-breitner.de> Message-ID: Thanks Joachim! I actually found a note about that in the aeson sources so I'm using ignore "Avoid lambda" ignore "Eta reduce" Cheers, Adam On Sun, 19 Mar 2017 at 17:34 Joachim Breitner wrote: > Hi, > > Am Sonntag, den 19.03.2017, 16:19 +0000 schrieb Adam Bergmark: > > The best way to find an answer to this for aeson is of course to run > > the benchmarks, but are there any rules-of-thumb that you take into > > account when linting? > > eta-reduction can increase sharing but can also increase the cost of a > function call, so that’s something to be careful about. > > Greetings, > Joachim > -- > Joachim Breitner > mail at joachim-breitner.de > http://www.joachim-breitner.de/ > _______________________________________________ > 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 Sun Mar 19 20:24:18 2017 From: ollie at ocharles.org.uk (Oliver Charles) Date: Sun, 19 Mar 2017 20:24:18 +0000 Subject: [Haskell-cafe] Best practices for linting wrt performance In-Reply-To: References: <1489941179.31214.4.camel@joachim-breitner.de> Message-ID: Is that "redundant case" actually acting like seq? On Sun, Mar 19, 2017 at 7:39 PM Adam Bergmark wrote: > Thanks Joachim! I actually found a note about that in the aeson sources so > I'm using > > ignore "Avoid lambda" > ignore "Eta reduce" > > Cheers, > Adam > > > On Sun, 19 Mar 2017 at 17:34 Joachim Breitner > wrote: > > Hi, > > Am Sonntag, den 19.03.2017, 16:19 +0000 schrieb Adam Bergmark: > > The best way to find an answer to this for aeson is of course to run > > the benchmarks, but are there any rules-of-thumb that you take into > > account when linting? > > eta-reduction can increase sharing but can also increase the cost of a > function call, so that’s something to be careful about. > > Greetings, > Joachim > -- > Joachim Breitner > mail at joachim-breitner.de > http://www.joachim-breitner.de/ > _______________________________________________ > 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 adam at bergmark.nl Sun Mar 19 20:48:51 2017 From: adam at bergmark.nl (Adam Bergmark) Date: Sun, 19 Mar 2017 20:48:51 +0000 Subject: [Haskell-cafe] Best practices for linting wrt performance In-Reply-To: References: <1489941179.31214.4.camel@joachim-breitner.de> Message-ID: It was part of some CPP so I guessed that was the only reason. There's no indication that this code should act like seq https://github.com/bos/aeson/commit/f25ac48afd3534f3b951140e448061bea83b7d28#diff-eedba5bbe31b1a9bc142d620e77614edL2397 On Sun, 19 Mar 2017 at 21:24 Oliver Charles wrote: > Is that "redundant case" actually acting like seq? > > On Sun, Mar 19, 2017 at 7:39 PM Adam Bergmark wrote: > > Thanks Joachim! I actually found a note about that in the aeson sources so > I'm using > > ignore "Avoid lambda" > ignore "Eta reduce" > > Cheers, > Adam > > > On Sun, 19 Mar 2017 at 17:34 Joachim Breitner > wrote: > > Hi, > > Am Sonntag, den 19.03.2017, 16:19 +0000 schrieb Adam Bergmark: > > The best way to find an answer to this for aeson is of course to run > > the benchmarks, but are there any rules-of-thumb that you take into > > account when linting? > > eta-reduction can increase sharing but can also increase the cost of a > function call, so that’s something to be careful about. > > Greetings, > Joachim > -- > Joachim Breitner > mail at joachim-breitner.de > http://www.joachim-breitner.de/ > _______________________________________________ > 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 olf at aatal-apotheke.de Sun Mar 19 21:29:18 2017 From: olf at aatal-apotheke.de (Olaf Klinke) Date: Sun, 19 Mar 2017 22:29:18 +0100 Subject: [Haskell-cafe] To [] Or Not To [] Message-ID: <034322E3-4F7D-4EA9-8D84-5650917C8CFF@aatal-apotheke.de> Just adding to the programming contest anecdotes. Here is what happens if you issue an applied math assignment without specifying the programming language to be used. The first student solves it in bash, to demonstrate how inefficient the solution can be. The second student writes a Turing machine simulator in Maple (I can't recall whether it was the brainf*ck dialect), then programs that Turing machine. The third student writes the solution in postscript and makes the printer solve the differential equation. All were languages available in the setting. I have no idea whether any of the above submissions were inspected by the tutor, but received a mark. Olaf From allbery.b at gmail.com Sun Mar 19 22:01:04 2017 From: allbery.b at gmail.com (Brandon Allbery) Date: Sun, 19 Mar 2017 18:01:04 -0400 Subject: [Haskell-cafe] To [] Or Not To [] In-Reply-To: <034322E3-4F7D-4EA9-8D84-5650917C8CFF@aatal-apotheke.de> References: <034322E3-4F7D-4EA9-8D84-5650917C8CFF@aatal-apotheke.de> Message-ID: I did that in a relatively boring math course just to try to keep my interest up. (Riemann integration in RM/COBOL, anyone?) On Sun, Mar 19, 2017 at 5:29 PM, Olaf Klinke wrote: > Just adding to the programming contest anecdotes. Here is what happens if > you issue an applied math assignment without specifying the programming > language to be used. The first student solves it in bash, to demonstrate > how inefficient the solution can be. The second student writes a Turing > machine simulator in Maple (I can't recall whether it was the brainf*ck > dialect), then programs that Turing machine. The third student writes the > solution in postscript and makes the printer solve the differential > equation. > All were languages available in the setting. I have no idea whether any of > the above submissions were inspected by the tutor, but received a mark. > > 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. > -- 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 mail at joachim-breitner.de Sun Mar 19 22:43:12 2017 From: mail at joachim-breitner.de (Joachim Breitner) Date: Sun, 19 Mar 2017 18:43:12 -0400 Subject: [Haskell-cafe] Best practices for linting wrt performance In-Reply-To: References: <1489941179.31214.4.camel@joachim-breitner.de> Message-ID: <8DA8BB19-5F5B-4874-9F43-96C128305E46@joachim-breitner.de> Hi, no. A case in Haskell does not necessary force evaluation (in contrast to a case in Core). Greetings, Joachim Am 19. März 2017 16:24:18 EDT schrieb Oliver Charles : >Is that "redundant case" actually acting like seq? > >On Sun, Mar 19, 2017 at 7:39 PM Adam Bergmark wrote: > >> Thanks Joachim! I actually found a note about that in the aeson >sources so >> I'm using >> >> ignore "Avoid lambda" >> ignore "Eta reduce" >> >> Cheers, >> Adam >> >> >> On Sun, 19 Mar 2017 at 17:34 Joachim Breitner > >> wrote: >> >> Hi, >> >> Am Sonntag, den 19.03.2017, 16:19 +0000 schrieb Adam Bergmark: >> > The best way to find an answer to this for aeson is of course to >run >> > the benchmarks, but are there any rules-of-thumb that you take into >> > account when linting? >> >> eta-reduction can increase sharing but can also increase the cost of >a >> function call, so that’s something to be careful about. >> >> Greetings, >> Joachim >> -- >> Joachim Breitner >> mail at joachim-breitner.de >> http://www.joachim-breitner.de/ >> _______________________________________________ >> 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 ollie at ocharles.org.uk Sun Mar 19 22:46:58 2017 From: ollie at ocharles.org.uk (Oliver Charles) Date: Sun, 19 Mar 2017 22:46:58 +0000 Subject: [Haskell-cafe] Best practices for linting wrt performance In-Reply-To: <8DA8BB19-5F5B-4874-9F43-96C128305E46@joachim-breitner.de> References: <1489941179.31214.4.camel@joachim-breitner.de> <8DA8BB19-5F5B-4874-9F43-96C128305E46@joachim-breitner.de> Message-ID: Ah, I stand corrected. Thanks! On Sun, Mar 19, 2017 at 10:46 PM Joachim Breitner wrote: > Hi, > > no. A case in Haskell does not necessary force evaluation (in contrast to > a case in Core). > > Greetings, > Joachim > > Am 19. März 2017 16:24:18 EDT schrieb Oliver Charles < > ollie at ocharles.org.uk>: > >Is that "redundant case" actually acting like seq? > > > >On Sun, Mar 19, 2017 at 7:39 PM Adam Bergmark wrote: > > > >> Thanks Joachim! I actually found a note about that in the aeson > >sources so > >> I'm using > >> > >> ignore "Avoid lambda" > >> ignore "Eta reduce" > >> > >> Cheers, > >> Adam > >> > >> > >> On Sun, 19 Mar 2017 at 17:34 Joachim Breitner > > > >> wrote: > >> > >> Hi, > >> > >> Am Sonntag, den 19.03.2017, 16:19 +0000 schrieb Adam Bergmark: > >> > The best way to find an answer to this for aeson is of course to > >run > >> > the benchmarks, but are there any rules-of-thumb that you take into > >> > account when linting? > >> > >> eta-reduction can increase sharing but can also increase the cost of > >a > >> function call, so that’s something to be careful about. > >> > >> Greetings, > >> Joachim > >> -- > >> Joachim Breitner > >> mail at joachim-breitner.de > >> http://www.joachim-breitner.de/ > >> _______________________________________________ > >> 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 ok at cs.otago.ac.nz Mon Mar 20 06:15:06 2017 From: ok at cs.otago.ac.nz (ok at cs.otago.ac.nz) Date: Mon, 20 Mar 2017 19:15:06 +1300 Subject: [Haskell-cafe] Has anyone used Graql in Haskell? In-Reply-To: References: <3e94654b-b474-4a18-029e-a63725e4cdc6@gmail.com> Message-ID: > Thanks, Vasiliy and MarLinn! I didn't realize the underlying behemoth was > proprietary. That's a deal-killer for me. Colour me surprised. https://github.com/graknlabs/grakn says that the source code is under GPL-3.0. Any RDF kit, like ClioPatria, should be able to do the kind of thing you want. Scaling and reliability will vary. From gershomb at gmail.com Mon Mar 20 19:30:56 2017 From: gershomb at gmail.com (Gershom B) Date: Mon, 20 Mar 2017 15:30:56 -0400 Subject: [Haskell-cafe] Registration Open: Compose 2017, New York, May 18-19 Message-ID: http://www.composeconference.org/2017 Compose is a conference for typed functional programmers, focused specifically on Haskell, OCaml, F#, SML, and related technologies. It will be held in New York on Thursday and Friday, May 18-19, 2017. Early Bird registration is now open at eventbrite: https://www.eventbrite.com/e/cmpse-conference-2017-tickets-32106159387 Additionally, we're happy to announce our keynote speaker as Emily Riehl, who is a professor of mathematics at Johns Hopkins University, and the author of the book Category Theory in Context (as well as much else). To get a sense of Compose, you can check out the great talks from past conferences: https://www.youtube.com/channel/UC0pEknZxL7Q1j0Ok8qImWdQ Finally, as a reminder, the Call for Presentations closes on March 23, so hurry up and get those talk proposals submitted! http://www.composeconference.org/2017/cfp/ Cheers, Gershom From louis at pan.me Tue Mar 21 07:53:59 2017 From: louis at pan.me (Louis Pan) Date: Tue, 21 Mar 2017 18:53:59 +1100 Subject: [Haskell-cafe] Semigroup and Monoid instances for ReaderT Message-ID: Hi all, In my Glazier GUI library, I had to use newtype wrappers to create Semigroup and Monoid instances for ReaderT. Is there a reason why ReaderT doesn't have an instance of Semigroup and Monoid? The reader ((->) a) is a Monoid and a Semigroup. https://hackage.haskell.org/package/base-4.9.1.0/docs/src/ GHC.Base.html#line-268 https://hackage.haskell.org/package/base-4.9.1.0/docs/src/ Data.Semigroup.html#line-150 Could the following be added to the transformers package? Or is it not lawful? instance (Applicative m, Semigroup a) => Semigroup (ReaderT r m a) where f <> g = (<>) <$> f <*> g {-# INLINABLE (<>) #-} instance (Applicative m, Monoid a) => Monoid (ReaderT r m a) where mempty = pure mempty {-# INLINABLE mempty #-} f `mappend` g = mappend <$> f <*> g {-# INLINABLE mappend #-} Does it make sense to extend the monoid instance to all the other transformers? Eg. instance (Monad m, Semigroup a) => Semigroup (StateT s m a) where f <> g = (<>) <$> f <*> g {-# INLINABLE (<>) #-} instance (Monad m, Monoid a) => Monoid (StateT s m a) where mempty = pure mempty {-# INLINABLE mempty #-} f `mappend` g = mappend <$> f <*> g {-# INLINABLE mappend #-} instance (Monad m, Monoid w, Semigroup a) => Semigroup (WriterT w m a) where f <> g = (<>) <$> f <*> g {-# INLINABLE (<>) #-} instance (Monad m, Monoid w, Monoid a) => Monoid (WriterT w m a) where mempty = pure mempty {-# INLINABLE mempty #-} f `mappend` g = mappend <$> f <*> g {-# INLINABLE mappend #-} and also for MaybeT, IdentityT, ExceptT, etc Regards, Louis -------------- next part -------------- An HTML attachment was scrubbed... URL: From litchard.michael at gmail.com Tue Mar 21 16:53:43 2017 From: litchard.michael at gmail.com (Michael Litchard) Date: Tue, 21 Mar 2017 09:53:43 -0700 Subject: [Haskell-cafe] Code Review Request - Unbalanced Parenthesis correction Message-ID: I'm prepping for a coding interview, and am examining the task of correcting unbalanced parentheses. The finger tree seems to be the right data structure. As a proof of concept I've used Data.Sequence to test my idea. If this is the right direction to go, I'll write more specialized finger tree code. The code works on the few test cases I have tried. Feedback appreciated. {-# LANGUAGE ViewPatterns #-}module Parenthesis whereimport BasicPrelude hiding (concat,null,empty) import Data.Sequence hiding (length)import Data.Foldable hiding (length,null) balanceParens :: String -> String balanceParens str = go str [] empty where go [] [] (null -> True) = [] go [] [] parens = Data.Foldable.toList parens go ('(':xs) [] (null -> True) = go xs [RP] (singleton '(') go (')':xs) [] (null -> True) = go xs [] (fromList "()") go ('(':xs) debit parens = go xs (RP:debit) (parens |> '(') go (')':xs) [] parens = go xs [] corrected where corrected = ('(' <| parens) |> ')' go (')':xs) (RP:debit) parens = go xs debit (parens |> ')') go (_:xs) debit parens = go xs debit parens go [] (RP:debit) parens = go [] debit (parens |> ')') example: balanceParens "))(""(())()" balanceParens ")))""((()))" -------------- next part -------------- An HTML attachment was scrubbed... URL: From dct25-561bs at mythic-beasts.com Tue Mar 21 17:13:11 2017 From: dct25-561bs at mythic-beasts.com (David Turner) Date: Tue, 21 Mar 2017 17:13:11 +0000 Subject: [Haskell-cafe] Code Review Request - Unbalanced Parenthesis correction In-Reply-To: References: Message-ID: Hi Michael, Are there any strange constraints on the problem, such as the input string being 10s of GB long, or any particular correction strategy being required? Your code seems to add some parens to the start/end of the entire string to balance it, whereas I think I might have balanced "))(" to "()()()" given free reign. Is the goal efficiency or clarity or something else? >From personal taste, I would recommend including a suite of automated tests alongside your implementation even if it is not explicitly requested. A quickcheck test asserting that the output is always balanced and that the input string is a substring of the output might be appropriate. On 21 March 2017 at 16:53, Michael Litchard wrote: > I'm prepping for a coding interview, and am examining the task of > correcting unbalanced parentheses. The finger tree seems to be the right > data structure. As a proof of concept I've used Data.Sequence to test my > idea. If this is the right direction to go, I'll write more specialized > finger tree code. The code works on the few test cases I have tried. > Feedback appreciated. > > {-# LANGUAGE ViewPatterns #-}module Parenthesis whereimport BasicPrelude hiding (concat,null,empty) > import Data.Sequence hiding (length)import Data.Foldable hiding (length,null) > > balanceParens :: String -> String > balanceParens str = go str [] empty > where > go [] [] (null -> True) = [] > go [] [] parens = Data.Foldable.toList parens > go ('(':xs) [] (null -> True) = go xs [RP] (singleton '(') > go (')':xs) [] (null -> True) = go xs [] (fromList "()") > go ('(':xs) debit parens = go xs (RP:debit) (parens |> '(') > go (')':xs) [] parens = go xs [] corrected > where corrected = ('(' <| parens) |> ')' > go (')':xs) (RP:debit) parens = go xs debit (parens |> ')') > go (_:xs) debit parens = go xs debit parens > go [] (RP:debit) parens = go [] debit (parens |> ')') > > example: > > balanceParens "))(""(())()" > balanceParens ")))""((()))" > > > _______________________________________________ > 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 toad3k at gmail.com Tue Mar 21 17:16:40 2017 From: toad3k at gmail.com (David McBride) Date: Tue, 21 Mar 2017 13:16:40 -0400 Subject: [Haskell-cafe] Code Review Request - Unbalanced Parenthesis correction In-Reply-To: References: Message-ID: Whether your algorithm is correct depends on how you are supposed to rebalance them. My naive attempt gives very different results. bal :: String -> String bal = go 0 where go :: Int -> String -> String go 0 "" = "" go n "" = replicate n ')' go n ('(':xs) = '(' : (go (n + 1) xs) go 0 (')':xs) = '(' : ')' : (go 0 xs) go n (')':xs) = ')' : (go (n - 1) xs) bal "))(" "()()()" bal ")))" "()()()" On Tue, Mar 21, 2017 at 12:53 PM, Michael Litchard wrote: > I'm prepping for a coding interview, and am examining the task of correcting > unbalanced parentheses. The finger tree seems to be the right data > structure. As a proof of concept I've used Data.Sequence to test my idea. If > this is the right direction to go, I'll write more specialized finger tree > code. The code works on the few test cases I have tried. Feedback > appreciated. > > {-# LANGUAGE ViewPatterns #-} > module Parenthesis where > import BasicPrelude hiding (concat,null,empty) > > import Data.Sequence hiding (length) > import Data.Foldable hiding (length,null) > > balanceParens :: String -> String > balanceParens str = go str [] empty > where > go [] [] (null -> True) = [] > go [] [] parens = Data.Foldable.toList parens > go ('(':xs) [] (null -> True) = go xs [RP] (singleton '(') > go (')':xs) [] (null -> True) = go xs [] (fromList "()") > go ('(':xs) debit parens = go xs (RP:debit) (parens |> '(') > go (')':xs) [] parens = go xs [] corrected > where corrected = ('(' <| parens) |> ')' > go (')':xs) (RP:debit) parens = go xs debit (parens |> ')') > go (_:xs) debit parens = go xs debit parens > go [] (RP:debit) parens = go [] debit (parens |> ')') > > example: > > balanceParens "))(" > "(())()" > balanceParens ")))" > "((()))" > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. From dct25-561bs at mythic-beasts.com Tue Mar 21 17:20:52 2017 From: dct25-561bs at mythic-beasts.com (David Turner) Date: Tue, 21 Mar 2017 17:20:52 +0000 Subject: [Haskell-cafe] Code Review Request - Unbalanced Parenthesis correction In-Reply-To: References: Message-ID: My attempt to replicate the OP's strategy but not impl: balanceParens :: String -> String balanceParens s = replicate neededOpening '(' ++ s ++ replicate neededClosing ')' where depthChange '(' = 1 depthChange ')' = -1 depthChange _ = 0 depths = scanl (+) 0 $ map depthChange s neededOpening = negate $ minimum depths neededClosing = last depths + neededOpening On 21 March 2017 at 17:16, David McBride wrote: > Whether your algorithm is correct depends on how you are supposed to > rebalance them. My naive attempt gives very different results. > > bal :: String -> String > bal = go 0 > where > go :: Int -> String -> String > go 0 "" = "" > go n "" = replicate n ')' > go n ('(':xs) = '(' : (go (n + 1) xs) > go 0 (')':xs) = '(' : ')' : (go 0 xs) > go n (')':xs) = ')' : (go (n - 1) xs) > > bal "))(" > "()()()" > > bal ")))" > "()()()" > > On Tue, Mar 21, 2017 at 12:53 PM, Michael Litchard > wrote: > > I'm prepping for a coding interview, and am examining the task of > correcting > > unbalanced parentheses. The finger tree seems to be the right data > > structure. As a proof of concept I've used Data.Sequence to test my > idea. If > > this is the right direction to go, I'll write more specialized finger > tree > > code. The code works on the few test cases I have tried. Feedback > > appreciated. > > > > {-# LANGUAGE ViewPatterns #-} > > module Parenthesis where > > import BasicPrelude hiding (concat,null,empty) > > > > import Data.Sequence hiding (length) > > import Data.Foldable hiding (length,null) > > > > balanceParens :: String -> String > > balanceParens str = go str [] empty > > where > > go [] [] (null -> True) = [] > > go [] [] parens = Data.Foldable.toList parens > > go ('(':xs) [] (null -> True) = go xs [RP] (singleton '(') > > go (')':xs) [] (null -> True) = go xs [] (fromList "()") > > go ('(':xs) debit parens = go xs (RP:debit) (parens |> '(') > > go (')':xs) [] parens = go xs [] corrected > > where corrected = ('(' <| parens) |> ')' > > go (')':xs) (RP:debit) parens = go xs debit (parens |> ')') > > go (_:xs) debit parens = go xs debit parens > > go [] (RP:debit) parens = go [] debit (parens |> ')') > > > > example: > > > > balanceParens "))(" > > "(())()" > > balanceParens ")))" > > "((()))" > > > > > > _______________________________________________ > > Haskell-Cafe mailing list > > To (un)subscribe, modify options or view archives go to: > > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > Only members subscribed via the mailman list are allowed to post. > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael at orlitzky.com Tue Mar 21 17:23:30 2017 From: michael at orlitzky.com (Michael Orlitzky) Date: Tue, 21 Mar 2017 13:23:30 -0400 Subject: [Haskell-cafe] Code Review Request - Unbalanced Parenthesis correction In-Reply-To: References: Message-ID: <2b2b48ba-4fc1-2c27-d710-c4c5fc38b550@orlitzky.com> On 03/21/2017 01:16 PM, David McBride wrote: > Whether your algorithm is correct depends on how you are supposed to > rebalance them. My naive attempt gives very different results. > You guys are trying to hard. Here's an algorithm that meets the stated requirements: balance _ = "" From litchard.michael at gmail.com Tue Mar 21 17:44:04 2017 From: litchard.michael at gmail.com (Michael Litchard) Date: Tue, 21 Mar 2017 10:44:04 -0700 Subject: [Haskell-cafe] Code Review Request - Unbalanced Parenthesis correction In-Reply-To: References: Message-ID: I got this idea from looking at glassdoor comments of previous interviewees. The spec was vague, but I imagined that the requirement would need to be efficient and keep contiguous parenthesis unaltered. so balanceParens ")))" == "()()()" would be incorrect. On Tue, Mar 21, 2017 at 10:20 AM, David Turner < dct25-561bs at mythic-beasts.com> wrote: > My attempt to replicate the OP's strategy but not impl: > > balanceParens :: String -> String > balanceParens s = replicate neededOpening '(' > ++ s ++ replicate neededClosing ')' > where > depthChange '(' = 1 > depthChange ')' = -1 > depthChange _ = 0 > > depths = scanl (+) 0 $ map depthChange s > neededOpening = negate $ minimum depths > neededClosing = last depths + neededOpening > > > > On 21 March 2017 at 17:16, David McBride wrote: > >> Whether your algorithm is correct depends on how you are supposed to >> rebalance them. My naive attempt gives very different results. >> >> bal :: String -> String >> bal = go 0 >> where >> go :: Int -> String -> String >> go 0 "" = "" >> go n "" = replicate n ')' >> go n ('(':xs) = '(' : (go (n + 1) xs) >> go 0 (')':xs) = '(' : ')' : (go 0 xs) >> go n (')':xs) = ')' : (go (n - 1) xs) >> >> bal "))(" >> "()()()" >> >> bal ")))" >> "()()()" >> >> On Tue, Mar 21, 2017 at 12:53 PM, Michael Litchard >> wrote: >> > I'm prepping for a coding interview, and am examining the task of >> correcting >> > unbalanced parentheses. The finger tree seems to be the right data >> > structure. As a proof of concept I've used Data.Sequence to test my >> idea. If >> > this is the right direction to go, I'll write more specialized finger >> tree >> > code. The code works on the few test cases I have tried. Feedback >> > appreciated. >> > >> > {-# LANGUAGE ViewPatterns #-} >> > module Parenthesis where >> > import BasicPrelude hiding (concat,null,empty) >> > >> > import Data.Sequence hiding (length) >> > import Data.Foldable hiding (length,null) >> > >> > balanceParens :: String -> String >> > balanceParens str = go str [] empty >> > where >> > go [] [] (null -> True) = [] >> > go [] [] parens = Data.Foldable.toList parens >> > go ('(':xs) [] (null -> True) = go xs [RP] (singleton '(') >> > go (')':xs) [] (null -> True) = go xs [] (fromList "()") >> > go ('(':xs) debit parens = go xs (RP:debit) (parens |> '(') >> > go (')':xs) [] parens = go xs [] corrected >> > where corrected = ('(' <| parens) |> ')' >> > go (')':xs) (RP:debit) parens = go xs debit (parens |> ')') >> > go (_:xs) debit parens = go xs debit parens >> > go [] (RP:debit) parens = go [] debit (parens |> ')') >> > >> > example: >> > >> > balanceParens "))(" >> > "(())()" >> > balanceParens ")))" >> > "((()))" >> > >> > >> > _______________________________________________ >> > Haskell-Cafe mailing list >> > To (un)subscribe, modify options or view archives go to: >> > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> > Only members subscribed via the mailman list are allowed to post. >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view archives go to: >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> Only members subscribed via the mailman list are allowed to post. >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From monkleyon at gmail.com Tue Mar 21 17:49:30 2017 From: monkleyon at gmail.com (MarLinn) Date: Tue, 21 Mar 2017 18:49:30 +0100 Subject: [Haskell-cafe] Code Review Request - Unbalanced Parenthesis correction In-Reply-To: References: Message-ID: Hi Michael, I think you're making your own task harder than necessary. For one thing, -XViewPatterns is nice, but in this case they hide some of the structure. Most importantly, they hide that all the special null-cases are actually unnecessary because the normal cases already cover them. I would further advise to use layout to reveal even more structure. That's especially useful when you later convert the explicit recursion into a fold. But even then, on a different level you're still working too hard: You're parsing the string and building/correcting the tree in one step. Why not create the tree, convert the tree, and then read out the tree in three steps? It's still the same complexity class but much easier to write and read. And once you are free to think of the tree manipulations on their own it might help recognize optimizations like those the solutions of other commenters use. That's not to say your modifications are useless. But the exploratory phase seems too early to apply them. Cheers, MarLinn On 2017-03-21 17:53, Michael Litchard wrote: > > I'm prepping for a coding interview, and am examining the task of > correcting unbalanced parentheses. The finger tree seems to be the > right data structure. As a proof of concept I've used |Data.Sequence| > to test my idea. If this is the right direction to go, I'll write more > specialized finger tree code. The code works on the few test cases I > have tried. Feedback appreciated. > > |{-# LANGUAGE ViewPatterns #-}moduleParenthesis whereimportBasicPrelude > hiding (concat,null,empty)importData.Sequence hiding > (length)importData.Foldable hiding (length,null)balanceParens ::String > ->String balanceParens str =go str []empty wherego [][](null > ->True)=[]go [][]parens =Data.Foldable.toList parens go > ('(':xs)[](null ->True)=go xs [RP](singleton '(')go (')':xs)[](null > ->True)=go xs [](fromList "()")go ('(':xs)debit parens =go xs > (RP:debit)(parens |>'(')go (')':xs)[]parens =go xs []corrected > wherecorrected =('('<|parens)|>')'go (')':xs)(RP:debit)parens =go xs > debit (parens |>')')go (_:xs)debit parens =go xs debit parens go > [](RP:debit)parens =go []debit (parens |>')')| > > example: > > |balanceParens "))(""(())()"balanceParens ")))""((()))"| > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From dct25-561bs at mythic-beasts.com Tue Mar 21 17:52:55 2017 From: dct25-561bs at mythic-beasts.com (David Turner) Date: Tue, 21 Mar 2017 17:52:55 +0000 Subject: [Haskell-cafe] Code Review Request - Unbalanced Parenthesis correction In-Reply-To: References: Message-ID: ... or it could be a ploy to see how you deal with incomplete or vague specs; how you ask clarifying questions etc. Adding sufficiently many opening parens at the start can't obviously be done without traversing the whole input first, whereas adding them as you discover excesses of closing parens is possible to implement in a streaming fashion, i.e. with O(1) memory usage and only traversing the input once. On 21 Mar 2017 17:44, "Michael Litchard" wrote: I got this idea from looking at glassdoor comments of previous interviewees. The spec was vague, but I imagined that the requirement would need to be efficient and keep contiguous parenthesis unaltered. so balanceParens ")))" == "()()()" would be incorrect. On Tue, Mar 21, 2017 at 10:20 AM, David Turner < dct25-561bs at mythic-beasts.com> wrote: > My attempt to replicate the OP's strategy but not impl: > > balanceParens :: String -> String > balanceParens s = replicate neededOpening '(' > ++ s ++ replicate neededClosing ')' > where > depthChange '(' = 1 > depthChange ')' = -1 > depthChange _ = 0 > > depths = scanl (+) 0 $ map depthChange s > neededOpening = negate $ minimum depths > neededClosing = last depths + neededOpening > > > > On 21 March 2017 at 17:16, David McBride wrote: > >> Whether your algorithm is correct depends on how you are supposed to >> rebalance them. My naive attempt gives very different results. >> >> bal :: String -> String >> bal = go 0 >> where >> go :: Int -> String -> String >> go 0 "" = "" >> go n "" = replicate n ')' >> go n ('(':xs) = '(' : (go (n + 1) xs) >> go 0 (')':xs) = '(' : ')' : (go 0 xs) >> go n (')':xs) = ')' : (go (n - 1) xs) >> >> bal "))(" >> "()()()" >> >> bal ")))" >> "()()()" >> >> On Tue, Mar 21, 2017 at 12:53 PM, Michael Litchard >> wrote: >> > I'm prepping for a coding interview, and am examining the task of >> correcting >> > unbalanced parentheses. The finger tree seems to be the right data >> > structure. As a proof of concept I've used Data.Sequence to test my >> idea. If >> > this is the right direction to go, I'll write more specialized finger >> tree >> > code. The code works on the few test cases I have tried. Feedback >> > appreciated. >> > >> > {-# LANGUAGE ViewPatterns #-} >> > module Parenthesis where >> > import BasicPrelude hiding (concat,null,empty) >> > >> > import Data.Sequence hiding (length) >> > import Data.Foldable hiding (length,null) >> > >> > balanceParens :: String -> String >> > balanceParens str = go str [] empty >> > where >> > go [] [] (null -> True) = [] >> > go [] [] parens = Data.Foldable.toList parens >> > go ('(':xs) [] (null -> True) = go xs [RP] (singleton '(') >> > go (')':xs) [] (null -> True) = go xs [] (fromList "()") >> > go ('(':xs) debit parens = go xs (RP:debit) (parens |> '(') >> > go (')':xs) [] parens = go xs [] corrected >> > where corrected = ('(' <| parens) |> ')' >> > go (')':xs) (RP:debit) parens = go xs debit (parens |> ')') >> > go (_:xs) debit parens = go xs debit parens >> > go [] (RP:debit) parens = go [] debit (parens |> ')') >> > >> > example: >> > >> > balanceParens "))(" >> > "(())()" >> > balanceParens ")))" >> > "((()))" >> > >> > >> > _______________________________________________ >> > 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 litchard.michael at gmail.com Tue Mar 21 18:04:24 2017 From: litchard.michael at gmail.com (Michael Litchard) Date: Tue, 21 Mar 2017 11:04:24 -0700 Subject: [Haskell-cafe] Code Review Request - Unbalanced Parenthesis correction In-Reply-To: References: Message-ID: David, Am I mistaken in believing the code I have in both O(1) in time and space? I'm certain that my use of Data.Sequence, and therefore finger trees, has this code at O(1) time. Doesn't using a lazy list mean I am using O(1) space? Or, would I have to use the conduits or pipes library? On Tue, Mar 21, 2017 at 10:52 AM, David Turner < dct25-561bs at mythic-beasts.com> wrote: > ... or it could be a ploy to see how you deal with incomplete or vague > specs; how you ask clarifying questions etc. > > Adding sufficiently many opening parens at the start can't obviously be > done without traversing the whole input first, whereas adding them as you > discover excesses of closing parens is possible to implement in a streaming > fashion, i.e. with O(1) memory usage and only traversing the input once. > > On 21 Mar 2017 17:44, "Michael Litchard" > wrote: > > I got this idea from looking at glassdoor comments of previous > interviewees. The spec was vague, but I imagined that the requirement would > need to be efficient and keep contiguous parenthesis unaltered. > so > balanceParens ")))" == "()()()" would be incorrect. > > > > On Tue, Mar 21, 2017 at 10:20 AM, David Turner < > dct25-561bs at mythic-beasts.com> wrote: > >> My attempt to replicate the OP's strategy but not impl: >> >> balanceParens :: String -> String >> balanceParens s = replicate neededOpening '(' >> ++ s ++ replicate neededClosing ')' >> where >> depthChange '(' = 1 >> depthChange ')' = -1 >> depthChange _ = 0 >> >> depths = scanl (+) 0 $ map depthChange s >> neededOpening = negate $ minimum depths >> neededClosing = last depths + neededOpening >> >> >> >> On 21 March 2017 at 17:16, David McBride wrote: >> >>> Whether your algorithm is correct depends on how you are supposed to >>> rebalance them. My naive attempt gives very different results. >>> >>> bal :: String -> String >>> bal = go 0 >>> where >>> go :: Int -> String -> String >>> go 0 "" = "" >>> go n "" = replicate n ')' >>> go n ('(':xs) = '(' : (go (n + 1) xs) >>> go 0 (')':xs) = '(' : ')' : (go 0 xs) >>> go n (')':xs) = ')' : (go (n - 1) xs) >>> >>> bal "))(" >>> "()()()" >>> >>> bal ")))" >>> "()()()" >>> >>> On Tue, Mar 21, 2017 at 12:53 PM, Michael Litchard >>> wrote: >>> > I'm prepping for a coding interview, and am examining the task of >>> correcting >>> > unbalanced parentheses. The finger tree seems to be the right data >>> > structure. As a proof of concept I've used Data.Sequence to test my >>> idea. If >>> > this is the right direction to go, I'll write more specialized finger >>> tree >>> > code. The code works on the few test cases I have tried. Feedback >>> > appreciated. >>> > >>> > {-# LANGUAGE ViewPatterns #-} >>> > module Parenthesis where >>> > import BasicPrelude hiding (concat,null,empty) >>> > >>> > import Data.Sequence hiding (length) >>> > import Data.Foldable hiding (length,null) >>> > >>> > balanceParens :: String -> String >>> > balanceParens str = go str [] empty >>> > where >>> > go [] [] (null -> True) = [] >>> > go [] [] parens = Data.Foldable.toList parens >>> > go ('(':xs) [] (null -> True) = go xs [RP] (singleton '(') >>> > go (')':xs) [] (null -> True) = go xs [] (fromList "()") >>> > go ('(':xs) debit parens = go xs (RP:debit) (parens |> '(') >>> > go (')':xs) [] parens = go xs [] corrected >>> > where corrected = ('(' <| parens) |> ')' >>> > go (')':xs) (RP:debit) parens = go xs debit (parens |> ')') >>> > go (_:xs) debit parens = go xs debit parens >>> > go [] (RP:debit) parens = go [] debit (parens |> ')') >>> > >>> > example: >>> > >>> > balanceParens "))(" >>> > "(())()" >>> > balanceParens ")))" >>> > "((()))" >>> > >>> > >>> > _______________________________________________ >>> > Haskell-Cafe mailing list >>> > To (un)subscribe, modify options or view archives go to: >>> > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>> > Only members subscribed via the mailman list are allowed to post. >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> To (un)subscribe, modify options or view archives go to: >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>> Only members subscribed via the mailman list are allowed to post. >>> >> >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dct25-561bs at mythic-beasts.com Tue Mar 21 18:12:39 2017 From: dct25-561bs at mythic-beasts.com (David Turner) Date: Tue, 21 Mar 2017 18:12:39 +0000 Subject: [Haskell-cafe] Code Review Request - Unbalanced Parenthesis correction In-Reply-To: References: Message-ID: It can't be done in better than O(n) time as you have to look at the whole input. I think you must be using O(n) space too. Consider a string of the form "()()()()...()())": You know the output starts with a '(' but you cannot know the second character of the output until you have read all the way to the end of the string and found the final character is unmatched. On 21 Mar 2017 18:04, "Michael Litchard" wrote: > David, > > Am I mistaken in believing the code I have in both O(1) in time and space? > I'm certain that my use of Data.Sequence, and therefore finger trees, has > this code at O(1) time. > Doesn't using a lazy list mean I am using O(1) space? Or, would I have to > use the conduits or pipes library? > > On Tue, Mar 21, 2017 at 10:52 AM, David Turner < > dct25-561bs at mythic-beasts.com> wrote: > >> ... or it could be a ploy to see how you deal with incomplete or vague >> specs; how you ask clarifying questions etc. >> >> Adding sufficiently many opening parens at the start can't obviously be >> done without traversing the whole input first, whereas adding them as you >> discover excesses of closing parens is possible to implement in a streaming >> fashion, i.e. with O(1) memory usage and only traversing the input once. >> >> On 21 Mar 2017 17:44, "Michael Litchard" >> wrote: >> >> I got this idea from looking at glassdoor comments of previous >> interviewees. The spec was vague, but I imagined that the requirement would >> need to be efficient and keep contiguous parenthesis unaltered. >> so >> balanceParens ")))" == "()()()" would be incorrect. >> >> >> >> On Tue, Mar 21, 2017 at 10:20 AM, David Turner < >> dct25-561bs at mythic-beasts.com> wrote: >> >>> My attempt to replicate the OP's strategy but not impl: >>> >>> balanceParens :: String -> String >>> balanceParens s = replicate neededOpening '(' >>> ++ s ++ replicate neededClosing ')' >>> where >>> depthChange '(' = 1 >>> depthChange ')' = -1 >>> depthChange _ = 0 >>> >>> depths = scanl (+) 0 $ map depthChange s >>> neededOpening = negate $ minimum depths >>> neededClosing = last depths + neededOpening >>> >>> >>> >>> On 21 March 2017 at 17:16, David McBride wrote: >>> >>>> Whether your algorithm is correct depends on how you are supposed to >>>> rebalance them. My naive attempt gives very different results. >>>> >>>> bal :: String -> String >>>> bal = go 0 >>>> where >>>> go :: Int -> String -> String >>>> go 0 "" = "" >>>> go n "" = replicate n ')' >>>> go n ('(':xs) = '(' : (go (n + 1) xs) >>>> go 0 (')':xs) = '(' : ')' : (go 0 xs) >>>> go n (')':xs) = ')' : (go (n - 1) xs) >>>> >>>> bal "))(" >>>> "()()()" >>>> >>>> bal ")))" >>>> "()()()" >>>> >>>> On Tue, Mar 21, 2017 at 12:53 PM, Michael Litchard >>>> wrote: >>>> > I'm prepping for a coding interview, and am examining the task of >>>> correcting >>>> > unbalanced parentheses. The finger tree seems to be the right data >>>> > structure. As a proof of concept I've used Data.Sequence to test my >>>> idea. If >>>> > this is the right direction to go, I'll write more specialized finger >>>> tree >>>> > code. The code works on the few test cases I have tried. Feedback >>>> > appreciated. >>>> > >>>> > {-# LANGUAGE ViewPatterns #-} >>>> > module Parenthesis where >>>> > import BasicPrelude hiding (concat,null,empty) >>>> > >>>> > import Data.Sequence hiding (length) >>>> > import Data.Foldable hiding (length,null) >>>> > >>>> > balanceParens :: String -> String >>>> > balanceParens str = go str [] empty >>>> > where >>>> > go [] [] (null -> True) = [] >>>> > go [] [] parens = Data.Foldable.toList parens >>>> > go ('(':xs) [] (null -> True) = go xs [RP] (singleton '(') >>>> > go (')':xs) [] (null -> True) = go xs [] (fromList "()") >>>> > go ('(':xs) debit parens = go xs (RP:debit) (parens |> '(') >>>> > go (')':xs) [] parens = go xs [] corrected >>>> > where corrected = ('(' <| parens) |> ')' >>>> > go (')':xs) (RP:debit) parens = go xs debit (parens |> ')') >>>> > go (_:xs) debit parens = go xs debit parens >>>> > go [] (RP:debit) parens = go [] debit (parens |> ')') >>>> > >>>> > example: >>>> > >>>> > balanceParens "))(" >>>> > "(())()" >>>> > balanceParens ")))" >>>> > "((()))" >>>> > >>>> > >>>> > _______________________________________________ >>>> > 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 olf at aatal-apotheke.de Tue Mar 21 20:09:58 2017 From: olf at aatal-apotheke.de (Olaf Klinke) Date: Tue, 21 Mar 2017 21:09:58 +0100 Subject: [Haskell-cafe] Semigroup and Monoid instances for ReaderT Message-ID: Maybe I missed something, but aren't the transformers a red herring here? instance (Semigroup a, Applicative f) => Semigroup (f a) where (<>) = liftA2 (<>) My first guess was that you could add this instance to your code without the need for changes to the transformers package. The problem with the semigroup instance above is that it conflicts with semigroup instances for f. For example, there is a semigroup instance for [a] when a is not a semigroup. For the declaration above, ghci 7.8.3 gave me: Overlapping instance declarations: instance (Semigroup a, Applicative f) => Semigroup (f a) -- Defined at :4:10 instance (Semigroup a, Semigroup b) => Semigroup (a, b) -- Defined in ‘Data.Semigroup’ Hence I guess you must use a newtype wrapper to declare when you want the semigroup instance of a and when you want the instance of f. Olaf From david.feuer at gmail.com Tue Mar 21 21:09:23 2017 From: david.feuer at gmail.com (David Feuer) Date: Tue, 21 Mar 2017 17:09:23 -0400 Subject: [Haskell-cafe] Semigroup and Monoid instances for ReaderT In-Reply-To: References: Message-ID: Yes, this is valid, and we should probably do it. mempty = pure mempty mappend = liftA2 mappend will make a valid Monoid for any Applicative instance, and x <> y = (<>) <$> x <.> y will make a valid Semigroup for any Apply instance. Proving this seems a bit gross. It's probably best to go via a well-known alternative formulation of Applicative: class Functor f => Apply' f where pair :: f a -> f b -> f (a, b) instance Apply' f => Applicative' f where pure' :: a -> f a This formulation lets you reassociate by switching between (a, (b,c)) and ((a,b),c) rather than shifting fmaps around. On Tue, Mar 21, 2017 at 3:53 AM, Louis Pan wrote: > Hi all, > > In my Glazier GUI library, I had to use newtype wrappers to create Semigroup > and Monoid instances for ReaderT. > > Is there a reason why ReaderT doesn't have an instance of Semigroup and > Monoid? > > The reader ((->) a) is a Monoid and a Semigroup. > https://hackage.haskell.org/package/base-4.9.1.0/docs/src/GHC.Base.html#line-268 > https://hackage.haskell.org/package/base-4.9.1.0/docs/src/Data.Semigroup.html#line-150 > > Could the following be added to the transformers package? Or is it not > lawful? > > instance (Applicative m, Semigroup a) => Semigroup (ReaderT r m a) where > f <> g = (<>) <$> f <*> g > {-# INLINABLE (<>) #-} > > instance (Applicative m, Monoid a) => Monoid (ReaderT r m a) where > mempty = pure mempty > {-# INLINABLE mempty #-} > > f `mappend` g = mappend <$> f <*> g > {-# INLINABLE mappend #-} > > Does it make sense to extend the monoid instance to all the other > transformers? Eg. > > instance (Monad m, Semigroup a) => Semigroup (StateT s m a) where > f <> g = (<>) <$> f <*> g > {-# INLINABLE (<>) #-} > > instance (Monad m, Monoid a) => Monoid (StateT s m a) where > mempty = pure mempty > {-# INLINABLE mempty #-} > > f `mappend` g = mappend <$> f <*> g > {-# INLINABLE mappend #-} > > instance (Monad m, Monoid w, Semigroup a) => Semigroup (WriterT w m a) where > f <> g = (<>) <$> f <*> g > {-# INLINABLE (<>) #-} > > instance (Monad m, Monoid w, Monoid a) => Monoid (WriterT w m a) where > mempty = pure mempty > {-# INLINABLE mempty #-} > > f `mappend` g = mappend <$> f <*> g > {-# INLINABLE mappend #-} > > and also for MaybeT, IdentityT, ExceptT, etc > > > Regards, > > Louis > > _______________________________________________ > 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 saurabhnanda at gmail.com Wed Mar 22 09:21:03 2017 From: saurabhnanda at gmail.com (Saurabh Nanda) Date: Wed, 22 Mar 2017 14:51:03 +0530 Subject: [Haskell-cafe] Full-time (remote acceptable) -- Haskell engineering at Vacation Labs, India Message-ID: Cross-posted from Reddit: https://www.reddit.com/r/haskell/comments/60tkh7/fulltime_remote_acceptable_haskell_engineering_at/ We are a startup based out of Goa (India), building travel-related technology products. Our flagship SaaS product is already in the market and has paying customers. We're expanding our product portfolio, and building new products in Haskell (the current product is written in Rails + AngularJS). If you're interested in using Haskell (and related FP languages, like Elm & Purescript) to build web/mobile products, do apply via http://www.vacationlabs.com/we-are-hiring/software-engineer-haskell/ PS: Our current stack is Rails, AngularJS v1, Postgres, Redis, Bootstrap+LessCSS. The stack for future product-dev is Haskell (on the server) with Typescript/Elm/Purescript (on the UI). -- Saurabh. -------------- next part -------------- An HTML attachment was scrubbed... URL: From louis at pan.me Wed Mar 22 10:32:31 2017 From: louis at pan.me (Louis Pan) Date: Wed, 22 Mar 2017 21:32:31 +1100 Subject: [Haskell-cafe] Semigroup and Monoid instances for ReaderT In-Reply-To: References: Message-ID: I'm glad you agree that it will be worthwhile. Thank you for cutting out the cruft from my code. I've added a request to http://hub.darcs.net/ross/transformers/issue/38 On 22 March 2017 at 08:09, David Feuer wrote: > Yes, this is valid, and we should probably do it. > > mempty = pure mempty > mappend = liftA2 mappend > > will make a valid Monoid for any Applicative instance, and > > x <> y = (<>) <$> x <.> y > > will make a valid Semigroup for any Apply instance. Proving this seems > a bit gross. It's probably best to go via a well-known alternative > formulation of Applicative: > > class Functor f => Apply' f where > pair :: f a -> f b -> f (a, b) > instance Apply' f => Applicative' f where > pure' :: a -> f a > > This formulation lets you reassociate by switching between (a, (b,c)) > and ((a,b),c) rather than shifting fmaps around. > > On Tue, Mar 21, 2017 at 3:53 AM, Louis Pan wrote: > > Hi all, > > > > In my Glazier GUI library, I had to use newtype wrappers to create > Semigroup > > and Monoid instances for ReaderT. > > > > Is there a reason why ReaderT doesn't have an instance of Semigroup and > > Monoid? > > > > The reader ((->) a) is a Monoid and a Semigroup. > > https://hackage.haskell.org/package/base-4.9.1.0/docs/src/ > GHC.Base.html#line-268 > > https://hackage.haskell.org/package/base-4.9.1.0/docs/src/ > Data.Semigroup.html#line-150 > > > > Could the following be added to the transformers package? Or is it not > > lawful? > > > > instance (Applicative m, Semigroup a) => Semigroup (ReaderT r m a) where > > f <> g = (<>) <$> f <*> g > > {-# INLINABLE (<>) #-} > > > > instance (Applicative m, Monoid a) => Monoid (ReaderT r m a) where > > mempty = pure mempty > > {-# INLINABLE mempty #-} > > > > f `mappend` g = mappend <$> f <*> g > > {-# INLINABLE mappend #-} > > > > Does it make sense to extend the monoid instance to all the other > > transformers? Eg. > > > > instance (Monad m, Semigroup a) => Semigroup (StateT s m a) where > > f <> g = (<>) <$> f <*> g > > {-# INLINABLE (<>) #-} > > > > instance (Monad m, Monoid a) => Monoid (StateT s m a) where > > mempty = pure mempty > > {-# INLINABLE mempty #-} > > > > f `mappend` g = mappend <$> f <*> g > > {-# INLINABLE mappend #-} > > > > instance (Monad m, Monoid w, Semigroup a) => Semigroup (WriterT w m a) > where > > f <> g = (<>) <$> f <*> g > > {-# INLINABLE (<>) #-} > > > > instance (Monad m, Monoid w, Monoid a) => Monoid (WriterT w m a) where > > mempty = pure mempty > > {-# INLINABLE mempty #-} > > > > f `mappend` g = mappend <$> f <*> g > > {-# INLINABLE mappend #-} > > > > and also for MaybeT, IdentityT, ExceptT, etc > > > > > > Regards, > > > > Louis > > > > _______________________________________________ > > 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 litchard.michael at gmail.com Wed Mar 22 18:31:12 2017 From: litchard.michael at gmail.com (Michael Litchard) Date: Wed, 22 Mar 2017 11:31:12 -0700 Subject: [Haskell-cafe] One-Off detection. Question about Space/Time complexity Message-ID: Problem spec from CareerCup . Given two strings, return boolean True/False if they are only one edit apart. Edit can be insert/delete/update of only one character in the string. Eg. -True xyz,xz xyz,xyk xy,xyz -False xyz,xyz xyz,xzy x,xyz module Strings.OneLetter where` import Preludeimport qualified Data.Text as T` oneLetter :: T.Text -> T.Text -> Bool oneLetter s1 s2 | s1 == s2 = False | max_l > (min_l + 1) = False | max_l == min_l = diff_size == 1 | otherwise = diff_size == 0 where length_s1 = T.length s1 length_s2 = T.length s2 max_l = max length_s1 length_s2 min_l = min length_s1 length_s2 diff_size = length $ filter (\(a,b) -> a /= b) zipped zipped = T.zip s1 s2` So, I used Text instead of String, hoping I could take advantage of fusion. I have the following questions and my initial attempt to answer them. What is the time complexity of oneLetter 0(m+n) where m is the length of s1 and n is the length of s2 what is the space complexity of oneLetter? I'm thinking due to laziness it's O(1), only two Chars are in memory at any one time, or two Ints. But I'm hazy on why. If this is wrong, please articulate why. If I'm right, and my reasoning is wrong or incomplete, please say why. I don't think I can improve the time complexity. Am I right? Can the space complexity be improved? What if I changed from Text to String? I don't think the time complexity changes, but how does this change the space complexity? -------------- next part -------------- An HTML attachment was scrubbed... URL: From dct25-561bs at mythic-beasts.com Wed Mar 22 18:48:06 2017 From: dct25-561bs at mythic-beasts.com (David Turner) Date: Wed, 22 Mar 2017 18:48:06 +0000 Subject: [Haskell-cafe] One-Off detection. Question about Space/Time complexity In-Reply-To: References: Message-ID: I think the space must be O(m+n) since you are using strict Text values. But even if you weren't, you're using s1 and s2 in more than one place so they will be shared, leading to them both being fully in memory at once. The minimum possible space complexity could well be O(1) if using String or lazy Text. The time complexity looks like O(min(m,n)), because that's the cost of `zip`/`filter`, not counting the cost of loading the two Texts into memory in the first place (which will be O(m+n)). If you used String, it'd be O(m+n) since that's the cost of the two calls to `length`. I think the minimum possible time complexity will be O(min(m,n)), and that could include the cost of loading the strings too. On 22 Mar 2017 18:32, "Michael Litchard" wrote: > Problem spec from CareerCup > . > > Given two strings, return boolean True/False if they are only one edit > apart. Edit can be insert/delete/update of only one character in the > string. Eg. > > -True > > xyz,xz > > xyz,xyk > > xy,xyz > > -False > > xyz,xyz > > xyz,xzy > > x,xyz > > module Strings.OneLetter where` > import Preludeimport qualified Data.Text as T` > > oneLetter :: T.Text -> T.Text -> Bool > oneLetter s1 s2 > | s1 == s2 = False > | max_l > (min_l + 1) = False > | max_l == min_l = diff_size == 1 > | otherwise = diff_size == 0 > where > length_s1 = T.length s1 > length_s2 = T.length s2 > max_l = max length_s1 length_s2 > min_l = min length_s1 length_s2 > diff_size = length $ filter (\(a,b) -> a /= b) zipped > zipped = T.zip s1 s2` > > So, I used Text instead of String, hoping I could take advantage of > fusion. I have the following questions and my initial attempt to answer > them. > > What is the time complexity of oneLetter 0(m+n) where m is the length of > s1 and n is the length of s2 > > what is the space complexity of oneLetter? I'm thinking due to laziness > it's O(1), only two Chars are in memory at any one time, or two Ints. But > I'm hazy on why. If this is wrong, please articulate why. If I'm right, and > my reasoning is wrong or incomplete, please say why. > > I don't think I can improve the time complexity. Am I right? Can the space > complexity be improved? > > What if I changed from Text to String? I don't think the time complexity > changes, but how does this change the space complexity? > > > > > _______________________________________________ > 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 dave at zednenem.com Wed Mar 22 19:55:06 2017 From: dave at zednenem.com (David Menendez) Date: Wed, 22 Mar 2017 15:55:06 -0400 Subject: [Haskell-cafe] Fwd: Semigroup and Monoid instances for ReaderT In-Reply-To: References: Message-ID: On Tue, Mar 21, 2017 at 3:53 AM, Louis Pan wrote: > Hi all, > > In my Glazier GUI library, I had to use newtype wrappers to create > Semigroup and Monoid instances for ReaderT. > > Is there a reason why ReaderT doesn't have an instance of Semigroup and > Monoid? > There are at least three reasonable instances of Semigroup and Monoid for ReaderT. instance (Applicative m, Monoid a) => Monoid (ReaderT r m a) where mempty = pure mempty mappend a b = mappend <$> a <*> b instance (Alternative m) => Monoid (ReaderT r m a) where mempty = empty mappend = (<|>) instance (Monoid (m a)) => Monoid (ReaderT r m a) where mempty = ReaderT $ mempty mappend a b = ReaderT $ mappend a b In the absence of a principled reason to prefer one over the others and a general consensus, I think it’s better not to choose. -- Dave Menendez -------------- next part -------------- An HTML attachment was scrubbed... URL: From louis.pan at gmail.com Wed Mar 22 23:34:55 2017 From: louis.pan at gmail.com (Louis Pan) Date: Thu, 23 Mar 2017 10:34:55 +1100 Subject: [Haskell-cafe] Fwd: Semigroup and Monoid instances for ReaderT In-Reply-To: References: Message-ID: Ah, good point. I didn't think that there would be other instances. I'll close the darcs request. On Thu, 23 Mar 2017 at 6:58 am, David Menendez wrote: > On Tue, Mar 21, 2017 at 3:53 AM, Louis Pan wrote: > > Hi all, > > In my Glazier GUI library, I had to use newtype wrappers to create > Semigroup and Monoid instances for ReaderT. > > Is there a reason why ReaderT doesn't have an instance of Semigroup and > Monoid? > > > There are at least three reasonable instances of Semigroup and Monoid for > ReaderT. > > instance (Applicative m, Monoid a) => Monoid (ReaderT r m a) where > mempty = pure mempty > mappend a b = mappend <$> a <*> b > > instance (Alternative m) => Monoid (ReaderT r m a) where > mempty = empty > mappend = (<|>) > > instance (Monoid (m a)) => Monoid (ReaderT r m a) where > mempty = ReaderT $ mempty > mappend a b = ReaderT $ mappend a b > > > In the absence of a principled reason to prefer one over the others and a > general consensus, I think it’s better not to choose. > > -- > Dave Menendez > > > > > > _______________________________________________ > > 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 ok at cs.otago.ac.nz Thu Mar 23 00:52:21 2017 From: ok at cs.otago.ac.nz (Richard A. O'Keefe) Date: Thu, 23 Mar 2017 13:52:21 +1300 Subject: [Haskell-cafe] Code Review Request - Unbalanced Parenthesis correction In-Reply-To: References: Message-ID: <05F55BD3-B7A7-4E7C-B84E-9B838D529713@cs.otago.ac.nz> An HTML attachment was scrubbed... URL: From ok at cs.otago.ac.nz Thu Mar 23 01:15:35 2017 From: ok at cs.otago.ac.nz (Richard A. O'Keefe) Date: Thu, 23 Mar 2017 14:15:35 +1300 Subject: [Haskell-cafe] Code Review Request - Unbalanced Parenthesis correction In-Reply-To: References: Message-ID: > On 22/03/2017, at 6:44 AM, Michael Litchard wrote: > > I got this idea from looking at glassdoor comments of previous interviewees. The spec was vague, but I imagined that the requirement would need to be efficient and keep contiguous parenthesis unaltered. > so > balanceParens ")))" == "()()()" would be incorrect. One parenthesIs two parenthesEs. Perhaps you could link to those glassdoor comments? It really is not obvious to me that "keep[ing] contiguous parenthes[e]s unaltered" even makes sense, let alone being desirable. Entirely by coincidence, I had a parenthesis problem about an hour ago, where I had changed fabs(X-(k-1)) to fabs(d)) and the right repair was to delete one of the right parentheses. The point of the question may well be not the code you come up with but the questions you ask on your way. I'd probably ask questions like these: 1. Do you have a precise specification? 2. Are you looking for an obviously correct solution, a solution with small workspace, a fast solution, or what? 3. What operations am I allowed to perform on a string? Which characters may I insert? Which characters may I delete? Is transposition of adjacent characters allowed? 4. Are you looking for a repair of minimal cost in some sense? If so, how is that cost computed? For example, inserting ( might cost 2 units and deleting ) might cost 3 units. 5. There's been a lot of work done on least cost syntax repair (e.g., Roland Backhouse). Am I allowed to look that up? From ok at cs.otago.ac.nz Thu Mar 23 01:22:23 2017 From: ok at cs.otago.ac.nz (Richard A. O'Keefe) Date: Thu, 23 Mar 2017 14:22:23 +1300 Subject: [Haskell-cafe] Code Review Request - Unbalanced Parenthesis correction In-Reply-To: References: Message-ID: I note that Ying's thesis on repairing bracket structure in XML is a cubic time algorithm. It's not immediately obvious to me that an algorithm computing "optimal" repairs for bracket structures can be faster than quadratic time. Everything hinges on what the requirements actually are. space? > I'm certain that my use of Data.Sequence, and therefore finger trees, has this code at O(1) time. > Doesn't using a lazy list mean I am using O(1) space? If the input has m characters and the output has n characters, the algorithm MUST take at least O(m+n) time. Two people have independently proposed basically the same streaming algorithm taking O(m+n) time and O(1) space with lazy Strings, and one of them proposed an algorithm that would reproduce the few test cases you provided, still with O(m+n) time and O(1) space, without finger or any other trees. Negotiating the specification comes first. From bog at khumba.net Thu Mar 23 03:01:44 2017 From: bog at khumba.net (Bryan Gardiner) Date: Wed, 22 Mar 2017 20:01:44 -0700 Subject: [Haskell-cafe] GHC 8.0.2 and extra dynamic libraries Message-ID: <20170322200144.182d30a7@khumba.net> Hi all, I'm not sure if this is the right place to ask this, but I'd like to see if there were any changes between GHC 8.0.1 and 8.0.2 in how linking works on Linux. I inject an extra library directory (extraLibDirs, for building qtah) via preBuild and preTest Cabal hooks[1], and while GHC 8.0.1 (or is this Cabal?) seems to pass this as both "-L$dir" and "-optl-Wl,-rpath,$dir" to the ghc link command, GHC 8.0.2 (Cabal?) appears to only pass the former, causing the built library to be unable to find its dependency in that directory. Is this a known change? Do I need to pass -optl-Wl,... myself now? I'm running Gentoo with the Haskell overlay, Cabal-1.24.2.0, and cabal-install-1.24.0.2 in both cases. Happy to provide more info if necessary. Thanks for any help you can provide, Bryan [1] https://gitlab.com/khumba/qtah/blob/master/qtah/Setup.hs From Andrew.Butterfield at scss.tcd.ie Thu Mar 23 08:52:10 2017 From: Andrew.Butterfield at scss.tcd.ie (Andrew Butterfield) Date: Thu, 23 Mar 2017 08:52:10 +0000 Subject: [Haskell-cafe] One-Off detection. Question about Space/Time complexity In-Reply-To: References: Message-ID: <652001DA-1681-4753-ACF2-EFEDDA49751E@scss.tcd.ie> It can be done in one sweep down both strings together - look for the first difference, and then test hypotheses regarding the 5 possible edits oneOff :: String -> String -> Bool oneOff [] [] = False oneOff [] (_:rest) = null rest oneOff (_:rest) [] = null rest oneOff s1@(c1:s1') s2@(c2:s2') | c1 == c2 = oneOff s1' s2' -- keep looking | otherwise = s1' == s2 -- s2 is s1 with c1 deleted or s1 is s2 with c1 inserted || s2' == s1 -- s1 is s2 with c2 deleted or s2 is s1 with c2 inserted || s1' == s2' -- c1 is s1 was replaced by c2 in s2, or v.v. I guess the above should be O(1) in space - it's just a list crawl with tests O(n) in the length of the shortest String Cheers, Andrew > On 22 Mar 2017, at 18:48, David Turner wrote: > > I think the space must be O(m+n) since you are using strict Text values. But even if you weren't, you're using s1 and s2 in more than one place so they will be shared, leading to them both being fully in memory at once. > > The minimum possible space complexity could well be O(1) if using String or lazy Text. > > The time complexity looks like O(min(m,n)), because that's the cost of `zip`/`filter`, not counting the cost of loading the two Texts into memory in the first place (which will be O(m+n)). If you used String, it'd be O(m+n) since that's the cost of the two calls to `length`. I think the minimum possible time complexity will be O(min(m,n)), and that could include the cost of loading the strings too. > > On 22 Mar 2017 18:32, "Michael Litchard" > wrote: > Problem spec from CareerCup . > > Given two strings, return boolean True/False if they are only one edit apart. Edit can be insert/delete/update of only one character in the string. Eg. > > -True > > xyz,xz > > xyz,xyk > > xy,xyz > > -False > > xyz,xyz > > xyz,xzy > > x,xyz > > module Strings.OneLetter where` > > import Prelude > import qualified Data.Text as T` > > oneLetter :: T.Text -> T.Text -> Bool > oneLetter s1 s2 > | s1 == s2 = False > | max_l > (min_l + 1) = False > | max_l == min_l = diff_size == 1 > | otherwise = diff_size == 0 > where > length_s1 = T.length s1 > length_s2 = T.length s2 > max_l = max length_s1 length_s2 > min_l = min length_s1 length_s2 > diff_size = length $ filter (\(a,b) -> a /= b) zipped > zipped = T.zip s1 s2` > So, I used Text instead of String, hoping I could take advantage of fusion. I have the following questions and my initial attempt to answer them. > > What is the time complexity of oneLetter 0(m+n) where m is the length of s1 and n is the length of s2 > > what is the space complexity of oneLetter? I'm thinking due to laziness it's O(1), only two Chars are in memory at any one time, or two Ints. But I'm hazy on why. If this is wrong, please articulate why. If I'm right, and my reasoning is wrong or incomplete, please say why. > > I don't think I can improve the time complexity. Am I right? Can the space complexity be improved? > > What if I changed from Text to String? I don't think the time complexity changes, but how does this change the space complexity? > > > > > > > _______________________________________________ > 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. Andrew Butterfield School of Computer Science & Statistics Trinity College Dublin 2, Ireland -------------- next part -------------- An HTML attachment was scrubbed... URL: From ollie at ocharles.org.uk Thu Mar 23 13:52:43 2017 From: ollie at ocharles.org.uk (Oliver Charles) Date: Thu, 23 Mar 2017 13:52:43 +0000 Subject: [Haskell-cafe] Num nstances for Data.Monoid.{First,Last} Message-ID: We already have Num instances on things like Sum and Product, could we have them on First and Last? I mostly want fromInteger on these types. To give you a real world example: keySpeed :: L.Fold KeyboardEventData Double keySpeed = L.foldMap (\KeyboardEventData {keyboardEventKeyMotion} -> case keyboardEventKeyMotion of Pressed -> Last (Just 1) Released -> Last (Just 0)) (fromMaybe 0 . getLast) keySpeed folds (under Control.Foldl) events from a UI system into the number 1 if the key has been pressed and 0 if the key has been released. It's OK in the above form, but if Last had a Num instance, I could just have Pressed -> 1 Released -> 0 Which I find preferable. Any thoughts? - Ollie -------------- next part -------------- An HTML attachment was scrubbed... URL: From dct25-561bs at mythic-beasts.com Thu Mar 23 15:19:44 2017 From: dct25-561bs at mythic-beasts.com (David Turner) Date: Thu, 23 Mar 2017 15:19:44 +0000 Subject: [Haskell-cafe] One-Off detection. Question about Space/Time complexity In-Reply-To: <652001DA-1681-4753-ACF2-EFEDDA49751E@scss.tcd.ie> References: <652001DA-1681-4753-ACF2-EFEDDA49751E@scss.tcd.ie> Message-ID: I also think it can be done in one sweep, but I think this code is O(max(m,n)-min(m,n)): s1' and s2' each appear twice so will be shared. On 23 March 2017 at 08:52, Andrew Butterfield < Andrew.Butterfield at scss.tcd.ie> wrote: > It can be done in one sweep down both strings together - look for the > first difference, > and then test hypotheses regarding the 5 possible edits > > oneOff :: String -> String -> Bool > > oneOff [] [] = False > oneOff [] (_:rest) = null rest > oneOff (_:rest) [] = null rest > oneOff s1@(c1:s1') s2@(c2:s2') > | c1 == c2 = oneOff s1' s2' -- keep looking > | otherwise > = s1' == s2 -- s2 is s1 with c1 deleted or s1 is s2 with c1 > inserted > || s2' == s1 -- s1 is s2 with c2 deleted or s2 is s1 with c2 > inserted > || s1' == s2' -- c1 is s1 was replaced by c2 in s2, or v.v. > > I guess the above should be O(1) in space - it's just a list crawl with > tests > O(n) in the length of the shortest String > > > Cheers, > Andrew > > On 22 Mar 2017, at 18:48, David Turner > wrote: > > I think the space must be O(m+n) since you are using strict Text values. > But even if you weren't, you're using s1 and s2 in more than one place so > they will be shared, leading to them both being fully in memory at once. > > The minimum possible space complexity could well be O(1) if using String > or lazy Text. > > > > The time complexity looks like O(min(m,n)), because that's the cost of > `zip`/`filter`, not counting the cost of loading the two Texts into memory > in the first place (which will be O(m+n)). If you used String, it'd be > O(m+n) since that's the cost of the two calls to `length`. I think the > minimum possible time complexity will be O(min(m,n)), and that could > include the cost of loading the strings too. > > On 22 Mar 2017 18:32, "Michael Litchard" > wrote: > >> Problem spec from CareerCup >> . >> >> Given two strings, return boolean True/False if they are only one edit >> apart. Edit can be insert/delete/update of only one character in the >> string. Eg. >> >> -True >> >> xyz,xz >> >> xyz,xyk >> >> xy,xyz >> >> -False >> >> xyz,xyz >> >> xyz,xzy >> >> x,xyz >> >> module Strings.OneLetter where` >> import Preludeimport qualified Data.Text as T` >> >> oneLetter :: T.Text -> T.Text -> Bool >> oneLetter s1 s2 >> | s1 == s2 = False >> | max_l > (min_l + 1) = False >> | max_l == min_l = diff_size == 1 >> | otherwise = diff_size == 0 >> where >> length_s1 = T.length s1 >> length_s2 = T.length s2 >> max_l = max length_s1 length_s2 >> min_l = min length_s1 length_s2 >> diff_size = length $ filter (\(a,b) -> a /= b) zipped >> zipped = T.zip s1 s2` >> >> So, I used Text instead of String, hoping I could take advantage of >> fusion. I have the following questions and my initial attempt to answer >> them. >> >> What is the time complexity of oneLetter 0(m+n) where m is the length of >> s1 and n is the length of s2 >> >> what is the space complexity of oneLetter? I'm thinking due to laziness >> it's O(1), only two Chars are in memory at any one time, or two Ints. >> But I'm hazy on why. If this is wrong, please articulate why. If I'm right, >> and my reasoning is wrong or incomplete, please say why. >> >> I don't think I can improve the time complexity. Am I right? Can the >> space complexity be improved? >> >> What if I changed from Text to String? I don't think the time complexity >> changes, but how does this change the space complexity? >> >> >> >> >> _______________________________________________ >> 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. > > > Andrew Butterfield > School of Computer Science & Statistics > Trinity College > Dublin 2, Ireland > > > _______________________________________________ > 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 Andrew.Butterfield at scss.tcd.ie Thu Mar 23 16:10:43 2017 From: Andrew.Butterfield at scss.tcd.ie (Andrew Butterfield) Date: Thu, 23 Mar 2017 16:10:43 +0000 Subject: [Haskell-cafe] One-Off detection. Question about Space/Time complexity In-Reply-To: References: <652001DA-1681-4753-ACF2-EFEDDA49751E@scss.tcd.ie> Message-ID: <40827E4A-8FFD-4F7D-932B-C10EEA37799E@scss.tcd.ie> Yes - they both might be scanned twice, but O(2n) = O(n) = O(3n), even. The scanniing by the three uses of == only walk over *all* of the longer list if its length is at most that of the shorter Simply put, if s1 is much longer than s2, then those == scans will end when they reach the end of the shorter s2 Or am I missing something? > On 23 Mar 2017, at 15:19, David Turner wrote: > > I also think it can be done in one sweep, but I think this code is O(max(m,n)-min(m,n)): s1' and s2' each appear twice so will be shared. if m == n your timing reduces to O(0) !? > > On 23 March 2017 at 08:52, Andrew Butterfield > wrote: > It can be done in one sweep down both strings together - look for the first difference, > and then test hypotheses regarding the 5 possible edits > > oneOff :: String -> String -> Bool > > oneOff [] [] = False > oneOff [] (_:rest) = null rest > oneOff (_:rest) [] = null rest > oneOff s1@(c1:s1') s2@(c2:s2') > | c1 == c2 = oneOff s1' s2' -- keep looking > | otherwise > = s1' == s2 -- s2 is s1 with c1 deleted or s1 is s2 with c1 inserted > || s2' == s1 -- s1 is s2 with c2 deleted or s2 is s1 with c2 inserted > || s1' == s2' -- c1 is s1 was replaced by c2 in s2, or v.v. > > I guess the above should be O(1) in space - it's just a list crawl with tests > O(n) in the length of the shortest String > > > Cheers, > Andrew > >> On 22 Mar 2017, at 18:48, David Turner > wrote: >> >> I think the space must be O(m+n) since you are using strict Text values. But even if you weren't, you're using s1 and s2 in more than one place so they will be shared, leading to them both being fully in memory at once. >> >> The minimum possible space complexity could well be O(1) if using String or lazy Text. > >> >> The time complexity looks like O(min(m,n)), because that's the cost of `zip`/`filter`, not counting the cost of loading the two Texts into memory in the first place (which will be O(m+n)). If you used String, it'd be O(m+n) since that's the cost of the two calls to `length`. I think the minimum possible time complexity will be O(min(m,n)), and that could include the cost of loading the strings too. >> >> On 22 Mar 2017 18:32, "Michael Litchard" > wrote: >> Problem spec from CareerCup . >> >> Given two strings, return boolean True/False if they are only one edit apart. Edit can be insert/delete/update of only one character in the string. Eg. >> >> -True >> >> xyz,xz >> >> xyz,xyk >> >> xy,xyz >> >> -False >> >> xyz,xyz >> >> xyz,xzy >> >> x,xyz >> >> module Strings.OneLetter where` >> >> import Prelude >> import qualified Data.Text as T` >> >> oneLetter :: T.Text -> T.Text -> Bool >> oneLetter s1 s2 >> | s1 == s2 = False >> | max_l > (min_l + 1) = False >> | max_l == min_l = diff_size == 1 >> | otherwise = diff_size == 0 >> where >> length_s1 = T.length s1 >> length_s2 = T.length s2 >> max_l = max length_s1 length_s2 >> min_l = min length_s1 length_s2 >> diff_size = length $ filter (\(a,b) -> a /= b) zipped >> zipped = T.zip s1 s2` >> So, I used Text instead of String, hoping I could take advantage of fusion. I have the following questions and my initial attempt to answer them. >> >> What is the time complexity of oneLetter 0(m+n) where m is the length of s1 and n is the length of s2 >> >> what is the space complexity of oneLetter? I'm thinking due to laziness it's O(1), only two Chars are in memory at any one time, or two Ints. But I'm hazy on why. If this is wrong, please articulate why. If I'm right, and my reasoning is wrong or incomplete, please say why. >> >> I don't think I can improve the time complexity. Am I right? Can the space complexity be improved? >> >> What if I changed from Text to String? I don't think the time complexity changes, but how does this change the space complexity? >> >> >> >> >> >> >> _______________________________________________ >> 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. > > Andrew Butterfield > School of Computer Science & Statistics > Trinity College > Dublin 2, Ireland > > > _______________________________________________ > 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. > Andrew Butterfield School of Computer Science & Statistics Trinity College Dublin 2, Ireland -------------- next part -------------- An HTML attachment was scrubbed... URL: From dct25-561bs at mythic-beasts.com Thu Mar 23 18:15:53 2017 From: dct25-561bs at mythic-beasts.com (David Turner) Date: Thu, 23 Mar 2017 18:15:53 +0000 Subject: [Haskell-cafe] One-Off detection. Question about Space/Time complexity In-Reply-To: <40827E4A-8FFD-4F7D-932B-C10EEA37799E@scss.tcd.ie> References: <652001DA-1681-4753-ACF2-EFEDDA49751E@scss.tcd.ie> <40827E4A-8FFD-4F7D-932B-C10EEA37799E@scss.tcd.ie> Message-ID: Sorry, I missed the vital word *space*. It looks time-efficient, but doesn't look O(1) in space. On 23 Mar 2017 16:12, "Andrew Butterfield" wrote: Yes - they both might be scanned twice, but O(2n) = O(n) = O(3n), even. The scanniing by the three uses of == only walk over *all* of the longer list if its length is at most that of the shorter Simply put, if s1 is much longer than s2, then those == scans will end when they reach the end of the shorter s2 Or am I missing something? On 23 Mar 2017, at 15:19, David Turner wrote: I also think it can be done in one sweep, but I think this code is O(max(m,n)-min(m,n)): s1' and s2' each appear twice so will be shared. if m == n your timing reduces to O(0) !? On 23 March 2017 at 08:52, Andrew Butterfield wrote: > It can be done in one sweep down both strings together - look for the > first difference, > and then test hypotheses regarding the 5 possible edits > > oneOff :: String -> String -> Bool > > oneOff [] [] = False > oneOff [] (_:rest) = null rest > oneOff (_:rest) [] = null rest > oneOff s1@(c1:s1') s2@(c2:s2') > | c1 == c2 = oneOff s1' s2' -- keep looking > | otherwise > = s1' == s2 -- s2 is s1 with c1 deleted or s1 is s2 with c1 > inserted > || s2' == s1 -- s1 is s2 with c2 deleted or s2 is s1 with c2 > inserted > || s1' == s2' -- c1 is s1 was replaced by c2 in s2, or v.v. > > I guess the above should be O(1) in space - it's just a list crawl with > tests > O(n) in the length of the shortest String > > > Cheers, > Andrew > > On 22 Mar 2017, at 18:48, David Turner > wrote: > > I think the space must be O(m+n) since you are using strict Text values. > But even if you weren't, you're using s1 and s2 in more than one place so > they will be shared, leading to them both being fully in memory at once. > > The minimum possible space complexity could well be O(1) if using String > or lazy Text. > > > > The time complexity looks like O(min(m,n)), because that's the cost of > `zip`/`filter`, not counting the cost of loading the two Texts into memory > in the first place (which will be O(m+n)). If you used String, it'd be > O(m+n) since that's the cost of the two calls to `length`. I think the > minimum possible time complexity will be O(min(m,n)), and that could > include the cost of loading the strings too. > > On 22 Mar 2017 18:32, "Michael Litchard" > wrote: > >> Problem spec from CareerCup >> . >> >> Given two strings, return boolean True/False if they are only one edit >> apart. Edit can be insert/delete/update of only one character in the >> string. Eg. >> >> -True >> >> xyz,xz >> >> xyz,xyk >> >> xy,xyz >> >> -False >> >> xyz,xyz >> >> xyz,xzy >> >> x,xyz >> >> module Strings.OneLetter where` >> import Preludeimport qualified Data.Text as T` >> >> oneLetter :: T.Text -> T.Text -> Bool >> oneLetter s1 s2 >> | s1 == s2 = False >> | max_l > (min_l + 1) = False >> | max_l == min_l = diff_size == 1 >> | otherwise = diff_size == 0 >> where >> length_s1 = T.length s1 >> length_s2 = T.length s2 >> max_l = max length_s1 length_s2 >> min_l = min length_s1 length_s2 >> diff_size = length $ filter (\(a,b) -> a /= b) zipped >> zipped = T.zip s1 s2` >> >> So, I used Text instead of String, hoping I could take advantage of >> fusion. I have the following questions and my initial attempt to answer >> them. >> >> What is the time complexity of oneLetter 0(m+n) where m is the length of >> s1 and n is the length of s2 >> >> what is the space complexity of oneLetter? I'm thinking due to laziness >> it's O(1), only two Chars are in memory at any one time, or two Ints. >> But I'm hazy on why. If this is wrong, please articulate why. If I'm right, >> and my reasoning is wrong or incomplete, please say why. >> >> I don't think I can improve the time complexity. Am I right? Can the >> space complexity be improved? >> >> What if I changed from Text to String? I don't think the time complexity >> changes, but how does this change the space complexity? >> >> >> >> >> _______________________________________________ >> 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. > > > Andrew Butterfield > School of Computer Science & Statistics > Trinity College > Dublin 2, Ireland > > > _______________________________________________ > 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. > Andrew Butterfield School of Computer Science & Statistics Trinity College Dublin 2, Ireland _______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From olf at aatal-apotheke.de Thu Mar 23 20:26:39 2017 From: olf at aatal-apotheke.de (Olaf Klinke) Date: Thu, 23 Mar 2017 21:26:39 +0100 Subject: [Haskell-cafe] One-Off detection. Question about Space/Time complexity Message-ID: I believe this is the classic publication on the subject: http://users.monash.edu/~lloyd/tildeStrings/Alignment/92.IPL.html The Haskell implementation is here: http://users.monash.edu/~lloyd/tildeFP/Haskell/1998/Edit01/ In case of a pair of one-off strings, it is O(m) time. Not sure whether the entire strings are kept in memory. My gut feeling is that they must be kept in memory in the worst case (edit distance max(m,n)) but stretches of matched prefixes can be garbage collected. So in your particular case it should indeed be O(1) space. Profiling suggests the algorithm is not O(1) space, but I might have done the input strings wrong. input :: Int -> String input = flip replicate 'a' length . input should be O(1) space, shouldn't it? With ghc 7.8.3 and -O2 it is not. Running the edit distance on the pair (input m, 'b' : input m) and profiling the program suggests the algorithm is O(m) space. Andrew Butterfield's oneOff seems to be linear space, too. -- Olaf $cat test.hs import System.Environment import Data.List (foldl') import EditDistance (d) input :: Int -> String input n = replicate n 'a' main = do args <- getArgs let n = read (head args) let x = input $! (n+1) let y = 'b' : input n print (d x y) $ghc -O2 --make -prof -fprof-auto test.hs [2 of 2] Compiling Main ( test.hs, test.o ) Linking test ... $for n in 1000 10000 100000; do ./test $n +RTS -p && grep 'total alloc' test.prof; done 1 total alloc = 358,128 bytes (excludes profiling overheads) 1 total alloc = 3,022,696 bytes (excludes profiling overheads) 1 total alloc = 29,663,256 bytes (excludes profiling overheads) From ok at cs.otago.ac.nz Thu Mar 23 23:21:59 2017 From: ok at cs.otago.ac.nz (Richard A. O'Keefe) Date: Fri, 24 Mar 2017 12:21:59 +1300 Subject: [Haskell-cafe] One-Off detection. Question about Space/Time complexity In-Reply-To: <652001DA-1681-4753-ACF2-EFEDDA49751E@scss.tcd.ie> References: <652001DA-1681-4753-ACF2-EFEDDA49751E@scss.tcd.ie> Message-ID: <397DB787-04C8-4EE3-932E-89BD038E9862@cs.otago.ac.nz> > On 23/03/2017, at 9:52 PM, Andrew Butterfield wrote: > > It can be done in one sweep down both strings together - look for the first difference, > and then test hypotheses regarding the 5 possible edits > > oneOff :: String -> String -> Bool > > oneOff [] [] = False > oneOff [] (_:rest) = null rest > oneOff (_:rest) [] = null rest > oneOff s1@(c1:s1') s2@(c2:s2') > | c1 == c2 = oneOff s1' s2' -- keep looking > | otherwise > = s1' == s2 -- s2 is s1 with c1 deleted or s1 is s2 with c1 inserted > || s2' == s1 -- s1 is s2 with c2 deleted or s2 is s1 with c2 inserted > || s1' == s2' -- c1 is s1 was replaced by c2 in s2, or v.v. > > I guess the above should be O(1) in space The question is what "O(1) in space" means here. If you discount the storage required for the strings, fine. If however you think in terms of lazy lists of characters, the fact that this code will look at the tails of the lists up to 3 times means that those tails will be stored, so we are talking about O(n) space. I believe it is possible to walk down s1 s1' s2 s2' in a single pass, maintaining "streaming". Whether it is _worth_ doing that is another matter. From clintonmead at gmail.com Fri Mar 24 03:27:09 2017 From: clintonmead at gmail.com (Clinton Mead) Date: Fri, 24 Mar 2017 14:27:09 +1100 Subject: [Haskell-cafe] Why does "enumFromThenTo x x y" depend on "y"? Message-ID: I'm implementing Enum for a type I have, and I figured it should replicate what ordinary Enum types, so I did some tests on how Enum behaves. I noticed that: "enumFromThenTo 3 3 5" is not the same as "enumFromThenTo 3 3 1". This seems bizarre to me. Generally increasing the stepsize increases the length of the list. For example, "length (enumFromThenTo 0 10 1000) == 101" "length (enumFromThenTo 0 2 1000) == 501" "length (enumFromThenTo 0 1 1000) == 1001" "length (enumFromThenTo 0 0 1000) == infinite" but "length (enumFromThenTo 0 (-10) (-1000)) == 101" "length (enumFromThenTo 0 (-2) (-1000)) == 501" "length (enumFromThenTo 0 (-1) (-1000)) == 1001" "length (enumFromThenTo 0 0 1000) == 0" It would seem to me that "enumFromThenTo x y z == map negate (enumFromThenTo (-x) (-y) (-z))" should be an invariant that should hold but in this case it clearly doesn't. Is this intentional, and if so, for what reason? Or is this a GHC bug? -------------- next part -------------- An HTML attachment was scrubbed... URL: From vandijk.roel at gmail.com Fri Mar 24 09:03:34 2017 From: vandijk.roel at gmail.com (Roel van Dijk) Date: Fri, 24 Mar 2017 10:03:34 +0100 Subject: [Haskell-cafe] Why does "enumFromThenTo x x y" depend on "y"? In-Reply-To: References: Message-ID: This behaviour follows directly from the language report [1]: - The sequence enumFromThenTo e1 e2 e3 is the list [e1,e1 + i,e1 + 2i,…e3 ], where the increment, i, is e2 − e1. If the increment is positive or zero, the list terminates when the next element would be greater than e3; the list is empty if e1 > e3. If the increment is negative, the list terminates when the next element would be less than e3; the list is empty if e1 < e3. In both "enumFromThenTo 3 3 5" and "enumFromThenTo 3 3 1" the increment is 0. So the list must terminate when the next element would be greater than 5 or 1 respectively. In this first case 3 > 5 == False, so you get an unbounded list. In the second case 3 > 1 == True, so you get an empty list. The above is only specified for the types Int and Integer. It would be nice to have some laws that govern the behaviour of all Enum instances (not just Int and Integer). Not just in relation with the Bounded class. 1 - https://www.haskell.org/onlinereport/haskell2010/haskellch6.html#x13-1310006.3.4 2017-03-24 4:27 GMT+01:00 Clinton Mead : > I'm implementing Enum for a type I have, and I figured it should replicate > what ordinary Enum types, so I did some tests on how Enum behaves. > > I noticed that: > > "enumFromThenTo 3 3 5" is not the same as "enumFromThenTo 3 3 1". > > This seems bizarre to me. Generally increasing the stepsize increases the > length of the list. > > For example, > > "length (enumFromThenTo 0 10 1000) == 101" > "length (enumFromThenTo 0 2 1000) == 501" > "length (enumFromThenTo 0 1 1000) == 1001" > "length (enumFromThenTo 0 0 1000) == infinite" > > but > > "length (enumFromThenTo 0 (-10) (-1000)) == 101" > "length (enumFromThenTo 0 (-2) (-1000)) == 501" > "length (enumFromThenTo 0 (-1) (-1000)) == 1001" > "length (enumFromThenTo 0 0 1000) == 0" > > It would seem to me that "enumFromThenTo x y z == map negate > (enumFromThenTo (-x) (-y) (-z))" should be an invariant that should hold > but in this case it clearly doesn't. > > Is this intentional, and if so, for what reason? Or is this a GHC bug? > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From abela at chalmers.se Fri Mar 24 10:30:15 2017 From: abela at chalmers.se (Andreas Abel) Date: Fri, 24 Mar 2017 11:30:15 +0100 Subject: [Haskell-cafe] Code Review Request - Unbalanced Parenthesis correction In-Reply-To: <2b2b48ba-4fc1-2c27-d710-c4c5fc38b550@orlitzky.com> References: <2b2b48ba-4fc1-2c27-d710-c4c5fc38b550@orlitzky.com> Message-ID: <0d5182cd-70c7-d521-455c-2ae4ade8fda1@chalmers.se> > balance _ = "" Haha! The other trivial solution simply replaces each parenthesis by "()": balance = concatMap $ const "()" balance "))(" then returns "()()()". This achieves that the balanced string is a superstring of the original string. (Not a minimal one.) On 21.03.2017 18:23, Michael Orlitzky wrote: > On 03/21/2017 01:16 PM, David McBride wrote: >> Whether your algorithm is correct depends on how you are supposed to >> rebalance them. My naive attempt gives very different results. >> > > You guys are trying to hard. Here's an algorithm that meets the stated > requirements: > > balance _ = "" -- Andreas Abel <>< Du bist der geliebte Mensch. Department of Computer Science and Engineering Chalmers and Gothenburg University, Sweden andreas.abel at gu.se http://www.cse.chalmers.se/~abela/ From jan.loewenstein at gmail.com Fri Mar 24 20:57:03 2017 From: jan.loewenstein at gmail.com (=?UTF-8?Q?Jan_von_L=C3=B6wenstein?=) Date: Fri, 24 Mar 2017 20:57:03 +0000 Subject: [Haskell-cafe] Code/style review Message-ID: Hi, TL;DR I am pretty new to Haskell and have some Haskell code I'd love to get feedback on. ( https://github.com/SAP/bosh-cpi-haskell/tree/a586079dd9383fca030f1536116522874a086a0f and https://github.com/SAP/bosh-kubernetes-cpi-release/tree/master/src/bosh-kubernetes-cpi ) Longer version: I started looking into Haskell back in November last year. Pretty soon I wanted to try something more "real-world" IO heavy in order to see how that goes. I came up with a side-project at work to implement a Bosh Kubernetes CPI. Bosh (bosh.io) is a tool to install and manage distributed systems on a range of IaaSs. In particular it is used to install Cloud Foundry (a cloud application development platform). I guess I don't have to introduce Kubernetes. The interface between Bosh and its cloud provider interfaces (CPI) is a simple command line application. Bosh provides configuration via file provided as process call argument. It provides the method to be invoked including arguments as JSON via stdin and expects a response via stdout. The CPI can provide a log via stderr. (http://bosh.io/docs/cpi-api-v1.html) The interface to Kubernetes is basically a REST api, i.e. http calls. Currently I use a generated client based on Servant ( https://github.com/soundcloud/haskell-kubernetes) I have put that interface into its own package. I created two typeclasses FileSystem[1] and System[2] to abstract away the system (I guess I should call them MonadFileSystem and MonadSystem to align with how mtl calls the monadic classes). And I created another typeclass MonadCpi[3] to abstract away the concrete implementation towards potentially several infrastructures. The Kubernetes implementation[4] is rather hacked (no tests, low testability, etc.) and I'd like to change that. I thought about a typeclass for REST resources (with methods create, get, list, update, delete, ...) and I begin to have problems integrating that into my current primitives (e.g. I'd like to have a MonadLog instance that uses my System typeclass for printing to stderr). That's when I started to ask myself if I had chosen the right Haskell tools and primitives for what I was doing and thought it was time to get some feedback from more experienced Haskellers aka you. I know this was a pretty long text. Sorry for that. Any feedback, including "you did it completely wrong" is appreciated - as long as it includes "have a look here and here", "look this is what I would do", or similar. Many thanks already for reading. Best Jan [1] https://github.com/SAP/bosh-cpi-haskell/blob/a586079dd9383fca030f1536116522874a086a0f/src/CPI/Base/System.hs#L29-L30 [2] https://github.com/SAP/bosh-cpi-haskell/blob/a586079dd9383fca030f1536116522874a086a0f/src/CPI/Base/System.hs#L32-L36 [3] https://github.com/SAP/bosh-cpi-haskell/blob/a586079dd9383fca030f1536116522874a086a0f/src/CPI/Base.hs#L126-L138 [4] https://github.com/SAP/bosh-kubernetes-cpi-release/blob/master/src/bosh-kubernetes-cpi/src/CPI/Kubernetes.hs#L65-L296 -------------- next part -------------- An HTML attachment was scrubbed... URL: From spam at scientician.net Fri Mar 24 21:23:40 2017 From: spam at scientician.net (Bardur Arantsson) Date: Fri, 24 Mar 2017 22:23:40 +0100 Subject: [Haskell-cafe] Void vs () Message-ID: Hi all, [Context: I'm working on a CQRS/ES library and in the following, "i" is an identifier for an aggregate root, "e" is an event type, and the "Int" is a sequence number.] So, I have a data type data Foo i e = Foo i e Int where I want to have a corresponding data Batch i e = Batch i [Foo x e Int] (I'll come back to "x". It's just a metasyntactic variable for now. The point of the "Int" is that it's extra information that I really need to keep, but it's not essential to the Foo data structure itself.) with an operation batchFoos :: [Foo i e] -> [Batch i e] batchFoos = ... (basically a standard Data.List.groupBy where I compare for equality on the i's.) I also have an extraction function toList :: Batch i e -> (i, [Foo x e Int]) My question is then: What's the best thing to use for "x", Void or ()? The idea behind "collapsing" the "i" parameter away to an "x" is to signal to users to the API that they can be absolutely certain that when they call "toList", they can be sure that all the Foo's that they get back have the same i value, namely the one which is the first component of the tuple. An alernative I've been considering is actually to create a Foo' type which actually does eliminate the i parameter, but it seems a bit boilerplatey. (It's not a *lot* of code to duplicate, so if it looks like the best option, I'll do that... but it feels odd.) Anyone have any suggestions on what the best way to approach this would be? (Aside: AFAICT there's no reasonable way to implement anything like Foldable or Traversable to avoid the explicit "toList" function, right? AFAICT Foldable/Traversable constrain you to using the *actual* last type parameter, "e", for folding over. Are there any generic alternative type classes that let you "pick your own element type"? I'm guessing Traversal could possibly be that, but if I have to incur a Lens dependency, I'll just live with a "toList" function. This is just about whether it can be done elegantly -- it's not a big deal.) Regards, From monkleyon at gmail.com Fri Mar 24 21:50:02 2017 From: monkleyon at gmail.com (MarLinn) Date: Fri, 24 Mar 2017 22:50:02 +0100 Subject: [Haskell-cafe] Void vs () In-Reply-To: References: Message-ID: <04fc62e0-9ca5-dcca-b76f-b09398ed995e@gmail.com> > My question is then: What's the best thing to use for "x", Void or ()? > […] > An alernative I've been considering is actually to create a Foo' type > which actually does eliminate the i parameter This is only a partial answer, but why not role your own i? And why not define Foo' in terms of Foo and whatever you end up using? data ThereIsNoIOnlyZuul -- intentionally left blank type Foo' e n = Foo ThereIsNoIOnlyZuul e n -- extra types included for clarity The reason I suggest this is that a) your own types are also documentation and b) you can change the behavior of your new type at will. Speaking of new types… > (Aside: AFAICT there's no reasonable way to implement anything like > Foldable or Traversable to avoid the explicit "toList" function, > right? […]) I suspect the canonical answer would be to use copious amounts of newtype. Downside: lots of wrapping and unwrapping. Upside: it's like an early Christmas! Cheers, MarLinn From spam at scientician.net Fri Mar 24 22:11:27 2017 From: spam at scientician.net (Bardur Arantsson) Date: Fri, 24 Mar 2017 23:11:27 +0100 Subject: [Haskell-cafe] Void vs () In-Reply-To: <04fc62e0-9ca5-dcca-b76f-b09398ed995e@gmail.com> References: <04fc62e0-9ca5-dcca-b76f-b09398ed995e@gmail.com> Message-ID: On 2017-03-24 22:50, MarLinn wrote: > >> My question is then: What's the best thing to use for "x", Void or ()? >> […] >> An alernative I've been considering is actually to create a Foo' type >> which actually does eliminate the i parameter > > This is only a partial answer, but why not role your own i? And why not > define Foo' in terms of Foo and whatever you end up using? > Not sure what you mean by "role your own i" ... but Foo' as a newtype of Foo might actually make a lot of sense. I think I'm *mostly* using type-class methods on the Foo, so I can just "propagate" those trivially. I hadn't considered that idea, thanks! (I'm sure it'll work out, but I'll at least try it to see how it works with the rest of the code.) > data ThereIsNoIOnlyZuul -- intentionally left blank > > type Foo' e n = Foo ThereIsNoIOnlyZuul e n -- extra types included > for clarity > Well, Void *is* ThereIsNoIOnlyZuul, at least AFAICT? :) Regards, From spam at scientician.net Fri Mar 24 22:26:26 2017 From: spam at scientician.net (Bardur Arantsson) Date: Fri, 24 Mar 2017 23:26:26 +0100 Subject: [Haskell-cafe] Void vs () In-Reply-To: References: <04fc62e0-9ca5-dcca-b76f-b09398ed995e@gmail.com> Message-ID: On 2017-03-24 23:11, Bardur Arantsson wrote: > (I'm sure it'll work out, but I'll at least try it to see how it works ^^^ not sure (I'm guessing that omission was pretty obvious from context, but...) From monkleyon at gmail.com Fri Mar 24 22:44:13 2017 From: monkleyon at gmail.com (MarLinn) Date: Fri, 24 Mar 2017 23:44:13 +0100 Subject: [Haskell-cafe] Void vs () In-Reply-To: References: <04fc62e0-9ca5-dcca-b76f-b09398ed995e@gmail.com> Message-ID: <3f643b71-dc99-194c-1784-7b765a8c00c9@gmail.com> > Not sure what you mean by "role your own i" Oups. *roll Basically what I did with ThereIsNoIOnlyZuul. A custom Void/(). > Well, Void *is* ThereIsNoIOnlyZuul, at least AFAICT? :) Apart from details, I think so too, yes. Void has instances and some primitive functions while Zuul has a more meaningful name (well… theoretically) and the ability to become more than itself later on. Say you're doing it like I suggested, but then you decide that () would have been better than something Void-like – just add a single constructor to Zuul, done. No global search-replace necessary. But it also comes down to preferences. I personally have started to define my own types even for things that could be trivially expressed via Bool, Maybe, or Either just so that my types are more mnemonic. But then some of my hobby projects stall because I can spend hours on adjusting types before I even start to really implement something… Painting the yak shed, if you will. Cheers, MarLinn From david.feuer at gmail.com Fri Mar 24 23:45:22 2017 From: david.feuer at gmail.com (David Feuer) Date: Fri, 24 Mar 2017 19:45:22 -0400 Subject: [Haskell-cafe] Void vs () In-Reply-To: References: Message-ID: Using Void states that the list will always be empty, because the only way to put elements in it would be to fill in the Void fields with bottoms. () is the canonical choice for "doesn't matter", but a custom data Boring = DoNotBother would work as well. On Mar 24, 2017 5:26 PM, "Bardur Arantsson" wrote: Hi all, [Context: I'm working on a CQRS/ES library and in the following, "i" is an identifier for an aggregate root, "e" is an event type, and the "Int" is a sequence number.] So, I have a data type data Foo i e = Foo i e Int where I want to have a corresponding data Batch i e = Batch i [Foo x e Int] (I'll come back to "x". It's just a metasyntactic variable for now. The point of the "Int" is that it's extra information that I really need to keep, but it's not essential to the Foo data structure itself.) with an operation batchFoos :: [Foo i e] -> [Batch i e] batchFoos = ... (basically a standard Data.List.groupBy where I compare for equality on the i's.) I also have an extraction function toList :: Batch i e -> (i, [Foo x e Int]) My question is then: What's the best thing to use for "x", Void or ()? The idea behind "collapsing" the "i" parameter away to an "x" is to signal to users to the API that they can be absolutely certain that when they call "toList", they can be sure that all the Foo's that they get back have the same i value, namely the one which is the first component of the tuple. An alernative I've been considering is actually to create a Foo' type which actually does eliminate the i parameter, but it seems a bit boilerplatey. (It's not a *lot* of code to duplicate, so if it looks like the best option, I'll do that... but it feels odd.) Anyone have any suggestions on what the best way to approach this would be? (Aside: AFAICT there's no reasonable way to implement anything like Foldable or Traversable to avoid the explicit "toList" function, right? AFAICT Foldable/Traversable constrain you to using the *actual* last type parameter, "e", for folding over. Are there any generic alternative type classes that let you "pick your own element type"? I'm guessing Traversal could possibly be that, but if I have to incur a Lens dependency, I'll just live with a "toList" function. This is just about whether it can be done elegantly -- it's not a big deal.) Regards, _______________________________________________ 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 capn.freako at gmail.com Sat Mar 25 01:39:06 2017 From: capn.freako at gmail.com (David Banas) Date: Fri, 24 Mar 2017 18:39:06 -0700 Subject: [Haskell-cafe] Literate Haskell w/ markdown? Message-ID: <1FA7EAA0-7857-420A-9FE7-EE5CC206F5D9@gmail.com> Hi all, Would anyone care to share their preferred method for writing/processing literate Haskell w/ markdown? Thanks, -db From mike at barrucadu.co.uk Sat Mar 25 08:17:37 2017 From: mike at barrucadu.co.uk (Michael Walker) Date: Sat, 25 Mar 2017 08:17:37 +0000 Subject: [Haskell-cafe] Literate Haskell w/ markdown? In-Reply-To: <1FA7EAA0-7857-420A-9FE7-EE5CC206F5D9@gmail.com> References: <1FA7EAA0-7857-420A-9FE7-EE5CC206F5D9@gmail.com> Message-ID: David, I occasionally use Literate Haskell with Markdown. For the most part it works though, as I'm sure you've found, GHC doesn't like lines starting with '#' which is a bit of a pain. If you use Pandoc to render your .lhs files, you can use '=' instead: http://pandoc.org/MANUAL.html#literate-haskell-support On 25 March 2017 at 01:39, David Banas wrote: > Hi all, > > Would anyone care to share their preferred method for writing/processing literate Haskell w/ markdown? > > Thanks, > -db > > _______________________________________________ > 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 simon at mintsource.org Sat Mar 25 08:35:51 2017 From: simon at mintsource.org (Simon Peter Nicholls) Date: Sat, 25 Mar 2017 09:35:51 +0100 Subject: [Haskell-cafe] Literate Haskell w/ markdown? In-Reply-To: <1FA7EAA0-7857-420A-9FE7-EE5CC206F5D9@gmail.com> References: <1FA7EAA0-7857-420A-9FE7-EE5CC206F5D9@gmail.com> Message-ID: <60E3AA74-B32E-4FB5-BF03-B121A72B07D6@mintsource.org> Hiya, markdown-unlit works for me: https://github.com/sol/markdown-unlit Cheers, Si > On 25 Mar 2017, at 02:39, David Banas wrote: > > Hi all, > > Would anyone care to share their preferred method for writing/processing literate Haskell w/ markdown? > > Thanks, > -db > > _______________________________________________ > 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 spam at scientician.net Sat Mar 25 09:21:28 2017 From: spam at scientician.net (Bardur Arantsson) Date: Sat, 25 Mar 2017 10:21:28 +0100 Subject: [Haskell-cafe] Void vs () In-Reply-To: References: Message-ID: On 2017-03-25 00:45, David Feuer wrote: > Using Void states that the list will always be empty, because the only > way to put elements in it would be to fill in the Void fields with > bottoms. Right, so I kind of took it to mean "don't even bother trying to look at this -- there's nothing here", but I guess it could get kind of awkward if you were to, say, try to sort the list further. You'd have to purposefully avoid the field explicitly... Haven't go to it, but I'm probably going to go with a newtype and punt the naming by just doing Foo' vs Foo. After all, naming is really hard. :). Regards, From cdsmith at gmail.com Sat Mar 25 23:51:48 2017 From: cdsmith at gmail.com (Chris Smith) Date: Sat, 25 Mar 2017 16:51:48 -0700 Subject: [Haskell-cafe] Void vs () In-Reply-To: References: Message-ID: I'm afraid the answers so far haven't been as clear as they should. You want (), and no one at all will be surprised by this use of (). () is the type that says the value should contain no information. There is one possible value; and since all values of () are the same, there's no information contained in the choice of value. It is completely standard to use () for situations exactly like this, where a type was designed with the possibility of some information being communicated, but in this case there's really nothing to say. Your situation is exactly analogous to common uses, like IO () as the type for IO actions with no result. So where does Void fit in? Void is a type that cannot occur at all! There are NO possible values for Void. The result is that there are no possible values for Foo Void e. And therefore, if you define Batch i e using Void, the only values of Batch i e are those that have an empty list, so Batch i e is isomorphic to Int. This is NOT what you want. (The above is ignoring bottoms. It's true that you can create other possible values of Foo Void e by using undefined as a value for Void. This isn't a road you want to go down.) On Sat, Mar 25, 2017 at 2:21 AM, Bardur Arantsson wrote: > On 2017-03-25 00:45, David Feuer wrote: > > Using Void states that the list will always be empty, because the only > > way to put elements in it would be to fill in the Void fields with > > bottoms. > > Right, so I kind of took it to mean "don't even bother trying to look at > this -- there's nothing here", but I guess it could get kind of awkward > if you were to, say, try to sort the list further. You'd have to > purposefully avoid the field explicitly... > > Haven't go to it, but I'm probably going to go with a newtype and punt > the naming by just doing Foo' vs Foo. After all, naming is really hard. :). > > Regards, > > _______________________________________________ > 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 chneukirchen at gmail.com Sun Mar 26 18:57:53 2017 From: chneukirchen at gmail.com (Christian Neukirchen) Date: Sun, 26 Mar 2017 20:57:53 +0200 Subject: [Haskell-cafe] Munich Haskell Meeting, 2017-03-29 @ 19:30 Message-ID: <87k27b7tn2.fsf@gmail.com> Dear all, Next week, our monthly Munich Haskell Meeting will take place again on Wednesday, March 29 at Max-Emanuel-Brauerei at 19h30. For details see here: http://muenchen.haskell.bayern/dates.html If you plan to join, please add yourself to this dudle so we can reserve enough seats! It is OK to add yourself to the dudle anonymously or pseudonymously. https://dudle.inf.tu-dresden.de/haskell-munich-mar-2017/ Everybody is welcome! cu, -- Christian Neukirchen http://chneukirchen.org From kaura.dev at sange.fi Mon Mar 27 21:11:24 2017 From: kaura.dev at sange.fi (Aura Kelloniemi) Date: Tue, 28 Mar 2017 00:11:24 +0300 Subject: [Haskell-cafe] Proposal for an extension: in-module namespaces Message-ID: <8737dye877.fsf@solaria> Hello I've been thinking about an extension to GHC which would allow creating new module-like namespaces within normal Haskell modules. Because this kind of namespacing system seems quite obvious to me, I ask if it has already been proposed or discussed in detail? The motivation: 1. It would assist in solving the 'pollution of namespace' -problem, of which many Haskellers have complained. 2. It would allow building bundles of related modules which can be exported from one module and then imported into others. This could result in radically fewer import statements. Rant: I'm tired of writing import qualified Data.ByteSstring as B import qualified Data.ByteString.Builder as B import qualified Data.ByteString.Lazy as BL import qualified Data.ByteString.Lazy.Builder as BL import qualified Data.HashMap.Strict as HM import qualified Data.Text as T import qualified Data.Text.Lazy as TL import qualified Data.Text.Lazy.Builder as BL A huge portion of this appears in almos all my Haskell source files. If I wrote my code in Python, I could condense all these imports to: So, you see, it was zero lines of code. I'm also tired of these patterns: (personName p), (companyName c), (objectName o), ... and I hardly prefer (name (p :: Person)), (name (c :: Company)) or (name (o ::Object)) using the DuplicateRecordFields syntax. Proposal: I propose that modules can contain named submodules. They can be exported and imported just like anything else within a module, like this: {-# LANGUAGE Submodules #-} module Library.Things (qualified module Person, qualified module Company, personWorksInCompany ) where -- import ... qualified module Person (Person (..)) where -- This is the module Library.Things.Person. Submodules could possibly -- use some other keywords than 'qualified module'. Maybe just 'module', -- 'submodule' or 'namespace'. data Person = Person { name :: {-# UNPACK #-} !T.Text, id :: {-# UNPACK #-} !Unique, ... } -- Back in Library.Things qualified module Company where data Company = Company { name :: {-# UNPACK #-} !T.Text, employees :: {-# UNPACK #-} !V.Vector Unique, ... } -- back in Library.Things again: personWorksIn :: Person.Person -> Company.Company -> Bool personWorksIn p c = Person.id p `elem` Company.employees c -- ... end of Library.Things And in another file: {-# LANGUAGE Submodules #-} -- The following demonstrates some ways of importing submodules. They are -- not meant to be used like this in real code: import Library.Things import qualified Library.Things as Things -- Now the submodules are also in scope and can be referred to like this: person1 :: Person.Person person2 :: Things.Person.Person company :: Library.Things.Company.Company -- And we also could have written: after importing Library.Things: import Person -- And now data type Person, selector name, etc. are in scope -- If we also imported the Company module: import Things.Company -- selector 'name' would now be ambiguous and need qualification at use site. -- Import lists would also work when bringing submodule contents to current -- namespace. Like this: import Library.Things hiding (module Company) -- or import qualified Library.Things (module Person) -- Which would allow Library.THings.Person.Person to be used requiring use of -- the fully qualified name. -- But the following would not work if Library.Things was not already -- imported: import Library.Things.Person -- because there is no such module, just submodule. -- ... end of other file Some projects probably would like to create a module like this: module Imports (qualified module B, qualified module HM, qualified module T ) where import Data.ByteString as B -- ... and so forth ... Open questions: - Should there be a separate keyword for importing submodules, for example 'use' or 'import namespace'? - Would imports be allowed within submodules? I'd say no for importing other modules, but importing submodules could be ok. - Would it be possible to extend submodules after their initial definition by just writing a new 'qualified module' block? I'd say yes, because submodules are just about namespacing. It is today possible to import many modules qualified and put them in the same namespace, like is often done. - What do you fellow Haskellers think about this all? -- Aura From palotai.robin at gmail.com Tue Mar 28 07:06:03 2017 From: palotai.robin at gmail.com (Robin Palotai) Date: Tue, 28 Mar 2017 09:06:03 +0200 Subject: [Haskell-cafe] Proposal for an extension: in-module namespaces In-Reply-To: <8737dye877.fsf@solaria> References: <8737dye877.fsf@solaria> Message-ID: My subjective cents: - Namespace pollution practically doesn't exist if you import qualified. - The common stuff you always import can just go to a custom prelude. You can roll your own based on, say, Protolude [1]. Please weight a power-to-disturbance ratio of new features. Each of these become additional burden when learning or for tool writers (say automatic refactoring tools etc). Robin [1]: http://www.stephendiehl.com/posts/protolude.html 2017-03-27 23:11 GMT+02:00 Aura Kelloniemi : > Hello > > I've been thinking about an extension to GHC which would allow creating new > module-like namespaces within normal Haskell modules. Because this kind of > namespacing system seems quite obvious to me, I ask if it has already been > proposed or discussed in detail? > > The motivation: > 1. It would assist in solving the 'pollution of namespace' -problem, of > which > many Haskellers have complained. > > 2. It would allow building bundles of related modules which can be exported > from one module and then imported into others. This could result in > radically fewer import statements. > > Rant: > > I'm tired of writing > > import qualified Data.ByteSstring as B > import qualified Data.ByteString.Builder as B > import qualified Data.ByteString.Lazy as BL > import qualified Data.ByteString.Lazy.Builder as BL > import qualified Data.HashMap.Strict as HM > import qualified Data.Text as T > import qualified Data.Text.Lazy as TL > import qualified Data.Text.Lazy.Builder as BL > > A huge portion of this appears in almos all my Haskell source files. If I > wrote my code in Python, I could condense all these imports to: > > > So, you see, it was zero lines of code. > > I'm also tired of these patterns: > (personName p), (companyName c), (objectName o), ... and I hardly > prefer (name (p :: Person)), (name (c :: Company)) or (name (o ::Object)) > using the DuplicateRecordFields syntax. > > Proposal: > > I propose that modules can contain named submodules. They can be exported > and > imported just like anything else within a module, like this: > > {-# LANGUAGE Submodules #-} > module Library.Things > (qualified module Person, > qualified module Company, > personWorksInCompany > ) where > > -- import ... > > qualified module Person (Person (..)) where > -- This is the module Library.Things.Person. Submodules could possibly > -- use some other keywords than 'qualified module'. Maybe just > 'module', > -- 'submodule' or 'namespace'. > data Person = Person { > name :: {-# UNPACK #-} !T.Text, > id :: {-# UNPACK #-} !Unique, > ... > } > > -- Back in Library.Things > qualified module Company where > data Company = Company { > name :: {-# UNPACK #-} !T.Text, > employees :: {-# UNPACK #-} !V.Vector Unique, > ... > } > > -- back in Library.Things again: > > personWorksIn :: Person.Person -> Company.Company -> Bool > personWorksIn p c = Person.id p `elem` Company.employees c > > -- ... end of Library.Things > > And in another file: > > {-# LANGUAGE Submodules #-} > > -- The following demonstrates some ways of importing submodules. They are > -- not meant to be used like this in real code: > import Library.Things > import qualified Library.Things as Things > > -- Now the submodules are also in scope and can be referred to like this: > person1 :: Person.Person > person2 :: Things.Person.Person > company :: Library.Things.Company.Company > > -- And we also could have written: after importing Library.Things: > import Person > -- And now data type Person, selector name, etc. are in scope > -- If we also imported the Company module: > import Things.Company > -- selector 'name' would now be ambiguous and need qualification at use > site. > > -- Import lists would also work when bringing submodule contents to current > -- namespace. Like this: > import Library.Things hiding (module Company) > -- or > import qualified Library.Things (module Person) > -- Which would allow Library.THings.Person.Person to be used requiring use > of > -- the fully qualified name. > > -- But the following would not work if Library.Things was not already > -- imported: > import Library.Things.Person > -- because there is no such module, just submodule. > > -- ... end of other file > > Some projects probably would like to create a module like this: > > module Imports > (qualified module B, > qualified module HM, > qualified module T > ) where > > import Data.ByteString as B > -- ... and so forth ... > > Open questions: > > - Should there be a separate keyword for importing submodules, for example > 'use' or 'import namespace'? > - Would imports be allowed within submodules? I'd say no for importing > other > modules, but importing submodules could be ok. > - Would it be possible to extend submodules after their initial definition > by just writing a new 'qualified module' block? I'd say yes, because > submodules are just about namespacing. It is today possible to import > many modules qualified and put them in the same namespace, like is often > done. > - What do you fellow Haskellers think about this all? > > -- > 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 shumovichy at gmail.com Tue Mar 28 09:23:36 2017 From: shumovichy at gmail.com (Yuras Shumovich) Date: Tue, 28 Mar 2017 12:23:36 +0300 Subject: [Haskell-cafe] Proposal for an extension: in-module namespaces In-Reply-To: <8737dye877.fsf@solaria> References: <8737dye877.fsf@solaria> Message-ID: Hello, Something like that was proposed multiple times, e.g. here: https://ghc.haskell.org/trac/ghc/wiki/Records/NestedModules I personally like the idea a lot because it makes module system much more refactoring friendly. E.g. you can merge two modules into one file without renaming conflicting names as a step in a long refactoring chain. Or you can prototype in one file, and split the code into multiple modules later. Also, I think backpack has some limited support for multiple modules in one file. At least I saw something similar in backpack examples in Edward Yang's blog. Anyway I'd like to see your idea officially proposed via ghc-proposals. Thanks, Yuras. 28 мар 2017 г. 0:14 пользователь "Aura Kelloniemi" написал: Hello I've been thinking about an extension to GHC which would allow creating new module-like namespaces within normal Haskell modules. Because this kind of namespacing system seems quite obvious to me, I ask if it has already been proposed or discussed in detail? The motivation: 1. It would assist in solving the 'pollution of namespace' -problem, of which many Haskellers have complained. 2. It would allow building bundles of related modules which can be exported from one module and then imported into others. This could result in radically fewer import statements. Rant: I'm tired of writing import qualified Data.ByteSstring as B import qualified Data.ByteString.Builder as B import qualified Data.ByteString.Lazy as BL import qualified Data.ByteString.Lazy.Builder as BL import qualified Data.HashMap.Strict as HM import qualified Data.Text as T import qualified Data.Text.Lazy as TL import qualified Data.Text.Lazy.Builder as BL A huge portion of this appears in almos all my Haskell source files. If I wrote my code in Python, I could condense all these imports to: So, you see, it was zero lines of code. I'm also tired of these patterns: (personName p), (companyName c), (objectName o), ... and I hardly prefer (name (p :: Person)), (name (c :: Company)) or (name (o ::Object)) using the DuplicateRecordFields syntax. Proposal: I propose that modules can contain named submodules. They can be exported and imported just like anything else within a module, like this: {-# LANGUAGE Submodules #-} module Library.Things (qualified module Person, qualified module Company, personWorksInCompany ) where -- import ... qualified module Person (Person (..)) where -- This is the module Library.Things.Person. Submodules could possibly -- use some other keywords than 'qualified module'. Maybe just 'module', -- 'submodule' or 'namespace'. data Person = Person { name :: {-# UNPACK #-} !T.Text, id :: {-# UNPACK #-} !Unique, ... } -- Back in Library.Things qualified module Company where data Company = Company { name :: {-# UNPACK #-} !T.Text, employees :: {-# UNPACK #-} !V.Vector Unique, ... } -- back in Library.Things again: personWorksIn :: Person.Person -> Company.Company -> Bool personWorksIn p c = Person.id p `elem` Company.employees c -- ... end of Library.Things And in another file: {-# LANGUAGE Submodules #-} -- The following demonstrates some ways of importing submodules. They are -- not meant to be used like this in real code: import Library.Things import qualified Library.Things as Things -- Now the submodules are also in scope and can be referred to like this: person1 :: Person.Person person2 :: Things.Person.Person company :: Library.Things.Company.Company -- And we also could have written: after importing Library.Things: import Person -- And now data type Person, selector name, etc. are in scope -- If we also imported the Company module: import Things.Company -- selector 'name' would now be ambiguous and need qualification at use site. -- Import lists would also work when bringing submodule contents to current -- namespace. Like this: import Library.Things hiding (module Company) -- or import qualified Library.Things (module Person) -- Which would allow Library.THings.Person.Person to be used requiring use of -- the fully qualified name. -- But the following would not work if Library.Things was not already -- imported: import Library.Things.Person -- because there is no such module, just submodule. -- ... end of other file Some projects probably would like to create a module like this: module Imports (qualified module B, qualified module HM, qualified module T ) where import Data.ByteString as B -- ... and so forth ... Open questions: - Should there be a separate keyword for importing submodules, for example 'use' or 'import namespace'? - Would imports be allowed within submodules? I'd say no for importing other modules, but importing submodules could be ok. - Would it be possible to extend submodules after their initial definition by just writing a new 'qualified module' block? I'd say yes, because submodules are just about namespacing. It is today possible to import many modules qualified and put them in the same namespace, like is often done. - What do you fellow Haskellers think about this all? -- 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 matija.pretnar at fmf.uni-lj.si Tue Mar 28 11:40:29 2017 From: matija.pretnar at fmf.uni-lj.si (Matija Pretnar) Date: Tue, 28 Mar 2017 13:40:29 +0200 Subject: [Haskell-cafe] Two PhD positions in Ljubljana starting October 2017 Message-ID: <0ECB1D3C-D41B-4879-A8DE-77BBECC01CA7@fmf.uni-lj.si> We are looking for two PhD students at the Faculty of Mathematics and Physics, University of Ljubljana. The programme starts in October 2017 and lasts three years. The positions will be fully funded (subject to approval by the funding agency). The candidates should have a Master's degree in mathematics or computer science. No knowledge of Slovene is required. The first PhD student will be advised by dr. Andrej Bauer. The topic of research is foundations of type theory. The candidate should have interest in mathematical aspects of type theory, and familiarity with proof assistants is desirable. The second PhD student will be advised by dr. Matija Pretnar. The topic of research is the theory of programming languages with a focus on computational effects. The candidate should have interest in both the mathematical foundations and practical implementation of programming languages. Candidates should send their applications as soon as possible, but no later than the end of April, to Andrej Bauer or Matija Pretnar , depending on their primary interest. Please include a short CV, academic record, and a statement of interest. Andrej Bauer and Matija Pretnar From ezyang at mit.edu Tue Mar 28 13:22:33 2017 From: ezyang at mit.edu (Edward Z. Yang) Date: Tue, 28 Mar 2017 09:22:33 -0400 Subject: [Haskell-cafe] Proposal for an extension: in-module namespaces In-Reply-To: References: <8737dye877.fsf@solaria> Message-ID: <1490707318-sup-7061@sabre> Excerpts from Yuras Shumovich's message of 2017-03-28 12:23:36 +0300: > Also, I think backpack has some limited support for multiple modules in one > file. At least I saw something similar in backpack examples in Edward > Yang's blog. You can put multiple modules in a bkp file, but that is mostly a tool for compiler tests, and not intended to be used for "real" software. Edward From shumovichy at gmail.com Tue Mar 28 13:43:54 2017 From: shumovichy at gmail.com (Yuras Shumovich) Date: Tue, 28 Mar 2017 16:43:54 +0300 Subject: [Haskell-cafe] Proposal for an extension: in-module namespaces In-Reply-To: <1490707318-sup-7061@sabre> References: <8737dye877.fsf@solaria> <1490707318-sup-7061@sabre> Message-ID: <1490708634.21383.3.camel@gmail.com> 28-03-2017, Аўт а 09:22 -0400, Edward Z. Yang напісаў: > Excerpts from Yuras Shumovich's message of 2017-03-28 12:23:36 +0300: > > Also, I think backpack has some limited support for multiple > > modules in one > > file. At least I saw something similar in backpack examples in > > Edward > > Yang's blog. > > You can put multiple modules in a bkp file, but that is mostly a tool > for compiler tests, and not intended to be used for "real" software. Thank you for clarification. Yeah, I think I saw it on GHC Trac too. It is very neat! But what prevents it from being useful for real software? I often use anansi ( http://hackage.haskell.org/package/anansi ) when prototyping new projects, so that I can write multiple modules in one file. (One .anansi file generates a number of .hs files.) But it is an ugly workaround at best. Yuras. > > Edward From ezyang at mit.edu Tue Mar 28 13:48:38 2017 From: ezyang at mit.edu (Edward Z. Yang) Date: Tue, 28 Mar 2017 09:48:38 -0400 Subject: [Haskell-cafe] Proposal for an extension: in-module namespaces In-Reply-To: <1490708634.21383.3.camel@gmail.com> References: <8737dye877.fsf@solaria> <1490707318-sup-7061@sabre> <1490708634.21383.3.camel@gmail.com> Message-ID: <1490708761-sup-3850@sabre> There are a number of problems: 1. There is no support for mixed Backpack/regular module projects, and it's not altogether clear how you would implement it, since it's not obvious from file naming where a "module" might live. This is in contrast to something like anansi which generates hs files so that the existing lookup codepaths work. 2. Recompilation avoidance operates on an entire bkp file, so if you modify any submodule, you have to rebuild everything. Not great if you actually have a lot of code. 3. GHCi doesn't know how to deal with bkp files at all. bkp files also support defining multiple libraries, which is a phase violation with Cabal, and not really solvable at all. Edward Excerpts from Yuras Shumovich's message of 2017-03-28 16:43:54 +0300: > 28-03-2017, Аўт а 09:22 -0400, Edward Z. Yang напісаў: > > Excerpts from Yuras Shumovich's message of 2017-03-28 12:23:36 +0300: > > > Also, I think backpack has some limited support for multiple > > > modules in one > > > file. At least I saw something similar in backpack examples in > > > Edward > > > Yang's blog. > > > > You can put multiple modules in a bkp file, but that is mostly a tool > > for compiler tests, and not intended to be used for "real" software. > > Thank you for clarification. Yeah, I think I saw it on GHC Trac too. It > is very neat! But what prevents it from being useful for real software? > I often use anansi ( http://hackage.haskell.org/package/anansi ) when > prototyping new projects, so that I can write multiple modules in one > file. (One .anansi file generates a number of .hs files.) But it is an > ugly workaround at best. > > Yuras. > > > > > Edward From mail at joachim-breitner.de Tue Mar 28 14:23:24 2017 From: mail at joachim-breitner.de (Joachim Breitner) Date: Tue, 28 Mar 2017 10:23:24 -0400 Subject: [Haskell-cafe] Proposal for an extension: in-module namespaces In-Reply-To: <8737dye877.fsf@solaria> References: <8737dye877.fsf@solaria> Message-ID: <1490711004.30447.7.camel@joachim-breitner.de> Hi, Am Dienstag, den 28.03.2017, 00:11 +0300 schrieb Aura Kelloniemi: > - What do you fellow Haskellers think about this all? no opinion yet, but with my context fixes proposal at https://github.com/ghc-proposals/ghc-proposals/pull/40 I got the feedback that on its own, it does not pull its weight, but as part of a larger deal, it might be a useful feature. So I guess you can also consider if “parametrized modules” might be something that you would want to add to your proposal. 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 jannis at limperg.de Tue Mar 28 14:53:53 2017 From: jannis at limperg.de (Jannis Limperg) Date: Tue, 28 Mar 2017 16:53:53 +0200 Subject: [Haskell-cafe] Proposal for an extension: in-module namespaces In-Reply-To: <8737dye877.fsf@solaria> References: <8737dye877.fsf@solaria> Message-ID: <54d35d59-513b-3fbe-1ec8-e99d7d72627f@limperg.de> > I've been thinking about an extension to GHC which would allow creating new > module-like namespaces within normal Haskell modules. Because this kind of > namespacing system seems quite obvious to me, I ask if it has already been > proposed or discussed in detail? Take a look at Agda's module system as described in the user documentation[1] and Norell's PhD thesis[2]. It supports the features you propose, along with lightweight parameterised modules (subsuming Joachim's "context fixes" proposal) and some additional stuff. At the same time, it doesn't buy into the complexity of ML-style generative module functors, which I think is a good tradeoff. [1] http://agda.readthedocs.io/en/v2.5.2/language/module-system.html [2] http://www.cse.chalmers.se/~ulfn/papers/thesis.pdf (PDF) Cheers, Jannis From scooter.phd at gmail.com Tue Mar 28 18:08:24 2017 From: scooter.phd at gmail.com (Scott Michel) Date: Tue, 28 Mar 2017 11:08:24 -0700 Subject: [Haskell-cafe] SublimeHaskell on SublimeText 2 Message-ID: Is there anyone out there who uses the SublimeHaskell plugin for SublimeText 2? Reason for asking: I would sincerely like to remove all vestiges of SublimeText 2 from the plugin. I suspect (know) that it hasn't worked for SublimeText 2 for a long time and the amount of work to backport the current plugin would involve significant effort. For those of you who gave up on SublimeHaskell: Consider giving it another chance. It's more stable now and I've personally been working off issues to make it, in the words of one of the testers, "suck less." (*) It's still not perfect -- known issues are: - The hsdev backend starts up always. I'm refactoring the backend management code, which will take a while, but this will get fixed. It will also enable an enterprising individual to integrate intero and other backends. - Can't connect to a remote hsdev backend. Planned enhancement. - Can't use multiple stack.yamls. Planned enhancement that could get released in the next two weeks. -scooter (*) Paraphrase of Michael Elkin's comment about the Mutt mail client: "All mail users agents suck, Mutt just sucks less." -------------- next part -------------- An HTML attachment was scrubbed... URL: From code at funwithsoftware.org Tue Mar 28 18:22:00 2017 From: code at funwithsoftware.org (Patrick Pelletier) Date: Tue, 28 Mar 2017 11:22:00 -0700 Subject: [Haskell-cafe] [ANN] wiringPi-1.0.1 Message-ID: <9b6087be-9ad6-6e92-ccf3-5fdd540f15db@funwithsoftware.org> https://hackage.haskell.org/package/wiringPi https://github.com/ppelleti/hs-wiringPi The most significant addition in this version is the wiringPiISR function, which makes it possible to get a callback when an input pin changes, thus avoiding the need to poll. In a future version, I might add a higher-level facility on top of this, such as the ability to update a TVar when an input changes. (Let me know if you have any thoughts on this.) New in 1.0.1: * Examples for Pi-LITEr and Fish Dish boards. * Added piGpioLayout as a synonym for piBoardRev, to reflect the name change in version 2.36 of the C library. * Addition of wiringPiISR function. (Contributed by Satoshi Ogata.) * Improvements to documentation and examples. About wiringPi: This is a Haskell binding to the wiringPi library, which allows you to interface with the GPIO pins on the Raspberry Pi. Unlike some other solutions for using the Raspberry Pi's GPIO pins, wiringPi provides access to more advanced features, such as enabling the internal pull-up or pull-down resistors. --Patrick From spam at scientician.net Wed Mar 29 05:39:11 2017 From: spam at scientician.net (Bardur Arantsson) Date: Wed, 29 Mar 2017 07:39:11 +0200 Subject: [Haskell-cafe] Queue which tracks actual in-memory element size? Message-ID: Hi all, So we have the TBQueue[1] which tracks the number of elements, but does anyone know if there's an equivalent queue which the actual combined size of the elements? (I'd be quite happy if it used "gsize" or similar, but I suppose the ideal would be if I could supply a "size estimator" function.) It seems like an obvious generalization of TBQueue[2], but my Google-fu is letting me down at the moment. Regards, --- [1] https://hackage.haskell.org/package/stm-2.4.4.1/docs/Control-Concurrent-STM-TBQueue.html [2] TBQueue would be the equivalent of estimating every element to have size 1. From tobias.grosser at inf.ethz.ch Wed Mar 29 05:45:23 2017 From: tobias.grosser at inf.ethz.ch (Tobias Grosser) Date: Wed, 29 Mar 2017 07:45:23 +0200 Subject: [Haskell-cafe] Call for participation - Programming Languages Mentoring Workshop (PLMW) Message-ID: <1490766323.2692905.926973637.752ACB7F@webmail.messagingengine.com> We invite early graduate students and undergraduates to apply for a scholarship and to participate in the Programming Languages Mentoring Workshop (PLMW) in Barcelona, Spain on Sunday, June 18, 2017. The purpose of this mentoring workshop is to encourage and prepare graduate students and senior undergraduate students to pursue careers in programming language research. The workshop also includes specific mentoring opportunities for students who belong to traditionally underrepresented populations, including women, people of color, students with disabilities, and first-generation students. Throughout the day, we’ll have technical sessions, to discuss cutting-edge research in programming languages; and mentoring sessions, to help you learn about, prepare, and succeed in your research career. You’ll also have the opportunity to talk with top programming language researchers and other students interested in programming language research. This workshop is part of the activities surrounding the Programming Languages Design and Implementation (PLDI) conference and takes place the day before the main conference. One goal of the workshop is to make the PLDI conference more accessible to newcomers. We hope that participants will stay through the entire conference. Other events that follow the workshop include the Programming Languages Summer School and the European Conference on Object-Oriented Programming (ECOOP). Scholarship funds are available for students to attend PLMW at PLDI. These scholarships should cover reasonable expenses (airfare, hotel, and registration fees) for attendance at both the workshop and an associated event (such as the PLDI conference or the summer school), but are limited. We welcome students with alternative sources of funding to attend as well; but everyone who plans to attend needs to apply. Apply for a scholarship and to participate at PLMW at PLDI: https://goo.gl/forms/80aacyFiXNFNnPqA3 The deadline for full consideration of funding is SATURDAY, APRIL 15. Selected participants will be notified by APRIL 29 and will need to pre-register and commit to attending the workshop by MAY 10. Applicants who apply after April 15 but by May 15 may be eligible to receive funding, if funds remain, and will be notified by by May 29. Additionally, if you are currently a student in the United States who cannot (or will not) travel due to concerns about US travel restrictions, we encourage you to apply and let us know. We may be able to arrange another form of mentoring for you. We look forward to seeing you! The PLMW at PLDI Organizers Michael Carbin, MIT Stephen Chong, Harvard University Işıl Dillig, The University of Texas at Austin Ben Wiedermann, Harvey Mudd College From litchard.michael at gmail.com Wed Mar 29 17:37:58 2017 From: litchard.michael at gmail.com (Michael Litchard) Date: Wed, 29 Mar 2017 10:37:58 -0700 Subject: [Haskell-cafe] Request for white paper Message-ID: I'm looking for a freely available version of the below paper. Google Scholar points me to 7 versions, all of which are behind a paywall. Stefan Kahrs, "Red-black trees with types", Journal of functional programming, 11(04), pp 425-432, July 2001 -------------- next part -------------- An HTML attachment was scrubbed... URL: From leo at woerteler.de Wed Mar 29 20:57:56 2017 From: leo at woerteler.de (=?UTF-8?Q?Leonard_W=c3=b6rteler?=) Date: Wed, 29 Mar 2017 22:57:56 +0200 Subject: [Haskell-cafe] Request for white paper In-Reply-To: References: Message-ID: <93ed6bf5-0cc3-32f9-9f62-0ac2bbfb4333@woerteler.de> Hi Michael, Am 29.03.2017 um 19:37 schrieb Michael Litchard: > I'm looking for a freely available version of the below paper. Google > Scholar points me to 7 versions, all of which are behind a paywall. > > Stefan Kahrs, "Red-black trees with types", Journal of functional > programming, 11(04), pp 425-432, July 2001 this link (and then clicking on the "Download full-text PDF" button) seems to work without registration: https://www.researchgate.net/publication/259413698_Red-black_trees_with_types Hope that helps, Leo From litchard.michael at gmail.com Thu Mar 30 00:02:42 2017 From: litchard.michael at gmail.com (Michael Litchard) Date: Wed, 29 Mar 2017 17:02:42 -0700 Subject: [Haskell-cafe] Request for white paper In-Reply-To: <93ed6bf5-0cc3-32f9-9f62-0ac2bbfb4333@woerteler.de> References: <93ed6bf5-0cc3-32f9-9f62-0ac2bbfb4333@woerteler.de> Message-ID: Thanks to everyone who sent me a link. :) Wow! On Wed, Mar 29, 2017 at 1:57 PM, Leonard Wörteler wrote: > Hi Michael, > > > Am 29.03.2017 um 19:37 schrieb Michael Litchard: > >> I'm looking for a freely available version of the below paper. Google >> Scholar points me to 7 versions, all of which are behind a paywall. >> >> Stefan Kahrs, "Red-black trees with types", Journal of functional >> programming, 11(04), pp 425-432, July 2001 >> > > this link (and then clicking on the "Download full-text PDF" button) seems > to work without registration: > > > https://www.researchgate.net/publication/259413698_Red-black > _trees_with_types > > Hope that helps, > Leo > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gershomb at gmail.com Thu Mar 30 22:21:46 2017 From: gershomb at gmail.com (Gershom B) Date: Thu, 30 Mar 2017 18:21:46 -0400 Subject: [Haskell-cafe] Compose Conference Call for Participation [NYC, May 18-19] Message-ID: =============================================== Call for Participation Compose Conference 2017 May 18-19 2017 New York, NY http://www.composeconference.org/2017 =============================================== The practice and craft of functional programming :: Conference Compose is a conference for typed functional programmers, focused specifically on Haskell, OCaml, F#, SML, and related technologies. Typed functional programming has been taken up widely, by industry and hobbyists alike. For many of us it has renewed our belief that code should be beautiful, and that programming can be as enjoyable as it is practical. Compose is about bringing together functional programmers of all levels of skill and experience — from technical leads to novices, and from long-time hackers to students just getting started. It will feature a keynote by Emily Riehl on aspects of category theory and computation, and two days of great talks. * Invited Talks Emily Riehl: TBA * Local Information (venue): http://www.composeconference.org/2017/ * Accepted Talks and Tutorials Barry Burd - Teaching Haskell David Rhodes - Learning F#: Case study with branch and bound Edmund Cape - Multiplying by 1 - an important form of computation and how it reveals distinctions between kleislis Enzo Alda, et al. - Reactive Sheets: an intuitive approach to functional‑reactive computing Hezekiah Carty and Chris Donaher - Distrest - REST access to distributed services Hongbo Zhang - BuckleScript: Making functional programming accessible to JavaScript developers Jennifer Paykin, Kenneth Foner, Antal Spector-Zabusky - `choose` Your Own Derivative Joachim Breitner - Lock-step simulation is child’s play Martín Ceresa, Gustavo Grieco - QuickFuzz Testing for Fun and Profit Michael Chavinda - Android programming in Froid Nikhil Barthwal - Implementing an Event-Driven Microservices Architecture in F#: A case study of Jet.com Nikita Volkov - New Hasql - a simpler, safer and faster Postgres client Sebastien Mondet - Typed-Tagless Final Bioinformatics Stephen Compall - Working with Monads in OCaml Stuart Popejoy - Smart Contracts and Formal Verification with Z3 with Pact Yaron Minsky - Data Driven UIs, Incrementally * Full abstracts: http://www.composeconference.org/2017/program * Registration: http://composeconference.eventbrite.com * Follow @composeconf on twitter for news: https://twitter.com/composeconf * On freenode irc, chat with fellow attendees at #composeconference * Corporate sponsorships are welcome. Current sponsors list forthcoming. * Policies (diversity and anti-harassment): http://www.composeconference.org/conduct * Email us with any questions at info at composeconference.org * Please forward this announcement to interested parties and lists. From trevor.mcdonell at gmail.com Fri Mar 31 09:25:13 2017 From: trevor.mcdonell at gmail.com (Trevor McDonell) Date: Fri, 31 Mar 2017 09:25:13 +0000 Subject: [Haskell-cafe] [ANN] Accelerate 1.0 Message-ID: Friends, After much delay, it is my pleasure to announce the release of Accelerate 1.0. Accelerate is an embedded language for computations on dense, multidimensional arrays. Computations are expressed in the form of parameterised collective operations, such as maps, folds, and permutations. These computations are online compiled and can be executed on a range of architectures, such as multicore CPUs and GPUs. This release includes updates to a number core and support packages: * accelerate: Defines the core language (https://hackage.haskell.org/package/accelerate) * accelerate-llvm-native: Accelerate backend to execute computations on multicore CPUs ( https://hackage.haskell.org/package/accelerate-llvm-native) * accelerate-llvm-ptx: Accelerate backend to execute computations on CUDA GPUs (https://hackage.haskell.org/package/accelerate-llvm-ptx) * accelerate-llvm: For developing new backends targeting LLVM (https://hackage.haskell.org/package/accelerate-llvm) * accelerate-io: Conversions between Accelerate arrays and other formats (including vector and repa) (https://hackage.haskell.org/package/accelerate-io) * accelerate-fft: FFI bindings to discrete Fourier transforms (FFTW and cuFFT) (https://hackage.haskell.org/package/accelerate-fft) * accelerate-bignum: Fixed-width large integer arithmetic (> 64-bits) (https://hackage.haskell.org/package/accelerate-bignum) * accelerate-examples: Computational kernels and example applications, as well as regression test suite (https://hackage.haskell.org/package/accelerate-examples) * mwc-random-accelerate: Generate Accelerate arrays filled with pseudorandom numbers (https://hackage.haskell.org/package/mwc-random-accelerate) * gloss-accelerate: Generate gloss pictures from Accelerate (https://hackage.haskell.org/package/gloss-accelerate) * gloss-raster-accelerate: Parallel rendering of raster images and animations (https://hackage.haskell.org/package/gloss-raster-accelerate) * colour-accelerate: Colour representations in Accelerate, including RGB, sRGB, HSV and HSL (https://hackage.haskell.org/package/colour-accelerate ) * lens-accelerate: Lens operators for Accelerate types (https://hackage.haskell.org/package/lens-accelerate) * (soon) linear-accelerate: Linear vector spaces in Accelerate (https://hackage.haskell.org/package/linear-accelerate) (pending https://github.com/ekmett/linear-accelerate/pull/4) The (still under construction) acceleratehs.org website includes some installation instructions and a short tutorial to help you get started. * http://www.acceleratehs.org/get-started.html * http://www.acceleratehs.org/examples/mandelbrot.html If you find a bug or have a question, head over to the GitHub issue tracker or mailing list. * https://github.com/AccelerateHS/accelerate/issues * accelerate-haskell at googlegroups.com We welcome new contributors, so please contact us if you would like to get involved! -------------- next part -------------- An HTML attachment was scrubbed... URL: From frederic.cogny at gmail.com Fri Mar 31 12:33:16 2017 From: frederic.cogny at gmail.com (Frederic Cogny) Date: Fri, 31 Mar 2017 12:33:16 +0000 Subject: [Haskell-cafe] Suggestion on how to solve a type issue with Numeric.AD Message-ID: Hello Café *Issue: * I'm having trouble using the AD package presumably due to a wrong use of types (Sorry I know it's a bit vague) Any help or pointer on how to solve this would be greatly appreciated. Thanks in advance *Background: * I've implemented a symbolic expression tree [full code here: https://pastebin.com/FDpSFuRM] -- | Expression Tree data ExprTree a = Const a -- ^ number | ParamNode ParamName -- ^ parameter | VarNode VarName -- ^ variable | UnaryNode MonoOp (ExprTree a) -- ^ operator of arity 1 | BinaryNode DualOp (ExprTree a) (ExprTree a) -- ^ operator of arity 2 | CondNode (Cond a) (ExprTree a) (ExprTree a) -- ^ conditional node deriving (Eq,Show, Generic) An evaluation function on it -- | evaluates an Expression Tree on its Context (Map ParamName a, Map VarName a) evaluate :: (Eq a, Ord a, Floating a) => ExprTree a -> Context a -> a And a few instances on it: instance Num a => Default (ExprTree a) where ... instance Num a => Num (ExprTree a) where ... instance Fractional a => Fractional (ExprTree a) where ... instance Floating a => Floating (ExprTree a) where ... instance (Arbitrary a) => Arbitrary (ExprTree a) where ... This allows me to easily create (using derivation rules) the derivative(s) of such a tree with respect to its variable(s): diff :: (Eq a, Floating a) => ExprTree a -> VarName -> ExprTree a grad :: (Eq a, Floating a) => ExprTree a -> Map VarName (ExprTree a) hessian :: (Eq a, Floating a) => ExprTree a -> Map VarName (Map VarName (ExprTree a)) So far, so good ... Now, to gain assurance in my implementation I wanted to check the derivatives against the Numeric.AD module so I create the two following -- | helper for AD usage exprTreeToListFun :: (RealFloat a) => ExprTree a -- ^ tree -> Map ParamName a -- ^ paramDict -> ([a] -> a) -- fun from var values to their evaluation exprTreeToListFun tree paramDict vals = res where res = evaluate tree (paramDict, varDict) varDict = Map.fromList $ zip (getVarNames tree) vals gradThroughAD :: RealFloat a => ExprTree a -> Context a -> Map VarName a gradThroughAD tree (paramDict, varDict) = res where varNames = Map.keys varDict varVals = Map.elems varDict gradList = AD.grad (exprTreeToListFun tree paramDict) varVals res = Map.fromList $ zip varNames gradList it unfortunately does not type check with message: • Couldn't match type ‘a’ with ‘Numeric.AD.Internal.Reverse.Reverse s a’ ‘a’ is a rigid type variable bound by the type signature for: gradThroughAD :: forall a. RealFloat a => ExprTree a -> Context a -> Map VarName a at src/ SymbolicExpression.hs:452:18 Expected type: [Numeric.AD.Internal.Reverse. Reverse s a] -> Numeric.AD.Internal.Reverse.Reverse s a Actual type: [a] -> a • In the first argument of ‘AD.grad’, namely ‘(exprTreeToListFun tree paramDict)’ In the expression: AD.grad (exprTreeToListFun tree paramDict) varVals In an equation for ‘gradList’: gradList = AD.grad (exprTreeToListFun tree paramDict) varVals • Relevant bindings include gradList :: [a] (bound at src/SymbolicExpression.hs:457:5) varVals :: [a] (bound at src/ SymbolicExpression.hs:456:5) varDict :: Map VarName a (bound at src/SymbolicExpression.hs:453:32) paramDict :: Map ParamName a (bound at src/SymbolicExpression.hs:453:21) tree :: ExprTree a (bound at src/ SymbolicExpression.hs:453:15) gradThroughAD :: ExprTree a -> Context a -> Map VarName a (bound at src/SymbolicExpression.hs:453:1) I was a bit surprised (I guess naively) by this, since to me, 'a' is polymorphic with RealFloat as type constraint and that is "supposed" to work with AD So anyway, I tried to modify as follow: {-# LANGUAGE Rank2Types #-} -- | helper for AD usage exprTreeToListFun :: (RealFloat a) => ExprTree a -- ^ tree -> Map ParamName a -- ^ paramDict -> *(RealFloat b => *[b] -> b) -- fun from var values to their evaluation exprTreeToListFun tree paramDict vals = res where res = *realToFrac* $ evaluate tree (paramDict, varDict) varDict = Map.fromList $ zip (getVarNames tree) *$ map realToFrac *vals This now typechecks and runs but going through AD returns me *all derivatives as zero* as if treating the variables (that passed through *realToFrac*) as constants, so not that much helpful either. Any idea how this can be solved ? Apologies if this is a question that already has an answer somewhere but poking around SO It looks like I'm not the only one having similar issues and unfortunately none of the answers I found really helped me, if anything it confirms the same issue of null derivatives: http://stackoverflow.com/questions/36878083/ad-type-unification-error-with-constrained-type-vector Thanks again -- Frederic Cogny +33 7 83 12 61 69 -------------- next part -------------- An HTML attachment was scrubbed... URL: