From publicityifl at gmail.com Tue May 1 05:26:55 2018 From: publicityifl at gmail.com (Jurriaan Hage) Date: Mon, 30 Apr 2018 22:26:55 -0700 Subject: [Haskell-cafe] 3rd CfP: IFL 2018 (30th Symposium on Implementation and Application of Functional Languages) Message-ID: Hello, Please, find below the third call for papers for IFL 2018. Please forward these to anyone you think may be interested. Apologies for any duplicates you may receive. best regards, Jurriaan Hage Publicity Chair of IFL --- ============================================================ ==================== IFL 2018 30th Symposium on Implementation and Application of Functional Languages University of Massachusetts Lowell, MA, USA September 5th-7th, 2018 http://iflconference.org ============================================================ ==================== ### Scope The goal of the IFL symposia is to bring together researchers actively engaged in the implementation and application of functional and function-based programming languages. IFL 2018 will be a venue for researchers to present and discuss new ideas and concepts, work in progress, and publication-ripe results related to the implementation and application of functional languages and function-based programming. Topics of interest to IFL include, but are not limited to: - language concepts - type systems, type checking, type inferencing - compilation techniques - staged compilation - run-time function specialization - run-time code generation - partial evaluation - (abstract) interpretation - metaprogramming - generic programming - automatic program generation - array processing - concurrent/parallel programming - concurrent/parallel program execution - embedded systems - web applications - (embedded) domain specific languages - security - novel memory management techniques - run-time profiling performance measurements - debugging and tracing - virtual/abstract machine architectures - validation, verification of functional programs - tools and programming techniques - (industrial) applications ### Keynote Speakers * Adam Chlipala, Massachusetts Institute of Technology CSAIL * Arjun Guha, University of Massachusetts Amherst ### Submissions and peer-review Differently from previous editions of IFL, IFL 2018 solicits two kinds of submissions: * Regular papers (12 pages including references) * Draft papers for presentations ('weak' limit between 8 and 15 pages) Regular papers will undergo a rigorous review by the program committee, and will be evaluated according to their correctness, novelty, originality, relevance, significance, and clarity. A set of regular papers will be conditionally accepted for publication. Authors of conditionally accepted papers will be provided with committee reviews along with a set of mandatory revisions. Regular papers not accepted for publication will be considered as draft papers, at the request of the author. Draft papers will be screened to make sure that they are within the scope of IFL, and will be accepted for presentation or rejected accordingly. Prior to the symposium: Authors of conditionally accepted papers and accepted presentations will submit a pre-proceedings version of their work that will appear in the draft proceedings distributed at the symposium. The draft proceedings does not constitute a formal publication. We require that at least one of the authors present the work at IFL 2018. After the symposium: Authors of conditionally accepted papers will submit a revised versions of their paper for the formal post-proceedings. The program committee will assess whether the mandatory revisions have been adequately addressed by the authors and thereby determines the final accept/reject status of the paper. Our interest is to ultimately accept all conditionally accepted papers. If you are an author of a conditionally accepted paper, please make sure that you address all the concerns of the reviewers. Authors of accepted presentations will be given the opportunity to incorporate the feedback from discussions at the symposium and will be invited to submit a revised full article for the formal post-proceedings. The program committee will evaluate these submissions according to their correctness, novelty, originality, relevance, significance, and clarity, and will thereby determine whether the paper is accepted or rejected. ### Publication The formal proceedings will appear in the International Conference Proceedings Series of the ACM Digital Library. At no time may work submitted to IFL be simultaneously submitted to other venues; submissions must adhere to ACM SIGPLAN's republication policy: http://www.sigplan.org/Resources/Policies/Republication ### Important dates Submission of regular papers: May 25, 2018 Submission of draft papers: July 17, 2018 Regular and draft papers notification: July 20, 2018 Deadline for early registration: August 8, 2018 Submission of pre-proceedings version: August 29, 2018 IFL Symposium: September 5-7, 2018 Submission of papers for post-proceedings: November 7, 2018 Notification of acceptance: December 22, 2018 Camera-ready version: February 10, 2019 ### Submission details All contributions must be written in English. Papers must use the ACM two columns conference format, which can be found at: http://www.acm.org/publications/proceedings-template Authors submit through EasyChair: https://easychair.org/conferences/?conf=ifl2018 ### Peter Landin Prize The Peter Landin Prize is awarded to the best paper presented at the symposium every year. The honored article is selected by the program committee based on the submissions received for the formal review process. The prize carries a cash award equivalent to 150 Euros. ### Organization and Program committee Chairs: Jay McCarthy & Matteo Cimini, University of Massachusetts Lowell, USA Program Committee: * Arthur Chargueraud, Inria, FR * Ben Delaware, Purdue University, USA * Christos Dimoulas, Northwestern University, USA * David Darais, University of Vermont, USA * Dominic Orchard, University of Kent, UK * Ekaterina Komendantskaya, Heriot-Watt University, UK * Garrett Morris, University of Kansas, USA * Heather Miller, EPFL & Northeastern University, CH & USA * Jeremy Yallop, University of Cambridge, UK * Keiko Nakata, SAP Innovation Center Potsdam, DE * Laura Castro, University of A Coruna, ESP * Magnus Myreen, Chalmers University of Technology, SWE * Natalia Chechina, Bournemouth University, UK * Peter Achten, Radboud Universiteit Nijmegen, NL * Peter-Michael Osera, Grinnell College, USA * Richard Eisenberg, Bryn Mawr College, USA * Trevor McDonell, University of New South Wales, AUS * Yukiyoshi Kameyama, University of Tsukuba, JAP ### Venue The 30th IFL is organized by the University of Massachusetts Lowell. The City of Lowell is located at the heart of the Merrimack Valley just 30 miles northwest of Boston. Lowell can be easily reached by train or taxi. See the website for more information on the venue. ### Acknowledgments This call-for-papers is an adaptation and evolution of content from previous instances of IFL. We are grateful to prior organizers for their work, which is reused here. A part of IFL 2018 format and CFP language that describes conditionally accepted papers has been adapted from call-for-papers of OOPSLA conferences. -------------- next part -------------- An HTML attachment was scrubbed... URL: From juhpetersen at gmail.com Tue May 1 06:48:21 2018 From: juhpetersen at gmail.com (Jens Petersen) Date: Tue, 1 May 2018 15:48:21 +0900 Subject: [Haskell-cafe] [ANNOUNCE] GHC 8.4.2 released In-Reply-To: <87in8md9v9.fsf@smart-cactus.org> References: <87in8md9v9.fsf@smart-cactus.org> Message-ID: I have built ghc-8.4.2 for Fedora and EPEL7 in https://copr.fedorainfracloud.org/coprs/petersen/ghc-8.4.2/ Thanks, Jens From paolo.veronelli at gmail.com Wed May 2 13:07:05 2018 From: paolo.veronelli at gmail.com (Paolino) Date: Wed, 2 May 2018 15:07:05 +0200 Subject: [Haskell-cafe] profunctorial vs vanlaarhoven lenses Message-ID: Hello, I'm trying to write a lens for a datatype which seems easy in the Twan van Laarhoven encoding but I cannot find it as easy in the profunctorial one data Q5 a b = Q51 a (Identity b) | Q52 [b] lq5Twan :: Applicative f => (b -> f b') -> Q5 a b -> f (Q5 a b') lq5Twan f (Q51 a bs) = Q51 a <$> traverse f bs lq5Twan f (Q52 bs) = Q52 <$> traverse f bs data BT tt tt' b t t' a = BT1 (tt -> b) (t a) | BT2 (tt' -> b) (t' a) deriving (Functor,Foldable,Traversable) runBT (BT1 f x) = f x runBT (BT2 f x) = f x lq5Profunctor :: forall p a b b' . Traversing p => p b b' -> p (Q5 a b) (Q5 a b') lq5Profunctor = dimap pre post . second' . traverse' where pre (Q51 a x) = ((), BT1 (Q51 a) x) pre (Q52 bs) = ((), BT2 Q52 bs) post ((),x) = runBT x The issue here is that I need to project type 'b' into 2 different Traversable (sketched [] and Identity) so the traverse' must handle both together. Is the lq5Twan correct ? Which simpler ways to write the lq5Profunctor we have ? Thanks for help. paolino -------------- next part -------------- An HTML attachment was scrubbed... URL: From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Wed May 2 16:10:12 2018 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Wed, 2 May 2018 17:10:12 +0100 Subject: [Haskell-cafe] profunctorial vs vanlaarhoven lenses In-Reply-To: References: Message-ID: <20180502161012.gdbocvz7uipfmvdo@weber> On Wed, May 02, 2018 at 03:07:05PM +0200, Paolino wrote: > I'm trying to write a lens for a datatype which seems easy in the Twan van > Laarhoven encoding but I cannot find it as easy in the profunctorial one > > data Q5 a b = Q51 a (Identity b) | Q52 [b] > > lq5Twan :: Applicative f => (b -> f b') -> Q5 a b -> f (Q5 a b') > lq5Twan f (Q51 a bs) = Q51 a <$> traverse f bs > lq5Twan f (Q52 bs) = Q52 <$> traverse f bs [...] > lq5Profunctor :: forall p a b b' . Traversing p => p b b' -> p (Q5 a > b) (Q5 a b') [...] > Which simpler ways to write the lq5Profunctor we have ? Is `wander lq5Twan` good enough, or is your question more philosophical? From paolo.veronelli at gmail.com Wed May 2 16:29:09 2018 From: paolo.veronelli at gmail.com (Paolino) Date: Wed, 2 May 2018 18:29:09 +0200 Subject: [Haskell-cafe] profunctorial vs vanlaarhoven lenses In-Reply-To: <20180502161012.gdbocvz7uipfmvdo@weber> References: <20180502161012.gdbocvz7uipfmvdo@weber> Message-ID: Well, I can accept it as an evidence of why not to use the profunctor encoding for multi target lens (if that's the name). But I guess we are already in philosophy (so I'm more puzzled than before) and I hope you can elaborate more. .p 2018-05-02 18:10 GMT+02:00 Tom Ellis < tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk>: > On Wed, May 02, 2018 at 03:07:05PM +0200, Paolino wrote: > > I'm trying to write a lens for a datatype which seems easy in the Twan > van > > Laarhoven encoding but I cannot find it as easy in the profunctorial one > > > > data Q5 a b = Q51 a (Identity b) | Q52 [b] > > > > lq5Twan :: Applicative f => (b -> f b') -> Q5 a b -> f (Q5 a b') > > lq5Twan f (Q51 a bs) = Q51 a <$> traverse f bs > > lq5Twan f (Q52 bs) = Q52 <$> traverse f bs > [...] > > lq5Profunctor :: forall p a b b' . Traversing p => p b b' -> p (Q5 a > > b) (Q5 a b') > [...] > > Which simpler ways to write the lq5Profunctor we have ? > > Is `wander lq5Twan` good enough, or is your question more philosophical? > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view 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 tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Wed May 2 16:31:39 2018 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Wed, 2 May 2018 17:31:39 +0100 Subject: [Haskell-cafe] profunctorial vs vanlaarhoven lenses In-Reply-To: References: Message-ID: <20180502163139.rd74vbqnwwaqd4ci@weber> On Wed, May 02, 2018 at 03:07:05PM +0200, Paolino wrote: > I'm trying to write a lens for a datatype which seems easy in the Twan van > Laarhoven encoding but I cannot find it as easy in the profunctorial one By the way ... which library are you using for profunctor lenses? From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Wed May 2 16:43:57 2018 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Wed, 2 May 2018 17:43:57 +0100 Subject: [Haskell-cafe] profunctorial vs vanlaarhoven lenses In-Reply-To: References: <20180502161012.gdbocvz7uipfmvdo@weber> Message-ID: <20180502164357.kjjg74bg26fv7wh5@weber> I'm not sure what you mean. If you want to write a profunctor traversal then `wander lq5Twan` seems fine. If you want to understand why it's hard to directly write profunctor traversals then I'm afraid I'm as puzzled as you. On Wed, May 02, 2018 at 06:29:09PM +0200, Paolino wrote: > Well, I can accept it as an evidence of why not to use the profunctor > encoding for multi target lens (if that's the name). > But I guess we are already in philosophy (so I'm more puzzled than before) > and I hope you can elaborate more. > > .p > > > 2018-05-02 18:10 GMT+02:00 Tom Ellis < > tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk>: > > > On Wed, May 02, 2018 at 03:07:05PM +0200, Paolino wrote: > > > I'm trying to write a lens for a datatype which seems easy in the Twan > > van > > > Laarhoven encoding but I cannot find it as easy in the profunctorial one > > > > > > data Q5 a b = Q51 a (Identity b) | Q52 [b] > > > > > > lq5Twan :: Applicative f => (b -> f b') -> Q5 a b -> f (Q5 a b') > > > lq5Twan f (Q51 a bs) = Q51 a <$> traverse f bs > > > lq5Twan f (Q52 bs) = Q52 <$> traverse f bs > > [...] > > > lq5Profunctor :: forall p a b b' . Traversing p => p b b' -> p (Q5 a > > > b) (Q5 a b') > > [...] > > > Which simpler ways to write the lq5Profunctor we have ? > > > > Is `wander lq5Twan` good enough, or is your question more philosophical? From paolo.veronelli at gmail.com Wed May 2 17:09:42 2018 From: paolo.veronelli at gmail.com (Paolino) Date: Wed, 2 May 2018 19:09:42 +0200 Subject: [Haskell-cafe] profunctorial vs vanlaarhoven lenses In-Reply-To: <20180502164357.kjjg74bg26fv7wh5@weber> References: <20180502161012.gdbocvz7uipfmvdo@weber> <20180502164357.kjjg74bg26fv7wh5@weber> Message-ID: I'm not using any lens libraries, I'm writing both encodings from scratch based on standard libs, as a learning path. I see anyway that Traversing class is declaring exactly the Twan -> Profunctor promotion (given the Applicative on f) which looks a lot like a white flag on the "write traversal as profunctor" research. Actually I was induced from purescript to think that the profunctorial encoding was completely alternative to the twan, but I had no evidence of the fact, so I should better dig into purescript library. .p 2018-05-02 18:43 GMT+02:00 Tom Ellis < tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk>: > I'm not sure what you mean. If you want to write a profunctor traversal > then `wander lq5Twan` seems fine. If you want to understand why it's hard > to directly write profunctor traversals then I'm afraid I'm as puzzled as > you. > > On Wed, May 02, 2018 at 06:29:09PM +0200, Paolino wrote: > > Well, I can accept it as an evidence of why not to use the profunctor > > encoding for multi target lens (if that's the name). > > But I guess we are already in philosophy (so I'm more puzzled than > before) > > and I hope you can elaborate more. > > > > .p > > > > > > 2018-05-02 18:10 GMT+02:00 Tom Ellis < > > tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk>: > > > > > On Wed, May 02, 2018 at 03:07:05PM +0200, Paolino wrote: > > > > I'm trying to write a lens for a datatype which seems easy in the > Twan > > > van > > > > Laarhoven encoding but I cannot find it as easy in the profunctorial > one > > > > > > > > data Q5 a b = Q51 a (Identity b) | Q52 [b] > > > > > > > > lq5Twan :: Applicative f => (b -> f b') -> Q5 a b -> f (Q5 a b') > > > > lq5Twan f (Q51 a bs) = Q51 a <$> traverse f bs > > > > lq5Twan f (Q52 bs) = Q52 <$> traverse f bs > > > [...] > > > > lq5Profunctor :: forall p a b b' . Traversing p => p b b' -> p (Q5 a > > > > b) (Q5 a b') > > > [...] > > > > Which simpler ways to write the lq5Profunctor we have ? > > > > > > Is `wander lq5Twan` good enough, or is your question more > philosophical? > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From oleg.grenrus at iki.fi Wed May 2 21:06:57 2018 From: oleg.grenrus at iki.fi (Oleg Grenrus) Date: Thu, 3 May 2018 00:06:57 +0300 Subject: [Haskell-cafe] profunctorial vs vanlaarhoven lenses In-Reply-To: References: <20180502161012.gdbocvz7uipfmvdo@weber> <20180502164357.kjjg74bg26fv7wh5@weber> Message-ID: Here's a little gist I wrote. See https://gist.github.com/phadej/04aae6cb98840ef9eeb592b76e6f3a67 for syntax highlighted versions. Hopefully it gives you some insights! \begin{code} {-# LANGUAGE RankNTypes, DeriveFunctor, DeriveFoldable, DeriveTraversable, TupleSections #-} import Data.Functor.Identity import Data.Profunctor import Data.Profunctor.Traversing import Data.Traversable import Data.Tuple (swap) data Q5 a b = Q51 a (Identity b) | Q52 [b] lq5Twan :: Applicative f => (b -> f b') -> Q5 a b -> f (Q5 a b') lq5Twan f (Q51 a bs) = Q51 a <$> traverse f bs lq5Twan f (Q52 bs) = Q52 <$> traverse f bs data BT tt tt' b t t' a = BT1 (tt -> b) (t a) | BT2 (tt' -> b) (t' a) deriving (Functor,Foldable,Traversable) runBT (BT1 f x) = f x runBT (BT2 f x) = f x lq5Profunctor :: forall p a b b' . Traversing p => p b b' -> p (Q5 a b) (Q5 a b') lq5Profunctor = dimap pre post . second' . traverse' where   pre (Q51 a x) = ((), BT1 (Q51 a) x)   pre (Q52 bs) = ((), BT2 Q52 bs)   post ((),x) = runBT x \end{code} \begin{code} instance Functor (Q5 a) where fmap = fmapDefault instance Foldable (Q5 a) where foldMap = foldMapDefault instance Traversable (Q5 a) where     traverse f (Q51 a bs) = Q51 a <$> traverse f bs     traverse f (Q52 bs) = Q52 <$> traverse f bs lq5Twan' :: Applicative f => (b -> f b') -> Q5 a b -> f (Q5 a b') lq5Twan' = traverse lq5Profunctor' :: forall p a b b' . Traversing p => p b b' -> p (Q5 a b) (Q5 a b') lq5Profunctor' = traverse' \end{code} And in general: three steps: 1. create a Traversable newtype over your type 2. dimap pre post . traverse' 3. Profit! Compare that to writing Lens 1. bijection your 's' to (a, r) (Note: 'r' can be 's'!) 2. dimap to from . first' 3. Profit! Trivial examples: \begin{code} type Lens s t a b = forall p. Strong p => p a b -> p s t _1 :: Lens (a, c) (b, c) a b _1 = dimap id id . first' _2 :: Lens (c, a) (c, b) a b _2 = dimap swap swap . first' \end{code} Note again, that in usual `lens` definition we pick r to be s: we "carry over" the whole "s", though "s - a = r" would be enough. But in practice constructing "residual" is expensive. Think about record with 10 fields: residual in a single field lens would be 9-tuple - not really worth it. Interlude, one can define Traversal over first argument too. Using Bitraversable class that would be direct. In this case it's Affine (Traversal), so we can do "better" than using `traverse'`. \begin{code} lq5ProFirst :: forall p a a' b. (Choice p, Strong p) => p a a' -> p (Q5 a b) (Q5 a' b) lq5ProFirst = dimap f g . right' . first' where     -- Think why we have chosen [b] + a * b     -- compare to definition of Q5!     --     -- The r + r' * s shape justifies the name Affine, btw.     f :: Q5 a b -> Either [b] (a, Identity b)     f (Q51 a x) = Right (a, x)     f (Q52 bs)  = Left bs     g (Left bs) = Q52 bs     g (Right (a, x)) = Q51 a x \end{code} Note: how the same 1. bijection to some structure (`r' + r * a` in this case 2. dimap to from . ... 3. Profit pattern is applied again. Another way to think about it is that we 1. Use `Iso` (for all Profunctor!) to massage value into the form, so 2. we can use "Optic specific" transform 3. Profit! And optic specific: - Lens -> Products - Prism -> Coproducts (Sums) - Traversal -> Traversable - Setter -> Functor (Mapping type class has map' :: Functor f => p a b -> p (f a) (f b)) - etc. So the fact that defining arbitrary Traversals directly is more handy with `wander`, than `traverse'` (as you can omit `dimap`!) is more related to the fact that we have \begin{spec} class Traversable t where     traverse :: Applicative f => (a -> f b) -> t a -> f (t b) \end{spec} ... and we (well, me) don't yet know another elegant way to capture "the essense of Traversable". (I don't think FunList is particularly "elegant") Sidenote: we can define Lens using Traversing/Mapping -like class too, hopefully it gives you another viewpoint too. \begin{code} class Functor t => Singular t where     single :: Functor f => (a -> f b) -> t a -> f (t b) fmapSingle :: Singular t => (a -> b) -> t a -> t b fmapSingle ab ta = runIdentity (single (Identity . ab) ta) instance Singular Identity where     single f (Identity a) = Identity <$> f a instance Singular ((,) a) where     single f (a, b) = (a,) <$> f b class Profunctor p => Strong' p where     single' :: Singular f => p a b -> p (f a) (f b) instance Strong' (->) where     single' ab = fmap ab instance Functor f => Strong' (Star f) where     single' (Star afb) = Star (single afb) -- lens using Strong' & Single: 1. 2. 3. lens' :: Strong' p => (s -> a) -> (s -> b -> t) -> p a b -> p s t lens' sa sbt = dimap (\s -> (s, sa s)) (\(s,b) -> sbt s b) . single' \end{code} Cheers, Oleg On 02.05.2018 20:09, Paolino wrote: > I'm not using any lens libraries, I'm writing both encodings from > scratch based on standard libs, as a learning path. > I see anyway that Traversing class is declaring exactly the Twan -> > Profunctor promotion (given the Applicative on f)  which looks a lot  > like a white flag on the "write traversal as profunctor" research. > Actually I was induced from purescript to think that the profunctorial > encoding was completely alternative to the twan, but I had no evidence > of the fact, so I should better dig into purescript library. > > .p > > 2018-05-02 18:43 GMT+02:00 Tom Ellis > >: > > I'm not sure what you mean.  If you want to write a profunctor > traversal > then `wander lq5Twan` seems fine.  If you want to understand why > it's hard > to directly write profunctor traversals then I'm afraid I'm as > puzzled as > you. > > On Wed, May 02, 2018 at 06:29:09PM +0200, Paolino wrote: > > Well, I can accept it as an evidence of why  not to use the > profunctor > > encoding for multi target lens (if that's the name). > > But I guess we are already in philosophy (so I'm more puzzled > than before) > > and I hope you can elaborate more. > > > > .p > > > > > > 2018-05-02 18:10 GMT+02:00 Tom Ellis < > > tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk > >: > > > > > On Wed, May 02, 2018 at 03:07:05PM +0200, Paolino wrote: > > > > I'm trying to write a lens for a datatype which seems easy > in the Twan > > > van > > > > Laarhoven encoding but I cannot find it as easy in the > profunctorial one > > > > > > > > data Q5 a b = Q51 a (Identity b) | Q52 [b] > > > > > > > > lq5Twan :: Applicative f => (b -> f b') -> Q5 a b -> f (Q5 a b') > > > > lq5Twan f (Q51 a bs) = Q51 a <$> traverse f bs > > > > lq5Twan f (Q52 bs) = Q52 <$> traverse f bs > > > [...] > > > > lq5Profunctor :: forall p a b b' . Traversing p => p b b' -> > p (Q5 a > > > > b) (Q5 a b') > > > [...] > > > > Which simpler ways to write the lq5Profunctor we have ? > > > > > > Is `wander lq5Twan` good enough, or is your question more > philosophical? > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view 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 -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: OpenPGP digital signature URL: From rustompmody at gmail.com Thu May 3 05:01:18 2018 From: rustompmody at gmail.com (Rustom Mody) Date: Thu, 3 May 2018 10:31:18 +0530 Subject: [Haskell-cafe] emacs heads up Message-ID: There seems to be some significant developments in emacs' haskell mode Can I understand?? The run-haskell command is now evidently deprecated What is the new alternative? Or do we just stay with run-haskell? Context: - Teaching Haskell - Using emacs - Need a nice REPL - Not (immediately) getting into in stack cabal etc; though will be needed in due course -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeroen at chordify.net Thu May 3 06:49:05 2018 From: jeroen at chordify.net (Jeroen Bransen) Date: Thu, 3 May 2018 08:49:05 +0200 Subject: [Haskell-cafe] emacs heads up In-Reply-To: References: Message-ID: <30049a4e-a54a-11c7-71e6-60ac756684a8@chordify.net> You may want to have a look at https://commercialhaskell.github.io/intero/ Op 3-5-2018 om 07:01 schreef Rustom Mody: > There seems to be some significant developments in emacs' haskell mode > > Can I understand?? > > The run-haskell command is now evidently deprecated > > What is the new alternative? > Or do we just stay with run-haskell? > > Context: > - Teaching Haskell > - Using emacs > - Need a nice REPL > - Not (immediately) getting into in stack cabal etc; though will be > needed in due course > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view 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 paolo.veronelli at gmail.com Thu May 3 12:54:53 2018 From: paolo.veronelli at gmail.com (Paolino) Date: Thu, 3 May 2018 14:54:53 +0200 Subject: [Haskell-cafe] profunctorial vs vanlaarhoven lenses In-Reply-To: References: <20180502161012.gdbocvz7uipfmvdo@weber> <20180502164357.kjjg74bg26fv7wh5@weber> Message-ID: Hi Oleg, How easy should it be to "create a Traversable newtype over your type" ? data Q6 a b c = Q61 a (Identity b) | Q62 [b] | Q63 c newtype Q6b a c b = Q61b (Q6 a b c) I cannot automatically derive anything for Q6b (Functor, Foldable, Traversable). So we are back to hand writing lenses for Q6, or I miss something ? For the rest, it was a very nice followup, I'm still rereading. Thanks Best .p 2018-05-02 23:06 GMT+02:00 Oleg Grenrus : > Here's a little gist I wrote. > > See https://gist.github.com/phadej/04aae6cb98840ef9eeb592b76e6f3a67 > for syntax highlighted versions. > > Hopefully it gives you some insights! > > \begin{code} > {-# LANGUAGE RankNTypes, DeriveFunctor, DeriveFoldable, > DeriveTraversable, TupleSections #-} > import Data.Functor.Identity > import Data.Profunctor > import Data.Profunctor.Traversing > import Data.Traversable > import Data.Tuple (swap) > > data Q5 a b = Q51 a (Identity b) | Q52 [b] > > lq5Twan :: Applicative f => (b -> f b') -> Q5 a b -> f (Q5 a b') > lq5Twan f (Q51 a bs) = Q51 a <$> traverse f bs > lq5Twan f (Q52 bs) = Q52 <$> traverse f bs > > data BT tt tt' b t t' a = BT1 (tt -> b) (t a) | BT2 (tt' -> b) (t' a) > deriving (Functor,Foldable,Traversable) > runBT (BT1 f x) = f x > runBT (BT2 f x) = f x > > lq5Profunctor :: forall p a b b' . Traversing p => p b b' -> p (Q5 a b) > (Q5 a b') > lq5Profunctor = dimap pre post . second' . traverse' where > pre (Q51 a x) = ((), BT1 (Q51 a) x) > pre (Q52 bs) = ((), BT2 Q52 bs) > post ((),x) = runBT x > \end{code} > > \begin{code} > instance Functor (Q5 a) where fmap = fmapDefault > instance Foldable (Q5 a) where foldMap = foldMapDefault > instance Traversable (Q5 a) where > traverse f (Q51 a bs) = Q51 a <$> traverse f bs > traverse f (Q52 bs) = Q52 <$> traverse f bs > > lq5Twan' :: Applicative f => (b -> f b') -> Q5 a b -> f (Q5 a b') > lq5Twan' = traverse > > lq5Profunctor' :: forall p a b b' . Traversing p => p b b' -> p (Q5 a b) > (Q5 a b') > lq5Profunctor' = traverse' > \end{code} > > And in general: three steps: > > 1. create a Traversable newtype over your type > 2. dimap pre post . traverse' > 3. Profit! > > Compare that to writing Lens > > 1. bijection your 's' to (a, r) (Note: 'r' can be 's'!) > 2. dimap to from . first' > 3. Profit! > > Trivial examples: > > \begin{code} > type Lens s t a b = forall p. Strong p => p a b -> p s t > > _1 :: Lens (a, c) (b, c) a b > _1 = dimap id id . first' > > _2 :: Lens (c, a) (c, b) a b > _2 = dimap swap swap . first' > \end{code} > > Note again, that in usual `lens` definition we pick r to be s: > we "carry over" the whole "s", though "s - a = r" would be enough. > But in practice constructing "residual" is expensive. > Think about record with 10 fields: residual in a single field lens > would be 9-tuple - not really worth it. > > Interlude, one can define Traversal over first argument too. > Using Bitraversable class that would be direct. > > In this case it's Affine (Traversal), so we can do "better" than using > `traverse'`. > > \begin{code} > lq5ProFirst :: forall p a a' b. (Choice p, Strong p) => p a a' -> p (Q5 > a b) (Q5 a' b) > lq5ProFirst = dimap f g . right' . first' where > -- Think why we have chosen [b] + a * b > -- compare to definition of Q5! > -- > -- The r + r' * s shape justifies the name Affine, btw. > f :: Q5 a b -> Either [b] (a, Identity b) > f (Q51 a x) = Right (a, x) > f (Q52 bs) = Left bs > > g (Left bs) = Q52 bs > g (Right (a, x)) = Q51 a x > \end{code} > > Note: how the same > > 1. bijection to some structure (`r' + r * a` in this case > 2. dimap to from . ... > 3. Profit > > pattern is applied again. > > Another way to think about it is that we > > 1. Use `Iso` (for all Profunctor!) to massage value into the form, so > 2. we can use "Optic specific" transform > 3. Profit! > > And optic specific: > - Lens -> Products > - Prism -> Coproducts (Sums) > - Traversal -> Traversable > - Setter -> Functor (Mapping type class has map' :: Functor f => p a b > -> p (f a) (f b)) > - etc. > > So the fact that defining arbitrary Traversals directly is more handy with > `wander`, than `traverse'` (as you can omit `dimap`!) is more related to > the > fact that we have > > \begin{spec} > class Traversable t where > traverse :: Applicative f => (a -> f b) -> t a -> f (t b) > \end{spec} > > ... and we (well, me) don't yet know another elegant way to capture "the > essense of Traversable". (I don't think FunList is particularly "elegant") > > > Sidenote: we can define Lens using Traversing/Mapping -like class too, > hopefully it gives you another viewpoint too. > > \begin{code} > class Functor t => Singular t where > single :: Functor f => (a -> f b) -> t a -> f (t b) > > fmapSingle :: Singular t => (a -> b) -> t a -> t b > fmapSingle ab ta = runIdentity (single (Identity . ab) ta) > > instance Singular Identity where > single f (Identity a) = Identity <$> f a > > instance Singular ((,) a) where > single f (a, b) = (a,) <$> f b > > class Profunctor p => Strong' p where > single' :: Singular f => p a b -> p (f a) (f b) > > instance Strong' (->) where > single' ab = fmap ab > > instance Functor f => Strong' (Star f) where > single' (Star afb) = Star (single afb) > > -- lens using Strong' & Single: 1. 2. 3. > lens' :: Strong' p => (s -> a) -> (s -> b -> t) -> p a b -> p s t > lens' sa sbt = dimap (\s -> (s, sa s)) (\(s,b) -> sbt s b) . single' > \end{code} > > Cheers, Oleg > > > On 02.05.2018 20:09, Paolino wrote: > > I'm not using any lens libraries, I'm writing both encodings from > > scratch based on standard libs, as a learning path. > > I see anyway that Traversing class is declaring exactly the Twan -> > > Profunctor promotion (given the Applicative on f) which looks a lot > > like a white flag on the "write traversal as profunctor" research. > > Actually I was induced from purescript to think that the profunctorial > > encoding was completely alternative to the twan, but I had no evidence > > of the fact, so I should better dig into purescript library. > > > > .p > > > > 2018-05-02 18:43 GMT+02:00 Tom Ellis > > > >: > > > > I'm not sure what you mean. If you want to write a profunctor > > traversal > > then `wander lq5Twan` seems fine. If you want to understand why > > it's hard > > to directly write profunctor traversals then I'm afraid I'm as > > puzzled as > > you. > > > > On Wed, May 02, 2018 at 06:29:09PM +0200, Paolino wrote: > > > Well, I can accept it as an evidence of why not to use the > > profunctor > > > encoding for multi target lens (if that's the name). > > > But I guess we are already in philosophy (so I'm more puzzled > > than before) > > > and I hope you can elaborate more. > > > > > > .p > > > > > > > > > 2018-05-02 18:10 GMT+02:00 Tom Ellis < > > > tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk > > >: > > > > > > > On Wed, May 02, 2018 at 03:07:05PM +0200, Paolino wrote: > > > > > I'm trying to write a lens for a datatype which seems easy > > in the Twan > > > > van > > > > > Laarhoven encoding but I cannot find it as easy in the > > profunctorial one > > > > > > > > > > data Q5 a b = Q51 a (Identity b) | Q52 [b] > > > > > > > > > > lq5Twan :: Applicative f => (b -> f b') -> Q5 a b -> f (Q5 a > b') > > > > > lq5Twan f (Q51 a bs) = Q51 a <$> traverse f bs > > > > > lq5Twan f (Q52 bs) = Q52 <$> traverse f bs > > > > [...] > > > > > lq5Profunctor :: forall p a b b' . Traversing p => p b b' -> > > p (Q5 a > > > > > b) (Q5 a b') > > > > [...] > > > > > Which simpler ways to write the lq5Profunctor we have ? > > > > > > > > Is `wander lq5Twan` good enough, or is your question more > > philosophical? > > > > _______________________________________________ > > Haskell-Cafe mailing list > > To (un)subscribe, modify options or view 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 tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Thu May 3 21:24:43 2018 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Thu, 3 May 2018 22:24:43 +0100 Subject: [Haskell-cafe] Strange error with GADT DataKinds -- needs TypeInType!? Message-ID: <20180503212443.7ldgdu4herrjlfwt@weber> Can anyone explain why the type instance for K is fine but the one for I needs TypeInType? (It does indeed work when I turn on TypeInType.) {-# LANGUAGE GADTs #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE PolyKinds #-} data T a b where K :: b -> T a b I :: T a a type family F (a :: T ka kb) -- Data constructor ‘I’ cannot be used here -- (Perhaps you intended to use TypeInType) -- type instance F 'I = () type instance F ('K b) = () From rae at cs.brynmawr.edu Thu May 3 22:16:13 2018 From: rae at cs.brynmawr.edu (Richard Eisenberg) Date: Thu, 3 May 2018 18:16:13 -0400 Subject: [Haskell-cafe] Strange error with GADT DataKinds -- needs TypeInType!? In-Reply-To: <20180503212443.7ldgdu4herrjlfwt@weber> References: <20180503212443.7ldgdu4herrjlfwt@weber> Message-ID: Data constructor I is a GADT constructor -- it constrains the values of its return type. Specifically, it says that T's two parameters must be the same. K is not a GADT constructor (it's just a GADT-syntax constructor), as it doesn't constraint the return type at all. In order to use a GADT constructor in a type, you need -XTypeInType; this ability was not available before GHC 8.0. There are concrete plans to smooth out this wrinkle: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0020-no-type-in-type.rst I hope this helps! Richard > On May 3, 2018, at 5:24 PM, Tom Ellis wrote: > > Can anyone explain why the type instance for K is fine but the one for I > needs TypeInType? (It does indeed work when I turn on TypeInType.) > > > > {-# LANGUAGE GADTs #-} > {-# LANGUAGE TypeFamilies #-} > {-# LANGUAGE DataKinds #-} > {-# LANGUAGE PolyKinds #-} > > data T a b where > K :: b -> T a b > I :: T a a > > type family F (a :: T ka kb) > > -- Data constructor ‘I’ cannot be used here > -- (Perhaps you intended to use TypeInType) > -- type instance F 'I = () > > type instance F ('K b) = () > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view 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 tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Fri May 4 05:36:30 2018 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Fri, 4 May 2018 06:36:30 +0100 Subject: [Haskell-cafe] Strange error with GADT DataKinds -- needs TypeInType!? In-Reply-To: References: <20180503212443.7ldgdu4herrjlfwt@weber> Message-ID: <20180504053630.yg4nhxzqlsjstqkb@weber> Yes indeed, that's very helpful, thanks! The following *does* work so I assume "existential types" do not fall under the purview of GADTs in this context? {-# LANGUAGE GADTs #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE PolyKinds #-} data T a b where E :: T a b -> T b c -> T a c type family F (a :: T ka kb) type instance F ('E a b) = () On Thu, May 03, 2018 at 06:16:13PM -0400, Richard Eisenberg wrote: > Data constructor I is a GADT constructor -- it constrains the values of its return type. Specifically, it says that T's two parameters must be the same. K is not a GADT constructor (it's just a GADT-syntax constructor), as it doesn't constraint the return type at all. In order to use a GADT constructor in a type, you need -XTypeInType; this ability was not available before GHC 8.0. > > There are concrete plans to smooth out this wrinkle: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0020-no-type-in-type.rst > > I hope this helps! > Richard > > > On May 3, 2018, at 5:24 PM, Tom Ellis wrote: > > > > Can anyone explain why the type instance for K is fine but the one for I > > needs TypeInType? (It does indeed work when I turn on TypeInType.) > > > > > > > > {-# LANGUAGE GADTs #-} > > {-# LANGUAGE TypeFamilies #-} > > {-# LANGUAGE DataKinds #-} > > {-# LANGUAGE PolyKinds #-} > > > > data T a b where > > K :: b -> T a b > > I :: T a a > > > > type family F (a :: T ka kb) > > > > -- Data constructor ‘I’ cannot be used here > > -- (Perhaps you intended to use TypeInType) > > -- type instance F 'I = () > > > > type instance F ('K b) = () > > _______________________________________________ > > Haskell-Cafe mailing list > > To (un)subscribe, modify options or view 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 dennis.raddle at gmail.com Fri May 4 08:35:58 2018 From: dennis.raddle at gmail.com (Dennis Raddle) Date: Fri, 4 May 2018 01:35:58 -0700 Subject: [Haskell-cafe] help with emacs intero Message-ID: I started having trouble with Emacs intero mode a week ago. I've tried to get help on the Intero issues list as well as Stack Overflow to no avail. I'm wondering if anyone here knows enough about Intero or Emacs to at least point me to the next debugging step. At this point I don't enough to know what to try or look for. Basically flycheck stopped working, and every time I type a few characters I'm getting "Error while checking syntax automatically: (wrong-type-argument number-or-marker-p "Abort trap: 6") Any clue what this is referring to, or why it would suddenly start last week, when all was fine prior? -------------- next part -------------- An HTML attachment was scrubbed... URL: From magnus at therning.org Fri May 4 12:47:03 2018 From: magnus at therning.org (Magnus Therning) Date: Fri, 04 May 2018 14:47:03 +0200 Subject: [Haskell-cafe] Picking up the CI buildnumber during build Message-ID: <87a7tfbnaw.fsf@therning.org> I'm looking for a way to pick up the CI buildnumber from the environment (e.g. $TRAVIS_BUILD_NUMBER) and use it as part of of the output of `my-tool --version`. I don't really know where to start looking, so I'm hoping someone on the list has already done something similar and can point me to a working example :) /M -- Magnus Therning OpenPGP: 0x927912051716CE39 email: magnus at therning.org jabber: magnus at therning.org twitter: magthe http://therning.org/magnus I am always doing that which I cannot do, in order that I may learn how to do it. — Pablo Picasso -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 832 bytes Desc: not available URL: From vanessa.mchale at iohk.io Fri May 4 12:51:04 2018 From: vanessa.mchale at iohk.io (Vanessa McHale) Date: Fri, 4 May 2018 07:51:04 -0500 Subject: [Haskell-cafe] Picking up the CI buildnumber during build In-Reply-To: <87a7tfbnaw.fsf@therning.org> References: <87a7tfbnaw.fsf@therning.org> Message-ID: Hi Magnus, I would use getEnv or lookupEnv, along with Template Haskell and the runIO function. This would allow you to embed environment variables at compile time. On 05/04/2018 07:47 AM, Magnus Therning wrote: > I'm looking for a way to pick up the CI buildnumber from the environment > (e.g. $TRAVIS_BUILD_NUMBER) and use it as part of of the output of > `my-tool --version`. I don't really know where to start looking, so I'm > hoping someone on the list has already done something similar and can > point me to a working example :) > > /M > > -- > Magnus Therning              OpenPGP: 0x927912051716CE39 > email: magnus at therning.org   jabber: magnus at therning.org > twitter: magthe               http://therning.org/magnus > > I am always doing that which I cannot do, in order that I may learn > how to do it. >     — Pablo Picasso > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -- *Vanessa McHale* Functional Compiler Engineer | Chicago, IL -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 455 bytes Desc: OpenPGP digital signature URL: From noteed at gmail.com Fri May 4 13:00:13 2018 From: noteed at gmail.com (Vo Minh Thu) Date: Fri, 04 May 2018 13:00:13 +0000 Subject: [Haskell-cafe] Picking up the CI buildnumber during build In-Reply-To: <87a7tfbnaw.fsf@therning.org> References: <87a7tfbnaw.fsf@therning.org> Message-ID: Hi, I would search for some custom setup.hs with git describe on Google. I know I did something along those lines in the past. I'll try to find it again. Cheers, Thu Le ven. 4 mai 2018 à 14:47, Magnus Therning a écrit : > I'm looking for a way to pick up the CI buildnumber from the > environment > (e.g. $TRAVIS_BUILD_NUMBER) and use it as part of of the output of > `my-tool --version`. I don't really know where to start looking, > so I'm > hoping someone on the list has already done something similar and > can > point me to a working example :) > > /M > > -- > Magnus Therning OpenPGP: 0x927912051716CE39 > email: magnus at therning.org jabber: magnus at therning.org > twitter: magthe http://therning.org/magnus > > I am always doing that which I cannot do, in order that I may > learn > how to do it. > — Pablo Picasso > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view 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 May 4 13:04:58 2018 From: adam at bergmark.nl (Adam Bergmark) Date: Fri, 04 May 2018 13:04:58 +0000 Subject: [Haskell-cafe] Picking up the CI buildnumber during build In-Reply-To: References: <87a7tfbnaw.fsf@therning.org> Message-ID: Here is a package for embedding git info https://hackage.haskell.org/package/gitrev Cheers, Adam On Fri, 4 May 2018 at 15:00, Vo Minh Thu wrote: > Hi, > > I would search for some custom setup.hs with git describe on Google. > > I know I did something along those lines in the past. I'll try to find it > again. > > Cheers, > Thu > > Le ven. 4 mai 2018 à 14:47, Magnus Therning a > écrit : > >> I'm looking for a way to pick up the CI buildnumber from the >> environment >> (e.g. $TRAVIS_BUILD_NUMBER) and use it as part of of the output of >> `my-tool --version`. I don't really know where to start looking, >> so I'm >> hoping someone on the list has already done something similar and >> can >> point me to a working example :) >> >> /M >> >> -- >> Magnus Therning OpenPGP: 0x927912051716CE39 >> email: magnus at therning.org jabber: magnus at therning.org >> twitter: magthe http://therning.org/magnus >> >> I am always doing that which I cannot do, in order that I may >> learn >> how to do it. >> — Pablo Picasso >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view 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 rae at cs.brynmawr.edu Fri May 4 18:02:48 2018 From: rae at cs.brynmawr.edu (Richard Eisenberg) Date: Fri, 4 May 2018 14:02:48 -0400 Subject: [Haskell-cafe] Strange error with GADT DataKinds -- needs TypeInType!? In-Reply-To: <20180504053630.yg4nhxzqlsjstqkb@weber> References: <20180503212443.7ldgdu4herrjlfwt@weber> <20180504053630.yg4nhxzqlsjstqkb@weber> Message-ID: Constructors that bind existential variables were actually promoted pre-GHC 8.0, so they don't require -XTypeInType. In other words, your assumption is right. Richard > On May 4, 2018, at 1:36 AM, Tom Ellis wrote: > > Yes indeed, that's very helpful, thanks! The following *does* work so I > assume "existential types" do not fall under the purview of GADTs in this > context? > > > > {-# LANGUAGE GADTs #-} > {-# LANGUAGE TypeFamilies #-} > {-# LANGUAGE DataKinds #-} > {-# LANGUAGE PolyKinds #-} > > data T a b where > E :: T a b -> T b c -> T a c > > type family F (a :: T ka kb) > > type instance F ('E a b) = () > > > On Thu, May 03, 2018 at 06:16:13PM -0400, Richard Eisenberg wrote: >> Data constructor I is a GADT constructor -- it constrains the values of its return type. Specifically, it says that T's two parameters must be the same. K is not a GADT constructor (it's just a GADT-syntax constructor), as it doesn't constraint the return type at all. In order to use a GADT constructor in a type, you need -XTypeInType; this ability was not available before GHC 8.0. >> >> There are concrete plans to smooth out this wrinkle: https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0020-no-type-in-type.rst > >> >> I hope this helps! >> Richard >> >>> On May 3, 2018, at 5:24 PM, Tom Ellis wrote: >>> >>> Can anyone explain why the type instance for K is fine but the one for I >>> needs TypeInType? (It does indeed work when I turn on TypeInType.) >>> >>> >>> >>> {-# LANGUAGE GADTs #-} >>> {-# LANGUAGE TypeFamilies #-} >>> {-# LANGUAGE DataKinds #-} >>> {-# LANGUAGE PolyKinds #-} >>> >>> data T a b where >>> K :: b -> T a b >>> I :: T a a >>> >>> type family F (a :: T ka kb) >>> >>> -- Data constructor ‘I’ cannot be used here >>> -- (Perhaps you intended to use TypeInType) >>> -- type instance F 'I = () >>> >>> type instance F ('K b) = () >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> To (un)subscribe, modify options or view 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 magnus at therning.org Fri May 4 18:51:15 2018 From: magnus at therning.org (Magnus Therning) Date: Fri, 04 May 2018 20:51:15 +0200 Subject: [Haskell-cafe] Picking up the CI buildnumber during build In-Reply-To: References: <87a7tfbnaw.fsf@therning.org> Message-ID: <87o9hvfe58.fsf@therning.org> Vanessa McHale writes: > Hi Magnus, > > I would use getEnv > > or lookupEnv, along with Template Haskell and the runIO > > function. This would allow you to embed environment variables at > compile > time. Thanks! That were indeed the functions I was looking for. I ended up with the following: ```haskell import Data.Maybe (fromMaybe) import Language.Haskell.TH (ExpQ, runIO, stringE) import System.Environment (lookupEnv) getBuildEnv :: String -> String -> ExpQ getBuildEnv def varname = (runIO $ fromMaybe def <$> lookupEnv varname) >>= stringE ``` /M -- Magnus Therning OpenPGP: 0x927912051716CE39 email: magnus at therning.org jabber: magnus at therning.org twitter: magthe http://therning.org/magnus Ah, good taste! What a dreadful thing! Taste is the enemy of creativeness. — Pablo Picasso -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 832 bytes Desc: not available URL: From magnus at therning.org Fri May 4 18:52:33 2018 From: magnus at therning.org (Magnus Therning) Date: Fri, 04 May 2018 20:52:33 +0200 Subject: [Haskell-cafe] Picking up the CI buildnumber during build In-Reply-To: References: <87a7tfbnaw.fsf@therning.org> Message-ID: <87muxffe32.fsf@therning.org> Adam Bergmark writes: > Here is a package for embedding git info > https://hackage.haskell.org/package/gitrev Thanks! That was a good example of something similar to what I wanted, albeit a bit more complex :) /M -- Magnus Therning OpenPGP: 0x927912051716CE39 email: magnus at therning.org jabber: magnus at therning.org twitter: magthe http://therning.org/magnus If you can tell the truth, you don't have to remember anything. — Mark Twain -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 832 bytes Desc: not available URL: From anthony_clayden at clear.net.nz Sat May 5 02:34:38 2018 From: anthony_clayden at clear.net.nz (Anthony Clayden) Date: Sat, 05 May 2018 02:34:38 +0000 Subject: [Haskell-cafe] Scoped Type Variables discussion forum [was: open up the issues tracker on ghc-proposals] In-Reply-To: References: Message-ID: This thread is a discussion about discussions, not the discussion itself ;-) I'm cc'ing to the cafe; but I'd prefer replies to come to glasgow-haskell-users. >> I can volunteer to at least scrape together all the objections to ScopedTypeVariables as currently. It's not yet a proposal, so not on github. Start a wiki page? A cafe thread? (It'll get lost.) A ghc-users thread? (It'll get ignored.) > ... don’t care what forums or list or whatever. As long as it’s collated and such > It could even be on the prime issue tracker for prime proposals. Just that it’s written down :) Thanks Carter, but I understand Haskell Prime to be to assess mature/stable proposals (preferably already delivered as extensions). This discussion is at first going to be more exploratory: * likes and dislikes about ScopedTypeVariables as currently. * confusions experienced by users (especially newbies) -- although absolute newbies wouldn't be using it(?), so intermediates? * feedback from those teaching Haskell. * wild ideas for possible alternative designs. * possible improvements to the current design. * I think we're all agreed that ScopedTypeVariables should have been in Haskell from the beginning; but it wasn't, so now we have to worry about backwards compatibility for programs that worked around the omission. Or do we? What code would break? How much pain would that cause? * anything else? > We have lots of forums, but your point is that certain sorts of discussions never get going with the right audience – you especially point to “confused beginners”. > ... It’s quite a challenge because beginners tend not to be vocal, and yet they are a crucial set of Haskell users. Every Haskell user started as a beginner. On this particular topic, there's plenty of confused people asking questions on StackOverflow. (Heads up: they're especially asking why they need explicit `forall` whereas in reguar Haskell that 'intermediates' see, the forall is implicit.) Can other people point me to questions/likes/dislikes on other forums? Reddit for example. If you've read this far, you now understand what we're trying to cover. It's going to be random/varied thoughts at first, then perhaps coalescing to an approach or two. At that point a formal proposal on github proper; and the random stuff might be interesting background but will essentially get archived/thrown away. I do agree with David's suggestion that github Issue tracker looks like a suitable solution. We can write formatted code and text. We can add links and references. What do others think? Joachim has opened up Issues tracker, as a try-out. If using it doesn't work out, that's fine and in keeping with my "thrown away" above. Also where else should I post links to this message to 'advertise' the thread? I don't reddit much, so if that's suitable, please someone post there. Thank you AntC -------------- next part -------------- An HTML attachment was scrubbed... URL: From gershomb at gmail.com Sat May 5 06:16:41 2018 From: gershomb at gmail.com (Gershom B) Date: Sat, 5 May 2018 02:16:41 -0400 Subject: [Haskell-cafe] Announce: Haskell Platform 8.4.2 Message-ID: On behalf of the Haskell Platform team, I'm happy to announce the release of Haskell Platform 8.4.2 Now available at https://www.haskell.org/platform/ This includes GHC 8.4.2, cabal-install 2.2.0.0, and stack 1.7.1, all with substantial improvements since the last platform release. A full list of contents is available at https://www.haskell.org/platform/contents.html Thanks to all the contributors to this release, thanks to all the package and tool maintainers and authors, and a big thanks to the GHC team for all their hard work. There are (still) currently no 32 bit Windows builds available. We're looking into the issues preventing us from building an installer for that platform. The components all appear to work individually in such a case, and can be installed separately by users who so desire. A list of new GHC changes is available at: https://ghc.haskell.org/trac/ghc/blog/ghc-8.4.1-released and https://ghc.haskell.org/trac/ghc/blog/ghc-8.4.2-released A list of cabal changes is available at: https://hackage.haskell.org/package/cabal-install-2.2.0.0/changelog The cabal documentation page is at: https://www.haskell.org/cabal/users-guide/ A list of stack changes is at: https://docs.haskellstack.org/en/stable/ChangeLog/#v171 The stack documentation page is at: https://docs.haskellstack.org/en/stable/README/ Happy Haskell Hacking all, Gershom From gershomb at gmail.com Sat May 5 06:22:57 2018 From: gershomb at gmail.com (Gershom B) Date: Sat, 5 May 2018 02:22:57 -0400 Subject: [Haskell-cafe] Announce: Haskell Platform 8.4.2 In-Reply-To: References: Message-ID: One additional feature I forgot to note: the windows platform installers should no longer require manually altering the cabal config file to add `extra-prog-path`, etc. to point to the msys distribution. The new windows installer takes advantage of the `cabal user-config --augment` command to add those lines automatically. This should give a smoother install experience for new windows users. --gershom On Sat, May 5, 2018 at 2:16 AM, Gershom B wrote: > On behalf of the Haskell Platform team, I'm happy to announce the release of > > Haskell Platform 8.4.2 > > Now available at > > https://www.haskell.org/platform/ > > This includes GHC 8.4.2, cabal-install 2.2.0.0, and stack 1.7.1, all > with substantial improvements since the last platform release. > > A full list of contents is available at > https://www.haskell.org/platform/contents.html > > Thanks to all the contributors to this release, thanks to all the > package and tool maintainers and authors, and a big thanks to the GHC > team for all their hard work. > > There are (still) currently no 32 bit Windows builds available. We're > looking into the issues preventing us from building an installer for > that platform. The components all appear to work individually in such > a case, and can be installed separately by users who so desire. > > A list of new GHC changes is available at: > https://ghc.haskell.org/trac/ghc/blog/ghc-8.4.1-released and > https://ghc.haskell.org/trac/ghc/blog/ghc-8.4.2-released > > A list of cabal changes is available at: > https://hackage.haskell.org/package/cabal-install-2.2.0.0/changelog > > The cabal documentation page is at: > https://www.haskell.org/cabal/users-guide/ > > A list of stack changes is at: > https://docs.haskellstack.org/en/stable/ChangeLog/#v171 > > The stack documentation page is at: > https://docs.haskellstack.org/en/stable/README/ > > Happy Haskell Hacking all, > Gershom From dennis.raddle at gmail.com Sun May 6 02:50:29 2018 From: dennis.raddle at gmail.com (Dennis Raddle) Date: Sat, 5 May 2018 19:50:29 -0700 Subject: [Haskell-cafe] help with emacs intero In-Reply-To: References: Message-ID: It works now. I wiped the slate clean essentially... installed a new version of stack, initialized a new project, and copied in just the files I need for now. On Fri, May 4, 2018 at 1:35 AM, Dennis Raddle wrote: > I started having trouble with Emacs intero mode a week ago. I've tried to > get help on the Intero issues list as well as Stack Overflow to no avail. > > I'm wondering if anyone here knows enough about Intero or Emacs to at > least point me to the next debugging step. At this point I don't enough to > know what to try or look for. > > Basically flycheck stopped working, and every time I type a few characters > I'm getting "Error while checking syntax automatically: > (wrong-type-argument number-or-marker-p "Abort trap: 6") > > Any clue what this is referring to, or why it would suddenly start last > week, when all was fine prior? > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From clintonmead at gmail.com Mon May 7 04:57:40 2018 From: clintonmead at gmail.com (Clinton Mead) Date: Mon, 7 May 2018 14:57:40 +1000 Subject: [Haskell-cafe] How to expose if a constraint is satisfiable Message-ID: It's occurred to me that one could write a class C t which is satisfied whenever (A t) or (B t) is satisfied like so: --- data Satisfied type family IsSatisfiable :: Constraint -> Type class A t class B t class C' t ta tb instance A t => C' t Satisfied tb where ... instance B t => C' t ta Satisfied where ... instance (A t, B t) => C' t Satisfied Satisfied where ... class C' t ( IsSatisfiable (A t)) ( IsSatisfiable (B t)) => C t --- We may need overlapping instances (with all the caveats that come with it) but it should be fine otherwise. "IsSatisfiable" here is defined as follows: IsSatisfiable c = Satisfied -- (if c is satisfiable) IsSatisfiable c = IsSatisfiable c -- (if c is not satisfiable) That's all that's needed. And it seems to be a reasonable type function. I note classes are open, so perhaps it could be dangerous to state that a constraint is not satisfiable (because it might be in another part of a program) but simply not reducing if we can't satisfy the constraint locally should be fine I think. At worst we'll get a compile error, but we shouldn't get inconsistent types. Is there anyway to implement this type function, or alternatively an approach which allows this type of "inherit from two classes" idea? -------------- next part -------------- An HTML attachment was scrubbed... URL: From anthony_clayden at clear.net.nz Mon May 7 11:11:43 2018 From: anthony_clayden at clear.net.nz (Anthony Clayden) Date: Mon, 07 May 2018 11:11:43 +0000 Subject: [Haskell-cafe] How to expose if a constraint is satisfiable Message-ID: > It's occurred to me that one could write a class C t which is satisfied > whenever (A t) or (B t) is satisfied like so: Hi Clinton, this sounds like you might want "Choosing a type-class instance based on the context" https://wiki.haskell.org/GHC/AdvancedOverlap > --- > > data Satisfied > > type family IsSatisfiable :: Constraint -> Type That type family is doing the same job as auxiliary class `ShowPred` on that wiki page. Rather than all the machinery you give for the disjunction, you could use another type family: type family EitherSatisfied :: Type -> Type -> Type instance EitherSatisfied Satisfied tb = Satisfied instance EitherSatisfied ta Satisfied = Satisfied Those two instances do overlap (as you expected); and they exhibit confluence, aka coincident overlap (they produce the same result); so that's fine. But you haven't given any instances for `IsSatisfiable`. How do you expect to get from the Constraint to the `Satisfied` type? You say > IsSatisfiable c = Satisfied -- (if c is satisfiable) What are you going to put for `c`? If you follow that wiki page, you'll need to in effect repeat every instance decl for classes `A, B`: instance A Int where ... type instance IsSatisfiable (A Int) = Satisfied (The wiki page was written before there were type families, so type class `ShowPred` has a Functional Dependency giving a type-level Boolean result.) Your `C t` class becomes class EitherSatisfied ( IsSatisfiable (A t)) ( IsSatisfiable (B t)) ~ Satisfied => C t where ... ---- Nowadays there's a better way: make Associated Types for the two classes, give them a default instance: class A t where type APred t type instance APred t = Satisfied ... class B t where type BPred t type instance BPred t = Satisfied ... Now every instance defined for `A, B` in effect automatically gives you `APred, BPred` instances. Then class EitherSatisifed (APred t) (BPred t) ~ Satisfied => C t where ... AntC -------------- next part -------------- An HTML attachment was scrubbed... URL: From clintonmead at gmail.com Mon May 7 11:50:37 2018 From: clintonmead at gmail.com (Clinton Mead) Date: Mon, 7 May 2018 21:50:37 +1000 Subject: [Haskell-cafe] How to expose if a constraint is satisfiable In-Reply-To: References: Message-ID: Hi Anthony Perhaps I've misunderstood, but there's a few issues with the approaches you suggest: Firstly, you refer to https://wiki.haskell.org/GHC/AdvancedOverlap. Unfortunately (unless I've missed something) these involve listing all the instances of parent classes. I'm trying to avoid that. Indeed if I have to explicitly list all the instances I might as well write them the normal way so I'm not sure what the point of any trickery is. I also tried the associated types approach you suggested towards the end of your email previously. This works perfectly fine if you can edit the base class, but I can't edit say, "Applicative" or "Num". I did something like the following, but I ran into a problem: {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE UndecidableInstances #-} {-# LANGUAGE FlexibleInstances #-} data Satisfied class Num t => MyNum t where type IsNum t instance Num t => MyNum t where type IsNum t = Satisfied data D = D f :: IsNum t ~ Satisfied => t -> () f _ = () main = print $ f D Ideally this should not compile, but unfortunately it happily compiles, showing that GHC generates an "IsNum" type family instance for "D", despite the fact that "Num D" is not satisfied. Any suggestions going forward from here? On Mon, May 7, 2018 at 9:11 PM, Anthony Clayden < anthony_clayden at clear.net.nz> wrote: > > It's occurred to me that one could write a class C t which is satisfied > > > whenever (A t) or (B t) is satisfied like so: > > Hi Clinton, this sounds like you might want "Choosing a type-class instance based on the context" > https://wiki.haskell.org/GHC/AdvancedOverlap > > > > --- > > > > data Satisfied > > > > type family IsSatisfiable :: Constraint -> Type > > That type family is doing the same job as auxiliary class `ShowPred` on that wiki page. > > Rather than all the machinery you give for the disjunction, you could use another type family: > > type family EitherSatisfied :: Type -> Type -> Type > instance EitherSatisfied Satisfied tb = Satisfied > instance EitherSatisfied ta Satisfied = Satisfied > > Those two instances do overlap (as you expected); and they exhibit confluence, aka coincident overlap (they produce the same result); so that's fine. > > But you haven't given any instances for `IsSatisfiable`. How do you expect to get from the Constraint to the `Satisfied` type? > > You say > > > IsSatisfiable c = Satisfied -- (if c is satisfiable) > > What are you going to put for `c`? If you follow that wiki page, you'll need to in effect repeat every instance decl for classes `A, B`: > > instance A Int where ... > > type instance IsSatisfiable (A Int) = Satisfied > > (The wiki page was written before there were type families, so type class `ShowPred` has a Functional Dependency giving a type-level Boolean result.) > Your `C t` class becomes > > class EitherSatisfied ( IsSatisfiable (A t)) ( IsSatisfiable (B t)) ~ Satisfied => C t where ... > > ---- > > Nowadays there's a better way: make Associated Types for the two classes, give them a default instance: > > class A t where > type APred t > type instance APred t = Satisfied > ... > > class B t where > type BPred t > > type instance BPred t = Satisfied > ... > > > Now every instance defined for `A, B` in effect automatically gives you > `APred, BPred` instances. Then > > class EitherSatisifed (APred t) (BPred t) ~ Satisfied => C t where ... > > > AntC > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view 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 lysxia at gmail.com Mon May 7 12:27:56 2018 From: lysxia at gmail.com (Li-yao Xia) Date: Mon, 7 May 2018 08:27:56 -0400 Subject: [Haskell-cafe] How to expose if a constraint is satisfiable In-Reply-To: References: Message-ID: <58e1ed0b-1bed-99d2-f9fc-5fcba05ca24d@gmail.com> Hi Clinton, > instance A t => C' t Satisfied tb where >   ... > > instance B t => C' t ta Satisfied where >   ... > > instance (A t, B t) => C' t Satisfied Satisfied where >   ... > The first two instances will only be picked if `ta` or `tb` can be determined to not "unify" with `Satisfied`. But a type family that cannot reduce will still "unify" with anything (it might just be that the rules to reduce it exist but are not in scope). I'm not sure "unify" is the right term when talking about this behavior of type families, but it's the one used in describing the instance resolution algorithm ("find all instances that unify with the target constraint"): https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#overlapping-instances These instances are only useful if we can actually decide satisfiability of constraints, which contradicts the open-world assumption as you mentioned. IsSatisfiable c = Satisfied -- (if c is satisfiable) IsSatisfiable c = Unsatisfiable -- (if c is not satisfiable) Regards, Li-yao From clintonmead at gmail.com Mon May 7 12:39:54 2018 From: clintonmead at gmail.com (Clinton Mead) Date: Mon, 7 May 2018 22:39:54 +1000 Subject: [Haskell-cafe] How to expose if a constraint is satisfiable In-Reply-To: <58e1ed0b-1bed-99d2-f9fc-5fcba05ca24d@gmail.com> References: <58e1ed0b-1bed-99d2-f9fc-5fcba05ca24d@gmail.com> Message-ID: On Mon, May 7, 2018 at 10:27 PM, Li-yao Xia wrote: > Hi Clinton, > > instance A t => C' t Satisfied tb where >> ... >> >> instance B t => C' t ta Satisfied where >> ... >> >> instance (A t, B t) => C' t Satisfied Satisfied where >> ... >> >> > The first two instances will only be picked if `ta` or `tb` can be > determined to not "unify" with `Satisfied`. But a type family that cannot > reduce will still "unify" with anything (it might just be that the rules to > reduce it exist but are not in scope). > > Why is this the case? Can't the first instance be picked even if tb hasn't been determined not to unify with "Satisfied", as long as the 2nd type variable does unify with "Satisfied"? > I'm not sure "unify" is the right term when talking about this behavior of > type families, but it's the one used in describing the instance resolution > algorithm ("find all instances that unify with the target constraint"): > https://downloads.haskell.org/~ghc/latest/docs/html/users_gu > ide/glasgow_exts.html#overlapping-instances > > These instances are only useful if we can actually decide satisfiability > of constraints, which contradicts the open-world assumption as you > mentioned. > > > IsSatisfiable c = Satisfied -- (if c is satisfiable) > IsSatisfiable c = Unsatisfiable -- (if c is not satisfiable) > > But your example is different to mine. I've said I'm looking for the following: IsSatisfiable c = Satisfied -- (if c is satisfiable) IsSatisfiable c = *IsSatisfiable c* -- (if c is not satisfiable) Notice I never mentioned "Unsatisfiable". Without "Unsatisfiable", I don't see how this violates the open-world assumption. > > Regards, > Li-yao > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view 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 Mon May 7 18:21:58 2018 From: allbery.b at gmail.com (Brandon Allbery) Date: Mon, 7 May 2018 14:21:58 -0400 Subject: [Haskell-cafe] How to expose if a constraint is satisfiable In-Reply-To: References: Message-ID: On Mon, May 7, 2018 at 7:50 AM, Clinton Mead wrote: > class Num t => MyNum t where > type IsNum t > instance Num t => MyNum t where > type IsNum t = Satisfied > This looks wrong to me: given how instance resolution works, I'd expect this to match every type and produce Satisfied, and later rejection based on the context wouldn't affect it. But I could well be thinking about it incorrectly. -- 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 kane at kane.cx Mon May 7 18:29:24 2018 From: kane at kane.cx (David Kraeutmann) Date: Mon, 7 May 2018 20:29:24 +0200 Subject: [Haskell-cafe] How to expose if a constraint is satisfiable In-Reply-To: References: Message-ID: <92cc4aa3-0bad-f9b5-7089-8db445c9cd83@kane.cx> Correct. That instance won't work as expected. On 5/7/2018 8:21 PM, Brandon Allbery wrote: > On Mon, May 7, 2018 at 7:50 AM, Clinton Mead > wrote: > > class Num t => MyNum t where >   type IsNum t > instance Num t => MyNum t where >   type IsNum t = Satisfied > > > This looks wrong to me: given how instance resolution works, I'd > expect this to match every type and produce Satisfied, and later > rejection based on the context wouldn't affect it. But I could well be > thinking about it incorrectly. > > -- > 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 anthony_clayden at clear.net.nz Tue May 8 01:17:30 2018 From: anthony_clayden at clear.net.nz (Anthony Clayden) Date: Tue, 08 May 2018 01:17:30 +0000 Subject: [Haskell-cafe] How to expose if a constraint is satisfiable In-Reply-To: References: Message-ID: On Tue, 8 May 2018 at 12:20 AM, Clinton Mead wrote: > > Firstly, you refer to https://wiki.haskell.org/GHC/AdvancedOverlap. > Unfortunately (unless I've missed something) these involve listing all the > instances of parent classes. I'm trying to avoid that. Indeed if I have to > explicitly list all the instances I might as well write them the normal way > so I'm not sure what the point of any trickery is. > Yes that approach does need declaring instances of `ShowPred` (or in general `XXXPred`), which doubles-up the instances for `Show` (or `XXX`). That approach is making a closed world: for every type `t`, return either `True` or `False` that it has an instance for `Show`. I'm not sure what you mean by "write them the normal way"? Just declaring `t` an instance of `Show` doesn't expose that in any way you can run type-level functions over it. > I also tried the associated types approach you suggested towards the end > of your email previously. This works perfectly fine if you can edit the > base class, but I can't edit say, "Applicative" or "Num". > Your O.P. talked about classes `A, B`, which I assumed you were writing fresh. What is your use case for wanting `EitherSatisfied (Applicative t) (Num t)` for the same `t`? (Those two classes want a `t` of different kind/arity, for one thing.) I did something like the following, but I ran into a problem: > > ... > class Num t => MyNum t where > type IsNum t > instance Num t => MyNum t where > type IsNum t = Satisfied > No that won't work (as others have pointed out). That `MyNum t` instance makes every type an instance of `MyNum`, so `(IsNum t)` always returns `Satisfied`. And it'll always compile because the instance constraint `Num t` is ignored for associated types. (Note that an Assoc type is just syntactic sugar for a type family, and you can't put constraints on TF equations.) > Any suggestions going forward from here? > I'm puzzled what it is you're trying to do. Your O.P. on the cafe talked about satisfying one or both of two constraints. Neither that nor your StackOverflow original question 'Reducing satisfied constraints to ordinary types' mentioned you want to use this for `Prelude` classes. Which specific classes? There is a ghc extension coming along soon which supports some limited froms of implications over types and instances. I'm not going to suggest it until I know what you're trying to do. I have a nervous feeling that you nurse incorrect expectations. This instance Num t => MyNum t where _does not_ say "if `t` is an instance of `Num`, it's thereby an instance of `MyNum`". It says "every `t` is an instance of `MyNum`; if I use some method from `MyNum` on some particular type `t0`, validate that also `Num t0`". There's a deep reason why Haskell works like that. See my added note to the SO answer. AntC -------------- next part -------------- An HTML attachment was scrubbed... URL: From clintonmead at gmail.com Tue May 8 02:00:29 2018 From: clintonmead at gmail.com (Clinton Mead) Date: Tue, 8 May 2018 12:00:29 +1000 Subject: [Haskell-cafe] How to expose if a constraint is satisfiable In-Reply-To: References: Message-ID: On Tue, May 8, 2018 at 11:17 AM, Anthony Clayden < anthony_clayden at clear.net.nz> wrote: > > On Tue, 8 May 2018 at 12:20 AM, Clinton Mead > wrote: > >> >> Firstly, you refer to https://wiki.haskell.org/GHC/AdvancedOverlap. >> Unfortunately (unless I've missed something) these involve listing all the >> instances of parent classes. I'm trying to avoid that. Indeed if I have to >> explicitly list all the instances I might as well write them the normal way >> so I'm not sure what the point of any trickery is. >> > > Yes that approach does need declaring instances of `ShowPred` (or in > general `XXXPred`), which doubles-up the instances for `Show` (or `XXX`). > That approach is making a closed world: for every type `t`, return either > `True` or `False` that it has an instance for `Show`. > > I'm not sure what you mean by "write them the normal way"? Just declaring > `t` an instance of `Show` doesn't expose that in any way you can run > type-level functions over it. > By normal way as in if I need to list every instance as "ShowPred", I might as well just scrap "ShowPred" and just write them directly as instances of "Print". i.e. instance Print Int where print = show instance Print Char where print = show Seems not much more work than: instance ShowPred Int = HTrue instance ShowPred Bool = HTrue etc so why use "ShowPred" at all? > > I'm puzzled what it is you're trying to do. > I'm trying to select instances based on whether constraints are fulfilled. For example: class Join m where join :: m (m a) -> m a instance Monad m => Join m where join x = x >>= id instance Comonad m => Join m where join = extract Obviously I can't do this, but consider: class Join' m (IsSatisfied m) (IsSatisfied m) => Join m where join :: m (m a) -> m a instance Join' m (IsSatisfied m) (IsSatisfied m) => Join m where join = join' instance Monad m => Join' m Satisfied t2 where join' x = x >>= id instance Comonad m => Join' m t1 Satisfied where join' = extract instance Comonad m => Join' m Satisfied Satisfied where join' = extract If I'm in a room, I can quite correctly assert things do exist if I can see them. But I can't assert things can't exist. Asserting things don't exist would violate the open world assumption, but only asserting when they do exist should not. "IsSatisfied" only needs to assert when the constraint is satisfied, it doesn't need to assert when it isn't, so I don't think it violates the open world assumption. Also GHC has this information to give an answer to IsSatisfied, it simply has to try to solve the constraint and if it succeeds reduce it to Satisfied, and if it doesn't it just does nothing. I just need a way to entice GHC to do that. -------------- next part -------------- An HTML attachment was scrubbed... URL: From lysxia at gmail.com Tue May 8 03:34:38 2018 From: lysxia at gmail.com (Li-yao Xia) Date: Mon, 7 May 2018 23:34:38 -0400 Subject: [Haskell-cafe] How to expose if a constraint is satisfiable In-Reply-To: References: <58e1ed0b-1bed-99d2-f9fc-5fcba05ca24d@gmail.com> Message-ID: Hi Clinton, On 05/07/2018 08:39 AM, Clinton Mead wrote: > > > On Mon, May 7, 2018 at 10:27 PM, Li-yao Xia > wrote: > > Hi Clinton, > > instance A t => C' t Satisfied tb where >    ... > > instance B t => C' t ta Satisfied where >    ... > > instance (A t, B t) => C' t Satisfied Satisfied where >    ... > > > The first two instances will only be picked if `ta` or `tb` can be > determined to not "unify" with `Satisfied`. But a type family that > cannot reduce will still "unify" with anything (it might just be > that the rules to reduce it exist but are not in scope). > > Why is this the case? Can't the first instance be picked even if tb > hasn't been determined not to unify with "Satisfied", as long as the 2nd > type variable does unify with "Satisfied"? If you pick an instance to solve a constraint that still unifies with another one, the broken assumption is uniqueness of instances. Many libraries assume instances are unique. The most common example is containers, which uses Ord to implement Set/Map with binary search trees. (De)serialization libraries are another example. For a concrete illustration, consider the following newtype, whose Ord instance depends on the existence of Ord or Show for the wrapped type: newtype T a = T a instance OrdIf a (IsSatisfiable (Ord a)) (IsSatisfiable (Show a)) => Ord (T a) where compare = compareIf class OrdIf a ta tb where compareIf :: a -> a -> Ordering instance Ord a => OrdIf a Satisfied tb where compareIf (T a) (T b) = compare a b instance Show a => OrdIf a ta Satisfied where compareIf (T a) (T b) = compare (show a) (show b) instance Ord a => OrdIf a Satisfied Satisfied where compareIf (T a) (T b) = compare b a -- flipped We can have the following three definitions, that use three different instances for (Ord (T a)). f1 :: Ord a => T a -> T a -> Ordering f1 = compare -- first OrdIf instance f2 :: Show a => T a -> T a -> Ordering f2 = compare -- second OrdIf instance f3 :: (Ord a, Show a) => T a -> T a -> Ordering f3 = compare -- third OrdIf instance Now specialize them to a type that has both Ord and Show instances. g1 :: T Int -> T Int -> Ordering g1 = f1 g2 :: T Int -> T Int -> Ordering g2 = f2 g3 :: T Int -> T Int -> Ordering g3 = f3 Referential transparency is lost. If you replace fi (for i=1,2,3) with its body (compare), only g3 doesn't change meaning (and that's assuming the most specific instance was picked in f3, which can be nontrivial to guarantee in general without that rule about ensuring there is no other unifiable instance). g4 :: T Int -> T Int -> Ordering g4 = compare Perhaps a more general litmus test for features related to instance resolution is: can the meaning of a well-typed polymorphic function change if I make it (more) monomorphic, or if I add instances to the context? I believe I demonstrated that can happen above, which is bad. The rationale is that we should be able to understand what a function does without keeping track of all instances we import (it's right there in the PVP that new non-orphan instances are not breaking changes), and without knowing the exact types of local functions (it happens often that a function has a much more general inferred type than what we have in mind). > These instances are only useful if we can actually decide > satisfiability of constraints, which contradicts the open-world > assumption as you mentioned. > > > IsSatisfiable c = Satisfied -- (if c is satisfiable) > IsSatisfiable c = Unsatisfiable -- (if c is not satisfiable) > > But your example is different to mine. I've said I'm looking for the > following: > > IsSatisfiable c = Satisfied -- (if c is satisfiable) > IsSatisfiable c =*IsSatisfiable c*-- (if c is not satisfiable) > > Notice I never mentioned "Unsatisfiable". Without "Unsatisfiable", I > don't see how this violates the open-world assumption. > Sorry, that was a clumsy way for me to say that this approach you propose would not work. Regards, Li-yao From clintonmead at gmail.com Tue May 8 03:45:01 2018 From: clintonmead at gmail.com (Clinton Mead) Date: Tue, 8 May 2018 13:45:01 +1000 Subject: [Haskell-cafe] How to expose if a constraint is satisfiable In-Reply-To: References: <58e1ed0b-1bed-99d2-f9fc-5fcba05ca24d@gmail.com> Message-ID: Hi Li-yao I understand this issue, but I think what your describing doesn't relate to what I'm talking about uniquely. For example: instance {-# OVERLAPPABLE #-} Num x => C x where ... instance {-# OVERLAPPING #-} C Int where ... is completely legal, and the instance used depends on context. This is an issue with overlapping instances, but already GHC allows it. I don't think what I'm proposing is any worse to what's already legal. On Tue, May 8, 2018 at 1:34 PM, Li-yao Xia wrote: > Hi Clinton, > > On 05/07/2018 08:39 AM, Clinton Mead wrote: > >> >> >> On Mon, May 7, 2018 at 10:27 PM, Li-yao Xia > lysxia at gmail.com>> wrote: >> >> Hi Clinton, >> >> instance A t => C' t Satisfied tb where >> ... >> >> instance B t => C' t ta Satisfied where >> ... >> >> instance (A t, B t) => C' t Satisfied Satisfied where >> ... >> >> >> The first two instances will only be picked if `ta` or `tb` can be >> determined to not "unify" with `Satisfied`. But a type family that >> cannot reduce will still "unify" with anything (it might just be >> that the rules to reduce it exist but are not in scope). >> >> Why is this the case? Can't the first instance be picked even if tb >> hasn't been determined not to unify with "Satisfied", as long as the 2nd >> type variable does unify with "Satisfied"? >> > > If you pick an instance to solve a constraint that still unifies with > another one, the broken assumption is uniqueness of instances. Many > libraries assume instances are unique. The most common example is > containers, which uses Ord to implement Set/Map with binary search trees. > (De)serialization libraries are another example. > > For a concrete illustration, consider the following newtype, whose Ord > instance depends on the existence of Ord or Show for the wrapped type: > > > newtype T a = T a > > instance OrdIf a (IsSatisfiable (Ord a)) (IsSatisfiable (Show a)) > => Ord (T a) where > compare = compareIf > > class OrdIf a ta tb where > compareIf :: a -> a -> Ordering > > instance Ord a => OrdIf a Satisfied tb where > compareIf (T a) (T b) = compare a b > > instance Show a => OrdIf a ta Satisfied where > compareIf (T a) (T b) = compare (show a) (show b) > > instance Ord a => OrdIf a Satisfied Satisfied where > compareIf (T a) (T b) = compare b a -- flipped > > > We can have the following three definitions, that use three different > instances for (Ord (T a)). > > > f1 :: Ord a => T a -> T a -> Ordering > f1 = compare -- first OrdIf instance > > f2 :: Show a => T a -> T a -> Ordering > f2 = compare -- second OrdIf instance > > f3 :: (Ord a, Show a) => T a -> T a -> Ordering > f3 = compare -- third OrdIf instance > > > Now specialize them to a type that has both Ord and Show instances. > > > g1 :: T Int -> T Int -> Ordering > g1 = f1 > > g2 :: T Int -> T Int -> Ordering > g2 = f2 > > g3 :: T Int -> T Int -> Ordering > g3 = f3 > > > Referential transparency is lost. If you replace fi (for i=1,2,3) with its > body (compare), only g3 doesn't change meaning (and that's assuming the > most specific instance was picked in f3, which can be nontrivial to > guarantee in general without that rule about ensuring there is no other > unifiable instance). > > > g4 :: T Int -> T Int -> Ordering > g4 = compare > > > Perhaps a more general litmus test for features related to instance > resolution is: can the meaning of a well-typed polymorphic function change > if I make it (more) monomorphic, or if I add instances to the context? I > believe I demonstrated that can happen above, which is bad. > > The rationale is that we should be able to understand what a function does > without keeping track of all instances we import (it's right there in the > PVP that new non-orphan instances are not breaking changes), and without > knowing the exact types of local functions (it happens often that a > function has a much more general inferred type than what we have in mind). > > > These instances are only useful if we can actually decide >> satisfiability of constraints, which contradicts the open-world >> assumption as you mentioned. >> >> >> IsSatisfiable c = Satisfied -- (if c is satisfiable) >> IsSatisfiable c = Unsatisfiable -- (if c is not satisfiable) >> >> But your example is different to mine. I've said I'm looking for the >> following: >> >> IsSatisfiable c = Satisfied -- (if c is satisfiable) >> IsSatisfiable c =*IsSatisfiable c*-- (if c is not satisfiable) >> >> Notice I never mentioned "Unsatisfiable". Without "Unsatisfiable", I >> don't see how this violates the open-world assumption. >> >> > Sorry, that was a clumsy way for me to say that this approach you propose > would not work. > > Regards, > Li-yao > -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Tue May 8 03:58:17 2018 From: allbery.b at gmail.com (Brandon Allbery) Date: Mon, 7 May 2018 23:58:17 -0400 Subject: [Haskell-cafe] How to expose if a constraint is satisfiable In-Reply-To: References: <58e1ed0b-1bed-99d2-f9fc-5fcba05ca24d@gmail.com> Message-ID: On Mon, May 7, 2018 at 11:45 PM, Clinton Mead wrote: > instance {-# OVERLAPPABLE #-} Num x => C x where ... > instance {-# OVERLAPPING #-} C Int where ... > > is completely legal, and the instance used depends on context. > > This is an issue with overlapping instances, but already GHC allows it. I > don't think what I'm proposing is any worse to what's already legal. > Int can be verified as more specific than "matches any type". Two instance heads differing *only* in context cannot. -- 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 clintonmead at gmail.com Tue May 8 04:17:40 2018 From: clintonmead at gmail.com (Clinton Mead) Date: Tue, 8 May 2018 14:17:40 +1000 Subject: [Haskell-cafe] How to expose if a constraint is satisfiable In-Reply-To: References: <58e1ed0b-1bed-99d2-f9fc-5fcba05ca24d@gmail.com> Message-ID: > > Int can be verified as more specific than "matches any type". Two instance > heads differing *only* in context cannot. > > I realise this, but the instances heads I proposed also don't only differ in context. -------------- next part -------------- An HTML attachment was scrubbed... URL: From anthony_clayden at clear.net.nz Tue May 8 06:19:45 2018 From: anthony_clayden at clear.net.nz (Anthony Clayden) Date: Tue, 08 May 2018 06:19:45 +0000 Subject: [Haskell-cafe] How to expose if a constraint is satisfiable In-Reply-To: References: Message-ID: On Tue, 8 May 2018 at 2:00 PM, Clinton Mead wrote: > On Tue, May 8, 2018 at 11:17 AM, Anthony Clayden < > anthony_clayden at clear.net.nz> wrote: > >> >> On Tue, 8 May 2018 at 12:20 AM, Clinton Mead >> wrote: >> >>> >>> Firstly, you refer to https://wiki.haskell.org/GHC/AdvancedOverlap. >>> Unfortunately (unless I've missed something) these involve listing all the >>> instances of parent classes. I'm trying to avoid that. Indeed if I have to >>> explicitly list all the instances I might as well write them the normal way >>> so I'm not sure what the point of any trickery is. >>> >> >> Yes that approach does need declaring instances of `ShowPred` (or in >> general `XXXPred`), which doubles-up the instances for `Show` (or `XXX`). >> That approach is making a closed world: for every type `t`, return either >> `True` or `False` that it has an instance for `Show`. >> >> I'm not sure what you mean by "write them the normal way"? Just declaring >> `t` an instance of `Show` doesn't expose that in any way you can run >> type-level functions over it. >> > > By normal way as in if I need to list every instance as "ShowPred", I > might as well just scrap "ShowPred" and just write them directly as > instances of "Print". i.e. > No you haven't got it: there's a default/fallback instance for `Print` that applies if `ShowPred` comes out `False`. Also if you have `True/False` you can do Boolean logic over the result: type instance ShowPred [a] = ShowPred a -- implication type instance ShowPred (a, b) = And (ShowPred a) (ShowPred b) -- conjunction including either/or logic, which is where your O.P. started. (Although we seem to have come a long way from that.) So turning to your latest example ... >> I'm puzzled what it is you're trying to do. >> > > I'm trying to select instances based on whether constraints are fulfilled. > > ... consider: > > class Join' m (IsSatisfied m) (IsSatisfied m) => Join m where > join :: m (m a) -> m a > > instance Join' m (IsSatisfied m) (IsSatisfied m) => Join m where > join = join' > ?? I think that context needs something like instance Join' m (IsMonad m) (IsComonad m) => Join m where ... > instance Monad m => Join' m Satisfied t2 where > join' x = x >>= id > > instance Comonad m => Join' m t1 Satisfied where > join' = extract > > instance Comonad m => Join' m Satisfied Satisfied where > join' = extract > So if some `m0` is both a `Comonad` and a `Monad`, you want to prefer the `Comonad` method. If `m0` is a `Monad` but not a `Comonad`, use the `Monad` method. You've just invoked a closed world: you're relying on the compiler determining some `m0` is _not_ a `Comonad`. Technically: your instances for `Join'` overlap. So the compiler's inference selection must determine which is the more specific, given some particular `m0` with its `t1, t2` result from `IsSatisfied`. It can select head `Join' m Satisfied t2` only if it can prove `t2` is apart from `Satisfied`. ... > > "IsSatisfied" only needs to assert when the constraint is satisfied, it > doesn't need to assert when it isn't, ... > Yes it does for what you're asking to do. so I don't think it violates the open world assumption. Also GHC has this > information to give an answer to IsSatisfied, it simply has to try to solve > the constraint and if it succeeds reduce it to Satisfied, and if it doesn't > it just does nothing. > To the contrary: what you want it to do is select a different instance. AntC -------------- next part -------------- An HTML attachment was scrubbed... URL: From zocca.marco at gmail.com Tue May 8 08:58:52 2018 From: zocca.marco at gmail.com (Marco Zocca) Date: Tue, 8 May 2018 10:58:52 +0200 Subject: [Haskell-cafe] Taking over `data-default-*` Message-ID: Dear all, I've been increasingly relying on data-default-class, but sadly it doesn't look like it's currently maintained; there are some tickets on the github issue tracker that would need some attention. I have tried contacting the authro/current maintainer Lukas Mai (CC'd) by email but have not received an answer so far (I hope he's doing well, btw). This is my first public request for taking over the `data-default` family of packages: data-default-class data-default-instances-base data-default-instances-containers data-default-instances-dlist data-default-instances-old-locale data-default Kind regards, Marco Zocca (http://hackage.haskell.org/user/ocramz) From cma at bitemyapp.com Tue May 8 09:02:17 2018 From: cma at bitemyapp.com (Christopher Allen) Date: Tue, 8 May 2018 04:02:17 -0500 Subject: [Haskell-cafe] Taking over `data-default-*` In-Reply-To: References: Message-ID: Is this something folks still think is a good idea? I purge Data.Default from projects I work on. On Tue, May 8, 2018 at 3:58 AM, Marco Zocca wrote: > Dear all, > > I've been increasingly relying on data-default-class, but sadly it > doesn't look like it's currently maintained; there are some tickets on > the github issue tracker that would need some attention. > > I have tried contacting the authro/current maintainer Lukas Mai (CC'd) > by email but have not received an answer so far (I hope he's doing > well, btw). > > This is my first public request for taking over the `data-default` > family of packages: > > data-default-class > data-default-instances-base > data-default-instances-containers > data-default-instances-dlist > data-default-instances-old-locale > data-default > > Kind regards, > Marco Zocca > (http://hackage.haskell.org/user/ocramz) > _______________________________________________ > Libraries mailing list > Libraries at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries -- Chris Allen Currently working on http://haskellbook.com From lanablack at amok.cc Tue May 8 09:06:31 2018 From: lanablack at amok.cc (Lana Black) Date: Tue, 08 May 2018 09:06:31 +0000 Subject: [Haskell-cafe] Taking over `data-default-*` In-Reply-To: References: Message-ID: <8F2E90EC-F168-4D6B-84B5-11C10BFD9002@amok.cc> On May 8, 2018 9:02:17 AM UTC, Christopher Allen wrote: >Is this something folks still think is a good idea? I purge >Data.Default from projects I work on. > >On Tue, May 8, 2018 at 3:58 AM, Marco Zocca >wrote: >> Dear all, >> >> I've been increasingly relying on data-default-class, but sadly it >> doesn't look like it's currently maintained; there are some tickets >on >> the github issue tracker that would need some attention. >> >> I have tried contacting the authro/current maintainer Lukas Mai >(CC'd) >> by email but have not received an answer so far (I hope he's doing >> well, btw). >> >> This is my first public request for taking over the `data-default` >> family of packages: >> >> data-default-class >> data-default-instances-base >> data-default-instances-containers >> data-default-instances-dlist >> data-default-instances-old-locale >> data-default >> >> Kind regards, >> Marco Zocca >> (http://hackage.haskell.org/user/ocramz) >> _______________________________________________ >> Libraries mailing list >> Libraries at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries > > > >-- >Chris Allen >Currently working on http://haskellbook.com >_______________________________________________ >Haskell-Cafe mailing list >To (un)subscribe, modify options or view archives go to: >http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >Only members subscribed via the mailman list are allowed to post. It is sometimes useful for things like configuration, where a proper Monoid instance would be tricky and unnecessary. Other than this, I don't know of any legitimate uses. From zocca.marco at gmail.com Tue May 8 09:10:52 2018 From: zocca.marco at gmail.com (Marco Zocca) Date: Tue, 8 May 2018 11:10:52 +0200 Subject: [Haskell-cafe] Taking over `data-default-*` In-Reply-To: References: Message-ID: data-default alone is depended on by > 500 packages : http://packdeps.haskellers.com/reverse/data-default Could you motivate why it's not a good idea ? On Tue, May 8, 2018 at 11:02 AM, Christopher Allen wrote: > Is this something folks still think is a good idea? I purge > Data.Default from projects I work on. > > On Tue, May 8, 2018 at 3:58 AM, Marco Zocca wrote: >> Dear all, >> >> I've been increasingly relying on data-default-class, but sadly it >> doesn't look like it's currently maintained; there are some tickets on >> the github issue tracker that would need some attention. >> >> I have tried contacting the authro/current maintainer Lukas Mai (CC'd) >> by email but have not received an answer so far (I hope he's doing >> well, btw). >> >> This is my first public request for taking over the `data-default` >> family of packages: >> >> data-default-class >> data-default-instances-base >> data-default-instances-containers >> data-default-instances-dlist >> data-default-instances-old-locale >> data-default >> >> Kind regards, >> Marco Zocca >> (http://hackage.haskell.org/user/ocramz) >> _______________________________________________ >> Libraries mailing list >> Libraries at haskell.org >> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries > > > > -- > Chris Allen > Currently working on http://haskellbook.com From cma at bitemyapp.com Tue May 8 09:20:59 2018 From: cma at bitemyapp.com (Christopher Allen) Date: Tue, 8 May 2018 04:20:59 -0500 Subject: [Haskell-cafe] Taking over `data-default-*` In-Reply-To: References: Message-ID: It's completely lawless and there's no semantically meaningful or unique "default" value for most types. It's much better practice to use explicit default values declared by name and imported explicitly. Data.Default is probably one of the most notorious abuses of type classes in the ecosystem. I'm aware it's common, I'd just hoped people would've started trimming it away. Consider Monoid. What's the default value for `Int`? Should it be the identity? The zero? For which operations over `Int`? A "default" value should either be something explicitly created and defined as a value for a domain-specific purpose or it should have a specific meaning with respect to an operation defined by a law such as w/ the monoids of summation and multiplication. On Tue, May 8, 2018 at 4:10 AM, Marco Zocca wrote: > data-default alone is depended on by > 500 packages : > http://packdeps.haskellers.com/reverse/data-default > > Could you motivate why it's not a good idea ? > > > > On Tue, May 8, 2018 at 11:02 AM, Christopher Allen wrote: >> Is this something folks still think is a good idea? I purge >> Data.Default from projects I work on. >> >> On Tue, May 8, 2018 at 3:58 AM, Marco Zocca wrote: >>> Dear all, >>> >>> I've been increasingly relying on data-default-class, but sadly it >>> doesn't look like it's currently maintained; there are some tickets on >>> the github issue tracker that would need some attention. >>> >>> I have tried contacting the authro/current maintainer Lukas Mai (CC'd) >>> by email but have not received an answer so far (I hope he's doing >>> well, btw). >>> >>> This is my first public request for taking over the `data-default` >>> family of packages: >>> >>> data-default-class >>> data-default-instances-base >>> data-default-instances-containers >>> data-default-instances-dlist >>> data-default-instances-old-locale >>> data-default >>> >>> Kind regards, >>> Marco Zocca >>> (http://hackage.haskell.org/user/ocramz) >>> _______________________________________________ >>> Libraries mailing list >>> Libraries at haskell.org >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries >> >> >> >> -- >> Chris Allen >> Currently working on http://haskellbook.com -- Chris Allen Currently working on http://haskellbook.com From lambda.fairy at gmail.com Tue May 8 09:21:59 2018 From: lambda.fairy at gmail.com (Chris Wong) Date: Tue, 8 May 2018 21:21:59 +1200 Subject: [Haskell-cafe] Taking over `data-default-*` In-Reply-To: References: Message-ID: On Tue, May 8, 2018 at 9:10 PM, Marco Zocca wrote: > data-default alone is depended on by > 500 packages : > http://packdeps.haskellers.com/reverse/data-default > > Could you motivate why it's not a good idea ? > > I can think of two reasons: - It has no laws, so there's formal specification that tells us whether an instance is "correct" or not. - Type classes are useful when there is a large family of generic operations that can work with them. For example, the utility functions in Control.Monad [1] are used in all kinds of Haskell programs. But there are no such generic operations that apply to all Default instances. That said -- as you note, it's has quite a few dependents so it's great that someone is stepping up to maintain it regardless. Chris [1] https://hackage.haskell.org/package/base-4.11.1.0/docs/Control-Monad.html#g:4 > > On Tue, May 8, 2018 at 11:02 AM, Christopher Allen > wrote: > > Is this something folks still think is a good idea? I purge > > Data.Default from projects I work on. > > > > On Tue, May 8, 2018 at 3:58 AM, Marco Zocca > wrote: > >> Dear all, > >> > >> I've been increasingly relying on data-default-class, but sadly it > >> doesn't look like it's currently maintained; there are some tickets on > >> the github issue tracker that would need some attention. > >> > >> I have tried contacting the authro/current maintainer Lukas Mai (CC'd) > >> by email but have not received an answer so far (I hope he's doing > >> well, btw). > >> > >> This is my first public request for taking over the `data-default` > >> family of packages: > >> > >> data-default-class > >> data-default-instances-base > >> data-default-instances-containers > >> data-default-instances-dlist > >> data-default-instances-old-locale > >> data-default > >> > >> Kind regards, > >> Marco Zocca > >> (http://hackage.haskell.org/user/ocramz) > >> _______________________________________________ > >> Libraries mailing list > >> Libraries at haskell.org > >> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries > > > > > > > > -- > > Chris Allen > > Currently working on http://haskellbook.com > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > -- Chris Wong (https://lambda.xyz) "I had not the vaguest idea what this meant and when I could not remember the words, my tutor threw the book at my head, which did not stimulate my intellect in any way." -- Bertrand Russell -------------- next part -------------- An HTML attachment was scrubbed... URL: From targen at gmail.com Tue May 8 09:32:27 2018 From: targen at gmail.com (=?UTF-8?Q?Manuel_G=C3=B3mez?=) Date: Tue, 08 May 2018 09:32:27 +0000 Subject: [Haskell-cafe] Taking over `data-default-*` In-Reply-To: References: Message-ID: Does it make sense to consider stating a law for Default? e.g. if (Monoid t, Default t) then def = mempty On Tue, May 8, 2018 at 11:22 AM Chris Wong wrote: > On Tue, May 8, 2018 at 9:10 PM, Marco Zocca wrote: > >> data-default alone is depended on by > 500 packages : >> http://packdeps.haskellers.com/reverse/data-default >> >> Could you motivate why it's not a good idea ? >> >> > I can think of two reasons: > > - It has no laws, so there's formal specification that tells us whether an > instance is "correct" or not. > > - Type classes are useful when there is a large family of generic > operations that can work with them. For example, the utility functions in > Control.Monad [1] are used in all kinds of Haskell programs. But there are > no such generic operations that apply to all Default instances. > > That said -- as you note, it's has quite a few dependents so it's great > that someone is stepping up to maintain it regardless. > > Chris > > [1] > https://hackage.haskell.org/package/base-4.11.1.0/docs/Control-Monad.html#g:4 > > >> >> On Tue, May 8, 2018 at 11:02 AM, Christopher Allen >> wrote: >> > Is this something folks still think is a good idea? I purge >> > Data.Default from projects I work on. >> > >> > On Tue, May 8, 2018 at 3:58 AM, Marco Zocca >> wrote: >> >> Dear all, >> >> >> >> I've been increasingly relying on data-default-class, but sadly it >> >> doesn't look like it's currently maintained; there are some tickets on >> >> the github issue tracker that would need some attention. >> >> >> >> I have tried contacting the authro/current maintainer Lukas Mai (CC'd) >> >> by email but have not received an answer so far (I hope he's doing >> >> well, btw). >> >> >> >> This is my first public request for taking over the `data-default` >> >> family of packages: >> >> >> >> data-default-class >> >> data-default-instances-base >> >> data-default-instances-containers >> >> data-default-instances-dlist >> >> data-default-instances-old-locale >> >> data-default >> >> >> >> Kind regards, >> >> Marco Zocca >> >> (http://hackage.haskell.org/user/ocramz) >> >> _______________________________________________ >> >> Libraries mailing list >> >> Libraries at haskell.org >> >> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries >> > >> > >> > >> > -- >> > Chris Allen >> > Currently working on http://haskellbook.com >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view archives go to: >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> Only members subscribed via the mailman list are allowed to post. >> > > > > -- > Chris Wong (https://lambda.xyz) > > "I had not the vaguest idea what this meant and when I could not remember > the words, my tutor threw the book at my head, which did not stimulate my > intellect in any way." -- Bertrand Russell > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From cma at bitemyapp.com Tue May 8 09:38:41 2018 From: cma at bitemyapp.com (Christopher Allen) Date: Tue, 8 May 2018 04:38:41 -0500 Subject: [Haskell-cafe] Taking over `data-default-*` In-Reply-To: References: Message-ID: No, it doesn't, because if someone actually meant the monoidal identity then they would've asked for it. `Default` serves no purpose, it is useless. This is an attempt at ex post facto justification for abusing type classes to avoid importing a value. On Tue, May 8, 2018 at 4:32 AM, Manuel Gómez wrote: > Does it make sense to consider stating a law for Default? e.g. if (Monoid > t, Default t) then def = mempty > > On Tue, May 8, 2018 at 11:22 AM Chris Wong wrote: >> >> On Tue, May 8, 2018 at 9:10 PM, Marco Zocca wrote: >>> >>> data-default alone is depended on by > 500 packages : >>> http://packdeps.haskellers.com/reverse/data-default >>> >>> Could you motivate why it's not a good idea ? >>> >> >> I can think of two reasons: >> >> - It has no laws, so there's formal specification that tells us whether an >> instance is "correct" or not. >> >> - Type classes are useful when there is a large family of generic >> operations that can work with them. For example, the utility functions in >> Control.Monad [1] are used in all kinds of Haskell programs. But there are >> no such generic operations that apply to all Default instances. >> >> That said -- as you note, it's has quite a few dependents so it's great >> that someone is stepping up to maintain it regardless. >> >> Chris >> >> [1] >> https://hackage.haskell.org/package/base-4.11.1.0/docs/Control-Monad.html#g:4 >> >>> >>> >>> On Tue, May 8, 2018 at 11:02 AM, Christopher Allen >>> wrote: >>> > Is this something folks still think is a good idea? I purge >>> > Data.Default from projects I work on. >>> > >>> > On Tue, May 8, 2018 at 3:58 AM, Marco Zocca >>> > wrote: >>> >> Dear all, >>> >> >>> >> I've been increasingly relying on data-default-class, but sadly it >>> >> doesn't look like it's currently maintained; there are some tickets on >>> >> the github issue tracker that would need some attention. >>> >> >>> >> I have tried contacting the authro/current maintainer Lukas Mai (CC'd) >>> >> by email but have not received an answer so far (I hope he's doing >>> >> well, btw). >>> >> >>> >> This is my first public request for taking over the `data-default` >>> >> family of packages: >>> >> >>> >> data-default-class >>> >> data-default-instances-base >>> >> data-default-instances-containers >>> >> data-default-instances-dlist >>> >> data-default-instances-old-locale >>> >> data-default >>> >> >>> >> Kind regards, >>> >> Marco Zocca >>> >> (http://hackage.haskell.org/user/ocramz) >>> >> _______________________________________________ >>> >> Libraries mailing list >>> >> Libraries at haskell.org >>> >> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries >>> > >>> > >>> > >>> > -- >>> > Chris Allen >>> > Currently working on http://haskellbook.com >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> To (un)subscribe, modify options or view archives go to: >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>> Only members subscribed via the mailman list are allowed to post. >> >> >> >> >> -- >> Chris Wong (https://lambda.xyz) >> >> "I had not the vaguest idea what this meant and when I could not remember >> the words, my tutor threw the book at my head, which did not stimulate my >> intellect in any way." -- Bertrand Russell >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view archives go to: >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> Only members subscribed via the mailman list are allowed to post. > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -- Chris Allen Currently working on http://haskellbook.com From zocca.marco at gmail.com Tue May 8 09:39:38 2018 From: zocca.marco at gmail.com (Marco Zocca) Date: Tue, 8 May 2018 11:39:38 +0200 Subject: [Haskell-cafe] Taking over `data-default-*` In-Reply-To: References: Message-ID: While I very much agree with all of you on the need for solid typeclass laws, I think Default still has its place in the library author toolkit . Think for example of configuration data for very flexible functionality such as plotting. On the other hand, if it's such a bad idea, what's a good course of action in this case ? Take over and deprecate ? On Tue, May 8, 2018 at 11:21 AM, Chris Wong wrote: > On Tue, May 8, 2018 at 9:10 PM, Marco Zocca wrote: >> >> data-default alone is depended on by > 500 packages : >> http://packdeps.haskellers.com/reverse/data-default >> >> Could you motivate why it's not a good idea ? >> > > I can think of two reasons: > > - It has no laws, so there's formal specification that tells us whether an > instance is "correct" or not. > > - Type classes are useful when there is a large family of generic operations > that can work with them. For example, the utility functions in Control.Monad > [1] are used in all kinds of Haskell programs. But there are no such generic > operations that apply to all Default instances. > > That said -- as you note, it's has quite a few dependents so it's great that > someone is stepping up to maintain it regardless. > > Chris > > [1] > https://hackage.haskell.org/package/base-4.11.1.0/docs/Control-Monad.html#g:4 > >> >> >> On Tue, May 8, 2018 at 11:02 AM, Christopher Allen >> wrote: >> > Is this something folks still think is a good idea? I purge >> > Data.Default from projects I work on. >> > >> > On Tue, May 8, 2018 at 3:58 AM, Marco Zocca >> > wrote: >> >> Dear all, >> >> >> >> I've been increasingly relying on data-default-class, but sadly it >> >> doesn't look like it's currently maintained; there are some tickets on >> >> the github issue tracker that would need some attention. >> >> >> >> I have tried contacting the authro/current maintainer Lukas Mai (CC'd) >> >> by email but have not received an answer so far (I hope he's doing >> >> well, btw). >> >> >> >> This is my first public request for taking over the `data-default` >> >> family of packages: >> >> >> >> data-default-class >> >> data-default-instances-base >> >> data-default-instances-containers >> >> data-default-instances-dlist >> >> data-default-instances-old-locale >> >> data-default >> >> >> >> Kind regards, >> >> Marco Zocca >> >> (http://hackage.haskell.org/user/ocramz) >> >> _______________________________________________ >> >> Libraries mailing list >> >> Libraries at haskell.org >> >> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries >> > >> > >> > >> > -- >> > Chris Allen >> > Currently working on http://haskellbook.com >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view archives go to: >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> Only members subscribed via the mailman list are allowed to post. > > > > > -- > Chris Wong (https://lambda.xyz) > > "I had not the vaguest idea what this meant and when I could not remember > the words, my tutor threw the book at my head, which did not stimulate my > intellect in any way." -- Bertrand Russell From lysxia at gmail.com Tue May 8 11:49:50 2018 From: lysxia at gmail.com (Li-yao Xia) Date: Tue, 8 May 2018 07:49:50 -0400 Subject: [Haskell-cafe] How to expose if a constraint is satisfiable In-Reply-To: References: <58e1ed0b-1bed-99d2-f9fc-5fcba05ca24d@gmail.com> Message-ID: On 05/07/2018 11:45 PM, Clinton Mead wrote: > Hi Li-yao > > I understand this issue, but I think what your describing doesn't relate > to what I'm talking about uniquely. > > For example: > > instance {-# OVERLAPPABLE #-} Num x => C x where ... > instance {-# OVERLAPPING #-} C Int where ... > > is completely legal, and the instance used depends on context. > > This is an issue with overlapping instances, but already GHC allows it. > I don't think what I'm proposing is any worse to what's already legal. > No instance for the C type class above will be picked until x is equal to some applied type constructor; it will be more challenging to break coherence with that than using what you're proposing. It seems difficult to make a clear point because the whole topic of coherence with Haskell type classes is already a minefield. Li-yao From ollie at ocharles.org.uk Tue May 8 13:52:03 2018 From: ollie at ocharles.org.uk (Oliver Charles) Date: Tue, 8 May 2018 14:52:03 +0100 Subject: [Haskell-cafe] How to expose if a constraint is satisfiable In-Reply-To: References: <58e1ed0b-1bed-99d2-f9fc-5fcba05ca24d@gmail.com> Message-ID: I've only skimmed the thread, so sorry if this is a red herring, but could this be helpful? https://github.com/rampion/constraint-unions/blob/master/README.md On Tue, May 8, 2018 at 12:49 PM, Li-yao Xia wrote: > On 05/07/2018 11:45 PM, Clinton Mead wrote: > >> Hi Li-yao >> >> I understand this issue, but I think what your describing doesn't relate >> to what I'm talking about uniquely. >> >> For example: >> >> instance {-# OVERLAPPABLE #-} Num x => C x where ... >> instance {-# OVERLAPPING #-} C Int where ... >> >> is completely legal, and the instance used depends on context. >> >> This is an issue with overlapping instances, but already GHC allows it. I >> don't think what I'm proposing is any worse to what's already legal. >> >> No instance for the C type class above will be picked until x is equal to > some applied type constructor; it will be more challenging to break > coherence with that than using what you're proposing. > > It seems difficult to make a clear point because the whole topic of > coherence with Haskell type classes is already a minefield. > > > Li-yao > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view 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 parsonsmatt at gmail.com Tue May 8 16:26:20 2018 From: parsonsmatt at gmail.com (Matt) Date: Tue, 8 May 2018 10:26:20 -0600 Subject: [Haskell-cafe] Taking over `data-default-*` In-Reply-To: References: Message-ID: > It is sometimes useful for things like configuration, where a proper Monoid instance would be tricky and unnecessary. Other than this, I don't know of any legitimate uses. Configuration records have a fantastic monoid instance. `mempty` provides your defaults, and `mappend` provides an update. So you can do `mempty <> fileConfiguration <> environmentVariables <> commandLineArgs` (or you can flip the bias to get whatever overriding behavior you want). With `DerivingVia`, we should be able to make this derivable, using the First/Last semigroups/monoids and the isomorphism between tuples and product types. I'm weakly opposed to this type class as `def :: Foo` is less ergonomic than `defFoo`, and I'm never polymorphic over what I want a default in. But, as someone that doesn't want to use it, I don't have much of a say in how it gets run or maintained :) Matt Parsons On Tue, May 8, 2018 at 3:39 AM, Marco Zocca wrote: > While I very much agree with all of you on the need for solid > typeclass laws, I think Default still has its place in the library > author toolkit . > > Think for example of configuration data for very flexible > functionality such as plotting. > > On the other hand, if it's such a bad idea, what's a good course of > action in this case ? Take over and deprecate ? > > > > > > On Tue, May 8, 2018 at 11:21 AM, Chris Wong > wrote: > > On Tue, May 8, 2018 at 9:10 PM, Marco Zocca > wrote: > >> > >> data-default alone is depended on by > 500 packages : > >> http://packdeps.haskellers.com/reverse/data-default > >> > >> Could you motivate why it's not a good idea ? > >> > > > > I can think of two reasons: > > > > - It has no laws, so there's formal specification that tells us whether > an > > instance is "correct" or not. > > > > - Type classes are useful when there is a large family of generic > operations > > that can work with them. For example, the utility functions in > Control.Monad > > [1] are used in all kinds of Haskell programs. But there are no such > generic > > operations that apply to all Default instances. > > > > That said -- as you note, it's has quite a few dependents so it's great > that > > someone is stepping up to maintain it regardless. > > > > Chris > > > > [1] > > https://hackage.haskell.org/package/base-4.11.1.0/docs/ > Control-Monad.html#g:4 > > > >> > >> > >> On Tue, May 8, 2018 at 11:02 AM, Christopher Allen > >> wrote: > >> > Is this something folks still think is a good idea? I purge > >> > Data.Default from projects I work on. > >> > > >> > On Tue, May 8, 2018 at 3:58 AM, Marco Zocca > >> > wrote: > >> >> Dear all, > >> >> > >> >> I've been increasingly relying on data-default-class, but sadly it > >> >> doesn't look like it's currently maintained; there are some tickets > on > >> >> the github issue tracker that would need some attention. > >> >> > >> >> I have tried contacting the authro/current maintainer Lukas Mai > (CC'd) > >> >> by email but have not received an answer so far (I hope he's doing > >> >> well, btw). > >> >> > >> >> This is my first public request for taking over the `data-default` > >> >> family of packages: > >> >> > >> >> data-default-class > >> >> data-default-instances-base > >> >> data-default-instances-containers > >> >> data-default-instances-dlist > >> >> data-default-instances-old-locale > >> >> data-default > >> >> > >> >> Kind regards, > >> >> Marco Zocca > >> >> (http://hackage.haskell.org/user/ocramz) > >> >> _______________________________________________ > >> >> Libraries mailing list > >> >> Libraries at haskell.org > >> >> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries > >> > > >> > > >> > > >> > -- > >> > Chris Allen > >> > Currently working on http://haskellbook.com > >> _______________________________________________ > >> Haskell-Cafe mailing list > >> To (un)subscribe, modify options or view archives go to: > >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > >> Only members subscribed via the mailman list are allowed to post. > > > > > > > > > > -- > > Chris Wong (https://lambda.xyz) > > > > "I had not the vaguest idea what this meant and when I could not remember > > the words, my tutor threw the book at my head, which did not stimulate my > > intellect in any way." -- Bertrand Russell > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From allbery.b at gmail.com Tue May 8 18:47:47 2018 From: allbery.b at gmail.com (Brandon Allbery) Date: Tue, 8 May 2018 14:47:47 -0400 Subject: [Haskell-cafe] Taking over `data-default-*` In-Reply-To: References: Message-ID: Let me give you an example from xmonad. A good configuration system would let me, building a config, use it to set local defaults, like a variant of greenXPConfig for all XMonad.Prompt uses. But I can't use `def` for this. As a user, this has only changed the value I use to build a separate configuration I still have to use --- and done so in a way prone to produce weird errors if I make a mistake. Typeclasses are not flexible enough to provide a good solution here, and `def` ends up an annoyance instead of a help. On Tue, May 8, 2018 at 5:39 AM, Marco Zocca wrote: > While I very much agree with all of you on the need for solid > typeclass laws, I think Default still has its place in the library > author toolkit . > > Think for example of configuration data for very flexible > functionality such as plotting. > > On the other hand, if it's such a bad idea, what's a good course of > action in this case ? Take over and deprecate ? > > > > > > On Tue, May 8, 2018 at 11:21 AM, Chris Wong > wrote: > > On Tue, May 8, 2018 at 9:10 PM, Marco Zocca > wrote: > >> > >> data-default alone is depended on by > 500 packages : > >> http://packdeps.haskellers.com/reverse/data-default > >> > >> Could you motivate why it's not a good idea ? > >> > > > > I can think of two reasons: > > > > - It has no laws, so there's formal specification that tells us whether > an > > instance is "correct" or not. > > > > - Type classes are useful when there is a large family of generic > operations > > that can work with them. For example, the utility functions in > Control.Monad > > [1] are used in all kinds of Haskell programs. But there are no such > generic > > operations that apply to all Default instances. > > > > That said -- as you note, it's has quite a few dependents so it's great > that > > someone is stepping up to maintain it regardless. > > > > Chris > > > > [1] > > https://hackage.haskell.org/package/base-4.11.1.0/docs/ > Control-Monad.html#g:4 > > > >> > >> > >> On Tue, May 8, 2018 at 11:02 AM, Christopher Allen > >> wrote: > >> > Is this something folks still think is a good idea? I purge > >> > Data.Default from projects I work on. > >> > > >> > On Tue, May 8, 2018 at 3:58 AM, Marco Zocca > >> > wrote: > >> >> Dear all, > >> >> > >> >> I've been increasingly relying on data-default-class, but sadly it > >> >> doesn't look like it's currently maintained; there are some tickets > on > >> >> the github issue tracker that would need some attention. > >> >> > >> >> I have tried contacting the authro/current maintainer Lukas Mai > (CC'd) > >> >> by email but have not received an answer so far (I hope he's doing > >> >> well, btw). > >> >> > >> >> This is my first public request for taking over the `data-default` > >> >> family of packages: > >> >> > >> >> data-default-class > >> >> data-default-instances-base > >> >> data-default-instances-containers > >> >> data-default-instances-dlist > >> >> data-default-instances-old-locale > >> >> data-default > >> >> > >> >> Kind regards, > >> >> Marco Zocca > >> >> (http://hackage.haskell.org/user/ocramz) > >> >> _______________________________________________ > >> >> Libraries mailing list > >> >> Libraries at haskell.org > >> >> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries > >> > > >> > > >> > > >> > -- > >> > Chris Allen > >> > Currently working on http://haskellbook.com > >> _______________________________________________ > >> Haskell-Cafe mailing list > >> To (un)subscribe, modify options or view archives go to: > >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > >> Only members subscribed via the mailman list are allowed to post. > > > > > > > > > > -- > > Chris Wong (https://lambda.xyz) > > > > "I had not the vaguest idea what this meant and when I could not remember > > the words, my tutor threw the book at my head, which did not stimulate my > > intellect in any way." -- Bertrand Russell > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > -- 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 tonymorris at gmail.com Tue May 8 20:21:17 2018 From: tonymorris at gmail.com (Tony Morris) Date: Wed, 9 May 2018 06:21:17 +1000 Subject: [Haskell-cafe] Taking over `data-default-*` In-Reply-To: References: Message-ID: <3a3cbfe9-a557-e977-8500-76acb5e28e5f@gmail.com> Because it's a penalising way of "passing an argument to a function" with no benefit. On 05/08/2018 07:10 PM, Marco Zocca wrote: > data-default alone is depended on by > 500 packages : > http://packdeps.haskellers.com/reverse/data-default > > Could you motivate why it's not a good idea ? > > > > On Tue, May 8, 2018 at 11:02 AM, Christopher Allen wrote: >> Is this something folks still think is a good idea? I purge >> Data.Default from projects I work on. >> >> On Tue, May 8, 2018 at 3:58 AM, Marco Zocca wrote: >>> Dear all, >>> >>> I've been increasingly relying on data-default-class, but sadly it >>> doesn't look like it's currently maintained; there are some tickets on >>> the github issue tracker that would need some attention. >>> >>> I have tried contacting the authro/current maintainer Lukas Mai (CC'd) >>> by email but have not received an answer so far (I hope he's doing >>> well, btw). >>> >>> This is my first public request for taking over the `data-default` >>> family of packages: >>> >>> data-default-class >>> data-default-instances-base >>> data-default-instances-containers >>> data-default-instances-dlist >>> data-default-instances-old-locale >>> data-default >>> >>> Kind regards, >>> Marco Zocca >>> (http://hackage.haskell.org/user/ocramz) >>> _______________________________________________ >>> Libraries mailing list >>> Libraries at haskell.org >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries >> >> >> -- >> Chris Allen >> Currently working on http://haskellbook.com > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 488 bytes Desc: OpenPGP digital signature URL: From david.feuer at gmail.com Tue May 8 22:29:20 2018 From: david.feuer at gmail.com (David Feuer) Date: Tue, 8 May 2018 18:29:20 -0400 Subject: [Haskell-cafe] How to expose if a constraint is satisfiable In-Reply-To: References: <58e1ed0b-1bed-99d2-f9fc-5fcba05ca24d@gmail.com> Message-ID: Maybe look at https://www.reddit.com/r/haskell/comments/6k86je/constraint_unions_bringing_or_to_the_language_of/ (relating to the repository Oliver links to) and note also Edward Kmett's response. On Tue, May 8, 2018 at 9:52 AM, Oliver Charles wrote: > I've only skimmed the thread, so sorry if this is a red herring, but could > this be helpful? > https://github.com/rampion/constraint-unions/blob/master/README.md > > On Tue, May 8, 2018 at 12:49 PM, Li-yao Xia wrote: >> >> On 05/07/2018 11:45 PM, Clinton Mead wrote: >>> >>> Hi Li-yao >>> >>> I understand this issue, but I think what your describing doesn't relate >>> to what I'm talking about uniquely. >>> >>> For example: >>> >>> instance {-# OVERLAPPABLE #-} Num x => C x where ... >>> instance {-# OVERLAPPING #-} C Int where ... >>> >>> is completely legal, and the instance used depends on context. >>> >>> This is an issue with overlapping instances, but already GHC allows it. I >>> don't think what I'm proposing is any worse to what's already legal. >>> >> No instance for the C type class above will be picked until x is equal to >> some applied type constructor; it will be more challenging to break >> coherence with that than using what you're proposing. >> >> It seems difficult to make a clear point because the whole topic of >> coherence with Haskell type classes is already a minefield. >> >> >> Li-yao >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view 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 cheater00 at gmail.com Wed May 9 03:01:59 2018 From: cheater00 at gmail.com (cheater00 cheater00) Date: Wed, 09 May 2018 03:01:59 +0000 Subject: [Haskell-cafe] Scoped Type Variables discussion forum [was: open up the issues tracker on ghc-proposals] In-Reply-To: References: Message-ID: I couldn't live without ScopedTypeVariables. For me it's an essential tool when I want to figure out 1. if the type being inferred is the one I expect 2. what type a specific thing in code I am working with is Also useful for adding that one bit the inferer is missing without immediately modifying a complex type sig. I can do that later, but the proof of concept should be quick and easy. Backwards compat: Isn't this what we have Haskell 98, Haskell 2010, etc? On Sat, 5 May 2018 04:35 Anthony Clayden, wrote: > This thread is a discussion about discussions, not the discussion itself > ;-) > > I'm cc'ing to the cafe; but I'd prefer replies to come to > glasgow-haskell-users. > > > >> I can volunteer to at least scrape together all the objections to > ScopedTypeVariables as currently. It's not yet a proposal, so not on > github. Start a wiki page? A cafe thread? (It'll get lost.) A ghc-users > thread? (It'll get ignored.) > > > ... don’t care what forums or list or whatever. As long as it’s > collated and such > > It could even be on the prime issue tracker for prime proposals. Just > that it’s written down :) > > Thanks Carter, but I understand Haskell Prime to be to assess > mature/stable proposals (preferably already delivered as extensions). This > discussion is at first going to be more exploratory: > * likes and dislikes about ScopedTypeVariables as currently. > * confusions experienced by users (especially newbies) > -- although absolute newbies wouldn't be using it(?), so intermediates? > * feedback from those teaching Haskell. > * wild ideas for possible alternative designs. > * possible improvements to the current design. > * I think we're all agreed that ScopedTypeVariables should have been in > Haskell from the beginning; > but it wasn't, so now we have to worry about backwards compatibility for > programs that worked around the omission. > Or do we? What code would break? How much pain would that cause? > * anything else? > > > We have lots of forums, but your point is that certain sorts of > discussions never get going with the right audience – you especially point > to “confused beginners”. > > ... It’s quite a challenge because beginners tend not to be vocal, and > yet they are a crucial set of Haskell users. Every Haskell user started as > a beginner. > > On this particular topic, there's plenty of confused people asking > questions on StackOverflow. (Heads up: they're especially asking why they > need explicit `forall` whereas in reguar Haskell that 'intermediates' see, > the forall is implicit.) > > Can other people point me to questions/likes/dislikes on other forums? > Reddit for example. > > If you've read this far, you now understand what we're trying to cover. > It's going to be random/varied thoughts at first, then perhaps coalescing > to an approach or two. At that point a formal proposal on github proper; > and the random stuff might be interesting background but will essentially > get archived/thrown away. > > I do agree with David's suggestion that github Issue tracker looks like a > suitable solution. We can write formatted code and text. We can add links > and references. What do others think? Joachim has opened up Issues tracker, > as a try-out. If using it doesn't work out, that's fine and in keeping with > my "thrown away" above. > > Also where else should I post links to this message to 'advertise' the > thread? I don't reddit much, so if that's suitable, please someone post > there. > > Thank you > AntC > _______________________________________________ > Glasgow-haskell-users mailing list > Glasgow-haskell-users at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From anthony_clayden at clear.net.nz Wed May 9 07:44:02 2018 From: anthony_clayden at clear.net.nz (Anthony Clayden) Date: Wed, 09 May 2018 07:44:02 +0000 Subject: [Haskell-cafe] How to expose if a constraint is satisfiable Message-ID: Thanks David, Oliver, I'll leave it so Clinton whether that helps his use case. I see the write-ups for both the Constraint Unions package and ifCxt mentioned on the reddit thread talk about needing large amounts of boilerplate. That is, an instance for each class and type that effectively tells the class has an instance for that type. So that's the same as the AdvancedOverlap I linked to -- from Oleg + SPJ. IIUC, what Clinton's asking is: since there are already instances for `Show Int`, `Ord Float`, etc (declared in the Prelude), why can't ghc 'just know' that and expose it to type-level logic that can say: if there's `Show a` do this, otherwise do that? AntC > On *Tue May 8 22:29:20 UTC 2018*, David Feuer wrote: > Maybe look at https://www.reddit.com/r/haskell/comments/6k86je/constraint_unions_bringing_or_to_the_language_of/ > (relating to the repository Oliver links to) and note also Edward Kmett's response. Eurrm. Could somebody explain that response using familiar language. I think the `:-` operator might be referring to Edward's & David's 'constraints' package on github, for which I've asked if there's human-facing documentation. Also asked if it'll be superseded by the 'Qualified Constraints' new development. >> On Tue, May 8, 2018 at 9:52 AM, Oliver Charles > wrote: >>* I've only skimmed the thread, so sorry if this is a red herring, but could *>>* this be helpful?* -------------- next part -------------- An HTML attachment was scrubbed... URL: From adam at bergmark.nl Thu May 10 16:56:09 2018 From: adam at bergmark.nl (Adam Bergmark) Date: Thu, 10 May 2018 16:56:09 +0000 Subject: [Haskell-cafe] Taking over `data-default-*` In-Reply-To: <3a3cbfe9-a557-e977-8500-76acb5e28e5f@gmail.com> References: <3a3cbfe9-a557-e977-8500-76acb5e28e5f@gmail.com> Message-ID: I agree that you should avoid Data.Default, but there is still value in keeping the package up to date since it is well-used. I would appreciate it being actively maintained. I would however find it in bad taste to do a take over that immediately marks the package as deprecated... Cheers, Adam On Tue, 8 May 2018 at 22:22 Tony Morris wrote: > Because it's a penalising way of "passing an argument to a function" > with no benefit. > > > On 05/08/2018 07:10 PM, Marco Zocca wrote: > > data-default alone is depended on by > 500 packages : > > http://packdeps.haskellers.com/reverse/data-default > > > > Could you motivate why it's not a good idea ? > > > > > > > > On Tue, May 8, 2018 at 11:02 AM, Christopher Allen > wrote: > >> Is this something folks still think is a good idea? I purge > >> Data.Default from projects I work on. > >> > >> On Tue, May 8, 2018 at 3:58 AM, Marco Zocca > wrote: > >>> Dear all, > >>> > >>> I've been increasingly relying on data-default-class, but sadly it > >>> doesn't look like it's currently maintained; there are some tickets on > >>> the github issue tracker that would need some attention. > >>> > >>> I have tried contacting the authro/current maintainer Lukas Mai (CC'd) > >>> by email but have not received an answer so far (I hope he's doing > >>> well, btw). > >>> > >>> This is my first public request for taking over the `data-default` > >>> family of packages: > >>> > >>> data-default-class > >>> data-default-instances-base > >>> data-default-instances-containers > >>> data-default-instances-dlist > >>> data-default-instances-old-locale > >>> data-default > >>> > >>> Kind regards, > >>> Marco Zocca > >>> (http://hackage.haskell.org/user/ocramz) > >>> _______________________________________________ > >>> Libraries mailing list > >>> Libraries at haskell.org > >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries > >> > >> > >> -- > >> Chris Allen > >> Currently working on http://haskellbook.com > > _______________________________________________ > > Haskell-Cafe mailing list > > To (un)subscribe, modify options or view archives go to: > > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > > Only members subscribed via the mailman list are allowed to post. > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view 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 Thu May 10 17:08:04 2018 From: ietf-dane at dukhovni.org (Viktor Dukhovni) Date: Thu, 10 May 2018 13:08:04 -0400 Subject: [Haskell-cafe] Taking over `data-default-*` In-Reply-To: References: <3a3cbfe9-a557-e977-8500-76acb5e28e5f@gmail.com> Message-ID: <6AF6900A-317A-4552-801C-505CCE438C82@dukhovni.org> > On May 10, 2018, at 12:56 PM, Adam Bergmark wrote: > > I agree that you should avoid Data.Default, but there is still value in keeping the package up to date since it is well-used. I would appreciate it being actively maintained. > > I would however find it in bad taste to do a take over that immediately marks the package as deprecated... I use Hasql, and Hasql makes extensive use of Default to implement default encoders for various data types and tuples thereof. Is there a better design that the author of Hasql should be using instead? https://hackage.haskell.org/package/hasql-1.1.1/docs/Hasql-Encoders.html#t:Value -- Viktor. From adam at bergmark.nl Thu May 10 17:29:10 2018 From: adam at bergmark.nl (Adam Bergmark) Date: Thu, 10 May 2018 17:29:10 +0000 Subject: [Haskell-cafe] Taking over `data-default-*` In-Reply-To: <6AF6900A-317A-4552-801C-505CCE438C82@dukhovni.org> References: <3a3cbfe9-a557-e977-8500-76acb5e28e5f@gmail.com> <6AF6900A-317A-4552-801C-505CCE438C82@dukhovni.org> Message-ID: I think it would be better to just define a new typeclass with some added constraints/documentation to clarify what the defaults mean in hasql. It may end up being a copy of the Default class but I'd still prefer that. Cheers, Adam On Thu, 10 May 2018 at 19:08 Viktor Dukhovni wrote: > > > > On May 10, 2018, at 12:56 PM, Adam Bergmark wrote: > > > > I agree that you should avoid Data.Default, but there is still value in > keeping the package up to date since it is well-used. I would appreciate it > being actively maintained. > > > > I would however find it in bad taste to do a take over that immediately > marks the package as deprecated... > > I use Hasql, and Hasql makes extensive use of Default to implement default > encoders for various data types and tuples thereof. Is there a better > design > that the author of Hasql should be using instead? > > > https://hackage.haskell.org/package/hasql-1.1.1/docs/Hasql-Encoders.html#t:Value > > -- > Viktor. > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.feuer at gmail.com Thu May 10 20:57:59 2018 From: david.feuer at gmail.com (David Feuer) Date: Thu, 10 May 2018 20:57:59 +0000 Subject: [Haskell-cafe] Taking over `data-default-*` In-Reply-To: References: <3a3cbfe9-a557-e977-8500-76acb5e28e5f@gmail.com> Message-ID: I think a reasonable alternative is *passive* maintenance. Keep the package compiling, but commit to never adding new instances. This should gradually nudge people away when they try to use the package, find something is missing, and see the big bold "we're not gonna fix that". On Thu, May 10, 2018, 12:56 PM Adam Bergmark wrote: > I agree that you should avoid Data.Default, but there is still value in > keeping the package up to date since it is well-used. I would appreciate it > being actively maintained. > > I would however find it in bad taste to do a take over that immediately > marks the package as deprecated... > > Cheers, > Adam > > > On Tue, 8 May 2018 at 22:22 Tony Morris wrote: > >> Because it's a penalising way of "passing an argument to a function" >> with no benefit. >> >> >> On 05/08/2018 07:10 PM, Marco Zocca wrote: >> > data-default alone is depended on by > 500 packages : >> > http://packdeps.haskellers.com/reverse/data-default >> > >> > Could you motivate why it's not a good idea ? >> > >> > >> > >> > On Tue, May 8, 2018 at 11:02 AM, Christopher Allen >> wrote: >> >> Is this something folks still think is a good idea? I purge >> >> Data.Default from projects I work on. >> >> >> >> On Tue, May 8, 2018 at 3:58 AM, Marco Zocca >> wrote: >> >>> Dear all, >> >>> >> >>> I've been increasingly relying on data-default-class, but sadly it >> >>> doesn't look like it's currently maintained; there are some tickets on >> >>> the github issue tracker that would need some attention. >> >>> >> >>> I have tried contacting the authro/current maintainer Lukas Mai (CC'd) >> >>> by email but have not received an answer so far (I hope he's doing >> >>> well, btw). >> >>> >> >>> This is my first public request for taking over the `data-default` >> >>> family of packages: >> >>> >> >>> data-default-class >> >>> data-default-instances-base >> >>> data-default-instances-containers >> >>> data-default-instances-dlist >> >>> data-default-instances-old-locale >> >>> data-default >> >>> >> >>> Kind regards, >> >>> Marco Zocca >> >>> (http://hackage.haskell.org/user/ocramz) >> >>> _______________________________________________ >> >>> Libraries mailing list >> >>> Libraries at haskell.org >> >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries >> >> >> >> >> >> -- >> >> Chris Allen >> >> Currently working on http://haskellbook.com >> > _______________________________________________ >> > Haskell-Cafe mailing list >> > To (un)subscribe, modify options or view archives go to: >> > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> > Only members subscribed via the mailman list are allowed to post. >> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view 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 david.feuer at gmail.com Thu May 10 20:59:50 2018 From: david.feuer at gmail.com (David Feuer) Date: Thu, 10 May 2018 20:59:50 +0000 Subject: [Haskell-cafe] Taking over `data-default-*` In-Reply-To: References: <3a3cbfe9-a557-e977-8500-76acb5e28e5f@gmail.com> Message-ID: An even better version (arguably) is *hostile* maintenance. Every time someone notices a new type in a dependency, add an instance with a TypeError constraint. On Thu, May 10, 2018, 4:57 PM David Feuer wrote: > I think a reasonable alternative is *passive* maintenance. Keep the > package compiling, but commit to never adding new instances. This should > gradually nudge people away when they try to use the package, find > something is missing, and see the big bold "we're not gonna fix that". > > On Thu, May 10, 2018, 12:56 PM Adam Bergmark wrote: > >> I agree that you should avoid Data.Default, but there is still value in >> keeping the package up to date since it is well-used. I would appreciate it >> being actively maintained. >> >> I would however find it in bad taste to do a take over that immediately >> marks the package as deprecated... >> >> Cheers, >> Adam >> >> >> On Tue, 8 May 2018 at 22:22 Tony Morris wrote: >> >>> Because it's a penalising way of "passing an argument to a function" >>> with no benefit. >>> >>> >>> On 05/08/2018 07:10 PM, Marco Zocca wrote: >>> > data-default alone is depended on by > 500 packages : >>> > http://packdeps.haskellers.com/reverse/data-default >>> > >>> > Could you motivate why it's not a good idea ? >>> > >>> > >>> > >>> > On Tue, May 8, 2018 at 11:02 AM, Christopher Allen >>> wrote: >>> >> Is this something folks still think is a good idea? I purge >>> >> Data.Default from projects I work on. >>> >> >>> >> On Tue, May 8, 2018 at 3:58 AM, Marco Zocca >>> wrote: >>> >>> Dear all, >>> >>> >>> >>> I've been increasingly relying on data-default-class, but sadly it >>> >>> doesn't look like it's currently maintained; there are some tickets >>> on >>> >>> the github issue tracker that would need some attention. >>> >>> >>> >>> I have tried contacting the authro/current maintainer Lukas Mai >>> (CC'd) >>> >>> by email but have not received an answer so far (I hope he's doing >>> >>> well, btw). >>> >>> >>> >>> This is my first public request for taking over the `data-default` >>> >>> family of packages: >>> >>> >>> >>> data-default-class >>> >>> data-default-instances-base >>> >>> data-default-instances-containers >>> >>> data-default-instances-dlist >>> >>> data-default-instances-old-locale >>> >>> data-default >>> >>> >>> >>> Kind regards, >>> >>> Marco Zocca >>> >>> (http://hackage.haskell.org/user/ocramz) >>> >>> _______________________________________________ >>> >>> Libraries mailing list >>> >>> Libraries at haskell.org >>> >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries >>> >> >>> >> >>> >> -- >>> >> Chris Allen >>> >> Currently working on http://haskellbook.com >>> > _______________________________________________ >>> > Haskell-Cafe mailing list >>> > To (un)subscribe, modify options or view archives go to: >>> > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>> > Only members subscribed via the mailman list are allowed to post. >>> >>> >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> To (un)subscribe, modify options or view 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 tonymorris at gmail.com Thu May 10 21:00:36 2018 From: tonymorris at gmail.com (Tony Morris) Date: Fri, 11 May 2018 07:00:36 +1000 Subject: [Haskell-cafe] Taking over `data-default-*` In-Reply-To: <6AF6900A-317A-4552-801C-505CCE438C82@dukhovni.org> References: <3a3cbfe9-a557-e977-8500-76acb5e28e5f@gmail.com> <6AF6900A-317A-4552-801C-505CCE438C82@dukhovni.org> Message-ID: Instead of (Default a =>) use ((->) a). On 05/11/2018 03:08 AM, Viktor Dukhovni wrote: > >> On May 10, 2018, at 12:56 PM, Adam Bergmark wrote: >> >> I agree that you should avoid Data.Default, but there is still value in keeping the package up to date since it is well-used. I would appreciate it being actively maintained. >> >> I would however find it in bad taste to do a take over that immediately marks the package as deprecated... > I use Hasql, and Hasql makes extensive use of Default to implement default > encoders for various data types and tuples thereof. Is there a better design > that the author of Hasql should be using instead? > > https://hackage.haskell.org/package/hasql-1.1.1/docs/Hasql-Encoders.html#t:Value > -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 488 bytes Desc: OpenPGP digital signature URL: From brucker at spamfence.net Thu May 10 21:53:27 2018 From: brucker at spamfence.net (Achim D. Brucker) Date: Thu, 10 May 2018 22:53:27 +0100 Subject: [Haskell-cafe] Call for Papers: Workshop in OCL and Textual Modeling (OCL 2018) Message-ID: <20180510215327.kljyk7k2hannf2kv@kandagawa.home.brucker.ch> (Apologies for duplicates) CALL FOR PAPERS 18th International Workshop on OCL and Textual Modeling Co-located with MODELS 2018: ACM/IEEE 21th International Conference on Model Driven Engineering Languages and System, October 14 (tbc), 2018, Copenhagen, Denmark http://oclworkshop.github.io Modeling started out with UML and its precursors as a graphical notation. Such visual representations enable direct intuitive capturing of reality, but they have weaknesses: for example, detailed visual representations bear the risk of becoming overcrowded faster than textual models and some of the visual features lack the level of precision required to create complete and unambiguous specifications. These weaknesses of graphical notations encouraged the development of text-based modeling languages that either integrate with or replace graphical notations for modeling. Typical examples of such languages are OCL, textual MOF, Epsilon, and Alloy. Textual modeling languages have their roots in formal language paradigms like logic, programming and databases. The goal of this workshop is to create a forum where researchers and practitioners interested in building models using OCL or other kinds of textual languages can directly interact, report advances, share results, identify tools for language development, and discuss appropriate standards. In particular, the workshop will encourage discussions for achieving synergy from different modeling language concepts and modeling language use. The close interaction will enable researchers and practitioners to identify common interests and options for potential cooperation. ## Topics of interest Topics of interest include (but are not limited to): - Mappings between textual modeling languages and other languages/formalisms - Mathematical models and/or formal semantics for textual modeling languages - Algorithms, evaluation strategies and optimizations in the context of textual modeling languages for: - validation, verification, and testing, - model transformation and code generation, - meta-modeling and DSLs, and - query and constraint specifications - Alternative graphical/textual notations for textual modeling languages - Evolution, transformation and simplification of textual modeling expressions - Libraries, templates and patterns for textual modeling languages - Tools that support textual modeling languages (e.g., verification of OCL formulae, runtime monitoring of invariants) - Model-driven security using textual modeling languages - Complexity results for textual modeling languages - Quality models and benchmarks for comparing and evaluating textual modeling tools and algorithms - Successful applications of textual modeling languages - Case studies on industrial applications of textual modeling languages - Experience reports: - usage of textual modeling languages and tools in complex domains, - usability of textual modeling languages and tools for end-users - Empirical studies about the benefits and drawbacks of textual modeling languages - Innovative textual modeling tools - Comparison, evaluation and integration of modeling languages - Correlation between modeling languages and modeling tasks We particularly encourage submissions describing applications and case studies of textual modeling as well as test suites and benchmark collections for evaluating textual modeling tools. ## Venue This workshop will be organized as a part of MODELS 2018 Conference in Copenhagen, Denmark. Similar to its predecessors, the workshop addresses both people from academia and industry. The aim is to provide a forum for addressing integration of OCL and other textual modeling languages, as well as tools for textual modeling, and for disseminating good practice and discussing the new requirements for textual modeling. ## Workshop Format The workshop will include short (about 15 min) presentations, parallel sessions of working groups, and sum-up discussions. ## Submissions Two types of papers will be considered: * Short contributions (between 5 and 7 pages) describing new ideas, innovative tools or position papers. * Full papers (between 10 and 14 pages). in LNCS format. Submissions should be uploaded to [EasyChair](https://easychair.org/conferences/?conf=ocl2018). The program committee will review the submissions (minimum 2 reviews per paper, usually 3 reviews) and select papers according to their relevance and interest for discussions that will take place at the workshop. Accepted papers will be published online, as part of the MODELS workshop proceedings, in [CEUR](http://www.ceur-ws.org). ## Important Dates - Submission of papers: July 17, 2018 - Notification: August 17, 2018 - Workshop date: October 14, 2018 (tbc) -- Dr. Achim D. Brucker | Software Assurance & Security | University of Sheffield https://www.brucker.ch | https://logicalhacking.com/blog @adbrucker | @logicalhacking From gershomb at gmail.com Sat May 12 20:41:29 2018 From: gershomb at gmail.com (Gershom B) Date: Sat, 12 May 2018 16:41:29 -0400 Subject: [Haskell-cafe] PSA for Cabal 2.2 new-* users regarding .ghc.environment files Message-ID: There is an important change in the cabal new- commands for 2.2 that the release docs should have highlighted more significantly. Cabal new-* commands now produce a .ghc.environment file by default. These files [1] are picked up by ghc and ghci automatically (since 8.0.1), and allow them to operate directly with the same package environment used by the new-* commands. This lets you, for example, run `ghci` in a project where you are using `new-build` and get the proper dependencies in scope. Herbert has written an experimental tool to make it easier to create and manipulate these environments [2]. However: there is a drawback (on which some discussion at [3] and [4]. In particular, there is not good information provided by ghc about when these files are picked up and used. So if you are admixing new-* commands and other commands for the time being, jumping between the two, or admixing ghc and ghcjs, etc., then you may run into unexpected behavior! [5] The simplest solution for now is to delete the local .ghc.environment file in those cases (i.e. where you're mixing commands and get unexpected behavior). A particular gotcha is that these files are picked up not just in the current directory but also in any parent directory. Cheers, Gershom [1] documented at https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/packages.html#package-environments [2] https://github.com/hvr/cabal-env [3] https://github.com/haskell/cabal/issues/4542 [4] https://ghc.haskell.org/trac/ghc/ticket/13753 [5] Error messages may be like ".cabal/store/ghc-8.0.2/package.db/package.cache: openBinaryFile: does not exist (No such file or directory)" or complaints about missing inplace dependencies. From danburton.email at gmail.com Sat May 12 21:06:08 2018 From: danburton.email at gmail.com (Dan Burton) Date: Sat, 12 May 2018 14:06:08 -0700 Subject: [Haskell-cafe] PSA for Cabal 2.2 new-* users regarding .ghc.environment files In-Reply-To: References: Message-ID: > > So if you are admixing new-* > commands and other commands for the time being, jumping between the > two, or admixing ghc and ghcjs, etc., then you may run into unexpected > behavior! The simplest solution for now is to delete the local > .ghc.environment file in those cases Is `cabal exec` suitable for working around this issue? If not, is there something like `cabal new-exec` planned for the future? -- Dan Burton On Sat, May 12, 2018 at 1:41 PM, Gershom B wrote: > There is an important change in the cabal new- commands for 2.2 that > the release docs should have highlighted more significantly. > > Cabal new-* commands now produce a .ghc.environment file by default. > These files [1] are picked up by ghc and ghci automatically (since > 8.0.1), and allow them to operate directly with the same package > environment used by the new-* commands. This lets you, for example, > run `ghci` in a project where you are using `new-build` and get the > proper dependencies in scope. Herbert has written an experimental tool > to make it easier to create and manipulate these environments [2]. > > However: there is a drawback (on which some discussion at [3] and [4]. > In particular, there is not good information provided by ghc about > when these files are picked up and used. So if you are admixing new-* > commands and other commands for the time being, jumping between the > two, or admixing ghc and ghcjs, etc., then you may run into unexpected > behavior! [5] The simplest solution for now is to delete the local > .ghc.environment file in those cases (i.e. where you're mixing > commands and get unexpected behavior). A particular gotcha is that > these files are picked up not just in the current directory but also > in any parent directory. > > Cheers, > Gershom > > > [1] documented at > https://downloads.haskell.org/~ghc/latest/docs/html/users_ > guide/packages.html#package-environments > [2] https://github.com/hvr/cabal-env > [3] https://github.com/haskell/cabal/issues/4542 > [4] https://ghc.haskell.org/trac/ghc/ticket/13753 > [5] Error messages may be like > ".cabal/store/ghc-8.0.2/package.db/package.cache: openBinaryFile: does > not exist (No such file or directory)" or complaints about missing > inplace dependencies. > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From hvriedel at gmail.com Sat May 12 22:10:56 2018 From: hvriedel at gmail.com (Herbert Valerio Riedel) Date: Sun, 13 May 2018 00:10:56 +0200 Subject: [Haskell-cafe] PSA for Cabal 2.2 new-* users regarding .ghc.environment files In-Reply-To: References: Message-ID: On Sat, May 12, 2018 at 10:41 PM, Gershom B wrote: > In particular, there is not good information provided by ghc about > when these files are picked up and used. Fwiw, there's already an overdue patch up for that at https://phabricator.haskell.org/D4689 If there's enough demand, this could in theory even make it into a future GHC 8.4.3 From wolfgang-it at jeltsch.info Sun May 13 08:53:19 2018 From: wolfgang-it at jeltsch.info (Wolfgang Jeltsch) Date: Sun, 13 May 2018 11:53:19 +0300 Subject: [Haskell-cafe] PSA for Cabal 2.2 new-* users regarding .ghc.environment files In-Reply-To: References: Message-ID: <1526201599.3990.228.camel@jeltsch.info> Am Samstag, den 12.05.2018, 16:41 -0400 schrieb Gershom B: > There is an important change in the cabal new- commands for 2.2 that > the release docs should have highlighted more significantly. > > Cabal new-* commands now produce a .ghc.environment file by default. > These files [1] are picked up by ghc and ghci automatically (since > 8.0.1), and allow them to operate directly with the same package > environment used by the new-* commands. This lets you, for example, > run `ghci` in a project where you are using `new-build` and get the > proper dependencies in scope. Herbert has written an experimental tool > to make it easier to create and manipulate these environments [2]. I already had issues with this. I ran some custom tool, which was a Haskell script, in a directory where I had run cabal new-build before. As a result, this tool didn’t work, because some module it needed couldn’t be found. It took me a while to find out what the problem was. In my opinion, it is questionable that these GHC environment files are generated by cabal new-build and then influence even Haskell scripts that have nothing to do with the project at hand. All the best, Wolfgang From allbery.b at gmail.com Sun May 13 09:39:17 2018 From: allbery.b at gmail.com (Brandon Allbery) Date: Sun, 13 May 2018 05:39:17 -0400 Subject: [Haskell-cafe] PSA for Cabal 2.2 new-* users regarding .ghc.environment files In-Reply-To: <1526201599.3990.228.camel@jeltsch.info> References: <1526201599.3990.228.camel@jeltsch.info> Message-ID: The whole point of them is to enable doing things that no tooling can sanely automate, enabling the environment from those builds to be available to do those things. Which is admittedly trying to do two incompatible things at once (propagate the build environment sometimes but not always, with no way to know which is intended); if you have a good answer for that one, I suspect many people would like to hear it. Stack has this a bit easier in that it can just expose its own environment, but it's also by design and intent less flexible than cabal new-build: reproducible builds means a static, predefined environment instead of the dynamic but constrained one presented by cabal new-build. Each tool has its own purpose and use cases; but while cabal new-build can produce frozen configurations emulating stack, there's no reasonable way to get a dynamic configuration from stack. The flip side of which is you need those environment files to get access to new-build's current/latest environment. It's definitely "wrong solution", but nobody has been able to figure out what the right solution is yet, or at least not in a way that works the way ghc does. (Which points to the further issue that how ghc works is itself rather limiting, thus stack and cabal trying to impose alternative solutions on it. But changing that is an even more tangled hairball, starting with "what exactly do you change it to?". Which might not have the same answer for stack vs. cabal, to say nothing of other build tools that might be in use e.g. in corporate in-house programming and that nobody outside them knows anything about.) On Sun, May 13, 2018 at 4:53 AM, Wolfgang Jeltsch wrote: > Am Samstag, den 12.05.2018, 16:41 -0400 schrieb Gershom B: > > There is an important change in the cabal new- commands for 2.2 that > > the release docs should have highlighted more significantly. > > > > Cabal new-* commands now produce a .ghc.environment file by default. > > These files [1] are picked up by ghc and ghci automatically (since > > 8.0.1), and allow them to operate directly with the same package > > environment used by the new-* commands. This lets you, for example, > > run `ghci` in a project where you are using `new-build` and get the > > proper dependencies in scope. Herbert has written an experimental tool > > to make it easier to create and manipulate these environments [2]. > > I already had issues with this. I ran some custom tool, which was a > Haskell script, in a directory where I had run cabal new-build before. > As a result, this tool didn’t work, because some module it needed > couldn’t be found. It took me a while to find out what the problem was. > > In my opinion, it is questionable that these GHC environment files are > generated by cabal new-build and then influence even Haskell scripts > that have nothing to do with the project at hand. > > All the best, > Wolfgang > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view 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 bertram.felgenhauer at googlemail.com Sun May 13 11:52:35 2018 From: bertram.felgenhauer at googlemail.com (Bertram Felgenhauer) Date: Sun, 13 May 2018 13:52:35 +0200 Subject: [Haskell-cafe] PSA for Cabal 2.2 new-* users regarding .ghc.environment files In-Reply-To: References: <1526201599.3990.228.camel@jeltsch.info> Message-ID: <20180513115234.GE29545@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> Brandon Allbery wrote: > The whole point of them is to enable doing things that no tooling can > sanely automate, enabling the environment from those builds to be available > to do those things. I think the complaint is not about the functionality at all, but about the fact that this environment information is picked up implicitly. This is exacerbated by the fact that the resulting diagnostic messages are poor. >From my own perspective, I expect that changing the working directory does not change the behavior of ghci except for where it looks for source code. This is somewhat broken by .ghci files, but one can opt out of these; ideally I'd like local .ghci files to be opt in, and only $HOME/.ghci be parsed by default. So that's what I would advocate: ghc's functionality to use these local (CWD-based) environment files should be disabled by default and enabled by a command line switch. It's unfortunate that this functionality has been present since ghc 8.0 but has gone unnoticed until now that cabal-install actually uses it, so cabal-install gets most of the blame. But at the very least it should be easy to opt out of this functionality. So https://ghc.haskell.org/trac/ghc/ticket/13753 will help. Cheers, Bertram From carter.schonwald at gmail.com Sun May 13 23:39:47 2018 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Sun, 13 May 2018 19:39:47 -0400 Subject: [Haskell-cafe] PSA for Cabal 2.2 new-* users regarding .ghc.environment files In-Reply-To: References: Message-ID: Seems like that’d be a worthwhile cleanup / fix up release so this can be more visible / less silent. :) On Sat, May 12, 2018 at 6:11 PM Herbert Valerio Riedel wrote: > On Sat, May 12, 2018 at 10:41 PM, Gershom B wrote: > > In particular, there is not good information provided by ghc about > > when these files are picked up and used. > > Fwiw, there's already an overdue patch up for that at > https://phabricator.haskell.org/D4689 > > If there's enough demand, this could in theory even make it into a > future GHC 8.4.3 > _______________________________________________ > Glasgow-haskell-users mailing list > Glasgow-haskell-users at haskell.org > http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From vanessa.mchale at iohk.io Mon May 14 00:32:44 2018 From: vanessa.mchale at iohk.io (Vanessa McHale) Date: Sun, 13 May 2018 19:32:44 -0500 Subject: [Haskell-cafe] Failing build for HaXml Message-ID: Does anyone know how to submit patches for HaXml? The .cabal file does not list any upstream source repo and it's currently breaking with GHC 8.4.2, which in turn breaks cabal-debian. Thanks -- *Vanessa McHale* Functional Compiler Engineer | Chicago, IL Website: www.iohk.io Twitter: @vamchale PGP Key ID: 4209B7B5 Input Output Twitter Github LinkedIn -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 488 bytes Desc: OpenPGP digital signature URL: From ivan.miljenovic at gmail.com Mon May 14 02:37:21 2018 From: ivan.miljenovic at gmail.com (Ivan Lazar Miljenovic) Date: Mon, 14 May 2018 12:37:21 +1000 Subject: [Haskell-cafe] Failing build for HaXml In-Reply-To: References: Message-ID: On 14 May 2018 at 10:32, Vanessa McHale wrote: > Does anyone know how to submit patches for HaXml? The .cabal file does not > list any upstream source repo and it's currently breaking with GHC 8.4.2, > which in turn breaks cabal-debian. > I think you may need to email them to Malcolm Wallace; he's moved to Github for cpphs but may still be using darcs for his other projects (not sure where though; it used to be code.haskell.org but IIRC those servers no longer exist). > > Thanks > -- > > > > *Vanessa McHale* > Functional Compiler Engineer | Chicago, IL > > Website: www.iohk.io > Twitter: @vamchale > PGP Key ID: 4209B7B5 > > [image: Input Output] > > [image: Twitter] [image: Github] > [image: LinkedIn] > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: From neil_mayhew at users.sourceforge.net Mon May 14 04:50:09 2018 From: neil_mayhew at users.sourceforge.net (Neil Mayhew) Date: Sun, 13 May 2018 22:50:09 -0600 Subject: [Haskell-cafe] Failing build for HaXml In-Reply-To: References: Message-ID: On 2018-05-13 08:37 PM, Ivan Lazar Miljenovic wrote: > I think you may need to email them to Malcolm Wallace; he's moved to > Github for cpphs but may still be using darcs for his other projects > (not sure where though; it used to be code.haskell.org but IIRC those > servers no longer exist). https://github.com/Simspace/HaXml says it's a fork of the darcs repo http://code.haskell.org/HaXml (which redirects to https://archives.haskell.org/code.haskell.org/HaXml/). It looks like development is continuing so you could try submitting a PR there, Vanessa. -------------- next part -------------- An HTML attachment was scrubbed... URL: From drkoster at qq.com Mon May 14 09:14:58 2018 From: drkoster at qq.com (winter) Date: Mon, 14 May 2018 17:14:58 +0800 Subject: [Haskell-cafe] Problem with submitting papers for haskell 2018 Message-ID: <67dfcb95-741f-4588-938b-968d7c701462@qq.com>+B2C9F3F4ED1FC7B5 Dear all,    Currently i and my friends @sighingnow are writing a paper on our new I/O manager based on libuv. We planed to submit it to Haskell 2018, and according to the official site's info, the deadline should be next month: https://icfp18.sigplan.org/track/haskellsymp-2018-papers But here is my problem, i registered an account on easychair as Haskell 2019 required and logged in, but when i click the submit link, a page with following info are provided: > Paper submission for Haskell 2018 is closed.,,You seem to have no previous roles at Haskell 2018, so > you cannot enter its pages. If you have questions about the conference, please contact Haskell 2018 > chairs. What does this mean? Did i miss the submission window? Or do i have to do some extra preparations? Please help! Cheers~ Winter From sergueyz at gmail.com Mon May 14 13:29:31 2018 From: sergueyz at gmail.com (Serguey Zefirov) Date: Mon, 14 May 2018 16:29:31 +0300 Subject: [Haskell-cafe] Current state of dependent types in Haskell Message-ID: Can anyone kindly point me at blog posts and/or articles on the subject? I would like to brush off my Haskell skills in that area with whatever new things that are hot. I once implemented type-level arithmetic in Haskell for sizing various hardware things but it is ages ago now. I would like to experiment with current state of affairs with type-level arithmetic and possibly experiment with adding structured values into the constraints. -------------- next part -------------- An HTML attachment was scrubbed... URL: From nicolas.wu at bristol.ac.uk Mon May 14 13:58:05 2018 From: nicolas.wu at bristol.ac.uk (Nicolas Wu) Date: Mon, 14 May 2018 13:58:05 +0000 Subject: [Haskell-cafe] Problem with submitting papers for haskell 2018 In-Reply-To: References: <5af953be.1c69fb81.4b6c4.199bSMTPIN_ADDED_BROKEN@mx.google.com> Message-ID: Hello Winter, Thanks for getting in touch, I’m glad to hear that you’re preparing a submission to the Haskell Symposium this year. You haven’t missed any deadlines: we’re still reviewing the early track papers and so EasyChair is closed for regular submissions until notifications for those papers are released. This will happen on 18 May 2018. Best wishes, Nick Dr Nicolas Wu Department of Computer Science University of Bristol > On 14 May 2018, at 14:19, Brent Yorgey wrote: > > Hi Nick, > > Did you see this message that was sent to haskell-cafe a few hours ago? > > -Brent > > ---------- Forwarded message --------- > From: winter > Date: Mon, May 14, 2018 at 4:15 AM > Subject: [Haskell-cafe] Problem with submitting papers for haskell 2018 > To: > > > Dear all, > > Currently i and my friends @sighingnow are writing a paper on our > new I/O manager based on libuv. We planed to submit it to Haskell 2018, > and according to the official site's info, the deadline should be next > month: https://icfp18.sigplan.org/track/haskellsymp-2018-papers > > But here is my problem, i registered an account on easychair as Haskell > 2019 required and logged in, but when i click the submit link, a page > with following info are provided: > > > Paper submission for Haskell 2018 is closed.,,You seem to have no > previous roles at Haskell 2018, so > you cannot enter its pages. If you > have questions about the conference, please contact Haskell 2018 > chairs. > > What does this mean? Did i miss the submission window? Or do i have to > do some extra preparations? Please help! > > > Cheers~ > > Winter > > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. From rae at cs.brynmawr.edu Mon May 14 14:23:48 2018 From: rae at cs.brynmawr.edu (Richard Eisenberg) Date: Mon, 14 May 2018 10:23:48 -0400 Subject: [Haskell-cafe] Current state of dependent types in Haskell In-Reply-To: References: Message-ID: <14B760E9-CB3E-4A39-A34C-C7721D85D7D9@cs.brynmawr.edu> I just posted a link to my recent paper (https://cs.brynmawr.edu/~rae/papers/2018/stitch/stitch.pdf) to Reddit. While that doesn't focus on dependent types, per se, it gives a good state-of-the-Haskell around features that will one day morph into dependent types. Richard > On May 14, 2018, at 9:29 AM, Serguey Zefirov wrote: > > Can anyone kindly point me at blog posts and/or articles on the subject? > > I would like to brush off my Haskell skills in that area with whatever new things that are hot. > > I once implemented type-level arithmetic in Haskell for sizing various hardware things but it is ages ago now. I would like to experiment with current state of affairs with type-level arithmetic and possibly experiment with adding structured values into the constraints. > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view 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 sergueyz at gmail.com Mon May 14 14:47:28 2018 From: sergueyz at gmail.com (Serguey Zefirov) Date: Mon, 14 May 2018 17:47:28 +0300 Subject: [Haskell-cafe] Current state of dependent types in Haskell In-Reply-To: <14B760E9-CB3E-4A39-A34C-C7721D85D7D9@cs.brynmawr.edu> References: <14B760E9-CB3E-4A39-A34C-C7721D85D7D9@cs.brynmawr.edu> Message-ID: Very cool, thank you very much! 2018-05-14 17:23 GMT+03:00 Richard Eisenberg : > I just posted a link to my recent paper (https://cs.brynmawr.edu/~rae/ > papers/2018/stitch/stitch.pdf) to Reddit. > > While that doesn't focus on dependent types, per se, it gives a good > state-of-the-Haskell around features that will one day morph into dependent > types. > > Richard > > > On May 14, 2018, at 9:29 AM, Serguey Zefirov wrote: > > > > Can anyone kindly point me at blog posts and/or articles on the subject? > > > > I would like to brush off my Haskell skills in that area with whatever > new things that are hot. > > > > I once implemented type-level arithmetic in Haskell for sizing various > hardware things but it is ages ago now. I would like to experiment with > current state of affairs with type-level arithmetic and possibly experiment > with adding structured values into the constraints. > > _______________________________________________ > > Haskell-Cafe mailing list > > To (un)subscribe, modify options or view 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 mikhail.glushenkov at gmail.com Mon May 14 14:52:25 2018 From: mikhail.glushenkov at gmail.com (Mikhail Glushenkov) Date: Mon, 14 May 2018 15:52:25 +0100 Subject: [Haskell-cafe] Failing build for HaXml In-Reply-To: References: Message-ID: Hi, On Mon, 14 May 2018, 01:33 Vanessa McHale, wrote: > > Does anyone know how to submit patches for HaXml? The .cabal file does not list any upstream source repo and it's currently breaking with GHC 8.4.2, which in turn breaks cabal-debian. A couple of months ago, I've sent a patch (attached) to Malcolm's @me.com address adding GHC 8.4 support to HaXml, but never got a reply. -------------- next part -------------- A non-text attachment was scrubbed... Name: support-building-with-ghc-8_4_1_.dpatch Type: application/octet-stream Size: 4405 bytes Desc: not available URL: From drkoster at qq.com Mon May 14 15:57:50 2018 From: drkoster at qq.com (winter) Date: Mon, 14 May 2018 23:57:50 +0800 Subject: [Haskell-cafe] Problem with submitting papers for haskell 2018 In-Reply-To: References: <5af953be.1c69fb81.4b6c4.199bSMTPIN_ADDED_BROKEN@mx.google.com> Message-ID: <3a11e234-3d83-5df8-0b34-fa9258fd89ba@qq.com>+F9EA46FF986E09D8 Hi Nick, Glad to hear that the regular track is not closed yet, thanks for the explanation! Best regards Winter On 2018年05月14日 21:58, Nicolas Wu wrote: > Hello Winter, > > Thanks for getting in touch, I’m glad to hear that you’re preparing a submission to the Haskell Symposium this year. > > You haven’t missed any deadlines: we’re still reviewing the early track papers and so EasyChair is closed for regular submissions until notifications for those papers are released. This will happen on 18 May 2018. > > Best wishes, > > Nick > > Dr Nicolas Wu > Department of Computer Science > University of Bristol > >> On 14 May 2018, at 14:19, Brent Yorgey wrote: >> >> Hi Nick, >> >> Did you see this message that was sent to haskell-cafe a few hours ago? >> >> -Brent >> >> ---------- Forwarded message --------- >> From: winter >> Date: Mon, May 14, 2018 at 4:15 AM >> Subject: [Haskell-cafe] Problem with submitting papers for haskell 2018 >> To: >> >> >> Dear all, >> >> Currently i and my friends @sighingnow are writing a paper on our >> new I/O manager based on libuv. We planed to submit it to Haskell 2018, >> and according to the official site's info, the deadline should be next >> month: https://icfp18.sigplan.org/track/haskellsymp-2018-papers >> >> But here is my problem, i registered an account on easychair as Haskell >> 2019 required and logged in, but when i click the submit link, a page >> with following info are provided: >> >> > Paper submission for Haskell 2018 is closed.,,You seem to have no >> previous roles at Haskell 2018, so > you cannot enter its pages. If you >> have questions about the conference, please contact Haskell 2018 > chairs. >> >> What does this mean? Did i miss the submission window? Or do i have to >> do some extra preparations? Please help! >> >> >> Cheers~ >> >> Winter >> >> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view archives go to: >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> Only members subscribed via the mailman list are allowed to post. From b at chreekat.net Mon May 14 19:39:23 2018 From: b at chreekat.net (Bryan Richter) Date: Mon, 14 May 2018 15:39:23 -0400 Subject: [Haskell-cafe] PSA for Cabal 2.2 new-* users regarding .ghc.environment files In-Reply-To: References: <1526201599.3990.228.camel@jeltsch.info> Message-ID: <3e0e8794-d1a7-7a3d-ba53-a0e57d9bdba9@chreekat.net> On 05/13/2018 05:39 AM, Brandon Allbery wrote: > The whole point of them is to enable doing things that no tooling > can sanely automate, enabling the environment from those builds to > be available to do those things. Which is admittedly trying to do > two incompatible things at once (propagate the build environment > sometimes but not always, with no way to know which is intended); if > you have a good answer for that one, I suspect many people would > like to hear it. I use nix-shell for choosing specific ghc environments, and undoubtedly a theoretical 'cabal shell' could work similarly. (In fact, Nix could probably produce a saner (shell) environment by using GHC environments, so the two solutions could converge.) Consider the following hypothetical session: $ cabal new-build # Creates .cabal.ghc.environment.arch-os-version, which is # non-default $ cabal shell # sets GHC_ENVIRONMENT to # $PWD/.cabal.ghc.environment.arch-os-version and spawns shell [cabal]$ ghc-pkg list ... (we see our customized environment) [cabal]$ exit $ cabal shell --run 'ghc-pkg list' ... (same output as previous) $ cabal shell --environment /path/to/ghc.environment [cabal]$ ghc-pkg list ... etc. Basically, "cabal shell" would be a wrapper over "GHC_ENVIRONMENT=/path $SHELL", but more friendly and with room for expansion. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: OpenPGP digital signature URL: From bertram.felgenhauer at googlemail.com Mon May 14 19:50:11 2018 From: bertram.felgenhauer at googlemail.com (Bertram Felgenhauer) Date: Mon, 14 May 2018 21:50:11 +0200 Subject: [Haskell-cafe] PSA for Cabal 2.2 new-* users regarding .ghc.environment files In-Reply-To: <3e0e8794-d1a7-7a3d-ba53-a0e57d9bdba9@chreekat.net> References: <1526201599.3990.228.camel@jeltsch.info> <3e0e8794-d1a7-7a3d-ba53-a0e57d9bdba9@chreekat.net> Message-ID: <20180514195010.GF29545@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> Bryan Richter wrote: > I use nix-shell for choosing specific ghc environments, and > undoubtedly a theoretical 'cabal shell' could work similarly. (In > fact, Nix could probably produce a saner (shell) environment by using > GHC environments, so the two solutions could converge.) > > Consider the following hypothetical session: > > $ cabal new-build > # Creates .cabal.ghc.environment.arch-os-version, which is > # non-default > > $ cabal shell > # sets GHC_ENVIRONMENT to > # $PWD/.cabal.ghc.environment.arch-os-version and spawns shell [...] > $ cabal shell --run 'ghc-pkg list' > ... (same output as previous) Note that cabal-install already provides a 'cabal exec' command which offers essentially that functionality for sandboxes, though in a different bikeshed color: $ cabal exec -- $SHELL $ cabal exec -- ghc-pkg list Cheers, Bertram From b at chreekat.net Mon May 14 20:14:31 2018 From: b at chreekat.net (Bryan Richter) Date: Mon, 14 May 2018 16:14:31 -0400 Subject: [Haskell-cafe] PSA for Cabal 2.2 new-* users regarding .ghc.environment files In-Reply-To: <20180514195010.GF29545@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> References: <1526201599.3990.228.camel@jeltsch.info> <3e0e8794-d1a7-7a3d-ba53-a0e57d9bdba9@chreekat.net> <20180514195010.GF29545@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> Message-ID: <83a4d932-0b49-1838-d3af-82e909a4c719@chreekat.net> On 05/14/2018 03:50 PM, Bertram Felgenhauer via Haskell-Cafe wrote: > Bryan Richter wrote: >> I use nix-shell for choosing specific ghc environments, and >> undoubtedly a theoretical 'cabal shell' could work similarly. (In >> fact, Nix could probably produce a saner (shell) environment by using >> GHC environments, so the two solutions could converge.) >> >> Consider the following hypothetical session: >> >> $ cabal new-build >> # Creates .cabal.ghc.environment.arch-os-version, which is >> # non-default >> >> $ cabal shell >> # sets GHC_ENVIRONMENT to >> # $PWD/.cabal.ghc.environment.arch-os-version and spawns shell > [...] >> $ cabal shell --run 'ghc-pkg list' >> ... (same output as previous) > > Note that cabal-install already provides a 'cabal exec' command which > offers essentially that functionality for sandboxes, though in a > different bikeshed color: > > $ cabal exec -- $SHELL > > $ cabal exec -- ghc-pkg list > Heh, oops, I knew that. :) I have just been in the Nix swamps for too long recently. That said, this seems like the right solution. Rather than create used-by-default GHC environments, Cabal should modify "exec" to pick up a Cabal-generated environment. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: OpenPGP digital signature URL: From sylvester.hazel at googlemail.com Mon May 14 23:27:42 2018 From: sylvester.hazel at googlemail.com (Sylvester Hazel) Date: Tue, 15 May 2018 01:27:42 +0200 Subject: [Haskell-cafe] GHC TV station? Message-ID: White space in "do notation" is no longer supported by GHC but I had to guess it the hard way seeing my solutions to Hutton's book and then his own code produce "Parse error" and irritating hint "Possibly caused by a missing 'do'?". So, Hutton 2ed is outdated, Haskell Platform is dropped exhausted then perhaps GHC should have a TV station? Fun is best when it can be shared. Regards, Sylvester -------------- next part -------------- An HTML attachment was scrubbed... URL: From ivan.miljenovic at gmail.com Tue May 15 00:15:12 2018 From: ivan.miljenovic at gmail.com (Ivan Lazar Miljenovic) Date: Tue, 15 May 2018 10:15:12 +1000 Subject: [Haskell-cafe] GHC TV station? In-Reply-To: References: Message-ID: On 15 May 2018 at 09:27, Sylvester Hazel via Haskell-Cafe wrote: > White space in "do notation" is no longer supported by GHC but I had to > guess it the hard way seeing my solutions to Hutton's book and then his own > code produce "Parse error" and irritating hint "Possibly caused by a missing > 'do'?". So, Hutton 2ed is outdated, Haskell Platform is dropped exhausted > then perhaps GHC should have a TV station? > Fun is best when it can be shared. What do you mean? I don't recall anything changing with how do notation works in GHC. -- Ivan Lazar Miljenovic Ivan.Miljenovic at gmail.com http://IvanMiljenovic.wordpress.com From dennis.raddle at gmail.com Tue May 15 00:41:24 2018 From: dennis.raddle at gmail.com (Dennis Raddle) Date: Mon, 14 May 2018 17:41:24 -0700 Subject: [Haskell-cafe] template haskell library for OO-like selector syntax? Message-ID: In my current application, I'm really missing the ability from OO to do things like someData.field1.field2 = "foo" What's do I mean? - field selectors are scoped so that names don't clash with each other or global names - this way of selecting data can be used both for reading it, and for updating specific fields of some data deep in a data hierarchy (In Haskell, if using immutable data, this would requiring doing a data update on every level). Any attempt to do this in Haskell, for me anyway, results in an explosion of names and a lot of boilerplate code and a resulting heavy syntax. Is there a way of obtaining OO-like concise syntax, perhaps with Template Haskell? Dennis -------------- next part -------------- An HTML attachment was scrubbed... URL: From parsonsmatt at gmail.com Tue May 15 01:01:48 2018 From: parsonsmatt at gmail.com (Matt) Date: Mon, 14 May 2018 19:01:48 -0600 Subject: [Haskell-cafe] template haskell library for OO-like selector syntax? In-Reply-To: References: Message-ID: You can use `makeFields` from the `lens` package to get something like: someData ^. field1 . field2 along with modifiers: someData & field1 . field2 %~ (* 2) and setters: someData & field1 . field2 .~ 42 where `field1` is polymorphic and can apply to many different data types Matt Parsons On Mon, May 14, 2018 at 6:41 PM, Dennis Raddle wrote: > In my current application, I'm really missing the ability from OO to do > things like > > someData.field1.field2 = "foo" > > What's do I mean? > > - field selectors are scoped so that names don't clash with each other or > global names > > - this way of selecting data can be used both for reading it, and for > updating specific fields of some data deep in a data hierarchy (In Haskell, > if using immutable data, this would requiring doing a data update on every > level). > > Any attempt to do this in Haskell, for me anyway, results in an explosion > of names and a lot of boilerplate code and a resulting heavy syntax. > > Is there a way of obtaining OO-like concise syntax, perhaps with Template > Haskell? > > Dennis > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view 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 dennis.raddle at gmail.com Tue May 15 05:27:19 2018 From: dennis.raddle at gmail.com (Dennis Raddle) Date: Mon, 14 May 2018 22:27:19 -0700 Subject: [Haskell-cafe] state monad transformer that adds or combines state Message-ID: I find myself using the state and exception monads at large scale in my programs. For instance I often keep a pseudorandom generator as the state, and use exception handling. In local computations, I may want to use some additional state. Is there a way to add a little extra state temporarily? Let's say I have data State1 = State1 StdGen type M1 = State State1 data State2 = State2 State1 Int type M2 = State State2 runM2 :: M2 a -> Int -> M1 a someFunc :: M1 Double someFunc = do r <- r2 <- runM2 (deeperFunc r) 3 <..etc..> deeperFunc :: Double -> M2 Double -------------- next part -------------- An HTML attachment was scrubbed... URL: From fa-ml at ariis.it Tue May 15 07:49:47 2018 From: fa-ml at ariis.it (Francesco Ariis) Date: Tue, 15 May 2018 09:49:47 +0200 Subject: [Haskell-cafe] state monad transformer that adds or combines state In-Reply-To: References: Message-ID: <20180515074947.nwlm6q6oij6hud6r@x60s.casa> On Mon, May 14, 2018 at 10:27:19PM -0700, Dennis Raddle wrote: > In local computations, I may want to use some additional state. Is there a > way to add a little extra state temporarily? Would StateT work (in general, taking advantage of what transformers have to offer)? From vandijk.roel at gmail.com Tue May 15 08:23:35 2018 From: vandijk.roel at gmail.com (Roel van Dijk) Date: Tue, 15 May 2018 10:23:35 +0200 Subject: [Haskell-cafe] GHC TV station? In-Reply-To: References: Message-ID: Hi Sylvester, Could you please give an example of code that you think should be correct, but is rejected by a recent GHC? It is certainly annoying when code from a book on Haskell fails to parse. But perhaps the cause is not so nefarious as a backwards incompatible change in syntax. 2018-05-15 1:27 GMT+02:00 Sylvester Hazel via Haskell-Cafe < haskell-cafe at haskell.org>: > White space in "do notation" is no longer supported by GHC but I had to > guess it the hard way seeing my solutions to Hutton's book and then his own > code produce "Parse error" and irritating hint "Possibly caused by a > missing 'do'?". So, Hutton 2ed is outdated, Haskell Platform is dropped > exhausted then perhaps GHC should have a TV station? > Fun is best when it can be shared. > Regards, > Sylvester > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view 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 theedge456 at free.fr Tue May 15 11:13:30 2018 From: theedge456 at free.fr (Fabien R) Date: Tue, 15 May 2018 13:13:30 +0200 Subject: [Haskell-cafe] compilation error of tensorflow-proto 0.1.0.0 Message-ID: <7d9df2f9-7978-2368-47ec-3d7cce39466f@free.fr> Hello, Using ghc 8.2.2 (debian) , I got the following error while building the package with cabal 2.0: Building library for tensorflow-proto-0.1.0.0.. creating dist/build /media/travail/ghc/bin/ghc --make -fbuilding-cabal-package -O -static -dynamic-too -dynosuf dyn_o -dynhisuf dyn_hi -outputdir dist/build -odir dist/build -hidir dist/build -stubdir dist/build -i -idist/build -i. -idist/build/autogen -idist/build/global-autogen -Idist/build/autogen -Idist/build/global-autogen -Idist/build -I. -optP-include -optPdist/build/autogen/cabal_macros.h -this-unit-id tensorflow-proto-0.1.0.0-A707TW4oXcjUPzDlNSl3T -hide-all-packages -Wmissing-home-modules -package-db dist/package.conf.inplace -package-id proto-lens-0.2.2.0-4VJbI6HHabd74gTwpFhCiY -package-id proto-lens-protoc-0.2.2.3-KiMlOomTiwkJiIiDqOmBdc -package-id base-4.10.1.0 -XHaskell2010 Proto.Tensorflow.Core.Framework.AttrValue Proto.Tensorflow.Core.Framework.Graph Proto.Tensorflow.Core.Framework.NodeDef Proto.Tensorflow.Core.Framework.OpDef Proto.Tensorflow.Core.Framework.ResourceHandle Proto.Tensorflow.Core.Framework.Summary Proto.Tensorflow.Core.Framework.Tensor Proto.Tensorflow.Core.Framework.TensorShape Proto.Tensorflow.Core.Framework.Types Proto.Tensorflow.Core.Protobuf.Config Proto.Tensorflow.Core.Util.Event Proto.Tensorflow.Core.Framework.AllocationDescription Proto.Tensorflow.Core.Framework.CostGraph Proto.Tensorflow.Core.Framework.Function Proto.Tensorflow.Core.Framework.StepStats Proto.Tensorflow.Core.Framework.TensorDescription Proto.Tensorflow.Core.Framework.Versions Proto.Tensorflow.Core.Protobuf.Debug [ 1 of 18] Compiling Proto.Tensorflow.Core.Framework.AllocationDescription ( dist/build/autogen/Proto/Tensorflow/Core/Framework/AllocationDescription.hs, dist/build/Proto/Tensorflow/Core/Framework/AllocationDescription.o ) dist/build/autogen/Proto/Tensorflow/Core/Framework/AllocationDescription.hs:159:15: error: ⢠Couldn't match expected type âData.ProtoLens.MessageDescriptor AllocationDescriptionâ with actual type âData.Map.Map Prelude.String (Data.ProtoLens.FieldDescriptor AllocationDescription) -> Data.ProtoLens.MessageDescriptor AllocationDescriptionâ ⢠Probable cause: âData.ProtoLens.MessageDescriptorâ is applied to too few arguments In the expression: Data.ProtoLens.MessageDescriptor (Data.Map.fromList [(Data.ProtoLens.Tag 1, requestedBytes__field_descriptor), (Data.ProtoLens.Tag 2, allocatedBytes__field_descriptor), (Data.ProtoLens.Tag 3, allocatorName__field_descriptor), (Data.ProtoLens.Tag 4, allocationId__field_descriptor), ....]) (Data.Map.fromList [("requested_bytes", requestedBytes__field_descriptor), ("allocated_bytes", allocatedBytes__field_descriptor), ("allocator_name", allocatorName__field_descriptor), ("allocation_id", allocationId__field_descriptor), ....]) Does it mean that I have the wrong version of proto-lens ? * proto-lens Synopsis: A lens-based implementation of protocol buffers in Haskell. Default available version: 0.3.1.0 Installed versions: 0.2.2.0, 0.3.1.0 Homepage: https://github.com/google/proto-lens#readme License: BSD3 -- Fabien From fa-ml at ariis.it Tue May 15 12:55:49 2018 From: fa-ml at ariis.it (Francesco Ariis) Date: Tue, 15 May 2018 14:55:49 +0200 Subject: [Haskell-cafe] compilation error of tensorflow-proto 0.1.0.0 In-Reply-To: <7d9df2f9-7978-2368-47ec-3d7cce39466f@free.fr> References: <7d9df2f9-7978-2368-47ec-3d7cce39466f@free.fr> Message-ID: <20180515125549.bzbt4zlilvydrcuo@x60s.casa> On Tue, May 15, 2018 at 01:13:30PM +0200, Fabien R wrote: > Hello, > > Using ghc 8.2.2 (debian) , I got the following error while building > the package with cabal 2.0: > > [...] > > Does it mean that I have the wrong version of proto-lens ? `cabal new-build --allow-newer` works (or at least, passes that specific compilation stage -- I get a `Can't run protoc on step [18 of 18]), so most likely yes! Can you check if it works on your machine? From ongy at ongy.net Tue May 15 12:57:02 2018 From: ongy at ongy.net (Markus Ongyerth) Date: Tue, 15 May 2018 14:57:02 +0200 Subject: [Haskell-cafe] Maintaining cpphs Message-ID: Hi Malcolm, Are you still interested in maintaining cpphs? I have posted an issue to your github tracker [1] (linked at [2]) and didn't get any response in a week. While that's not a terribly long time, the reason for this patch is trickling down to different distributions repositories (arch and debian-sid) which is making it harder for me to support users because of a dependency. If you are not planing to maintain cpphs in future, I'd like to take over the package on hackage. Cheers, ongy [1] https://github.com/malcolmwallace/cpphs/issues/16 [2] http://hackage.haskell.org/package/cpphs -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: From vanessa.mchale at iohk.io Tue May 15 14:01:59 2018 From: vanessa.mchale at iohk.io (Vanessa McHale) Date: Tue, 15 May 2018 09:01:59 -0500 Subject: [Haskell-cafe] template haskell library for OO-like selector syntax? In-Reply-To: References: Message-ID: >In Haskell, if using immutable data, this would requiring doing a data update on every level I'm not sure what you mean but in either case it doesn't have to do with immutability. Haskell is lazy, so your updates will only happen if the field is later accessed. The other fields in the record will only be updated if they A) change and B) are later accessed. If you just updated one field of a record the other fields will still have pointers to the old data. Otherwise, I agree with Matt's answer. Lenses handle this problem nicely  :) On 05/14/2018 07:41 PM, Dennis Raddle wrote: > In my current application, I'm really missing the ability from OO to > do things like > > someData.field1.field2 = "foo" > > What's do I mean? > > - field selectors are scoped so that names don't clash with each other > or global names > > - this way of selecting data can be used both for reading it, and for > updating specific fields of some data deep in a data hierarchy (In > Haskell, if using immutable data, this would requiring doing a data > update on every level).  > > Any attempt to do this in Haskell, for me anyway, results in an > explosion of names and a lot of boilerplate code and a resulting heavy > syntax. > > Is there a way of obtaining OO-like concise syntax, perhaps with > Template Haskell? > > Dennis > > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -- *Vanessa McHale* Functional Compiler Engineer | Chicago, IL Website: www.iohk.io Twitter: @vamchale PGP Key ID: 4209B7B5 Input Output Twitter Github LinkedIn -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 488 bytes Desc: OpenPGP digital signature URL: From vanessa.mchale at iohk.io Tue May 15 14:08:20 2018 From: vanessa.mchale at iohk.io (Vanessa McHale) Date: Tue, 15 May 2018 09:08:20 -0500 Subject: [Haskell-cafe] state monad transformer that adds or combines state In-Reply-To: References: Message-ID: You can simply use a state monad and then extract the data later when you don't want the extra state, viz. | sum :: (Num a) => [a] -> a sum xs = flip execState 0 $ mapM_ (\x -> do { s <- get ; put $ x + s }) xs | > For instance I often keep a pseudorandom generator as the state, and use exception handling. I'd use a monad transformer. Either `ExceptT` (which would add exceptions to the state monad) or `StateT` (which would add state to an exception monad). On 05/15/2018 12:27 AM, Dennis Raddle wrote: > I find myself using the state and exception monads at large scale in > my programs. For instance I often keep a pseudorandom generator as the > state, and use exception handling. > > In local computations, I may want to use some additional state. Is > there a way to add a little extra state temporarily? > > Let's say I have > > data State1 = State1 StdGen > > type M1 = State State1 > > data State2 = State2 State1 Int > > type M2 = State State2 > > runM2 :: M2  a -> Int -> M1 a > > someFunc :: M1 Double > someFunc = do >   r <- >   r2 <- runM2 (deeperFunc r) 3 >   <..etc..> > > deeperFunc :: Double -> M2 Double > > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -- *Vanessa McHale* Functional Compiler Engineer | Chicago, IL Website: www.iohk.io Twitter: @vamchale PGP Key ID: 4209B7B5 Input Output Twitter Github LinkedIn -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 488 bytes Desc: OpenPGP digital signature URL: From migmit at gmail.com Tue May 15 14:27:49 2018 From: migmit at gmail.com (Mig Mit) Date: Tue, 15 May 2018 16:27:49 +0200 Subject: [Haskell-cafe] template haskell library for OO-like selector syntax? In-Reply-To: References: Message-ID: <624DDE5D-C6F4-4661-BEEB-18D485A91801@gmail.com> Dennis probably means that when in imperative language you'd write employee.department.manager.salary += 1000 in vanilla Haskell it would be like newSalary = employee.department.manager.salary + 1000 newManager = employee.department.manager {salary = newSalary} newDepartment = employee.department {manager = newManager} newEmployee = employee {department = newDepartment} Lazyness have nothing to do with it. This is actually where lenses usually come in, although I'd argue that the data should rather be restructured. > On 2018. May 15., at 16:01, Vanessa McHale wrote: > > >In Haskell, if using immutable data, this would requiring doing a data update on every level > > I'm not sure what you mean but in either case it doesn't have to do with immutability. Haskell is lazy, so your updates will only happen if the field is later accessed. The other fields in the record will only be updated if they A) change and B) are later accessed. If you just updated one field of a record the other fields will still have pointers to the old data. > > Otherwise, I agree with Matt's answer. Lenses handle this problem nicely :) > On 05/14/2018 07:41 PM, Dennis Raddle wrote: >> In my current application, I'm really missing the ability from OO to do things like >> >> someData.field1.field2 = "foo" >> >> What's do I mean? >> >> - field selectors are scoped so that names don't clash with each other or global names >> >> - this way of selecting data can be used both for reading it, and for updating specific fields of some data deep in a data hierarchy (In Haskell, if using immutable data, this would requiring doing a data update on every level). >> >> Any attempt to do this in Haskell, for me anyway, results in an explosion of names and a lot of boilerplate code and a resulting heavy syntax. >> >> Is there a way of obtaining OO-like concise syntax, perhaps with Template Haskell? >> >> Dennis >> >> >> >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view archives go to: >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> Only members subscribed via the mailman list are allowed to post. > > -- > > > > Vanessa McHale > Functional Compiler Engineer | Chicago, IL > > Website: www.iohk.io > Twitter: @vamchale > PGP Key ID: 4209B7B5 > > > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view 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 Tue May 15 14:51:14 2018 From: ollie at ocharles.org.uk (Oliver Charles) Date: Tue, 15 May 2018 15:51:14 +0100 Subject: [Haskell-cafe] Haskell eXchange 2018 CFP (London, Thursday, 11th - Friday, 12th October) Message-ID: Hi all, The Haskell eXchange is an annual conference created for and by the Skills Matter community. An opportunity for Haskellers to meet, learn and share skills, discover emerging technologies and help evolve the Haskell ecosystem. Everyone is welcome to join, whether you are an expert or a beginner, whether you are a commercial user, an academic or a hobbyist, we'd love it if you join us this year at the Haskell eXchange! For 2018, we are planning to have three types of sessions: 1. Regular talks (35 minutes) 2. Hands-on workshops (approximately 90 minutes) 3. Lightning talks (5-10 minutes to be determined in the formal confirmation) The Haskell eXchange is a broad conference, and we'll consider anything with a clear Haskell connection. For example, talks about Haskell libraries and applications, experience reports of using Haskell for work, and tutorials on programming techniques are all fantastic proposals - but please feel free to submit anything that you think is interesting. The committee are happy to work with you if you're unsure if your talk is a good fit, and can be reached at haskellx at skillsmatter.com Most importantly, we're looking for talks that inspire and educate. If your proposal doesn't fit into any of the above categories, it doesn't matter! To submit, please see the form in https://skillsmatter.com/conferences/10237-haskell-exchange-2018#get_involved We look forward to your submissions! -------------- next part -------------- An HTML attachment was scrubbed... URL: From sylvester.hazel at googlemail.com Tue May 15 16:03:22 2018 From: sylvester.hazel at googlemail.com (Sylvester) Date: Tue, 15 May 2018 09:03:22 -0700 (MST) Subject: [Haskell-cafe] GHC TV station? In-Reply-To: References: Message-ID: <1526400202500-0.post@n5.nabble.com> strlen in Hutton 2ed 10.5 Derived primitives White Spaced run on Windows 7 Haskell Platform 8.2.2 strlen :: IO () GHCi, version 8.2.2: http://www.haskell.org/ghc/ :? for help strlen = do putStr "Enter a string: " [1 of 1] Compiling Main ( C:\strlen.WhiteSpaced.hs, interpreted ) xs <- getLine putStr "The string has " C:\strlen.WhiteSpaced.hs:2:14: error: putStr (show (length xs)) Parse error in pattern: putStr putStr " characters" Possibly caused by a missing 'do'? | 2 | strlen = do putStr "Enter a string: " | ^^^^^^^^^^^^^^^^^^^^^^^^^^^... Failed, no modules loaded. Prelude> Bracesed strlen :: IO GHCi, version 8.2.2: http://www.haskell.org/ghc/ :? for help strlen = do {putStr "Enter a string: "; [1 of 1] Compiling Main ( C:\strlen.Bracesed.hs, interpreted ) xs <- getLine; Ok, one module loaded. putStr "The string has "; *Main> putStr (show (length xs)); putStr " characters"} -- Sent from: http://haskell.1045720.n5.nabble.com/Haskell-Haskell-Cafe-f3074699.html From sylvester.hazel at googlemail.com Tue May 15 16:13:54 2018 From: sylvester.hazel at googlemail.com (Sylvester) Date: Tue, 15 May 2018 09:13:54 -0700 (MST) Subject: [Haskell-cafe] GHC TV station? In-Reply-To: References: Message-ID: <1526400834177-0.post@n5.nabble.com> strlen in Hutton 2ed 10.5 Derived primitives => run on Windows 7 Haskell Platform 8.2.2 strlen :: IO () strlen = do putStr "Enter a string: " xs <- getLine putStr "The string has " putStr (show (length xs)) putStr " characters" =================================================== GHCi, version 8.2.2: http://www.haskell.org/ghc/ :? for help [1 of 1] Compiling Main ( C:\strlen.WhiteSpaced.hs, interpreted ) C:\strlen.WhiteSpaced.hs:2:14: error: Parse error in pattern: putStr Possibly caused by a missing 'do'? | 2 | strlen = do putStr "Enter a string: " | ^^^^^^^^^^^^^^^^^^^^^^^^^^^... Failed, no modules loaded. Prelude> ================================================== strlen :: IO () strlen = do {putStr "Enter a string: "; xs <- getLine; putStr "The string has "; putStr (show (length xs)); putStr " characters"} ================================================= GHCi, version 8.2.2: http://www.haskell.org/ghc/ :? for help [1 of 1] Compiling Main ( C:\strlen.Bracesed.hs, interpreted ) Ok, one module loaded. *Main> -- Sent from: http://haskell.1045720.n5.nabble.com/Haskell-Haskell-Cafe-f3074699.html From sylvain at haskus.fr Tue May 15 16:23:42 2018 From: sylvain at haskus.fr (Sylvain Henry) Date: Tue, 15 May 2018 18:23:42 +0200 Subject: [Haskell-cafe] GHC TV station? In-Reply-To: <1526400834177-0.post@n5.nabble.com> References: <1526400834177-0.post@n5.nabble.com> Message-ID: <041f9b94-62aa-166c-9402-6ca5690f9812@haskus.fr> Some ways to fix the given code: strlen :: IO () strlen = do  putStr "Enter a string: " >> do                   xs <-  getLine                   putStr "The string has "                   putStr (show (length xs))                   putStr " characters" strlen :: IO () strlen = do  putStr "Enter a string: "              do                   xs <-  getLine                   putStr "The string has "                   putStr (show (length xs))                   putStr " characters" strlen :: IO () strlen = do  putStr "Enter a string: "              xs <-  getLine              putStr "The string has "              putStr (show (length xs))              putStr " characters" On 15/05/2018 18:13, Sylvester via Haskell-Cafe wrote: > strlen in Hutton 2ed 10.5 Derived primitives => run on Windows 7 Haskell > Platform 8.2.2 > strlen :: IO () > strlen = do putStr "Enter a string: " > xs <- getLine > putStr "The string has " > putStr (show (length xs)) > putStr " characters" > =================================================== > GHCi, version 8.2.2: http://www.haskell.org/ghc/ :? for help > [1 of 1] Compiling Main ( C:\strlen.WhiteSpaced.hs, interpreted > ) > > C:\strlen.WhiteSpaced.hs:2:14: error: > Parse error in pattern: putStr > Possibly caused by a missing 'do'? > | > 2 | strlen = do putStr "Enter a string: " > | ^^^^^^^^^^^^^^^^^^^^^^^^^^^... > Failed, no modules loaded. > Prelude> > ================================================== > strlen :: IO () > strlen = do {putStr "Enter a string: "; > xs <- getLine; > putStr "The string has "; > putStr (show (length xs)); > putStr " characters"} > ================================================= > GHCi, version 8.2.2: http://www.haskell.org/ghc/ :? for help > [1 of 1] Compiling Main ( C:\strlen.Bracesed.hs, interpreted ) > Ok, one module loaded. > *Main> > > > > -- > Sent from: http://haskell.1045720.n5.nabble.com/Haskell-Haskell-Cafe-f3074699.html > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view 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 ietf-dane at dukhovni.org Tue May 15 16:27:14 2018 From: ietf-dane at dukhovni.org (Viktor Dukhovni) Date: Tue, 15 May 2018 12:27:14 -0400 Subject: [Haskell-cafe] GHC TV station? In-Reply-To: <1526400834177-0.post@n5.nabble.com> References: <1526400834177-0.post@n5.nabble.com> Message-ID: <6182E05D-B9BA-4C43-9577-358779FAB491@dukhovni.org> > On May 15, 2018, at 12:13 PM, Sylvester via Haskell-Cafe wrote: > > strlen in Hutton 2ed 10.5 Derived primitives => run on Windows 7 Haskell > Platform 8.2.2 > strlen :: IO () > strlen = do putStr "Enter a string: " > xs <- getLine > putStr "The string has " > putStr (show (length xs)) > putStr " characters" > =================================================== The above indentation looks wrong. Try: ---------- $ cat foo.hs strlen :: IO () strlen = do putStr "Enter a string: " xs <- getLine putStr "The string has " putStr (show (length xs)) putStrLn " characters" $ ghci foo.hs GHCi, version 8.0.2: http://www.haskell.org/ghc/ :? for help [1 of 1] Compiling Main ( foo.hs, interpreted ) Ok, modules loaded: Main. Loaded GHCi configuration from /tmp/haskell-stack-ghci/05485125/ghci-script *Main> strlen Enter a string: foo The string has 3 characters *Main> ---------- If I incorrectly indent the subsequent lines: strlen :: IO () strlen = do putStr "Enter a string: " xs <- getLine putStr "The string has " putStr (show (length xs)) putStrLn " characters" Then I see an error: foo.hs:2:13: error: Parse error in pattern: putStr Possibly caused by a missing 'do'? -- Viktor. From neil_mayhew at users.sourceforge.net Tue May 15 16:56:34 2018 From: neil_mayhew at users.sourceforge.net (Neil Mayhew) Date: Tue, 15 May 2018 10:56:34 -0600 Subject: [Haskell-cafe] GHC TV station? In-Reply-To: <1526400834177-0.post@n5.nabble.com> References: <1526400834177-0.post@n5.nabble.com> Message-ID: On 2018-05-15 10:13 AM, Sylvester via Haskell-Cafe wrote: > strlen in Hutton 2ed 10.5 Derived primitives => run on Windows 7 Haskell > Platform 8.2.2 > strlen :: IO () > strlen = do putStr "Enter a string: " > xs <- getLine > putStr "The string has " > putStr (show (length xs)) > putStr " characters" > This works fine if you indent the code correctly. The code following the first putStr should line up with it vertically: strlen :: IO () strlen = do putStr "Enter a string: " xs <- getLine putStr "The string has " putStr (show (length xs)) putStr " characters" This compiles for me with ghc 8.2. The way you have the code above, the second and subsequent lines of the do block are indented further, and so would need an additional do. However, I don't think this is what's intended. Are you using tabs by any chance? Or have you copied the source from text that uses a mixture of tabs and spaces? -------------- next part -------------- An HTML attachment was scrubbed... URL: From sylvester.hazel at googlemail.com Tue May 15 17:01:50 2018 From: sylvester.hazel at googlemail.com (Sylvester Hazel) Date: Tue, 15 May 2018 19:01:50 +0200 Subject: [Haskell-cafe] GHC TV station? In-Reply-To: <6182E05D-B9BA-4C43-9577-358779FAB491@dukhovni.org> References: <1526400834177-0.post@n5.nabble.com> <6182E05D-B9BA-4C43-9577-358779FAB491@dukhovni.org> Message-ID: Hi Victor, It is frustrating that posting plain text is contorted (via nabble.com and then again in my mail.google.com account) - please see the attachment. I really have sent the right indentation copping the Hutton's script. Is it so difficult for you guys to replicate this obvious failure of GHC on "do notation" with white space? Regards, Sylvester On Tue, May 15, 2018 at 6:27 PM, Viktor Dukhovni wrote: > > > > On May 15, 2018, at 12:13 PM, Sylvester via Haskell-Cafe < > haskell-cafe at haskell.org> wrote: > > > > strlen in Hutton 2ed 10.5 Derived primitives => run on Windows 7 Haskell > > Platform 8.2.2 > > strlen :: IO () > > strlen = do putStr "Enter a string: " > > xs <- getLine > > putStr "The string has " > > putStr (show (length xs)) > > putStr " characters" > > =================================================== > > The above indentation looks wrong. Try: > > ---------- > $ cat foo.hs > strlen :: IO () > strlen = do putStr "Enter a string: " > xs <- getLine > putStr "The string has " > putStr (show (length xs)) > putStrLn " characters" > > $ ghci foo.hs > GHCi, version 8.0.2: http://www.haskell.org/ghc/ :? for help > [1 of 1] Compiling Main ( foo.hs, interpreted ) > Ok, modules loaded: Main. > Loaded GHCi configuration from /tmp/haskell-stack-ghci/ > 05485125/ghci-script > *Main> strlen > Enter a string: foo > The string has 3 characters > *Main> > ---------- > > If I incorrectly indent the subsequent lines: > > strlen :: IO () > strlen = do putStr "Enter a string: " > xs <- getLine > putStr "The string has " > putStr (show (length xs)) > putStrLn " characters" > > > Then I see an error: > > foo.hs:2:13: error: > Parse error in pattern: putStr > Possibly caused by a missing 'do'? > > -- > Viktor. > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: wrong is HTML.jpg Type: image/jpeg Size: 278883 bytes Desc: not available URL: From parsonsmatt at gmail.com Tue May 15 17:13:46 2018 From: parsonsmatt at gmail.com (Matt) Date: Tue, 15 May 2018 11:13:46 -0600 Subject: [Haskell-cafe] GHC TV station? In-Reply-To: References: <1526400834177-0.post@n5.nabble.com> <6182E05D-B9BA-4C43-9577-358779FAB491@dukhovni.org> Message-ID: Could you link to a GitHub gist or lambdapaste or similar? I don't see a plaintext attachment. Matt Parsons On Tue, May 15, 2018 at 11:01 AM, Sylvester Hazel via Haskell-Cafe < haskell-cafe at haskell.org> wrote: > Hi Victor, > It is frustrating that posting plain text is contorted (via nabble.com > and then again in my mail.google.com account) - please see the > attachment. > I really have sent the right indentation copping the Hutton's script. > Is it so difficult for you guys to replicate this obvious failure of GHC > on "do notation" with white space? > Regards, > Sylvester > > On Tue, May 15, 2018 at 6:27 PM, Viktor Dukhovni > wrote: > >> >> >> > On May 15, 2018, at 12:13 PM, Sylvester via Haskell-Cafe < >> haskell-cafe at haskell.org> wrote: >> > >> > strlen in Hutton 2ed 10.5 Derived primitives => run on Windows 7 Haskell >> > Platform 8.2.2 >> > strlen :: IO () >> > strlen = do putStr "Enter a string: " >> > xs <- getLine >> > putStr "The string has " >> > putStr (show (length xs)) >> > putStr " characters" >> > =================================================== >> >> The above indentation looks wrong. Try: >> >> ---------- >> $ cat foo.hs >> strlen :: IO () >> strlen = do putStr "Enter a string: " >> xs <- getLine >> putStr "The string has " >> putStr (show (length xs)) >> putStrLn " characters" >> >> $ ghci foo.hs >> GHCi, version 8.0.2: http://www.haskell.org/ghc/ :? for help >> [1 of 1] Compiling Main ( foo.hs, interpreted ) >> Ok, modules loaded: Main. >> Loaded GHCi configuration from /tmp/haskell-stack-ghci/054851 >> 25/ghci-script >> *Main> strlen >> Enter a string: foo >> The string has 3 characters >> *Main> >> ---------- >> >> If I incorrectly indent the subsequent lines: >> >> strlen :: IO () >> strlen = do putStr "Enter a string: " >> xs <- getLine >> putStr "The string has " >> putStr (show (length xs)) >> putStrLn " characters" >> >> >> Then I see an error: >> >> foo.hs:2:13: error: >> Parse error in pattern: putStr >> Possibly caused by a missing 'do'? >> >> -- >> Viktor. >> >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view archives go to: >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> Only members subscribed via the mailman list are allowed to post. >> > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view 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 bob at redivi.com Tue May 15 17:17:50 2018 From: bob at redivi.com (Bob Ippolito) Date: Tue, 15 May 2018 10:17:50 -0700 Subject: [Haskell-cafe] GHC TV station? In-Reply-To: References: <1526400834177-0.post@n5.nabble.com> <6182E05D-B9BA-4C43-9577-358779FAB491@dukhovni.org> Message-ID: It looks like you may be trying to do this with a proportional font, which is not going to work very well. You will have much better luck if you use a fixed width font when you need to line up columns where some of the lines have non-whitespace characters. An alternative approach would be to have a line break immediately after "do", so all of the lines that need to be indented have only preceding whitespace. The hindent code formatter uses this style, as you can see in any of its examples with do blocks, such as this: https://github.com/commercialhaskell/hindent/blob/master/TESTS.md#function-declarations - when code is written in this style, the blocks will line up visually whether or not the font is fixed width. On Tue, May 15, 2018 at 10:02 AM Sylvester Hazel via Haskell-Cafe < haskell-cafe at haskell.org> wrote: > Hi Victor, > It is frustrating that posting plain text is contorted (via nabble.com > and then again in my mail.google.com account) - please see the > attachment. > I really have sent the right indentation copping the Hutton's script. > Is it so difficult for you guys to replicate this obvious failure of GHC > on "do notation" with white space? > Regards, > Sylvester > > On Tue, May 15, 2018 at 6:27 PM, Viktor Dukhovni > wrote: > >> >> >> > On May 15, 2018, at 12:13 PM, Sylvester via Haskell-Cafe < >> haskell-cafe at haskell.org> wrote: >> > >> > strlen in Hutton 2ed 10.5 Derived primitives => run on Windows 7 Haskell >> > Platform 8.2.2 >> > strlen :: IO () >> > strlen = do putStr "Enter a string: " >> > xs <- getLine >> > putStr "The string has " >> > putStr (show (length xs)) >> > putStr " characters" >> > =================================================== >> >> The above indentation looks wrong. Try: >> >> ---------- >> $ cat foo.hs >> strlen :: IO () >> strlen = do putStr "Enter a string: " >> xs <- getLine >> putStr "The string has " >> putStr (show (length xs)) >> putStrLn " characters" >> >> $ ghci foo.hs >> GHCi, version 8.0.2: http://www.haskell.org/ghc/ :? for help >> [1 of 1] Compiling Main ( foo.hs, interpreted ) >> Ok, modules loaded: Main. >> Loaded GHCi configuration from >> /tmp/haskell-stack-ghci/05485125/ghci-script >> *Main> strlen >> Enter a string: foo >> The string has 3 characters >> *Main> >> ---------- >> >> If I incorrectly indent the subsequent lines: >> >> strlen :: IO () >> strlen = do putStr "Enter a string: " >> xs <- getLine >> putStr "The string has " >> putStr (show (length xs)) >> putStrLn " characters" >> >> >> Then I see an error: >> >> foo.hs:2:13: error: >> Parse error in pattern: putStr >> Possibly caused by a missing 'do'? >> >> -- >> Viktor. >> >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view archives go to: >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> Only members subscribed via the mailman list are allowed to post. >> > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view 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 sylvester.hazel at googlemail.com Tue May 15 18:11:13 2018 From: sylvester.hazel at googlemail.com (Sylvester) Date: Tue, 15 May 2018 11:11:13 -0700 (MST) Subject: [Haskell-cafe] GHC TV station? In-Reply-To: References: <1526400834177-0.post@n5.nabble.com> <6182E05D-B9BA-4C43-9577-358779FAB491@dukhovni.org> Message-ID: <1526407873810-0.post@n5.nabble.com> Bingo Bob! After all that nonsense of my contorted indentations here I discovered (independent from Bob) that Cambria font in my notepad was the reason. Changing it back to Consolas and correcting indentation in scripts agrees with GHC like with all of us:-) I am very sorry for that stupid interruption. Apology to GHC developers who deserve continuous praise. Thank you all for your kind attention and Best Wishes for you all:-) Sylvester -- Sent from: http://haskell.1045720.n5.nabble.com/Haskell-Haskell-Cafe-f3074699.html From malcolm.wallace at me.com Tue May 15 20:08:04 2018 From: malcolm.wallace at me.com (Malcolm Wallace) Date: Tue, 15 May 2018 21:08:04 +0100 Subject: [Haskell-cafe] Failing build for HaXml In-Reply-To: References: Message-ID: My apologies for lack of reply. The HaXml repo is in darcs, and I only recently discovered that the hosting service darcs.haskell.org is no more. It might finally be time to convert over to git, and find a new host. Regards, Malcolm On 14 May 2018, at 15:52, Mikhail Glushenkov wrote: > Hi, > > On Mon, 14 May 2018, 01:33 Vanessa McHale, wrote: >> >> Does anyone know how to submit patches for HaXml? The .cabal file does not list any upstream source repo and it's currently breaking with GHC 8.4.2, which in turn breaks cabal-debian. > > A couple of months ago, I've sent a patch (attached) to Malcolm's > @me.com address adding GHC 8.4 support to HaXml, but never got a > reply. > From dennis.raddle at gmail.com Tue May 15 21:00:30 2018 From: dennis.raddle at gmail.com (Dennis Raddle) Date: Tue, 15 May 2018 14:00:30 -0700 Subject: [Haskell-cafe] template haskell library for OO-like selector syntax? In-Reply-To: <624DDE5D-C6F4-4661-BEEB-18D485A91801@gmail.com> References: <624DDE5D-C6F4-4661-BEEB-18D485A91801@gmail.com> Message-ID: On Tue, May 15, 2018 at 7:27 AM, Mig Mit wrote: > Dennis probably means that when in imperative language you'd write > > employee.department.manager.salary += 1000 > > in vanilla Haskell it would be like > > newSalary = employee.department.manager.salary + 1000 > newManager = employee.department.manager {salary = newSalary} > newDepartment = employee.department {manager = newManager} > newEmployee = employee {department = newDepartment} > > Lazyness have nothing to do with it. This is actually where lenses usually > come in, although I'd argue that the data should rather be restructured. > > That's what I mean. In what sense can I restructure the data? My current application has lots of "composite" data... conceptually, "things" each of which hold a lot of "other things" each of which hold a lot of "still other things". And sometimes I want to update a single one of those "still other things". Lenses seem like a good solution, but if you have a better idea, let me know. D > > On 2018. May 15., at 16:01, Vanessa McHale wrote: > > >In Haskell, if using immutable data, this would requiring doing a data > update on every level > > I'm not sure what you mean but in either case it doesn't have to do with > immutability. Haskell is lazy, so your updates will only happen if the > field is later accessed. The other fields in the record will only be > updated if they A) change and B) are later accessed. If you just updated > one field of a record the other fields will still have pointers to the old > data. > > Otherwise, I agree with Matt's answer. Lenses handle this problem nicely > :) > On 05/14/2018 07:41 PM, Dennis Raddle wrote: > > In my current application, I'm really missing the ability from OO to do > things like > > someData.field1.field2 = "foo" > > What's do I mean? > > - field selectors are scoped so that names don't clash with each other or > global names > > - this way of selecting data can be used both for reading it, and for > updating specific fields of some data deep in a data hierarchy (In Haskell, > if using immutable data, this would requiring doing a data update on every > level). > > Any attempt to do this in Haskell, for me anyway, results in an explosion > of names and a lot of boilerplate code and a resulting heavy syntax. > > Is there a way of obtaining OO-like concise syntax, perhaps with Template > Haskell? > > Dennis > > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to:http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > > > -- > > > > *Vanessa McHale* > Functional Compiler Engineer | Chicago, IL > > Website: www.iohk.io > Twitter: @vamchale > PGP Key ID: 4209B7B5 > > [image: Input Output] > > [image: Twitter] [image: Github] > [image: LinkedIn] > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view 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 vanessa.mchale at iohk.io Tue May 15 21:06:20 2018 From: vanessa.mchale at iohk.io (Vanessa McHale) Date: Tue, 15 May 2018 16:06:20 -0500 Subject: [Haskell-cafe] template haskell library for OO-like selector syntax? In-Reply-To: References: <624DDE5D-C6F4-4661-BEEB-18D485A91801@gmail.com> Message-ID: <975cb8a8-4778-3eba-3b56-a718f8038bfb@iohk.io> >And sometimes I want to update a single one of those "still other things". >Lenses seem like a good solution Lenses are the best solution currently available. If you're worried about this being inefficient due to immutability... don't be. Due to laziness (and more general compiler optimizations), GHC can do this efficiently. On 05/15/2018 04:00 PM, Dennis Raddle wrote: > And sometimes I want to update a single one of those "still other things". ** -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 488 bytes Desc: OpenPGP digital signature URL: From migmit at gmail.com Tue May 15 21:18:45 2018 From: migmit at gmail.com (MigMit) Date: Tue, 15 May 2018 23:18:45 +0200 Subject: [Haskell-cafe] template haskell library for OO-like selector syntax? In-Reply-To: References: <624DDE5D-C6F4-4661-BEEB-18D485A91801@gmail.com> Message-ID: Continuing my example, you can store manager-to-salary mapping separately, in which case you won't need deep updates. I don't think there is a universal solution, same as there is no universal "best" way to translate an imperative program into a functional language. Az iPademről küldve 2018. máj. 15. dátummal, 23:00 időpontban Dennis Raddle írta: > > >> On Tue, May 15, 2018 at 7:27 AM, Mig Mit wrote: >> Dennis probably means that when in imperative language you'd write >> >> employee.department.manager.salary += 1000 >> >> in vanilla Haskell it would be like >> >> newSalary = employee.department.manager.salary + 1000 >> newManager = employee.department.manager {salary = newSalary} >> newDepartment = employee.department {manager = newManager} >> newEmployee = employee {department = newDepartment} >> >> Lazyness have nothing to do with it. This is actually where lenses usually come in, although I'd argue that the data should rather be restructured. >> > > That's what I mean. > > In what sense can I restructure the data? My current application has lots of "composite" data... conceptually, "things" each of which hold a lot of "other things" each of which hold a lot of "still other things". And sometimes I want to update a single one of those "still other things". > > Lenses seem like a good solution, but if you have a better idea, let me know. > > D > > > > >> >>> On 2018. May 15., at 16:01, Vanessa McHale wrote: >>> >>> >In Haskell, if using immutable data, this would requiring doing a data update on every level >>> >>> I'm not sure what you mean but in either case it doesn't have to do with immutability. Haskell is lazy, so your updates will only happen if the field is later accessed. The other fields in the record will only be updated if they A) change and B) are later accessed. If you just updated one field of a record the other fields will still have pointers to the old data. >>> >>> Otherwise, I agree with Matt's answer. Lenses handle this problem nicely :) >>>> On 05/14/2018 07:41 PM, Dennis Raddle wrote: >>>> In my current application, I'm really missing the ability from OO to do things like >>>> >>>> someData.field1.field2 = "foo" >>>> >>>> What's do I mean? >>>> >>>> - field selectors are scoped so that names don't clash with each other or global names >>>> >>>> - this way of selecting data can be used both for reading it, and for updating specific fields of some data deep in a data hierarchy (In Haskell, if using immutable data, this would requiring doing a data update on every level). >>>> >>>> Any attempt to do this in Haskell, for me anyway, results in an explosion of names and a lot of boilerplate code and a resulting heavy syntax. >>>> >>>> Is there a way of obtaining OO-like concise syntax, perhaps with Template Haskell? >>>> >>>> Dennis >>>> >>>> >>>> >>>> _______________________________________________ >>>> Haskell-Cafe mailing list >>>> To (un)subscribe, modify options or view archives go to: >>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >>>> Only members subscribed via the mailman list are allowed to post. >>> >>> -- >>> >>> >>> >>> Vanessa McHale >>> Functional Compiler Engineer | Chicago, IL >>> >>> Website: www.iohk.io >>> Twitter: @vamchale >>> PGP Key ID: 4209B7B5 >>> >>> >>> >>> >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> To (un)subscribe, modify options or view 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 dennis.raddle at gmail.com Tue May 15 21:29:09 2018 From: dennis.raddle at gmail.com (Dennis Raddle) Date: Tue, 15 May 2018 14:29:09 -0700 Subject: [Haskell-cafe] state monad transformer that adds or combines state In-Reply-To: <20180515074947.nwlm6q6oij6hud6r@x60s.casa> References: <20180515074947.nwlm6q6oij6hud6r@x60s.casa> Message-ID: I'm not sure what happens if I apply a StateT to an existing State or StateT monad. Not sure how 'get' and 'put' would function, or if I would need to lift get and put to choose which state to access. D On Tue, May 15, 2018 at 12:49 AM, Francesco Ariis wrote: > On Mon, May 14, 2018 at 10:27:19PM -0700, Dennis Raddle wrote: > > In local computations, I may want to use some additional state. Is there > a > > way to add a little extra state temporarily? > > Would StateT work (in general, taking advantage of what transformers > have to offer)? > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view 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 dennis.raddle at gmail.com Tue May 15 21:31:21 2018 From: dennis.raddle at gmail.com (Dennis Raddle) Date: Tue, 15 May 2018 14:31:21 -0700 Subject: [Haskell-cafe] state monad transformer that adds or combines state In-Reply-To: References: Message-ID: On Tue, May 15, 2018 at 7:08 AM, Vanessa McHale wrote: > You can simply use a state monad and then extract the data later when you > don't want the extra state, viz. > > sum :: (Num a) => [a] -> asum xs = flip execState 0 $ > mapM_ (\x -> do { s <- get ; put $ x + s }) xs > > > Not quite sure how this relates to my point. I need to have modify access to the state in the deeper, original monad, as well as a temporary state monad on top of it. And I don't want to create a single data constructor for a single state monad that has fields for every conceivable use anywhere in my code. D -------------- next part -------------- An HTML attachment was scrubbed... URL: From vanessa.mchale at iohk.io Tue May 15 21:33:06 2018 From: vanessa.mchale at iohk.io (Vanessa McHale) Date: Tue, 15 May 2018 16:33:06 -0500 Subject: [Haskell-cafe] state monad transformer that adds or combines state In-Reply-To: References: <20180515074947.nwlm6q6oij6hud6r@x60s.casa> Message-ID: You can apply StateT to an existing monad, e.g. StateT StateType (Either ErrorType). Then 'get' and 'put' can be used inside this monad. On 05/15/2018 04:29 PM, Dennis Raddle wrote: > I'm not sure what happens if I apply a StateT to an existing State or > StateT monad. Not sure how 'get' and 'put' would function, or if I > would need to lift get and put to choose which state to access. > > D > > On Tue, May 15, 2018 at 12:49 AM, Francesco Ariis > wrote: > > On Mon, May 14, 2018 at 10:27:19PM -0700, Dennis Raddle wrote: > > In local computations, I may want to use some additional state. > Is there a > > way to add a little extra state temporarily? > > Would StateT work (in general, taking advantage of what transformers > have to offer)? > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view 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: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 488 bytes Desc: OpenPGP digital signature URL: From ryan.reich at gmail.com Tue May 15 21:39:11 2018 From: ryan.reich at gmail.com (Ryan Reich) Date: Tue, 15 May 2018 14:39:11 -0700 Subject: [Haskell-cafe] state monad transformer that adds or combines state In-Reply-To: References: <20180515074947.nwlm6q6oij6hud6r@x60s.casa> Message-ID: You can use plain get and put to interact with the outer state, and you have to apply lift to use the inner state. This problem, which for almost any other combination of transformers is solved by mtl's web of MonadState instances, is an example of why the topic of "extensible effects" is so hot. You are basically asking to add, and later subtract, a new state "effect". Barring rewriting your original state type as a product that includes the new one, there isn't really a neat way of doing this. On Tue, May 15, 2018, 14:29 Dennis Raddle wrote: > I'm not sure what happens if I apply a StateT to an existing State or > StateT monad. Not sure how 'get' and 'put' would function, or if I would > need to lift get and put to choose which state to access. > > D > > On Tue, May 15, 2018 at 12:49 AM, Francesco Ariis wrote: > >> On Mon, May 14, 2018 at 10:27:19PM -0700, Dennis Raddle wrote: >> > In local computations, I may want to use some additional state. Is >> there a >> > way to add a little extra state temporarily? >> >> Would StateT work (in general, taking advantage of what transformers >> have to offer)? >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view 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 will.yager at gmail.com Tue May 15 21:49:12 2018 From: will.yager at gmail.com (Will Yager) Date: Tue, 15 May 2018 17:49:12 -0400 Subject: [Haskell-cafe] state monad transformer that adds or combines state In-Reply-To: References: <20180515074947.nwlm6q6oij6hud6r@x60s.casa> Message-ID: <24AD5314-993B-40F1-B703-02A0690BB6B1@gmail.com> Check out http://hackage.haskell.org/package/lens-4.16.1/docs/Control-Lens-Zoom.html#v:zoom > On May 15, 2018, at 17:39, Ryan Reich wrote: > > You can use plain get and put to interact with the outer state, and you have to apply lift to use the inner state. This problem, which for almost any other combination of transformers is solved by mtl's web of MonadState instances, is an example of why the topic of "extensible effects" is so hot. You are basically asking to add, and later subtract, a new state "effect". Barring rewriting your original state type as a product that includes the new one, there isn't really a neat way of doing this. > >> On Tue, May 15, 2018, 14:29 Dennis Raddle wrote: >> I'm not sure what happens if I apply a StateT to an existing State or StateT monad. Not sure how 'get' and 'put' would function, or if I would need to lift get and put to choose which state to access. >> >> D >> >>> On Tue, May 15, 2018 at 12:49 AM, Francesco Ariis wrote: >>> On Mon, May 14, 2018 at 10:27:19PM -0700, Dennis Raddle wrote: >>> > In local computations, I may want to use some additional state. Is there a >>> > way to add a little extra state temporarily? >>> >>> Would StateT work (in general, taking advantage of what transformers >>> have to offer)? >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> To (un)subscribe, modify options or view 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 lexi.lambda at gmail.com Tue May 15 21:55:00 2018 From: lexi.lambda at gmail.com (Alexis King) Date: Tue, 15 May 2018 16:55:00 -0500 Subject: [Haskell-cafe] state monad transformer that adds or combines state In-Reply-To: References: <20180515074947.nwlm6q6oij6hud6r@x60s.casa> Message-ID: > On May 15, 2018, at 16:29, Dennis Raddle > wrote: > > I'm not sure what happens if I apply a StateT to an existing State or > StateT monad. Not sure how 'get' and 'put' would function, or if I > would need to lift get and put to choose which state to access. The immediate answer to this question is “yes”. If you had StateT on top of StateT, you could access the different pieces of state by lifting to the appropriate level. As Ryan points out, this is admittedly a bit awkward, since it doesn’t work with the classes from mtl (due to the functional dependency on MonadState). Still, it’s possible. Extensible effects can solve this a little more cleanly. You can easily handle an effect locally, and you can have multiple state effects with different types. For example, using freer-simple: import Control.Monad.Freer import Control.Monad.Freer.State f :: Member (State StdGen) eff => Eff eff Double f = do r <- r2 <- runState @Int 3 (deeperFunc r) <...> deeperFunc :: Members '[State StdGen, State Int] eff => Double -> Eff eff Double deeperFunc = <...> This works just fine. To others suggesting the OP make the state a product: this seems unsatisfactory to me. It means you have to carry around the state for every local computation you might use, even long after it is no longer needed. If the state is truly local, there’s really no need to carry it around after its lifetime is, semantically, over. We invented local variables for a reason. (Such globalization of state also won’t work in general for things like recursive functions, for the same reasons that local variables cannot be properly implemented without a stack.) One small disclaimer: I am the maintainer of freer-simple, though I can’t really claim to be the author, since it’s a fork, and others did the vast majority of the work. Take my bias as you will. Alexis From anthony_clayden at clear.net.nz Wed May 16 02:09:06 2018 From: anthony_clayden at clear.net.nz (Anthony Clayden) Date: Wed, 16 May 2018 14:09:06 +1200 Subject: [Haskell-cafe] typeclasses considered unnecessary/the power of the @ Message-ID: Haskell 98/2010 keeps a strict distinction between term-level syntax and tokens vs type-level. With ExplicitTypeApplications that's being eased: there's a lightweight way to sneak a type expression into a term. And ghc's internal term language 'core' has had explicit type applications for many years. Then consider a lightweight syntax using type applications in patterns to define typeclass instances by (pattern) 'matching' on types: > (==) @Int x y = primEqInt x y -- or eta-reduced > (==) @Int = primEqInt -- shorthand for > > instance Eq Int where > (==) = primEqInt Given that many typeclasses have a single method (or one base method with others defined in terms of it) [Note **], having to invent a typeclass name is a bit of a pain. Here's a lighweight method decl: > meth :: @a @b. => a -> b -> Bool -- typevar binding to left of => (there might also be superclass constraints) > -- shorthand for > > class Classfor_meth a b where -- generated class name > meth :: a -> b -> Bool Do we need class names at all? We could sneak term-level names into types. Just use the method name in constraints (with some handy syntactic marking -- what could be better than prefix @): > meth2 :: (@meth a b, @show b) => a -> b -> String > meth2 x y = if (meth x y) then show y else "blah" Of course we can infer the constraints on `meth2`, given its equation. Note **: for some of the Prelude's classes with many methods, like Num, there's long-standing complaints that the methods are too much tangled up and should be refactored into a hierarchy with a single method in each class: Additive, Multiplicative, Divisive, etc. With type families we can tackle the classic collections class (with methods empty, insert) as a superclass constraint , er, supermethod method: > type family Elem c :: * > insert @c. => c -> Elem c -> c > > empty :: @c. (@insert c) => c -- entangle empty with insert Likewise for Monad: > (>>=) :: @m. => (m a) -> (a -> m b) -> (m b) > > return :: @m. (@>>= m) => a -> m a The soon-to-arrive Quantified Constraints extension will provide further ways to entangle methods/constraints. That might be an alternative way to express collections: > insert @c @e. (e ~ Elem c) => c -> e -> c > > empty @c. (forall e. @insert c e => @empty c) => c Of course all the above syntax is speculative/bikesheddable. The syntax needs to differentiate tyvars that are parameters/overloadable to the class/method vs parametric free tyvars. With explicit forall: > (>>=) :: forall m a b. @m. => (m a) -> (a -> m b) -> (m b) > > return :: forall m a. @m. (@>>= m) => a -> m a Or perhaps method signatures should look more like methods-as-constraints -- at cost of a bit of repetition > (>>=) :: forall m a b. (@>>= m) => (m a) -> (a -> m b) -> (m b) > > return :: forall m a. (@return m, @>>= m) => a -> m a AntC -------------- next part -------------- An HTML attachment was scrubbed... URL: From mihai.maruseac at gmail.com Wed May 16 02:34:37 2018 From: mihai.maruseac at gmail.com (Mihai Maruseac) Date: Tue, 15 May 2018 19:34:37 -0700 Subject: [Haskell-cafe] ANNOUNCE: Haskell Communities and Activities Report (34th ed., May 2018) Message-ID: On behalf of all the contributors, we are pleased to announce that the Haskell Communities and Activities Report (34th edition, May 2018) is now available, in PDF and HTML formats: http://haskell.org/communities/05-2018/report.pdf http://haskell.org/communities/05-2018/html/report.html All previous editions of HCAR can be accessed on the wiki at https://wiki.haskell.org/Haskell_Communities_and_Activities_Report Many thanks go to all the people that contributed to this report, both directly, by sending in descriptions, and indirectly, by doing all the interesting things that are reported. We hope you will find it as interesting a read as we did. If you have not encountered the Haskell Communities and Activities Reports before, you may like to know that the first of these reports was published in November 2001. Their goal is to improve the communication between the increasingly diverse groups, projects, and individuals working on, with, or inspired by Haskell. The idea behind these reports is simple: Every six months, a call goes out to all of you enjoying Haskell to contribute brief summaries of your own area of work. Many of you respond (eagerly, unprompted, and sometimes in time for the actual deadline) to the call. The editors collect all the contributions into a single report and feed that back to the community. When we try for the next update, six months from now, you might want to report on your own work, project, research area or group as well. So, please put the following into your diaries now: ======================================== End of September 2018: target deadline for contributions to the October 2018 edition of the HCAR Report ======================================== Unfortunately, many Haskellers working on interesting projects are so busy with their work that they seem to have lost the time to follow the Haskell related mailing lists and newsgroups, and have trouble even finding time to report on their work. If you are a member, user or friend of a project so burdened, please find someone willing to make time to report and ask them to "register" with the editors for a simple e-mail reminder in November (you could point us to them as well, and we can then politely ask if they want to contribute, but it might work better if you do the initial asking). Of course, they will still have to find the ten to fifteen minutes to draw up their report, but maybe we can increase our coverage of all that is going on in the community. Feel free to circulate this announcement further in order to reach people who might otherwise not see it. Enjoy! -- Mihai Maruseac (MM) "If you can't solve a problem, then there's an easier problem you can solve: find it." -- George Polya From spam at scientician.net Wed May 16 04:24:15 2018 From: spam at scientician.net (Bardur Arantsson) Date: Wed, 16 May 2018 06:24:15 +0200 Subject: [Haskell-cafe] typeclasses considered unnecessary/the power of the @ In-Reply-To: References: Message-ID: On 2018-05-16 04:09, Anthony Clayden wrote: > Haskell 98/2010 keeps a strict distinction between term-level syntax and > tokens vs type-level. > > With ExplicitTypeApplications that's being eased: there's a lightweight > way to sneak a type expression into a term. And ghc's internal term > language 'core' has had explicit type applications for many years. > > Then consider a lightweight syntax using type applications in patterns > to define typeclass instances by (pattern) 'matching' on types: [--snip--] An interesting post, but I don't see any mention of laws. This seems like it could be an... issue. (Not that we specify laws in the code anyway right now, but at least there's some idea of a "thing" we can attach the laws to and where we can document them.) Regards, From dennis.raddle at gmail.com Wed May 16 06:25:43 2018 From: dennis.raddle at gmail.com (Dennis Raddle) Date: Tue, 15 May 2018 23:25:43 -0700 Subject: [Haskell-cafe] hiring PureScript coder Message-ID: Hello list, I'm have many years of Python/C++ programming experience professionally, and I've used Haskell in my hobbies. But I'm now working full time as a math tutor. Every day I get ideas for a web app that could help me teach math, and maybe could eventually be for sale in the app store. I'd like to write version 0.1 of this in PureScript. And because I have more money than time at this point, I'd like to hire someone to get me started. I'm thinking of asking for the following: - set up a PureScript project that integrates with React - write code that demonstrates using the kinds of features I'll need, like React features, the HTML5 canvas, and JavaScript math notation libraries. - be available for a couple of Skype or Hangouts meetings as I look over this and have questions Can I get some suggestions as to where to find willing PureScript programmers, and a ballpark number of hours for this? I mean just an order of magnitude... is this closer to 5 hours, 10 hours, or 50 hours? Thanks, D -------------- next part -------------- An HTML attachment was scrubbed... URL: From asm13243546 at gmail.com Wed May 16 14:45:23 2018 From: asm13243546 at gmail.com (Alfred Matthews) Date: Wed, 16 May 2018 10:45:23 -0400 Subject: [Haskell-cafe] hiring PureScript coder In-Reply-To: References: Message-ID: Hello Dennis, Have you tried estimating this carefully in one week sprints or numbered milestones, and attaching an estimated effort, cost, or, budget, to each? Don't go reading The Lean Startup ir anything, simply plot it out in JIRA, Pivotal Tracker, etc. GitHub also has some of these tools. Alfred Matthews asm13243546 at gmail.com On Wed, May 16, 2018, 2:26 AM Dennis Raddle wrote: > Hello list, > > I'm have many years of Python/C++ programming experience professionally, > and I've used Haskell in my hobbies. But I'm now working full time as a > math tutor. Every day I get ideas for a web app that could help me teach > math, and maybe could eventually be for sale in the app store. > > I'd like to write version 0.1 of this in PureScript. And because I have > more money than time at this point, I'd like to hire someone to get me > started. I'm thinking of asking for the following: > > - set up a PureScript project that integrates with React > > - write code that demonstrates using the kinds of features I'll need, like > React features, the HTML5 canvas, and JavaScript math notation libraries. > > - be available for a couple of Skype or Hangouts meetings as I look over > this and have questions > > Can I get some suggestions as to where to find willing PureScript > programmers, and a ballpark number of hours for this? I mean just an order > of magnitude... is this closer to 5 hours, 10 hours, or 50 hours? > > Thanks, > D > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view 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 theedge456 at free.fr Wed May 16 16:50:23 2018 From: theedge456 at free.fr (Fabien R) Date: Wed, 16 May 2018 18:50:23 +0200 Subject: [Haskell-cafe] compilation error of tensorflow-proto 0.1.0.0 In-Reply-To: <20180515125549.bzbt4zlilvydrcuo@x60s.casa> References: <7d9df2f9-7978-2368-47ec-3d7cce39466f@free.fr> <20180515125549.bzbt4zlilvydrcuo@x60s.casa> Message-ID: On 15/05/18 14:55, Francesco Ariis wrote: > `cabal new-build --allow-newer` works (or at least, passes that specific > compilation stage I'm using 'cabal install'. 'cabal new-build' seems to rebuild everything... > -- I get a `Can't run protoc on step [18 of 18]), Check that you have protobuf 3 (I installed it from the sources). -- Fabien From vanessa.mchale at iohk.io Wed May 16 16:54:25 2018 From: vanessa.mchale at iohk.io (Vanessa McHale) Date: Wed, 16 May 2018 11:54:25 -0500 Subject: [Haskell-cafe] compilation error of tensorflow-proto 0.1.0.0 In-Reply-To: References: <7d9df2f9-7978-2368-47ec-3d7cce39466f@free.fr> <20180515125549.bzbt4zlilvydrcuo@x60s.casa> Message-ID: <62d3f6a1-f6c4-6d46-330a-2036782a0b7d@iohk.io> `cabal new-build` should only rebuild things once, however. And it's generally better. On 05/16/2018 11:50 AM, Fabien R wrote: > On 15/05/18 14:55, Francesco Ariis wrote: >> `cabal new-build --allow-newer` works (or at least, passes that specific >> compilation stage > I'm using 'cabal install'. > 'cabal new-build' seems to rebuild everything... > >> -- I get a `Can't run protoc on step [18 of 18]), > Check that you have protobuf 3 (I installed it from the sources). > > -- > Fabien > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view 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: 488 bytes Desc: OpenPGP digital signature URL: From michael at schmong.org Wed May 16 19:26:12 2018 From: michael at schmong.org (Michael Litchard) Date: Wed, 16 May 2018 12:26:12 -0700 Subject: [Haskell-cafe] hiring PureScript coder In-Reply-To: References: Message-ID: May I ask why you would choose Purescript over Reflex? On Wednesday, May 16, 2018, Alfred Matthews wrote: > Hello Dennis, > > Have you tried estimating this carefully in one week sprints or numbered > milestones, and attaching an estimated effort, > > cost, or, budget, to each? > > Don't go reading The Lean Startup ir anything, simply plot it out in JIRA, > Pivotal Tracker, etc. > > GitHub also has some of these tools. > > Alfred Matthews > > asm13243546 at gmail.com > > On Wed, May 16, 2018, 2:26 AM Dennis Raddle > wrote: > >> Hello list, >> >> I'm have many years of Python/C++ programming experience professionally, >> and I've used Haskell in my hobbies. But I'm now working full time as a >> math tutor. Every day I get ideas for a web app that could help me teach >> math, and maybe could eventually be for sale in the app store. >> >> I'd like to write version 0.1 of this in PureScript. And because I have >> more money than time at this point, I'd like to hire someone to get me >> started. I'm thinking of asking for the following: >> >> - set up a PureScript project that integrates with React >> >> - write code that demonstrates using the kinds of features I'll need, >> like React features, the HTML5 canvas, and JavaScript math notation >> libraries. >> >> - be available for a couple of Skype or Hangouts meetings as I look over >> this and have questions >> >> Can I get some suggestions as to where to find willing PureScript >> programmers, and a ballpark number of hours for this? I mean just an order >> of magnitude... is this closer to 5 hours, 10 hours, or 50 hours? >> >> Thanks, >> D >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view 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 dennis.raddle at gmail.com Wed May 16 19:56:57 2018 From: dennis.raddle at gmail.com (Dennis Raddle) Date: Wed, 16 May 2018 12:56:57 -0700 Subject: [Haskell-cafe] hiring PureScript coder In-Reply-To: References: Message-ID: Hi Michael, Here's my reasoning. Note that I'm not an expert on any of this. I'm choosing Purescript over Elm (or Reflex) because it has been described to me as a fuller implementation of functional programming, in particular Elm lacks type classes. I'm choosing React because I've been told by several people it's the best way to create a Javascript application that can be packaged for mobile or i.e. a self-contained app. I don't have many more reasons than that. D On Wed, May 16, 2018 at 12:26 PM, Michael Litchard wrote: > May I ask why you would choose Purescript over Reflex? > > > On Wednesday, May 16, 2018, Alfred Matthews wrote: > >> Hello Dennis, >> >> Have you tried estimating this carefully in one week sprints or numbered >> milestones, and attaching an estimated effort, >> >> cost, or, budget, to each? >> >> Don't go reading The Lean Startup ir anything, simply plot it out in >> JIRA, Pivotal Tracker, etc. >> >> GitHub also has some of these tools. >> >> Alfred Matthews >> >> asm13243546 at gmail.com >> >> On Wed, May 16, 2018, 2:26 AM Dennis Raddle >> wrote: >> >>> Hello list, >>> >>> I'm have many years of Python/C++ programming experience professionally, >>> and I've used Haskell in my hobbies. But I'm now working full time as a >>> math tutor. Every day I get ideas for a web app that could help me teach >>> math, and maybe could eventually be for sale in the app store. >>> >>> I'd like to write version 0.1 of this in PureScript. And because I have >>> more money than time at this point, I'd like to hire someone to get me >>> started. I'm thinking of asking for the following: >>> >>> - set up a PureScript project that integrates with React >>> >>> - write code that demonstrates using the kinds of features I'll need, >>> like React features, the HTML5 canvas, and JavaScript math notation >>> libraries. >>> >>> - be available for a couple of Skype or Hangouts meetings as I look over >>> this and have questions >>> >>> Can I get some suggestions as to where to find willing PureScript >>> programmers, and a ballpark number of hours for this? I mean just an order >>> of magnitude... is this closer to 5 hours, 10 hours, or 50 hours? >>> >>> Thanks, >>> D >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> To (un)subscribe, modify options or view 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 leandro at ostera.io Wed May 16 20:13:38 2018 From: leandro at ostera.io (Leandro Ostera) Date: Wed, 16 May 2018 22:13:38 +0200 Subject: [Haskell-cafe] hiring PureScript coder In-Reply-To: References: Message-ID: I’d point you right at ReasonML then — Ocaml dressed as JavaScript 🙌🏼 And the ReasonReact bindings of course. On Wed, 16 May 2018 at 21:57, Dennis Raddle wrote: > Hi Michael, > > Here's my reasoning. Note that I'm not an expert on any of this. > > I'm choosing Purescript over Elm (or Reflex) because it has been described > to me as a fuller implementation of functional programming, in particular > Elm lacks type classes. > > I'm choosing React because I've been told by several people it's the best > way to create a Javascript application that can be packaged for mobile or > i.e. a self-contained app. > > I don't have many more reasons than that. > > D > > > > On Wed, May 16, 2018 at 12:26 PM, Michael Litchard > wrote: > >> May I ask why you would choose Purescript over Reflex? >> >> >> On Wednesday, May 16, 2018, Alfred Matthews >> wrote: >> >>> Hello Dennis, >>> >>> Have you tried estimating this carefully in one week sprints or numbered >>> milestones, and attaching an estimated effort, >>> >>> cost, or, budget, to each? >>> >>> Don't go reading The Lean Startup ir anything, simply plot it out in >>> JIRA, Pivotal Tracker, etc. >>> >>> GitHub also has some of these tools. >>> >>> Alfred Matthews >>> >>> asm13243546 at gmail.com >>> >>> On Wed, May 16, 2018, 2:26 AM Dennis Raddle >>> wrote: >>> >>>> Hello list, >>>> >>>> I'm have many years of Python/C++ programming experience >>>> professionally, and I've used Haskell in my hobbies. But I'm now working >>>> full time as a math tutor. Every day I get ideas for a web app that could >>>> help me teach math, and maybe could eventually be for sale in the app store. >>>> >>>> I'd like to write version 0.1 of this in PureScript. And because I have >>>> more money than time at this point, I'd like to hire someone to get me >>>> started. I'm thinking of asking for the following: >>>> >>>> - set up a PureScript project that integrates with React >>>> >>>> - write code that demonstrates using the kinds of features I'll need, >>>> like React features, the HTML5 canvas, and JavaScript math notation >>>> libraries. >>>> >>>> - be available for a couple of Skype or Hangouts meetings as I look >>>> over this and have questions >>>> >>>> Can I get some suggestions as to where to find willing PureScript >>>> programmers, and a ballpark number of hours for this? I mean just an order >>>> of magnitude... is this closer to 5 hours, 10 hours, or 50 hours? >>>> >>>> Thanks, >>>> D >>>> _______________________________________________ >>>> Haskell-Cafe mailing list >>>> To (un)subscribe, modify options or view 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 dennis.raddle at gmail.com Wed May 16 20:23:38 2018 From: dennis.raddle at gmail.com (Dennis Raddle) Date: Wed, 16 May 2018 13:23:38 -0700 Subject: [Haskell-cafe] hiring PureScript coder In-Reply-To: References: Message-ID: On Wed, May 16, 2018 at 1:13 PM, Leandro Ostera wrote: > I’d point you right at ReasonML then — Ocaml dressed as JavaScript 🙌🏼 > > And the ReasonReact bindings of course. I should add that I don't want to learn another language... my time is already limited enough. My Haskell experience should make Purescript easy, and the way Purescript fits elegantly with JavaScript should mean that I can learn what I need to about JS libraries, and incorporate them, without any inefficiency. Learning OCaml, however... too much. With Scala, I learned that a combo OO/FP language requires a lot of effort to master... it's not just a matter of knowing FP and knowing OO and then assuming you can mix them expertly. It's really an entirely new category of language. I would be willing to consider another Haskell-like language in place of Purescript, and a framework other than React. D -------------- next part -------------- An HTML attachment was scrubbed... URL: From tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk Wed May 16 20:51:41 2018 From: tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk (Tom Ellis) Date: Wed, 16 May 2018 21:51:41 +0100 Subject: [Haskell-cafe] hiring PureScript coder In-Reply-To: References: Message-ID: <20180516205141.njfinrzbylhqej5s@weber> On Wed, May 16, 2018 at 12:56:57PM -0700, Dennis Raddle wrote: > I'm choosing Purescript over Elm (or Reflex) because it has been described > to me as a fuller implementation of functional programming, in particular > Elm lacks type classes. Did you know that Reflex is a Haskell library? https://hackage.haskell.org/package/reflex From asm13243546 at gmail.com Wed May 16 21:08:36 2018 From: asm13243546 at gmail.com (Alfred Matthews) Date: Wed, 16 May 2018 17:08:36 -0400 Subject: [Haskell-cafe] hiring PureScript coder In-Reply-To: References: Message-ID: I don't see any reason not to use PureScript, if you don't simply want to do architecture in JavaScript, in a functional style. Underscore, for JavaScript, is minimal and lightweight and you don't have to rely on compilers that remain experimental. It's experimental enough, writing JavaScript. But, you can leverage PureScript's Haskell-like-to JavaScript compilation workflow, much as one might for ClojureScript, and then, remaining in the Haskell ecosystem under Haskell-style BSD rather than BDFL community licensing, proceed to develop your own IP such that you can write maintainable JavaScript or Haskell code, with Purescript. Just my 2c Al On Wed, 16 May 2018 at 16:24 Dennis Raddle wrote: > On Wed, May 16, 2018 at 1:13 PM, Leandro Ostera wrote: > >> I’d point you right at ReasonML then — Ocaml dressed as JavaScript 🙌🏼 >> >> And the ReasonReact bindings of course. > > > > I should add that I don't want to learn another language... my time is > already limited enough. My Haskell experience should make Purescript easy, > and the way Purescript fits elegantly with JavaScript should mean that I > can learn what I need to about JS libraries, and incorporate them, without > any inefficiency. > > Learning OCaml, however... too much. With Scala, I learned that a combo > OO/FP language requires a lot of effort to master... it's not just a matter > of knowing FP and knowing OO and then assuming you can mix them expertly. > It's really an entirely new category of language. > > I would be willing to consider another Haskell-like language in place of > Purescript, and a framework other than React. > > > D > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view 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 asm13243546 at gmail.com Wed May 16 21:09:57 2018 From: asm13243546 at gmail.com (Alfred Matthews) Date: Wed, 16 May 2018 17:09:57 -0400 Subject: [Haskell-cafe] hiring PureScript coder In-Reply-To: References: Message-ID: Also it'seems worth asking at this time what your business plans are in re: client-server and SaaS. On Wed, 16 May 2018 at 17:08 Alfred Matthews wrote: > I don't see any reason not to use PureScript, if you don't simply want to > do architecture in JavaScript, in a functional style. > > Underscore, for JavaScript, is minimal and lightweight and you don't have > to rely on compilers that remain experimental. It's experimental enough, > writing JavaScript. But, you can leverage PureScript's Haskell-like-to > JavaScript compilation workflow, much as one might for ClojureScript, and > then, remaining in the Haskell ecosystem under Haskell-style BSD rather > than BDFL community licensing, proceed to develop your own IP such that you > can write maintainable JavaScript or Haskell code, with Purescript. > > Just my 2c > > Al > > On Wed, 16 May 2018 at 16:24 Dennis Raddle > wrote: > >> On Wed, May 16, 2018 at 1:13 PM, Leandro Ostera >> wrote: >> >>> I’d point you right at ReasonML then — Ocaml dressed as JavaScript 🙌🏼 >>> >>> And the ReasonReact bindings of course. >> >> >> >> I should add that I don't want to learn another language... my time is >> already limited enough. My Haskell experience should make Purescript easy, >> and the way Purescript fits elegantly with JavaScript should mean that I >> can learn what I need to about JS libraries, and incorporate them, without >> any inefficiency. >> >> Learning OCaml, however... too much. With Scala, I learned that a combo >> OO/FP language requires a lot of effort to master... it's not just a matter >> of knowing FP and knowing OO and then assuming you can mix them expertly. >> It's really an entirely new category of language. >> >> I would be willing to consider another Haskell-like language in place of >> Purescript, and a framework other than React. >> >> >> D >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view 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 asm13243546 at gmail.com Wed May 16 21:10:27 2018 From: asm13243546 at gmail.com (Alfred Matthews) Date: Wed, 16 May 2018 17:10:27 -0400 Subject: [Haskell-cafe] hiring PureScript coder In-Reply-To: References: Message-ID: Or not. Not my place. On Wed, 16 May 2018 at 17:09 Alfred Matthews wrote: > Also it'seems worth asking at this time what your business plans are in > re: client-server and SaaS. > > On Wed, 16 May 2018 at 17:08 Alfred Matthews > wrote: > >> I don't see any reason not to use PureScript, if you don't simply want to >> do architecture in JavaScript, in a functional style. >> >> Underscore, for JavaScript, is minimal and lightweight and you don't have >> to rely on compilers that remain experimental. It's experimental enough, >> writing JavaScript. But, you can leverage PureScript's Haskell-like-to >> JavaScript compilation workflow, much as one might for ClojureScript, and >> then, remaining in the Haskell ecosystem under Haskell-style BSD rather >> than BDFL community licensing, proceed to develop your own IP such that you >> can write maintainable JavaScript or Haskell code, with Purescript. >> >> Just my 2c >> >> Al >> >> On Wed, 16 May 2018 at 16:24 Dennis Raddle >> wrote: >> >>> On Wed, May 16, 2018 at 1:13 PM, Leandro Ostera >>> wrote: >>> >>>> I’d point you right at ReasonML then — Ocaml dressed as JavaScript 🙌🏼 >>>> >>>> And the ReasonReact bindings of course. >>> >>> >>> >>> I should add that I don't want to learn another language... my time is >>> already limited enough. My Haskell experience should make Purescript easy, >>> and the way Purescript fits elegantly with JavaScript should mean that I >>> can learn what I need to about JS libraries, and incorporate them, without >>> any inefficiency. >>> >>> Learning OCaml, however... too much. With Scala, I learned that a combo >>> OO/FP language requires a lot of effort to master... it's not just a matter >>> of knowing FP and knowing OO and then assuming you can mix them expertly. >>> It's really an entirely new category of language. >>> >>> I would be willing to consider another Haskell-like language in place of >>> Purescript, and a framework other than React. >>> >>> >>> D >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> To (un)subscribe, modify options or view 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 dennis.raddle at gmail.com Thu May 17 00:56:11 2018 From: dennis.raddle at gmail.com (Dennis Raddle) Date: Wed, 16 May 2018 17:56:11 -0700 Subject: [Haskell-cafe] hiring PureScript coder In-Reply-To: <20180516205141.njfinrzbylhqej5s@weber> References: <20180516205141.njfinrzbylhqej5s@weber> Message-ID: I was looking at this: https://github.com/mozilla/reflex Wrong Reflex? On Wed, May 16, 2018 at 1:51 PM, Tom Ellis < tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk> wrote: > On Wed, May 16, 2018 at 12:56:57PM -0700, Dennis Raddle wrote: > > I'm choosing Purescript over Elm (or Reflex) because it has been > described > > to me as a fuller implementation of functional programming, in particular > > Elm lacks type classes. > > Did you know that Reflex is a Haskell library? > > https://hackage.haskell.org/package/reflex > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view 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 Thu May 17 00:57:50 2018 From: allbery.b at gmail.com (Brandon Allbery) Date: Wed, 16 May 2018 20:57:50 -0400 Subject: [Haskell-cafe] hiring PureScript coder In-Reply-To: References: <20180516205141.njfinrzbylhqej5s@weber> Message-ID: In the Haskell community, "Reflex" usually means https://github.com/reflex-frp/reflex-platform . On Wed, May 16, 2018 at 8:56 PM, Dennis Raddle wrote: > I was looking at this: https://github.com/mozilla/reflex > > Wrong Reflex? > > > On Wed, May 16, 2018 at 1:51 PM, Tom Ellis jaguarpaw.co.uk> wrote: > >> On Wed, May 16, 2018 at 12:56:57PM -0700, Dennis Raddle wrote: >> > I'm choosing Purescript over Elm (or Reflex) because it has been >> described >> > to me as a fuller implementation of functional programming, in >> particular >> > Elm lacks type classes. >> >> Did you know that Reflex is a Haskell library? >> >> https://hackage.haskell.org/package/reflex >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view 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 theedge456 at free.fr Thu May 17 10:17:29 2018 From: theedge456 at free.fr (Fabien R) Date: Thu, 17 May 2018 12:17:29 +0200 Subject: [Haskell-cafe] compilation error of tensorflow-proto 0.1.0.0 In-Reply-To: <62d3f6a1-f6c4-6d46-330a-2036782a0b7d@iohk.io> References: <7d9df2f9-7978-2368-47ec-3d7cce39466f@free.fr> <20180515125549.bzbt4zlilvydrcuo@x60s.casa> <62d3f6a1-f6c4-6d46-330a-2036782a0b7d@iohk.io> Message-ID: <3c710aff-2c1d-4c3b-44c5-1eb6681860cd@free.fr> On 16/05/18 18:54, Vanessa McHale wrote: > `cabal new-build` should only rebuild things once, however. And it's > generally better. Ok. I have another error now: cabal -v new-build --allow-newer tensorflow-proto Building library for tensorflow-proto-0.1.0.0.. creating /tmp/tensorflow-proto-0.1.0.0/dist-newstyle/build/x86_64-linux/ghc-8.2.2/tensorflow-proto-0.1.0.0/build /media/travail/ghc/bin/ghc --make -fbuilding-cabal-package -O -static -dynamic-too -dynosuf dyn_o -dynhisuf dyn_hi -outputdir /tmp/tensorflow-proto-0.1.0.0/dist-newstyle/build/x86_64-linux/ghc-8.2.2/tensorflow-proto-0.1.0.0/build -odir /tmp/tensorflow-proto-0.1.0.0/dist-newstyle/build/x86_64-linux/ghc-8.2.2/tensorflow-proto-0.1.0.0/build -hidir /tmp/tensorflow-proto-0.1.0.0/dist-newstyle/build/x86_64-linux/ghc-8.2.2/tensorflow-proto-0.1.0.0/build -stubdir /tmp/tensorflow-proto-0.1.0.0/dist-newstyle/build/x86_64-linux/ghc-8.2.2/tensorflow-proto-0.1.0.0/build -i -i/tmp/tensorflow-proto-0.1.0.0/dist-newstyle/build/x86_64-linux/ghc-8.2.2/tensorflow-proto-0.1.0.0/build -i. -i/tmp/tensorflow-proto-0.1.0.0/dist-newstyle/build/x86_64-linux/ghc-8.2.2/tensorflow-proto-0.1.0.0/build/autogen -i/tmp/tensorflow-proto-0.1.0.0/dist-newstyle/build/x86_64-linux/ghc-8.2.2/tensorflow-proto-0.1.0.0/build/global-autogen -I/tmp/tensorflow-proto-0.1.0.0/dist-newstyle/build/x86_64-linux/ghc-8.2.2/tensorflow-proto-0.1.0.0/build/autogen -I/tmp/tensorflow-proto-0.1.0.0/dist-newstyle/build/x86_64-linux/ghc-8.2.2/tensorflow-proto-0.1.0.0/build/global-autogen -I/tmp/tensorflow-proto-0.1.0.0/dist-newstyle/build/x86_64-linux/ghc-8.2.2/tensorflow-proto-0.1.0.0/build -I. -optP-include -optP/tmp/tensorflow-proto-0.1.0.0/dist-newstyle/build/x86_64-linux/ghc-8.2.2/tensorflow-proto-0.1.0.0/build/autogen/cabal_macros.h -this-unit-id tensorflow-proto-0.1.0.0-inplace -hide-all-packages -Wmissing-home-modules -no-user-package-db -package-db /home/fabien/.cabal/store/ghc-8.2.2/package.db -package-db /tmp/tensorflow-proto-0.1.0.0/dist-newstyle/packagedb/ghc-8.2.2 -package-db /tmp/tensorflow-proto-0.1.0.0/dist-newstyle/build/x86_64-linux/ghc-8.2.2/tensorflow-proto-0.1.0.0/package.conf.inplace -package-id proto-lens-0.3.1.0-606296feb88b5391f9c209775e99cb41e62920d11d1a70bc2dee6dc222293b57 -package-id proto-lens-protoc-0.3.1.0-701ad82b9718922791137f9ed26169a31fe583a6444a5c76dfa689acf9e7466e -package-id base-4.10.1.0 -XHaskell2010 Proto.Tensorflow.Core.Framework.AttrValue Proto.Tensorflow.Core.Framework.Graph Proto.Tensorflow.Core.Framework.NodeDef Proto.Tensorflow.Core.Framework.OpDef Proto.Tensorflow.Core.Framework.ResourceHandle Proto.Tensorflow.Core.Framework.Summary Proto.Tensorflow.Core.Framework.Tensor Proto.Tensorflow.Core.Framework.TensorShape Proto.Tensorflow.Core.Framework.Types Proto.Tensorflow.Core.Protobuf.Config Proto.Tensorflow.Core.Util.Event Proto.Tensorflow.Core.Framework.AllocationDescription Proto.Tensorflow.Core.Framework.CostGraph Proto.Tensorflow.Core.Framework.Function Proto.Tensorflow.Core.Framework.StepStats Proto.Tensorflow.Core.Framework.TensorDescription Proto.Tensorflow.Core.Framework.Versions Proto.Tensorflow.Core.Protobuf.Debug [ 1 of 18] Compiling Proto.Tensorflow.Core.Framework.AllocationDescription ( /tmp/tensorflow-proto-0.1.0.0/dist-newstyle/build/x86_64-linux/ghc-8.2.2/tensorflow-proto-0.1.0.0/build/global-autogen/Proto/Tensorflow/Core/Framework/AllocationDescription.hs, /tmp/tensorflow-proto-0.1.0.0/dist-newstyle/build/x86_64-linux/ghc-8.2.2/tensorflow-proto-0.1.0.0/build/Proto/Tensorflow/Core/Framework/AllocationDescription.o ) /tmp/tensorflow-proto-0.1.0.0/dist-newstyle/build/x86_64-linux/ghc-8.2.2/tensorflow-proto-0.1.0.0/build/global-autogen/Proto/Tensorflow/Core/Framework/AllocationDescription.hs:134:9: error: âdescriptorâ is not a (visible) method of class âData.ProtoLens.Messageâ | 134 | descriptor | ^^^^^^^^^^ /tmp/tensorflow-proto-0.1.0.0/dist-newstyle/build/x86_64-linux/ghc-8.2.2/tensorflow-proto-0.1.0.0/build/global-autogen/Proto/Tensorflow/Core/Framework/AllocationDescription.hs:173:15: error: Not in scope: data constructor âData.ProtoLens.MessageDescriptorâ Perhaps you meant one of these: âData.ProtoLens.AnyMessageDescriptorâ (imported from Data.ProtoLens.Reexport.Data.ProtoLens), âData.ProtoLens.FieldDescriptorâ (imported from Data.ProtoLens.Reexport.Data.ProtoLens) Module âData.ProtoLensâ does not export âMessageDescriptorâ. | 173 | Data.ProtoLens.MessageDescriptor Any hint ? From fa-ml at ariis.it Thu May 17 10:35:55 2018 From: fa-ml at ariis.it (Francesco Ariis) Date: Thu, 17 May 2018 12:35:55 +0200 Subject: [Haskell-cafe] compilation error of tensorflow-proto 0.1.0.0 In-Reply-To: <3c710aff-2c1d-4c3b-44c5-1eb6681860cd@free.fr> References: <7d9df2f9-7978-2368-47ec-3d7cce39466f@free.fr> <20180515125549.bzbt4zlilvydrcuo@x60s.casa> <62d3f6a1-f6c4-6d46-330a-2036782a0b7d@iohk.io> <3c710aff-2c1d-4c3b-44c5-1eb6681860cd@free.fr> Message-ID: <20180517103555.o5cbloo3hwspc4uo@x60s.casa> On Thu, May 17, 2018 at 12:17:29PM +0200, Fabien R wrote: > On 16/05/18 18:54, Vanessa McHale wrote: > > `cabal new-build` should only rebuild things once, however. And it's > > generally better. > Ok. I have another error now: Try `cabal update` and run it again, if that fails file a bug in: https://github.com/tensorflow/haskell I see there are five pull-requests open, three of them older than a year; hopefully the repo has not been google'd. From kei at lanl.gov Thu May 17 23:33:44 2018 From: kei at lanl.gov (Kei Davis) Date: Thu, 17 May 2018 17:33:44 -0600 Subject: [Haskell-cafe] 2nd CfP Workshop on Functional High-Performance Computing 2018 Message-ID: <985c9f05-2076-94f5-8a6c-849267f814d1@lanl.gov> 2nd CfP Workshop on Functional High-Performance Computing 2018 The 7th ACM SIGPLAN Workshop on Functional High-Performance Computing (FHPC 2018) is being held as in previous years in conjunction with the International Conference on Functional Programming (ICFP 2018) together with numerous other workshops/symposia, and as a first, colocated with Strange Loop, in St. Louis, MO, USA. https://icfp18.sigplan.org/track/FHPC-2018-papers#FHPC-2018-Call-for-Papers -- Kei Davis Applied Computer Science Group CCS-7, Mail Stop B287 Los Alamos National Laboratory Los Alamos, NM 87545, U.S.A. From awpritchard at gmail.com Fri May 18 00:56:08 2018 From: awpritchard at gmail.com (Andrew Pritchard) Date: Thu, 17 May 2018 17:56:08 -0700 Subject: [Haskell-cafe] compilation error of tensorflow-proto 0.1.0.0 In-Reply-To: <20180517103555.o5cbloo3hwspc4uo@x60s.casa> References: <7d9df2f9-7978-2368-47ec-3d7cce39466f@free.fr> <20180515125549.bzbt4zlilvydrcuo@x60s.casa> <62d3f6a1-f6c4-6d46-330a-2036782a0b7d@iohk.io> <3c710aff-2c1d-4c3b-44c5-1eb6681860cd@free.fr> <20180517103555.o5cbloo3hwspc4uo@x60s.casa> Message-ID: This has been recently reported as https://github.com/tensorflow/haskell/issues/180 -- I've done a bit of analysis there, but it's not obvious what to do about it. On Thu, May 17, 2018 at 3:36 AM Francesco Ariis wrote: > On Thu, May 17, 2018 at 12:17:29PM +0200, Fabien R wrote: > > On 16/05/18 18:54, Vanessa McHale wrote: > > > `cabal new-build` should only rebuild things once, however. And it's > > > generally better. > > Ok. I have another error now: > > Try `cabal update` and run it again, if that fails file a bug in: > > https://github.com/tensorflow/haskell > > I see there are five pull-requests open, three of them older than > a year; hopefully the repo has not been google'd. > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view 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 May 18 11:21:23 2018 From: monkleyon at gmail.com (MarLinn) Date: Fri, 18 May 2018 13:21:23 +0200 Subject: [Haskell-cafe] typeclasses considered unnecessary/the power of the @ In-Reply-To: References: Message-ID: <93e94c45-a7e4-c5c7-2da8-8e471ec42a40@gmail.com> On 2018-05-16 04:09, Anthony Clayden wrote: > Haskell 98/2010 keeps a strict distinction between term-level syntax > and tokens vs type-level. > > With ExplicitTypeApplications that's being eased: there's a > lightweight way to sneak a type expression into a term. And ghc's > internal term language 'core' has had explicit type applications for > many years. > > Then consider a lightweight syntax using type applications in patterns > to define typeclass instances by (pattern) 'matching' on types: > > > (==) @Int x y = primEqInt x y         -- or eta-reduced > > (==) @Int     = primEqInt             -- shorthand for > > > > instance Eq Int where > >   (==) = primEqInt > > Given that many typeclasses have a single method (or one base method > with others defined in terms of it) [Note **], having to invent a > typeclass name is a bit of a pain. Here's a lighweight method decl: > > > meth :: @a @b. => a -> b -> Bool  -- typevar binding to left of => > (there might also be superclass constraints) > >                                       -- shorthand for > > > > class Classfor_meth a b where         -- generated class name > >   meth :: a -> b -> Bool As Oleg Kiselyov pointed out over a decade ago, all typeclasses can be reduced to just one, namely [1] class C l t | l -> t where ac :: l -> t Which in turn is basically an untagged version of the HasField typeclass that's being used to create overloaded records. [2] class HasField (x :: k)r a | x r -> a where getField :: r -> a (Not very surprising, because classes are basically compile-time records) In other words 1. You only have one class to replace (left as an exercise to the reader) 2. I don't think you need any fancy new tricks or syntax for multi-function classes 3. You might be able to also implement records with just type application and type families Cheers, MarLinn [1] http://okmij.org/ftp/Haskell/Haskell1/Haskell1.txt [2] https://github.com/adamgundry/ghc-proposals/blob/overloaded-record-fields/proposals/0000-overloaded-record-fields.rst#hasfield-class -------------- next part -------------- An HTML attachment was scrubbed... URL: From anthony_clayden at clear.net.nz Fri May 18 11:44:03 2018 From: anthony_clayden at clear.net.nz (Anthony Clayden) Date: Fri, 18 May 2018 23:44:03 +1200 Subject: [Haskell-cafe] typeclasses considered unnecessary/the power of the @ In-Reply-To: References: Message-ID: On 2018-05-16 04:24:15 UTC 2018, Bardur Arantsson wrote: > An interesting post, but I don't see any mention of laws. This seems like it could be an... issue. > > (Not that we specify laws in the code anyway right now, but at least there's some idea of a "thing" we can attach the laws to and where we can document them.) Thanks Bardur, I don't see an issue. Currently the laws are specified in terms of equivalences between method calls, not in terms of classes. Furthermore the laws might involve methods from many different classes. So we can attach the laws to the methods. For example, the Monad laws mention not only `return` and (>>=) but also `fmap`, `pure`, (*>), etc. Note that the classes in the Prelude are all single parameter, in compliance with H98; so it's unambiguous which type instantiation the laws are talking about. That can all be handled I think through the 'supermethod methods' I talked about (which play the role of superclass constraints). For example in making the Num class redundant, we require (+) to be a supermethod of (*); and (*) to be a supermethod of (/). AntC -------------- next part -------------- An HTML attachment was scrubbed... URL: From hello at mario.net.au Sat May 19 22:34:23 2018 From: hello at mario.net.au (Mario Rogic) Date: Sat, 19 May 2018 23:34:23 +0100 Subject: [Haskell-cafe] Archival of community.haskell.org In-Reply-To: References: Message-ID: Hi all The final steps in deprecating the legacy community.haskell.org server are almost complete. We will be shutting down SSH access and disabling the HTTP daemon this week. If by some chance there are folks who still need access to data, or require redirects, please contact me. Thanks - Mario On 5 September 2017 at 16:01, Mario Rogic wrote: > Hi all > > In continuation of the work towards shutting down the legacy > community.haskell.org server, I have the following updates to share: > > - The projects.haskell.org, and code.haskell.org sites have now been > archived to https://archives.haskell.org/, and redirects have been put > in place > - http://trac.haskell.org/ has been disabled, but will not be archived > due to its long term broken state > - We discovered that code/projects domains were still being used for > ~user dirs > , > redirect exceptions have now been put in place for those > > > Next on the list is the personal directories. Thanks to those who have > already reached out. > > If you still use a personal account on community.haskell.org or have data > there you would like to retain, *you are encouraged to migrate or backup > ASAP*. > > I can assist with putting in place redirects for a time, please email me > if desired. > > Thanks > > - Mario > > > On 4 March 2017 at 12:23, Mario Rogic wrote: > >> 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 dennis.raddle at gmail.com Sun May 20 20:06:48 2018 From: dennis.raddle at gmail.com (Dennis Raddle) Date: Sun, 20 May 2018 13:06:48 -0700 Subject: [Haskell-cafe] tutorials, Freer or "data a la carte" Message-ID: I'm interested in Control.Monad.Freer, but I would need some kind of tutorial aimed at a low-intermediate level. Also I think "data a la carte" might be applicable to me, but again I would need some kind of tutorial. D -------------- next part -------------- An HTML attachment was scrubbed... URL: From johnw at newartisans.com Mon May 21 04:49:49 2018 From: johnw at newartisans.com (John Wiegley) Date: Sun, 20 May 2018 21:49:49 -0700 Subject: [Haskell-cafe] tutorials, Freer or "data a la carte" In-Reply-To: (Dennis Raddle's message of "Sun, 20 May 2018 13:06:48 -0700") References: Message-ID: >>>>> "DR" == Dennis Raddle writes: DR> Also I think "data a la carte" might be applicable to me, but again I DR> would need some kind of tutorial. Wouter Swiestra's original paper is an excellent resource for understanding both the problem and the solution: http://www.cs.ru.nl/~W.Swierstra/Publications/DataTypesALaCarte.pdf If you're looking for something even simpler than that, might I suggest: http://blog.sumtypeofway.com/an-introduction-to-recursion-schemes/ -- John Wiegley GPG fingerprint = 4710 CF98 AF9B 327B B80F http://newartisans.com 60E1 46C4 BD1A 7AC1 4BA2 From ryan.trinkle at gmail.com Mon May 21 20:37:12 2018 From: ryan.trinkle at gmail.com (Ryan Trinkle) Date: Mon, 21 May 2018 16:37:12 -0400 Subject: [Haskell-cafe] Tezos is hiring 40 functional programmers Message-ID: Hi everyone, I received this from Tezos - one of Obsidian's clients - and I thought it would be of interest to people here. Tezos is a blockchain and a platform of distributed applications written in OCaml, which brings scalability, formal verification and self-amendment to the blockchain space. Tezos has 40 open positions in the world including 25 in France. Remote and part-time accepted. We are looking for profiles ranging from masters (with possible funding for PhD) to PhD with extensive experience. Expertise in a functional language such as OCaml, Haskell, Clojure or equivalent is required, as well as skills in one of the following topics: algorithms, compilers, design of programming languages, cryptography, p2p, web programming / UI in OCaml, SAT / SMT, linear and integer programming, formal verification, stochastic processes, computer algebra or numerical optimization. Highly competitive salaries. If you are interested, please send your CV (resumé) to careers at tezos.com Best, Ryan -------------- next part -------------- An HTML attachment was scrubbed... URL: From shin1aok at gmail.com Tue May 22 15:50:01 2018 From: shin1aok at gmail.com (Shinichi Higashino) Date: Wed, 23 May 2018 00:50:01 +0900 Subject: [Haskell-cafe] Question of defining Type Class Message-ID: <5142BEBD-B803-4AB4-9DC8-536BC2A89834@gmail.com> I am confusing since I am trying to define Abstract sense of Matrix; class Mat - is a more abstract concept since 1x1 Matrix is isomorphic to Num - is a more abstract concept since 1xn Matrix is isomorphic to Vector So, class Mat a => Num a where … class Mat a => Vec a where … should be . However, I know that the Initial object of Ring Category is Integer . So, I should start with Z and then I should define class ( Module R on Z ) But I could not find that kind of definition in Haskell. Is it Data.Ring ? I am so confusing now… Please help me if you are drinking some tea just now! From shin1aok at gmail.com Tue May 22 15:58:21 2018 From: shin1aok at gmail.com (Shinichi Higashino) Date: Wed, 23 May 2018 00:58:21 +0900 Subject: [Haskell-cafe] Question of defining Type Class In-Reply-To: <5142BEBD-B803-4AB4-9DC8-536BC2A89834@gmail.com> References: <5142BEBD-B803-4AB4-9DC8-536BC2A89834@gmail.com> Message-ID: <211F497F-B376-49AC-8C5E-ECE936CAA483@gmail.com> Sorry, I found it. > On May 23, 2018, at 0:50, Shinichi Higashino wrote: > > I am confusing since I am trying to define > Abstract sense of Matrix; > > class Mat > > - is a more abstract concept since 1x1 Matrix is isomorphic to Num > - is a more abstract concept since 1xn Matrix is isomorphic to Vector > > So, > > class Mat a => Num a where … > class Mat a => Vec a where … > > should be . > > However, I know that the Initial object of Ring Category is Integer . > So, I should start with Z and then I should define > > class ( Module R on Z ) > > But I could not find that kind of definition in Haskell. > Is it Data.Ring ? > > I am so confusing now… > Please help me if you are drinking some tea just now! From dennis.raddle at gmail.com Wed May 23 09:51:04 2018 From: dennis.raddle at gmail.com (Dennis Raddle) Date: Wed, 23 May 2018 02:51:04 -0700 Subject: [Haskell-cafe] haskell in the cloud Message-ID: I have a CPU-intensive Haskell application. I have it working with simple multi-core concurrency. I'm wondering if I can run this on a cloud virtual machine with 128 cores or so, paying by the CPU minute. I'll run it for maybe 15 minutes a day so I'm probably best off paying just for the CPU used. What platform would be recommended? For ease of use? For best price/performance? It's a backtracking optimization algorithm that builds data, one element at a time. It's not hard at all to make it concurrent: at the first 3 or so levels of element choices would be about 100 to 500 combinations. Even if the simplest method of running concurrent Haskell on multiple cores doesn't work, I could just divide these first cases into batches and run them on individual machines. D -------------- next part -------------- An HTML attachment was scrubbed... URL: From johndreaver at gmail.com Wed May 23 20:24:53 2018 From: johndreaver at gmail.com (David Reaver) Date: Wed, 23 May 2018 13:24:53 -0700 Subject: [Haskell-cafe] haskell in the cloud In-Reply-To: References: Message-ID: Amazon Web Services has a x1.32xlarge EC2 instance with 128 CPU cores and just under 2000 GiB of RAM for about $13 per hour. AWS actually has per-second billing (with a 1 minute minimum) since late last year. They have lots of other options as well of course. Here is their pricing page: https://aws.amazon.com/ec2/pricing/on-demand/ On Wed, May 23, 2018 at 2:51 AM, Dennis Raddle wrote: > I have a CPU-intensive Haskell application. I have it working with simple > multi-core concurrency. I'm wondering if I can run this on a cloud virtual > machine with 128 cores or so, paying by the CPU minute. I'll run it for > maybe 15 minutes a day so I'm probably best off paying just for the CPU > used. > > What platform would be recommended? For ease of use? For best > price/performance? > > It's a backtracking optimization algorithm that builds data, one element > at a time. It's not hard at all to make it concurrent: at the first 3 or so > levels of element choices would be about 100 to 500 combinations. Even if > the simplest method of running concurrent Haskell on multiple cores doesn't > work, I could just divide these first cases into batches and run them on > individual machines. > > D > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view 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 neil_mayhew at users.sourceforge.net Wed May 23 21:24:07 2018 From: neil_mayhew at users.sourceforge.net (Neil Mayhew) Date: Wed, 23 May 2018 15:24:07 -0600 Subject: [Haskell-cafe] haskell in the cloud In-Reply-To: References: Message-ID: <99467ec9-a06e-b46b-f970-270e2b04ce75@users.sourceforge.net> On 2018-05-23 02:24 PM, David Reaver wrote: > Even if the simplest method of running concurrent Haskell on multiple > cores doesn't work, I could just divide these first cases into batches > and run them on individual machines. You might find it's cheaper to use several low-end machines than one very high-end machine. You probably pay a premium for being able to run algorithms that require it all to be on one machine. -------------- next part -------------- An HTML attachment was scrubbed... URL: From alex at xn--wxa.email Wed May 23 21:26:00 2018 From: alex at xn--wxa.email (Alexandre Peyroux) Date: Wed, 23 May 2018 23:26:00 +0200 Subject: [Haskell-cafe] haskell in the cloud In-Reply-To: References: Message-ID: Hello, you can try https://www.scaleway.com/pricing/#anchor_pro Regards Le mer. 23 mai 2018 à 22:25, David Reaver a écrit : > Amazon Web Services has a x1.32xlarge EC2 instance with 128 CPU cores and > just under 2000 GiB of RAM for about $13 per hour. AWS actually has > per-second billing (with a 1 minute minimum) since late last year. > > They have lots of other options as well of course. Here is their pricing > page: https://aws.amazon.com/ec2/pricing/on-demand/ > > On Wed, May 23, 2018 at 2:51 AM, Dennis Raddle > wrote: > >> I have a CPU-intensive Haskell application. I have it working with simple >> multi-core concurrency. I'm wondering if I can run this on a cloud virtual >> machine with 128 cores or so, paying by the CPU minute. I'll run it for >> maybe 15 minutes a day so I'm probably best off paying just for the CPU >> used. >> >> What platform would be recommended? For ease of use? For best >> price/performance? >> >> It's a backtracking optimization algorithm that builds data, one element >> at a time. It's not hard at all to make it concurrent: at the first 3 or so >> levels of element choices would be about 100 to 500 combinations. Even if >> the simplest method of running concurrent Haskell on multiple cores doesn't >> work, I could just divide these first cases into batches and run them on >> individual machines. >> >> D >> >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view 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 dennis.raddle at gmail.com Wed May 23 21:59:27 2018 From: dennis.raddle at gmail.com (Dennis Raddle) Date: Wed, 23 May 2018 14:59:27 -0700 Subject: [Haskell-cafe] haskell in the cloud In-Reply-To: References: Message-ID: Thanks, everyone. Billing by the second is good. Billing by the hour is not going to work (that seems to be the Scaleway model). When I asked this question a while back, I was told that there is a cloud service specifically for Haskell programs. Just wondering if that might be a good fit for me. I probably would benefit the most by running on multiple machines. I'd like to have them coordinate with each other... i.e. one main controller program will initiate and run other programs for a few seconds, then collect the results and start another run. What's the simplest Haskell library to get this going? Cloud Haskell? D On Wed, May 23, 2018 at 1:24 PM, David Reaver wrote: > Amazon Web Services has a x1.32xlarge EC2 instance with 128 CPU cores and > just under 2000 GiB of RAM for about $13 per hour. AWS actually has > per-second billing (with a 1 minute minimum) since late last year. > > They have lots of other options as well of course. Here is their pricing > page: https://aws.amazon.com/ec2/pricing/on-demand/ > > On Wed, May 23, 2018 at 2:51 AM, Dennis Raddle > wrote: > >> I have a CPU-intensive Haskell application. I have it working with simple >> multi-core concurrency. I'm wondering if I can run this on a cloud virtual >> machine with 128 cores or so, paying by the CPU minute. I'll run it for >> maybe 15 minutes a day so I'm probably best off paying just for the CPU >> used. >> >> What platform would be recommended? For ease of use? For best >> price/performance? >> >> It's a backtracking optimization algorithm that builds data, one element >> at a time. It's not hard at all to make it concurrent: at the first 3 or so >> levels of element choices would be about 100 to 500 combinations. Even if >> the simplest method of running concurrent Haskell on multiple cores doesn't >> work, I could just divide these first cases into batches and run them on >> individual machines. >> >> D >> >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view 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 Wed May 23 22:09:47 2018 From: qdunkan at gmail.com (Evan Laforge) Date: Wed, 23 May 2018 15:09:47 -0700 Subject: [Haskell-cafe] how do cabal internal libraries work? Message-ID: The example at https://www.haskell.org/cabal/users-guide/developing-packages.html#library doesn't seem to work as I expect. The doc for the library field is out of date, but if you scroll down it mentions "internal libraries". But depending on the internal library doesn't seem to have any effect, in that cabal still complains I didn't mention Foo.Internal, and doesn't see the build-depends from it. Am I misinterpreting how the feature is supposed to work? This is with Cabal 2.2.0.1 and cabal-install 2.2.0.0, ghc 8.4.1: % cat testing.cabal name: foo version: 1.0 license: BSD3 cabal-version: >= 1.23 build-type: Simple library foo-internal exposed-modules: Foo.Internal build-depends: base, text library exposed-modules: Foo.Public build-depends: foo-internal, base % cat Foo/Internal.hs module Foo.Internal where import Data.Text % cat Foo/Public.hs module Foo.Public where import Foo.Internal % cabal build Resolving dependencies... Configuring foo-1.0... Warning: Packages using 'cabal-version: >= 1.10' must specify the 'default-language' field for each component (e.g. Haskell98 or Haskell2010). If a component uses different languages in different modules then list the other ones in the 'other-languages' field. Preprocessing library 'foo-internal' for foo-1.0.. Building library 'foo-internal' for foo-1.0.. [1 of 1] Compiling Foo.Internal ( Foo/Internal.hs, dist/build/foo-internal/Foo/Internal.o ) [1 of 1] Compiling Foo.Internal ( Foo/Internal.hs, dist/build/foo-internal/Foo/Internal.p_o ) Preprocessing library for foo-1.0.. Building library for foo-1.0.. : warning: [-Wmissing-home-modules] These modules are needed for compilation but not listed in your .cabal file's other-modules: Foo.Internal [1 of 2] Compiling Foo.Internal ( Foo/Internal.hs, dist/build/Foo/Internal.o ) Foo/Internal.hs:2:1: error: Could not find module ‘Data.Text’ Use -v to see a list of the files searched for. | 2 | import Data.Text | ^^^^^^^^^^^^^^^^ -------------- next part -------------- An HTML attachment was scrubbed... URL: From dymanic at gmail.com Wed May 23 22:14:51 2018 From: dymanic at gmail.com (Johann Gonzalez) Date: Wed, 23 May 2018 18:14:51 -0400 Subject: [Haskell-cafe] haskell in the cloud In-Reply-To: References: Message-ID: Hello!, You could also try Google Cloud's n1-ultramem-160 [1] , with 160 vcpus and 3800GB RAM. As you can only need to run it for a short time it can be a preemptible instance that goes for $5.3 per hour, with per second billing[2] [1]https://cloud.google.com/compute/pricing#megamem [2]https://cloud.google.com/compute/pricing#machinetype On Wed, May 23, 2018 at 5:59 PM, Dennis Raddle wrote: > Thanks, everyone. > > Billing by the second is good. Billing by the hour is not going to work > (that seems to be the Scaleway model). > > When I asked this question a while back, I was told that there is a cloud > service specifically for Haskell programs. Just wondering if that might be > a good fit for me. > > I probably would benefit the most by running on multiple machines. I'd > like to have them coordinate with each other... i.e. one main controller > program will initiate and run other programs for a few seconds, then > collect the results and start another run. > > What's the simplest Haskell library to get this going? Cloud Haskell? > > D > > > > On Wed, May 23, 2018 at 1:24 PM, David Reaver > wrote: > >> Amazon Web Services has a x1.32xlarge EC2 instance with 128 CPU cores and >> just under 2000 GiB of RAM for about $13 per hour. AWS actually has >> per-second billing (with a 1 minute minimum) since late last year. >> >> They have lots of other options as well of course. Here is their pricing >> page: https://aws.amazon.com/ec2/pricing/on-demand/ >> >> On Wed, May 23, 2018 at 2:51 AM, Dennis Raddle >> wrote: >> >>> I have a CPU-intensive Haskell application. I have it working with >>> simple multi-core concurrency. I'm wondering if I can run this on a cloud >>> virtual machine with 128 cores or so, paying by the CPU minute. I'll run it >>> for maybe 15 minutes a day so I'm probably best off paying just for the CPU >>> used. >>> >>> What platform would be recommended? For ease of use? For best >>> price/performance? >>> >>> It's a backtracking optimization algorithm that builds data, one element >>> at a time. It's not hard at all to make it concurrent: at the first 3 or so >>> levels of element choices would be about 100 to 500 combinations. Even if >>> the simplest method of running concurrent Haskell on multiple cores doesn't >>> work, I could just divide these first cases into batches and run them on >>> individual machines. >>> >>> D >>> >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> To (un)subscribe, modify options or view 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. > -- Johan Gonzalez Devops/IT Manager -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben.kolera at gmail.com Wed May 23 22:34:12 2018 From: ben.kolera at gmail.com (Ben Kolera) Date: Thu, 24 May 2018 08:34:12 +1000 Subject: [Haskell-cafe] how do cabal internal libraries work? In-Reply-To: References: Message-ID: Do you get the same error if you give each library a different hs-source-dir ? I don't know the actual reason, but I would guess that maybe something funny is happening with all of the modules being in the same folder. Just a guess which is probably wrong! Hope it helps! :) On Thu, 24 May 2018, 08:10 Evan Laforge, wrote: > The example at > https://www.haskell.org/cabal/users-guide/developing-packages.html#library > doesn't seem to work as I expect. The doc for the library field is out of > date, but if you scroll down it mentions "internal libraries". But > depending on the internal library doesn't seem to have any effect, in that > cabal still complains I didn't mention Foo.Internal, and doesn't see the > build-depends from it. Am I misinterpreting how the feature is supposed to > work? > > This is with Cabal 2.2.0.1 and cabal-install 2.2.0.0, ghc 8.4.1: > > % cat testing.cabal > name: foo > version: 1.0 > license: BSD3 > cabal-version: >= 1.23 > build-type: Simple > > library foo-internal > exposed-modules: Foo.Internal > build-depends: base, text > > library > exposed-modules: Foo.Public > build-depends: foo-internal, base > > % cat Foo/Internal.hs > module Foo.Internal where > import Data.Text > > % cat Foo/Public.hs > module Foo.Public where > import Foo.Internal > > % cabal build > Resolving dependencies... > Configuring foo-1.0... > Warning: Packages using 'cabal-version: >= 1.10' must specify the > 'default-language' field for each component (e.g. Haskell98 or > Haskell2010). > If a component uses different languages in different modules then list the > other ones in the 'other-languages' field. > Preprocessing library 'foo-internal' for foo-1.0.. > Building library 'foo-internal' for foo-1.0.. > [1 of 1] Compiling Foo.Internal ( Foo/Internal.hs, > dist/build/foo-internal/Foo/Internal.o ) > [1 of 1] Compiling Foo.Internal ( Foo/Internal.hs, > dist/build/foo-internal/Foo/Internal.p_o ) > Preprocessing library for foo-1.0.. > Building library for foo-1.0.. > > : warning: [-Wmissing-home-modules] > These modules are needed for compilation but not listed in your .cabal > file's other-modules: Foo.Internal > [1 of 2] Compiling Foo.Internal ( Foo/Internal.hs, > dist/build/Foo/Internal.o ) > > Foo/Internal.hs:2:1: error: > Could not find module ‘Data.Text’ > Use -v to see a list of the files searched for. > | > 2 | import Data.Text > | ^^^^^^^^^^^^^^^^ > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From oleg.grenrus at iki.fi Wed May 23 22:50:01 2018 From: oleg.grenrus at iki.fi (Oleg Grenrus) Date: Thu, 24 May 2018 01:50:01 +0300 Subject: [Haskell-cafe] how do cabal internal libraries work? In-Reply-To: References: Message-ID: Hi Evan, the cure to your problem is to put source files of different components into different directories. i.e. testing.cabal: library foo-internal     hs-source-dirs: internal     exposed-modules: Foo.Internal     build-depends: base, text library     hs-source-dirs: public     exposed-modules: Foo.Public     build-depends: foo-internal, base and file layout: public/Foo/Public.hs internal/Foo/Internal.hs Even Cabal tells GHC that "Foo.Public" is the only module it need to compile, GHC "discovers" ./Foo/Internal.hs and happily uses it. There are other similar interactions because of that implicitness, I'd advice to avoid having current directory "." (the default) in the hs-source-dirs. Hopefully this helps, P.S. try "cabal check", it will tell you (among possible other things), that to use internal libraries you need to specify "cabal-version: 2.0", and there's actually an open ticket to add a check for you exact problem (if components depend on each other *and* share a hs-source-dirs, it's a bad idea - you will end up recompiling modules). On 24.05.2018 01:09, Evan Laforge wrote: > The example at > https://www.haskell.org/cabal/users-guide/developing-packages.html#library > doesn't seem to work as I expect.  The doc for the library field is > out of date, but if you scroll down it mentions "internal libraries".  > But depending on the internal library doesn't seem to have any effect, > in that cabal still complains I didn't mention Foo.Internal, and > doesn't see the build-depends from it.  Am I misinterpreting how the > feature is supposed to work? > > This is with Cabal 2.2.0.1 and cabal-install 2.2.0.0, ghc 8.4.1: > > % cat testing.cabal > name:           foo > version:        1.0 > license:        BSD3 > cabal-version:  >= 1.23 > build-type:     Simple > > library foo-internal >     exposed-modules: Foo.Internal >     build-depends: base, text > > library >     exposed-modules: Foo.Public >     build-depends: foo-internal, base > > % cat Foo/Internal.hs > module Foo.Internal where > import Data.Text > > % cat Foo/Public.hs > module Foo.Public where > import Foo.Internal > > % cabal build > Resolving dependencies... > Configuring foo-1.0... > Warning: Packages using 'cabal-version: >= 1.10' must specify the > 'default-language' field for each component (e.g. Haskell98 or > Haskell2010). > If a component uses different languages in different modules then list the > other ones in the 'other-languages' field. > Preprocessing library 'foo-internal' for foo-1.0.. > Building library 'foo-internal' for foo-1.0.. > [1 of 1] Compiling Foo.Internal     ( Foo/Internal.hs, > dist/build/foo-internal/Foo/Internal.o ) > [1 of 1] Compiling Foo.Internal     ( Foo/Internal.hs, > dist/build/foo-internal/Foo/Internal.p_o ) > Preprocessing library for foo-1.0.. > Building library for foo-1.0.. > > : warning: [-Wmissing-home-modules] >     These modules are needed for compilation but not listed in your > .cabal file's other-modules: Foo.Internal > [1 of 2] Compiling Foo.Internal     ( Foo/Internal.hs, > dist/build/Foo/Internal.o ) > > Foo/Internal.hs:2:1: error: >     Could not find module ‘Data.Text’ >     Use -v to see a list of the files searched for. >   | > 2 | import Data.Text >   | ^^^^^^^^^^^^^^^^ > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view 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: 833 bytes Desc: OpenPGP digital signature URL: From oleg.grenrus at iki.fi Wed May 23 23:04:45 2018 From: oleg.grenrus at iki.fi (Oleg Grenrus) Date: Thu, 24 May 2018 02:04:45 +0300 Subject: [Haskell-cafe] profunctorial vs vanlaarhoven lenses In-Reply-To: References: <20180502161012.gdbocvz7uipfmvdo@weber> <20180502164357.kjjg74bg26fv7wh5@weber> Message-ID: <1b59b888-701d-e53d-0c15-1e7bba659e67@iki.fi> Hi Paolino, sorry for not replying promptly. Your type Q6 is Bitraversable which is in already in the base library (actually Triversable, if there were such class), should GHC be able to derive it? What else GHC should be able to derive? To my understanding (unfortunately I forgot the details), is that we'd would like to be able to teach GHC to derive instances from libraries, so we don't end up wiring special code for all instances out there. Also we'd might want different strategies for some type-classes (Bi/Traversable instances are unique, so that concern doesn't apply here). There's a GHC ticket for it [1], there are technical difficulties to overcome (and there is TH, more below), so there weren't much progress. That said, for Bitraversable, you could use `Data.Bifunctor.TH` [2], then you can use `bitraverse f pure` (sans wrapping/unwrapping) for Q6 to implement `traverse f` of Q6b. - Oleg [1]: https://ghc.haskell.org/trac/ghc/ticket/12457 [2]: http://hackage.haskell.org/package/bifunctors-5.5.2/docs/Data-Bifunctor-TH.html On 03.05.2018 15:54, Paolino wrote: > Hi Oleg, > > How easy should it be to "create a Traversable newtype over your type" ? > > data Q6 a b c = Q61 a (Identity b) | Q62 [b] | Q63 c > > newtype Q6b a c b = Q61b (Q6 a b c) > > I cannot automatically derive anything for Q6b (Functor, Foldable, > Traversable).  > So we are back to hand writing lenses for Q6, or I miss something ? > > For the rest, it was a very nice followup, I'm still rereading.  > > Thanks > > Best > > .p > > > > > 2018-05-02 23:06 GMT+02:00 Oleg Grenrus >: > > Here's a little gist I wrote. > > See > https://gist.github.com/phadej/04aae6cb98840ef9eeb592b76e6f3a67 > > for syntax highlighted versions. > > Hopefully it gives you some insights! > > \begin{code} > {-# LANGUAGE RankNTypes, DeriveFunctor, DeriveFoldable, > DeriveTraversable, TupleSections #-} > import Data.Functor.Identity > import Data.Profunctor > import Data.Profunctor.Traversing > import Data.Traversable > import Data.Tuple (swap) > > data Q5 a b = Q51 a (Identity b) | Q52 [b] > > lq5Twan :: Applicative f => (b -> f b') -> Q5 a b -> f (Q5 a b') > lq5Twan f (Q51 a bs) = Q51 a <$> traverse f bs > lq5Twan f (Q52 bs) = Q52 <$> traverse f bs > > data BT tt tt' b t t' a = BT1 (tt -> b) (t a) | BT2 (tt' -> b) (t' a) > deriving (Functor,Foldable,Traversable) > runBT (BT1 f x) = f x > runBT (BT2 f x) = f x > > lq5Profunctor :: forall p a b b' . Traversing p => p b b' -> p (Q5 > a b) > (Q5 a b') > lq5Profunctor = dimap pre post . second' . traverse' where >   pre (Q51 a x) = ((), BT1 (Q51 a) x) >   pre (Q52 bs) = ((), BT2 Q52 bs) >   post ((),x) = runBT x > \end{code} > > \begin{code} > instance Functor (Q5 a) where fmap = fmapDefault > instance Foldable (Q5 a) where foldMap = foldMapDefault > instance Traversable (Q5 a) where >     traverse f (Q51 a bs) = Q51 a <$> traverse f bs >     traverse f (Q52 bs) = Q52 <$> traverse f bs > > lq5Twan' :: Applicative f => (b -> f b') -> Q5 a b -> f (Q5 a b') > lq5Twan' = traverse > > lq5Profunctor' :: forall p a b b' . Traversing p => p b b' -> p > (Q5 a b) > (Q5 a b') > lq5Profunctor' = traverse' > \end{code} > > And in general: three steps: > > 1. create a Traversable newtype over your type > 2. dimap pre post . traverse' > 3. Profit! > > Compare that to writing Lens > > 1. bijection your 's' to (a, r) (Note: 'r' can be 's'!) > 2. dimap to from . first' > 3. Profit! > > Trivial examples: > > \begin{code} > type Lens s t a b = forall p. Strong p => p a b -> p s t > > _1 :: Lens (a, c) (b, c) a b > _1 = dimap id id . first' > > _2 :: Lens (c, a) (c, b) a b > _2 = dimap swap swap . first' > \end{code} > > Note again, that in usual `lens` definition we pick r to be s: > we "carry over" the whole "s", though "s - a = r" would be enough. > But in practice constructing "residual" is expensive. > Think about record with 10 fields: residual in a single field lens > would be 9-tuple - not really worth it. > > Interlude, one can define Traversal over first argument too. > Using Bitraversable class that would be direct. > > In this case it's Affine (Traversal), so we can do "better" than using > `traverse'`. > > \begin{code} > lq5ProFirst :: forall p a a' b. (Choice p, Strong p) => p a a' -> > p (Q5 > a b) (Q5 a' b) > lq5ProFirst = dimap f g . right' . first' where >     -- Think why we have chosen [b] + a * b >     -- compare to definition of Q5! >     -- >     -- The r + r' * s shape justifies the name Affine, btw. >     f :: Q5 a b -> Either [b] (a, Identity b) >     f (Q51 a x) = Right (a, x) >     f (Q52 bs)  = Left bs > >     g (Left bs) = Q52 bs >     g (Right (a, x)) = Q51 a x > \end{code} > > Note: how the same > > 1. bijection to some structure (`r' + r * a` in this case > 2. dimap to from . ... > 3. Profit > > pattern is applied again. > > Another way to think about it is that we > > 1. Use `Iso` (for all Profunctor!) to massage value into the form, so > 2. we can use "Optic specific" transform > 3. Profit! > > And optic specific: > - Lens -> Products > - Prism -> Coproducts (Sums) > - Traversal -> Traversable > - Setter -> Functor (Mapping type class has map' :: Functor f => p a b > -> p (f a) (f b)) > - etc. > > So the fact that defining arbitrary Traversals directly is more > handy with > `wander`, than `traverse'` (as you can omit `dimap`!) is more > related to the > fact that we have > > \begin{spec} > class Traversable t where >     traverse :: Applicative f => (a -> f b) -> t a -> f (t b) > \end{spec} > > ... and we (well, me) don't yet know another elegant way to > capture "the > essense of Traversable". (I don't think FunList is particularly > "elegant") > > > Sidenote: we can define Lens using Traversing/Mapping -like class too, > hopefully it gives you another viewpoint too. > > \begin{code} > class Functor t => Singular t where >     single :: Functor f => (a -> f b) -> t a -> f (t b) > > fmapSingle :: Singular t => (a -> b) -> t a -> t b > fmapSingle ab ta = runIdentity (single (Identity . ab) ta) > > instance Singular Identity where >     single f (Identity a) = Identity <$> f a > > instance Singular ((,) a) where >     single f (a, b) = (a,) <$> f b > > class Profunctor p => Strong' p where >     single' :: Singular f => p a b -> p (f a) (f b) > > instance Strong' (->) where >     single' ab = fmap ab > > instance Functor f => Strong' (Star f) where >     single' (Star afb) = Star (single afb) > > -- lens using Strong' & Single: 1. 2. 3. > lens' :: Strong' p => (s -> a) -> (s -> b -> t) -> p a b -> p s t > lens' sa sbt = dimap (\s -> (s, sa s)) (\(s,b) -> sbt s b) . single' > \end{code} > > Cheers, Oleg > > > On 02.05.2018 20:09, Paolino wrote: > > I'm not using any lens libraries, I'm writing both encodings from > > scratch based on standard libs, as a learning path. > > I see anyway that Traversing class is declaring exactly the Twan -> > > Profunctor promotion (given the Applicative on f)  which looks a > lot  > > like a white flag on the "write traversal as profunctor" research. > > Actually I was induced from purescript to think that the > profunctorial > > encoding was completely alternative to the twan, but I had no > evidence > > of the fact, so I should better dig into purescript library. > > > > .p > > > > 2018-05-02 18:43 GMT+02:00 Tom Ellis > > > > >>: > > > >     I'm not sure what you mean.  If you want to write a profunctor > >     traversal > >     then `wander lq5Twan` seems fine.  If you want to understand why > >     it's hard > >     to directly write profunctor traversals then I'm afraid I'm as > >     puzzled as > >     you. > > > >     On Wed, May 02, 2018 at 06:29:09PM +0200, Paolino wrote: > >     > Well, I can accept it as an evidence of why  not to use the > >     profunctor > >     > encoding for multi target lens (if that's the name). > >     > But I guess we are already in philosophy (so I'm more puzzled > >     than before) > >     > and I hope you can elaborate more. > >     > > >     > .p > >     > > >     > > >     > 2018-05-02 18:10 GMT+02:00 Tom Ellis < > >     > tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk > > >      >>: > >     > > >     > > On Wed, May 02, 2018 at 03:07:05PM +0200, Paolino wrote: > >     > > > I'm trying to write a lens for a datatype which seems easy > >     in the Twan > >     > > van > >     > > > Laarhoven encoding but I cannot find it as easy in the > >     profunctorial one > >     > > > > >     > > > data Q5 a b = Q51 a (Identity b) | Q52 [b] > >     > > > > >     > > > lq5Twan :: Applicative f => (b -> f b') -> Q5 a b -> f > (Q5 a b') > >     > > > lq5Twan f (Q51 a bs) = Q51 a <$> traverse f bs > >     > > > lq5Twan f (Q52 bs) = Q52 <$> traverse f bs > >     > > [...] > >     > > > lq5Profunctor :: forall p a b b' . Traversing p => p b > b' -> > >     p (Q5 a > >     > > > b) (Q5 a b') > >     > > [...] > >     > > > Which simpler ways to write the lq5Profunctor we have ? > >     > > > >     > > Is `wander lq5Twan` good enough, or is your question more > >     philosophical? > > > >     _______________________________________________ > >     Haskell-Cafe mailing list > >     To (un)subscribe, modify options or view 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 -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: OpenPGP digital signature URL: From qdunkan at gmail.com Thu May 24 03:10:55 2018 From: qdunkan at gmail.com (Evan Laforge) Date: Wed, 23 May 2018 20:10:55 -0700 Subject: [Haskell-cafe] how do cabal internal libraries work? In-Reply-To: References: Message-ID: On Wed, May 23, 2018 at 3:50 PM, Oleg Grenrus wrote: > Hi Evan, > > the cure to your problem is to put source files of different components > into different directories. i.e. Yes, that's exactly it! Thanks for the explanation. > Even Cabal tells GHC that "Foo.Public" is the only module it need to > compile, GHC "discovers" ./Foo/Internal.hs and happily uses it. > There are other similar interactions because of that implicitness, I'd > advice to avoid having current directory "." (the default) in the > hs-source-dirs. Indeed, though it's an awkward and surprising limitation, to me at least. I would think ghc would be looking for dist/build/library/Foo/Internal.hi, and not find it. I assume it has to do with ghc --make is sort of a build system, and cabal is sort of a build system, and they sort of cooperate with each other :) From dennis.raddle at gmail.com Thu May 24 03:20:58 2018 From: dennis.raddle at gmail.com (Dennis Raddle) Date: Wed, 23 May 2018 20:20:58 -0700 Subject: [Haskell-cafe] haskell in the cloud In-Reply-To: References: Message-ID: I notice that Amazon calls that "virtual CPUs" not "CPU cores".. is that the same as cores? I.e. will standard multi-core Haskell concurrency methods work? Anyone know? Mike On Wed, May 23, 2018 at 3:14 PM, Johann Gonzalez wrote: > Hello!, > > You could also try Google Cloud's n1-ultramem-160 [1] , with 160 vcpus and > 3800GB RAM. > As you can only need to run it for a short time it can be a preemptible > instance that goes for $5.3 per hour, with per second billing[2] > > [1]https://cloud.google.com/compute/pricing#megamem > [2]https://cloud.google.com/compute/pricing#machinetype > > On Wed, May 23, 2018 at 5:59 PM, Dennis Raddle > wrote: > >> Thanks, everyone. >> >> Billing by the second is good. Billing by the hour is not going to work >> (that seems to be the Scaleway model). >> >> When I asked this question a while back, I was told that there is a cloud >> service specifically for Haskell programs. Just wondering if that might be >> a good fit for me. >> >> I probably would benefit the most by running on multiple machines. I'd >> like to have them coordinate with each other... i.e. one main controller >> program will initiate and run other programs for a few seconds, then >> collect the results and start another run. >> >> What's the simplest Haskell library to get this going? Cloud Haskell? >> >> D >> >> >> >> On Wed, May 23, 2018 at 1:24 PM, David Reaver >> wrote: >> >>> Amazon Web Services has a x1.32xlarge EC2 instance with 128 CPU cores >>> and just under 2000 GiB of RAM for about $13 per hour. AWS actually has >>> per-second billing (with a 1 minute minimum) since late last year. >>> >>> They have lots of other options as well of course. Here is their pricing >>> page: https://aws.amazon.com/ec2/pricing/on-demand/ >>> >>> On Wed, May 23, 2018 at 2:51 AM, Dennis Raddle >>> wrote: >>> >>>> I have a CPU-intensive Haskell application. I have it working with >>>> simple multi-core concurrency. I'm wondering if I can run this on a cloud >>>> virtual machine with 128 cores or so, paying by the CPU minute. I'll run it >>>> for maybe 15 minutes a day so I'm probably best off paying just for the CPU >>>> used. >>>> >>>> What platform would be recommended? For ease of use? For best >>>> price/performance? >>>> >>>> It's a backtracking optimization algorithm that builds data, one >>>> element at a time. It's not hard at all to make it concurrent: at the first >>>> 3 or so levels of element choices would be about 100 to 500 combinations. >>>> Even if the simplest method of running concurrent Haskell on multiple cores >>>> doesn't work, I could just divide these first cases into batches and run >>>> them on individual machines. >>>> >>>> D >>>> >>>> _______________________________________________ >>>> Haskell-Cafe mailing list >>>> To (un)subscribe, modify options or view 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. >> > > > > -- > Johan Gonzalez > Devops/IT Manager > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From alexander.kjeldaas at gmail.com Thu May 24 06:44:10 2018 From: alexander.kjeldaas at gmail.com (Alexander Kjeldaas) Date: Thu, 24 May 2018 08:44:10 +0200 Subject: [Haskell-cafe] haskell in the cloud In-Reply-To: References: Message-ID: On Wed, May 23, 2018 at 11:59 PM, Dennis Raddle wrote: > Thanks, everyone. > > Billing by the second is good. Billing by the hour is not going to work > (that seems to be the Scaleway model). > You pay a significant premium for the per second billing. The price-efficient EC2 server is going to be c5.18xlarge Those are $0.048 / (core*hour). Compare that to Hetzner Cloud cores, also Skylake, which clocks in at $0.0073 / (core*hour). When you factor in server setup time of 1-3 minutes, then you can only use your "ultra-cheap" EC2 machine for a few minutes before it would be cheaper to rent the Hetzner server for an hour! Alexander > > When I asked this question a while back, I was told that there is a cloud > service specifically for Haskell programs. Just wondering if that might be > a good fit for me. > > I probably would benefit the most by running on multiple machines. I'd > like to have them coordinate with each other... i.e. one main controller > program will initiate and run other programs for a few seconds, then > collect the results and start another run. > > What's the simplest Haskell library to get this going? Cloud Haskell? > > > D > > > > On Wed, May 23, 2018 at 1:24 PM, David Reaver > wrote: > >> Amazon Web Services has a x1.32xlarge EC2 instance with 128 CPU cores and >> just under 2000 GiB of RAM for about $13 per hour. AWS actually has >> per-second billing (with a 1 minute minimum) since late last year. >> >> They have lots of other options as well of course. Here is their pricing >> page: https://aws.amazon.com/ec2/pricing/on-demand/ >> >> On Wed, May 23, 2018 at 2:51 AM, Dennis Raddle >> wrote: >> >>> I have a CPU-intensive Haskell application. I have it working with >>> simple multi-core concurrency. I'm wondering if I can run this on a cloud >>> virtual machine with 128 cores or so, paying by the CPU minute. I'll run it >>> for maybe 15 minutes a day so I'm probably best off paying just for the CPU >>> used. >>> >>> What platform would be recommended? For ease of use? For best >>> price/performance? >>> >>> It's a backtracking optimization algorithm that builds data, one element >>> at a time. It's not hard at all to make it concurrent: at the first 3 or so >>> levels of element choices would be about 100 to 500 combinations. Even if >>> the simplest method of running concurrent Haskell on multiple cores doesn't >>> work, I could just divide these first cases into batches and run them on >>> individual machines. >>> >>> D >>> >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> To (un)subscribe, modify options or view 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 asm13243546 at gmail.com Thu May 24 07:36:31 2018 From: asm13243546 at gmail.com (Alfred Matthews) Date: Thu, 24 May 2018 03:36:31 -0400 Subject: [Haskell-cafe] haskell in the cloud In-Reply-To: References: Message-ID: Nice. On Thu, 24 May 2018 at 02:45 Alexander Kjeldaas < alexander.kjeldaas at gmail.com> wrote: > On Wed, May 23, 2018 at 11:59 PM, Dennis Raddle > wrote: > >> Thanks, everyone. >> >> Billing by the second is good. Billing by the hour is not going to work >> (that seems to be the Scaleway model). >> > > > You pay a significant premium for the per second billing. The > price-efficient EC2 server is going to be c5.18xlarge > > Those are $0.048 / (core*hour). Compare that to Hetzner Cloud cores, > also Skylake, which clocks in at $0.0073 / (core*hour). > > When you factor in server setup time of 1-3 minutes, then you can only use > your "ultra-cheap" EC2 machine for a few minutes before it would be cheaper > to rent the Hetzner server for an hour! > > Alexander > > > >> >> When I asked this question a while back, I was told that there is a cloud >> service specifically for Haskell programs. Just wondering if that might be >> a good fit for me. >> >> I probably would benefit the most by running on multiple machines. I'd >> like to have them coordinate with each other... i.e. one main controller >> program will initiate and run other programs for a few seconds, then >> collect the results and start another run. >> >> What's the simplest Haskell library to get this going? Cloud Haskell? >> >> > > >> D >> >> >> >> On Wed, May 23, 2018 at 1:24 PM, David Reaver >> wrote: >> >>> Amazon Web Services has a x1.32xlarge EC2 instance with 128 CPU cores >>> and just under 2000 GiB of RAM for about $13 per hour. AWS actually has >>> per-second billing (with a 1 minute minimum) since late last year. >>> >>> They have lots of other options as well of course. Here is their pricing >>> page: https://aws.amazon.com/ec2/pricing/on-demand/ >>> >>> On Wed, May 23, 2018 at 2:51 AM, Dennis Raddle >>> wrote: >>> >>>> I have a CPU-intensive Haskell application. I have it working with >>>> simple multi-core concurrency. I'm wondering if I can run this on a cloud >>>> virtual machine with 128 cores or so, paying by the CPU minute. I'll run it >>>> for maybe 15 minutes a day so I'm probably best off paying just for the CPU >>>> used. >>>> >>>> What platform would be recommended? For ease of use? For best >>>> price/performance? >>>> >>>> It's a backtracking optimization algorithm that builds data, one >>>> element at a time. It's not hard at all to make it concurrent: at the first >>>> 3 or so levels of element choices would be about 100 to 500 combinations. >>>> Even if the simplest method of running concurrent Haskell on multiple cores >>>> doesn't work, I could just divide these first cases into batches and run >>>> them on individual machines. >>>> >>>> D >>>> >>>> _______________________________________________ >>>> Haskell-Cafe mailing list >>>> To (un)subscribe, modify options or view 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. -- Alfred. -------------- next part -------------- An HTML attachment was scrubbed... URL: From richardprideauxevans at gmail.com Thu May 24 16:15:45 2018 From: richardprideauxevans at gmail.com (Richard Evans) Date: Thu, 24 May 2018 17:15:45 +0100 Subject: [Haskell-cafe] Optimizing nearest-k code Message-ID: Dear Haskell Cafe, Given a set of sets, and a particular target set, I want to find the sets that are nearest (in terms of Hamming distance) to the target set. I am using the following code: import Data.List import qualified Data.Set as Set nearest_k :: Ord a => Int -> [(Set.Set a, v)] -> Set.Set a -> [(Set.Set a, v)] nearest_k k bs b = take k bs' where bs' = sortOn (hamming b) bs hamming :: Ord a => Set.Set a -> (Set.Set a, v) -> Int hamming x (y, _) = hamming_distance x y hamming_distance :: Ord a => Set.Set a -> Set.Set a -> Int hamming_distance xs ys = Set.size (Set.difference xs ys) + Set.size (Set.difference ys xs) subsets :: [a] -> [[a]] subsets [] = [[]] subsets (x:xs) = subsets xs ++ map (x:) (subsets xs) int_lists :: [[Int]] int_lists = subsets [1..20] values :: [(Set.Set Int, Int)] values = map f (zip [1..] int_lists) where f (i, x) = (Set.fromList x, i) test = nearest_k 8 values (Set.fromList [1,2,3]) ---- This works ok for the test above (with sets of ints), but is rather slow in my actual application (in which the sets are large sets of ground atoms of first-order logic). Is there some major optimization I should be doing here? thanks, Richard -------------- next part -------------- An HTML attachment was scrubbed... URL: From mwotton at gmail.com Thu May 24 17:36:26 2018 From: mwotton at gmail.com (Mark Wotton) Date: Thu, 24 May 2018 13:36:26 -0400 Subject: [Haskell-cafe] Optimizing nearest-k code In-Reply-To: References: Message-ID: there are a few things you can do. I ran it locally and got 3s cpu time and 3gb of allocation, more or less. first off, your subset implementation computes the subsets twice. taking that off took it down to 2s. After that it's mostly in the Set implementation. Using Map a () instead gives you access to Data.Map.Merge.Strict.merge, which is a bit more efficient (going over the two data structures once only) ``` module Main where import Data.List import Data.Map.Strict (Map) import qualified Data.Map.Merge.Strict as Map import qualified Data.Map.Strict as Map nearest_k :: (Ord a) => Int -> [(Map a (), v)] -> Map a () -> [(Map a (), v)] nearest_k k bs b = take k bs' where bs' = sortOn (hamming b) bs hamming :: (Ord a)=> Map a () -> (Map a (), v) -> Int hamming x (y, _) = hamming_distance x y hamming_distance :: (Ord a)=> Map a () -> Map a () -> Int hamming_distance xs ys = Map.size (Map.merge Map.preserveMissing Map.preserveMissing (Map.zipWithMaybeMatched (\_ _ _ -> Nothing)) xs ys) subsets :: [a] -> [[a]] subsets [] = [[]] subsets (x:xs) = let rs = subsets xs in rs ++ map (x:) rs int_lists :: [[Int]] int_lists = subsets [1..20] values :: [(Map Int (), Int)] values = map f (zip [1..] int_lists) where f (i, x) = (Map.fromList(zip x (repeat ())), i) test = nearest_k 8 values (Map.fromList (zip [1,2,3] (repeat ()))) main = print test ``` that took it to 1s, and now profiling indicates more than half the time is spent in generation of the test values, so I'll leave it there. I think if you wanted to do better than this you'd have to do some algorithmic changes - for instance, once your worst candidate is n steps away, you can stop calculating the hamming distance for anything else once it's > n, as it can't contribute usefully to the nearest neighbours. cheers, Mark On Thu, May 24, 2018 at 12:15 PM, Richard Evans wrote: > Dear Haskell Cafe, > > Given a set of sets, and a particular target set, I want to find the sets > that are nearest (in terms of Hamming distance) to the target set. > > I am using the following code: > > import Data.List > import qualified Data.Set as Set > > nearest_k :: Ord a => Int -> [(Set.Set a, v)] -> Set.Set a -> [(Set.Set a, > v)] > nearest_k k bs b = take k bs' where > bs' = sortOn (hamming b) bs > > hamming :: Ord a => Set.Set a -> (Set.Set a, v) -> Int > hamming x (y, _) = hamming_distance x y > > hamming_distance :: Ord a => Set.Set a -> Set.Set a -> Int > hamming_distance xs ys = Set.size (Set.difference xs ys) + Set.size > (Set.difference ys xs) > > > > subsets :: [a] -> [[a]] > subsets [] = [[]] > subsets (x:xs) = subsets xs ++ map (x:) (subsets xs) > > int_lists :: [[Int]] > int_lists = subsets [1..20] > > values :: [(Set.Set Int, Int)] > values = map f (zip [1..] int_lists) where > f (i, x) = (Set.fromList x, i) > > test = nearest_k 8 values (Set.fromList [1,2,3]) > > ---- > > This works ok for the test above (with sets of ints), but is rather slow in > my actual application (in which the sets are large sets of ground atoms of > first-order logic). Is there some major optimization I should be doing here? > > 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. -- A UNIX signature isn't a return address, it's the ASCII equivalent of a black velvet clown painting. It's a rectangle of carets surrounding a quote from a literary giant of weeniedom like Heinlein or Dr. Who. -- Chris Maeda From richardprideauxevans at gmail.com Thu May 24 18:03:07 2018 From: richardprideauxevans at gmail.com (Richard Evans) Date: Thu, 24 May 2018 19:03:07 +0100 Subject: [Haskell-cafe] Optimizing nearest-k code In-Reply-To: References: Message-ID: Thanks Mark, this is very helpful. On Thu, May 24, 2018 at 6:36 PM, Mark Wotton wrote: > there are a few things you can do. > > I ran it locally and got 3s cpu time and 3gb of allocation, more or less. > > first off, your subset implementation computes the subsets twice. > taking that off took it down to 2s. > > After that it's mostly in the Set implementation. Using Map a () > instead gives you access to Data.Map.Merge.Strict.merge, which is a > bit more efficient (going over the two data structures once only) > > ``` > module Main where > > import Data.List > import Data.Map.Strict (Map) > import qualified Data.Map.Merge.Strict as Map > import qualified Data.Map.Strict as Map > > nearest_k :: (Ord a) => Int -> [(Map a (), v)] -> Map a () -> [(Map a (), > v)] > nearest_k k bs b = take k bs' where > bs' = sortOn (hamming b) bs > > hamming :: (Ord a)=> Map a () -> (Map a (), v) -> Int > hamming x (y, _) = hamming_distance x y > > hamming_distance :: (Ord a)=> Map a () -> Map a () -> Int > hamming_distance xs ys = Map.size (Map.merge Map.preserveMissing > Map.preserveMissing (Map.zipWithMaybeMatched (\_ _ _ -> Nothing)) xs > ys) > > subsets :: [a] -> [[a]] > subsets [] = [[]] > subsets (x:xs) = let rs = subsets xs in rs ++ map (x:) rs > > int_lists :: [[Int]] > int_lists = subsets [1..20] > > values :: [(Map Int (), Int)] > values = map f (zip [1..] int_lists) where > f (i, x) = (Map.fromList(zip x (repeat ())), i) > > test = nearest_k 8 values (Map.fromList (zip [1,2,3] (repeat ()))) > > > main = print test > ``` > > that took it to 1s, and now profiling indicates more than half the > time is spent in generation of the test values, so I'll leave it > there. > > I think if you wanted to do better than this you'd have to do some > algorithmic changes - for instance, once your worst candidate is n > steps away, you can stop calculating the hamming distance for anything > else once it's > n, as it can't contribute usefully to the nearest > neighbours. > > cheers, > Mark > > On Thu, May 24, 2018 at 12:15 PM, Richard Evans > wrote: > > Dear Haskell Cafe, > > > > Given a set of sets, and a particular target set, I want to find the sets > > that are nearest (in terms of Hamming distance) to the target set. > > > > I am using the following code: > > > > import Data.List > > import qualified Data.Set as Set > > > > nearest_k :: Ord a => Int -> [(Set.Set a, v)] -> Set.Set a -> [(Set.Set > a, > > v)] > > nearest_k k bs b = take k bs' where > > bs' = sortOn (hamming b) bs > > > > hamming :: Ord a => Set.Set a -> (Set.Set a, v) -> Int > > hamming x (y, _) = hamming_distance x y > > > > hamming_distance :: Ord a => Set.Set a -> Set.Set a -> Int > > hamming_distance xs ys = Set.size (Set.difference xs ys) + Set.size > > (Set.difference ys xs) > > > > > > > > subsets :: [a] -> [[a]] > > subsets [] = [[]] > > subsets (x:xs) = subsets xs ++ map (x:) (subsets xs) > > > > int_lists :: [[Int]] > > int_lists = subsets [1..20] > > > > values :: [(Set.Set Int, Int)] > > values = map f (zip [1..] int_lists) where > > f (i, x) = (Set.fromList x, i) > > > > test = nearest_k 8 values (Set.fromList [1,2,3]) > > > > ---- > > > > This works ok for the test above (with sets of ints), but is rather slow > in > > my actual application (in which the sets are large sets of ground atoms > of > > first-order logic). Is there some major optimization I should be doing > here? > > > > 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. > > > > -- > A UNIX signature isn't a return address, it's the ASCII equivalent of a > black velvet clown painting. It's a rectangle of carets surrounding a > quote from a literary giant of weeniedom like Heinlein or Dr. Who. > -- Chris Maeda > -------------- next part -------------- An HTML attachment was scrubbed... URL: From olf at aatal-apotheke.de Thu May 24 21:00:41 2018 From: olf at aatal-apotheke.de (Olaf Klinke) Date: Thu, 24 May 2018 23:00:41 +0200 Subject: [Haskell-cafe] Config Files and monoids Message-ID: Dear cafe, a recent post here [1] mentioned that configurations, such as the ones read from a config file, can be given Monoid instances, where mempty is the empty or default configuration and mappend merges two partial configurations, producing a more complete one. The vgrep package explicitly does this, for instance. Although the ConfigParser type from the ConfigFile package has a binary 'merge' operation, it does define neither a Monoid not a Semigroup instance. I'm struggling to make the concept of monoidal configuration work when there is no sensible default configuration. Suppose my configuration type is data Config = Config {foo :: Bool, bar :: Int} with no reasonable default, e.g. emptyConfig = Config { foo = error "you did not specify option foo", bar = error "you did not specify option bar" } Some configuration monoids seem to have the second operand override the first, or the other way around. However, I wish that when cfg1 = emptyConfig {foo = True} cfg2 = emptyConfig {bar = 4} then cfg1 <> cfg2 == Config {foo = True, bar = 4}. So it seems that for mappend to work as intended one needs a terminating function that tells me if a record field is already defined, e.g. when all fields are Maybes. Vgrep.Environment.Config.Monoid does it this way. My solution so far was to resort to the monoid of endofunctions (as the getflag package does), that is, define cfg1, cfg2 :: Config -> Config cfg1 = \cfg -> cfg {foo = True} cfg2 = \cfg -> cfg {bar = 4} And then build (cfg1.cfg2) emptyConfig. (Alternatively, one might structure these as lenses instead of endofunctions, see e.g. Data.Monoid.Endo.Fold in the endo package.) Thus I arrived at class Config cfg where emptyConfig :: cfg -- may contain some defaults configOptions :: [Parser (cfg -> cfg)] Do you think every other concept of configuration parsing can be cast into this typeclass? -- Olaf [1] https://mail.haskell.org/pipermail/haskell-cafe/2018-May/129063.html From parsonsmatt at gmail.com Thu May 24 22:03:30 2018 From: parsonsmatt at gmail.com (Matt) Date: Thu, 24 May 2018 16:03:30 -0600 Subject: [Haskell-cafe] Config Files and monoids In-Reply-To: References: Message-ID: For a "fully general" approach, the problem is well expressed by the "higher kinded data" pattern: http://reasonablypolymorphic.com/blog/higher-kinded-data/ A `Config f = Config { configFoo :: f Foo, ... }` type would use either the First or Last monoids, depending on if you want earlier updates to take precedence over later ones. Then, you would get a `Config First` from your CLI parser, a `Config First` from your environment variable parser, and a `Config First` from your config file parser. After `mappend`ing them all together, you'd use a `gtraverse` function with a signature like: `Config First -> Either [Text] (Config Identity)` -- you'd either have a list of all fields that were missing, or a complete Config. Matt Parsons On Thu, May 24, 2018 at 3:00 PM, Olaf Klinke wrote: > Dear cafe, > > a recent post here [1] mentioned that configurations, such as the ones > read from a config file, can be given Monoid instances, where mempty is the > empty or default configuration and mappend merges two partial > configurations, producing a more complete one. The vgrep package explicitly > does this, for instance. Although the ConfigParser type from the ConfigFile > package has a binary 'merge' operation, it does define neither a Monoid not > a Semigroup instance. > > I'm struggling to make the concept of monoidal configuration work when > there is no sensible default configuration. Suppose my configuration type > is > > data Config = Config {foo :: Bool, bar :: Int} > > with no reasonable default, e.g. > > emptyConfig = Config { > foo = error "you did not specify option foo", > bar = error "you did not specify option bar" > } > > Some configuration monoids seem to have the second operand override the > first, or the other way around. However, I wish that when > cfg1 = emptyConfig {foo = True} > cfg2 = emptyConfig {bar = 4} > then cfg1 <> cfg2 == Config {foo = True, bar = 4}. > > So it seems that for mappend to work as intended one needs a terminating > function that tells me if a record field is already defined, e.g. when all > fields are Maybes. Vgrep.Environment.Config.Monoid does it this way. My > solution so far was to resort to the monoid of endofunctions (as the > getflag package does), that is, define > > cfg1, cfg2 :: Config -> Config > cfg1 = \cfg -> cfg {foo = True} > cfg2 = \cfg -> cfg {bar = 4} > > And then build (cfg1.cfg2) emptyConfig. (Alternatively, one might > structure these as lenses instead of endofunctions, see e.g. > Data.Monoid.Endo.Fold in the endo package.) > Thus I arrived at > > class Config cfg where > emptyConfig :: cfg -- may contain some defaults > configOptions :: [Parser (cfg -> cfg)] > > Do you think every other concept of configuration parsing can be cast into > this typeclass? > -- Olaf > > [1] https://mail.haskell.org/pipermail/haskell-cafe/2018-May/129063.html > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view 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 hexagoxel at hexagoxel.de Thu May 24 22:45:20 2018 From: hexagoxel at hexagoxel.de (lennart spitzner) Date: Fri, 25 May 2018 00:45:20 +0200 Subject: [Haskell-cafe] Config Files and monoids In-Reply-To: References: Message-ID: <55fac148-8f53-26ec-818c-45a163efd5c2@hexagoxel.de> Thanks matt for this pointer. I have also used the higher-kinded approach in the past, but using a slightly different abstraction. This is introduced in a very recent post [1]. I think this gives you the custom `gtraverse` you describe essentially for free (I assume you'd still need to write that, given that it has a custom type, right?). However it does not use the type family trick to avoid the `Identity` wrappers. The examples in my post still mostly assume that there is a default config, but I think you could work around this. This would involve the `CZipWithM` class instead of just `CZipWith`: The simple path would be cTraverse (fmap Identity) :: MyConfig Option -> Option (MyConfig Identity) which roughly corresponds to `gvalidate` from the "Higher-Kinded Data" post. The downside is that a Nothing result would not tell you which field(s) were missing. To fix that, you could define a static value of type `MyConfig (Const String)` that adds a value-level name to each field, and use `cZipWithM` to produce a `Either String (MyConfig Identity)` or perhaps even `Either [String] (MyConfig Identity)` by using the right traversal monad. Hope this helps. -- lennart [1] http://hexagoxel.de/postsforpublish/posts/2018-05-24-program-configuration.html On 25/05/18 00:03, Matt wrote: > For a "fully general" approach, the problem is well expressed by the > "higher kinded data" pattern: > http://reasonablypolymorphic.com/blog/higher-kinded-data/ > > A `Config f = Config { configFoo :: f Foo, ... }` type would use either the > First or Last monoids, depending on if you want earlier updates to take > precedence over later ones. Then, you would get a `Config First` from your > CLI parser, a `Config First` from your environment variable parser, and a > `Config First` from your config file parser. After `mappend`ing them all > together, you'd use a `gtraverse` function with a signature like: `Config > First -> Either [Text] (Config Identity)` -- you'd either have a list of > all fields that were missing, or a complete Config. > > Matt Parsons > > On Thu, May 24, 2018 at 3:00 PM, Olaf Klinke wrote: > >> Dear cafe, >> >> a recent post here [1] mentioned that configurations, such as the ones >> read from a config file, can be given Monoid instances, where mempty is the >> empty or default configuration and mappend merges two partial >> configurations, producing a more complete one. The vgrep package explicitly >> does this, for instance. Although the ConfigParser type from the ConfigFile >> package has a binary 'merge' operation, it does define neither a Monoid not >> a Semigroup instance. >> >> I'm struggling to make the concept of monoidal configuration work when >> there is no sensible default configuration. Suppose my configuration type >> is >> >> data Config = Config {foo :: Bool, bar :: Int} >> >> with no reasonable default, e.g. >> >> emptyConfig = Config { >> foo = error "you did not specify option foo", >> bar = error "you did not specify option bar" >> } >> >> Some configuration monoids seem to have the second operand override the >> first, or the other way around. However, I wish that when >> cfg1 = emptyConfig {foo = True} >> cfg2 = emptyConfig {bar = 4} >> then cfg1 <> cfg2 == Config {foo = True, bar = 4}. >> >> So it seems that for mappend to work as intended one needs a terminating >> function that tells me if a record field is already defined, e.g. when all >> fields are Maybes. Vgrep.Environment.Config.Monoid does it this way. My >> solution so far was to resort to the monoid of endofunctions (as the >> getflag package does), that is, define >> >> cfg1, cfg2 :: Config -> Config >> cfg1 = \cfg -> cfg {foo = True} >> cfg2 = \cfg -> cfg {bar = 4} >> >> And then build (cfg1.cfg2) emptyConfig. (Alternatively, one might >> structure these as lenses instead of endofunctions, see e.g. >> Data.Monoid.Endo.Fold in the endo package.) >> Thus I arrived at >> >> class Config cfg where >> emptyConfig :: cfg -- may contain some defaults >> configOptions :: [Parser (cfg -> cfg)] >> >> Do you think every other concept of configuration parsing can be cast into >> this typeclass? >> -- Olaf >> >> [1] https://mail.haskell.org/pipermail/haskell-cafe/2018-May/129063.html >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view 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 vanessa.mchale at iohk.io Fri May 25 02:36:15 2018 From: vanessa.mchale at iohk.io (Vanessa McHale) Date: Thu, 24 May 2018 21:36:15 -0500 Subject: [Haskell-cafe] Optimizing nearest-k code In-Reply-To: References: Message-ID: If you're looking for an efficient way to compute subsets, import Control.Monad subsets :: [a] -> [[a]] subsets = filterM (pure [True, False]) does the trick nicely. On 05/24/2018 12:36 PM, Mark Wotton wrote: > there are a few things you can do. > > I ran it locally and got 3s cpu time and 3gb of allocation, more or less. > > first off, your subset implementation computes the subsets twice. > taking that off took it down to 2s. > > After that it's mostly in the Set implementation. Using Map a () > instead gives you access to Data.Map.Merge.Strict.merge, which is a > bit more efficient (going over the two data structures once only) > > ``` > module Main where > > import Data.List > import Data.Map.Strict (Map) > import qualified Data.Map.Merge.Strict as Map > import qualified Data.Map.Strict as Map > > nearest_k :: (Ord a) => Int -> [(Map a (), v)] -> Map a () -> [(Map a (), v)] > nearest_k k bs b = take k bs' where > bs' = sortOn (hamming b) bs > > hamming :: (Ord a)=> Map a () -> (Map a (), v) -> Int > hamming x (y, _) = hamming_distance x y > > hamming_distance :: (Ord a)=> Map a () -> Map a () -> Int > hamming_distance xs ys = Map.size (Map.merge Map.preserveMissing > Map.preserveMissing (Map.zipWithMaybeMatched (\_ _ _ -> Nothing)) xs > ys) > > subsets :: [a] -> [[a]] > subsets [] = [[]] > subsets (x:xs) = let rs = subsets xs in rs ++ map (x:) rs > > int_lists :: [[Int]] > int_lists = subsets [1..20] > > values :: [(Map Int (), Int)] > values = map f (zip [1..] int_lists) where > f (i, x) = (Map.fromList(zip x (repeat ())), i) > > test = nearest_k 8 values (Map.fromList (zip [1,2,3] (repeat ()))) > > > main = print test > ``` > > that took it to 1s, and now profiling indicates more than half the > time is spent in generation of the test values, so I'll leave it > there. > > I think if you wanted to do better than this you'd have to do some > algorithmic changes - for instance, once your worst candidate is n > steps away, you can stop calculating the hamming distance for anything > else once it's > n, as it can't contribute usefully to the nearest > neighbours. > > cheers, > Mark > > On Thu, May 24, 2018 at 12:15 PM, Richard Evans > wrote: >> Dear Haskell Cafe, >> >> Given a set of sets, and a particular target set, I want to find the sets >> that are nearest (in terms of Hamming distance) to the target set. >> >> I am using the following code: >> >> import Data.List >> import qualified Data.Set as Set >> >> nearest_k :: Ord a => Int -> [(Set.Set a, v)] -> Set.Set a -> [(Set.Set a, >> v)] >> nearest_k k bs b = take k bs' where >> bs' = sortOn (hamming b) bs >> >> hamming :: Ord a => Set.Set a -> (Set.Set a, v) -> Int >> hamming x (y, _) = hamming_distance x y >> >> hamming_distance :: Ord a => Set.Set a -> Set.Set a -> Int >> hamming_distance xs ys = Set.size (Set.difference xs ys) + Set.size >> (Set.difference ys xs) >> >> >> >> subsets :: [a] -> [[a]] >> subsets [] = [[]] >> subsets (x:xs) = subsets xs ++ map (x:) (subsets xs) >> >> int_lists :: [[Int]] >> int_lists = subsets [1..20] >> >> values :: [(Set.Set Int, Int)] >> values = map f (zip [1..] int_lists) where >> f (i, x) = (Set.fromList x, i) >> >> test = nearest_k 8 values (Set.fromList [1,2,3]) >> >> ---- >> >> This works ok for the test above (with sets of ints), but is rather slow in >> my actual application (in which the sets are large sets of ground atoms of >> first-order logic). Is there some major optimization I should be doing here? >> >> 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: 488 bytes Desc: OpenPGP digital signature URL: From douglas.mcclean at gmail.com Fri May 25 02:52:42 2018 From: douglas.mcclean at gmail.com (Douglas McClean) Date: Thu, 24 May 2018 22:52:42 -0400 Subject: [Haskell-cafe] Config Files and monoids In-Reply-To: <55fac148-8f53-26ec-818c-45a163efd5c2@hexagoxel.de> References: <55fac148-8f53-26ec-818c-45a163efd5c2@hexagoxel.de> Message-ID: To get the static record of names you need to make good error messages for the missing things, I think it should also be possible to write a GHC.Generics function with an end result like: gNames :: (GNames r) => r (Const String) by digging through the metadata for each field in the record type r, extracting the name, using Const . fromString, and packaging it up in the record? But exactly how the Generic1 machinery for this works is escaping me at this hour. Perhaps someone can help fill in the details? On Thu, May 24, 2018 at 6:45 PM, lennart spitzner wrote: > Thanks matt for this pointer. I have also used the higher-kinded approach > in the past, but using a slightly different abstraction. This is introduced > in a very recent post [1]. I think this gives you the custom `gtraverse` > you describe essentially for free (I assume you'd still need to write that, > given that it has a custom type, right?). However it does not use the type > family trick to avoid the `Identity` wrappers. > > The examples in my post still mostly assume that there is a default > config, but I think you could work around this. This would involve the > `CZipWithM` class instead of just `CZipWith`: The simple path would be > > cTraverse (fmap Identity) :: MyConfig Option -> Option (MyConfig > Identity) > > which roughly corresponds to `gvalidate` from the "Higher-Kinded Data" > post. The downside is that a Nothing result would not tell you which > field(s) were missing. To fix that, you could define a static value of type > `MyConfig (Const String)` that adds a value-level name to each field, and > use `cZipWithM` to produce a `Either String (MyConfig Identity)` or perhaps > even `Either [String] (MyConfig Identity)` by using the right traversal > monad. > > Hope this helps. > > -- lennart > > [1] http://hexagoxel.de/postsforpublish/posts/2018-05- > 24-program-configuration.html > > > On 25/05/18 00:03, Matt wrote: > > For a "fully general" approach, the problem is well expressed by the > > "higher kinded data" pattern: > > http://reasonablypolymorphic.com/blog/higher-kinded-data/ > > > > A `Config f = Config { configFoo :: f Foo, ... }` type would use either > the > > First or Last monoids, depending on if you want earlier updates to take > > precedence over later ones. Then, you would get a `Config First` from > your > > CLI parser, a `Config First` from your environment variable parser, and a > > `Config First` from your config file parser. After `mappend`ing them all > > together, you'd use a `gtraverse` function with a signature like: `Config > > First -> Either [Text] (Config Identity)` -- you'd either have a list of > > all fields that were missing, or a complete Config. > > > > Matt Parsons > > > > On Thu, May 24, 2018 at 3:00 PM, Olaf Klinke > wrote: > > > >> Dear cafe, > >> > >> a recent post here [1] mentioned that configurations, such as the ones > >> read from a config file, can be given Monoid instances, where mempty is > the > >> empty or default configuration and mappend merges two partial > >> configurations, producing a more complete one. The vgrep package > explicitly > >> does this, for instance. Although the ConfigParser type from the > ConfigFile > >> package has a binary 'merge' operation, it does define neither a Monoid > not > >> a Semigroup instance. > >> > >> I'm struggling to make the concept of monoidal configuration work when > >> there is no sensible default configuration. Suppose my configuration > type > >> is > >> > >> data Config = Config {foo :: Bool, bar :: Int} > >> > >> with no reasonable default, e.g. > >> > >> emptyConfig = Config { > >> foo = error "you did not specify option foo", > >> bar = error "you did not specify option bar" > >> } > >> > >> Some configuration monoids seem to have the second operand override the > >> first, or the other way around. However, I wish that when > >> cfg1 = emptyConfig {foo = True} > >> cfg2 = emptyConfig {bar = 4} > >> then cfg1 <> cfg2 == Config {foo = True, bar = 4}. > >> > >> So it seems that for mappend to work as intended one needs a terminating > >> function that tells me if a record field is already defined, e.g. when > all > >> fields are Maybes. Vgrep.Environment.Config.Monoid does it this way. My > >> solution so far was to resort to the monoid of endofunctions (as the > >> getflag package does), that is, define > >> > >> cfg1, cfg2 :: Config -> Config > >> cfg1 = \cfg -> cfg {foo = True} > >> cfg2 = \cfg -> cfg {bar = 4} > >> > >> And then build (cfg1.cfg2) emptyConfig. (Alternatively, one might > >> structure these as lenses instead of endofunctions, see e.g. > >> Data.Monoid.Endo.Fold in the endo package.) > >> Thus I arrived at > >> > >> class Config cfg where > >> emptyConfig :: cfg -- may contain some defaults > >> configOptions :: [Parser (cfg -> cfg)] > >> > >> Do you think every other concept of configuration parsing can be cast > into > >> this typeclass? > >> -- Olaf > >> > >> [1] https://mail.haskell.org/pipermail/haskell-cafe/2018- > May/129063.html > >> _______________________________________________ > >> Haskell-Cafe mailing list > >> To (un)subscribe, modify options or view 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. > -- J. Douglas McClean (781) 561-5540 (cell) -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.feuer at gmail.com Fri May 25 05:45:46 2018 From: david.feuer at gmail.com (David Feuer) Date: Fri, 25 May 2018 01:45:46 -0400 Subject: [Haskell-cafe] Help evaluating TQueue variants Message-ID: I've written three related variations on TQueue (from the stm package). All three are designed to avoid the reader starvation problem described in GHC Trac 9539 [1] while limiting contention. Two are based on Okasaki's scheduled (i.e., real-time) banker's queues, while the third is based on his amortized-time banker's queue. I am hoping one or more people with programs that use TQueue heavily would be willing and able to try out these alternatives and see how they perform in their applications. I'm interested in how they compare to the current TQueue implementation, and also how they compare to each other. The queues are currently in a GitHub repository [2], but if it would be helpful I could put them up on Hackage. Thank you for your time. [1] https://ghc.haskell.org/trac/ghc/ticket/9539 [2] https://github.com/treeowl/stm-queues From svenpanne at gmail.com Fri May 25 13:58:58 2018 From: svenpanne at gmail.com (Sven Panne) Date: Fri, 25 May 2018 15:58:58 +0200 Subject: [Haskell-cafe] Config Files and monoids In-Reply-To: References: Message-ID: 2018-05-24 23:00 GMT+02:00 Olaf Klinke : > [...] I'm struggling to make the concept of monoidal configuration work > when there is no sensible default configuration. Suppose my configuration > type is > > data Config = Config {foo :: Bool, bar :: Int} > > with no reasonable default, e.g. > > emptyConfig = Config { > foo = error "you did not specify option foo", > bar = error "you did not specify option bar" > } > [...] > I find the approach in https://medium.com/@jonathangfischoff/the-partial-options-monoid-pattern-31914a71fc67 quite straightforward, without any need for higher-kinded stuff, generics or lenses: Just distinguish between partial and non-partial options, and make a Monoid instance only for the partial ones. Cheers, S. -------------- next part -------------- An HTML attachment was scrubbed... URL: From vanessa.mchale at iohk.io Fri May 25 13:59:30 2018 From: vanessa.mchale at iohk.io (Vanessa McHale) Date: Fri, 25 May 2018 08:59:30 -0500 Subject: [Haskell-cafe] Optimizing nearest-k code In-Reply-To: References: Message-ID: <1e445621-8900-16a9-af24-05843cf551f3@iohk.io> Also: are you sure let rs = subsets xs in rs ++ map (x:) rs is more efficient than subsets xs ++ map (x:) (subsets xs) I would have assumed these would be the same due to laziness, etc. On 05/24/2018 12:36 PM, Mark Wotton wrote: > there are a few things you can do. > > I ran it locally and got 3s cpu time and 3gb of allocation, more or less. > > first off, your subset implementation computes the subsets twice. > taking that off took it down to 2s. > > After that it's mostly in the Set implementation. Using Map a () > instead gives you access to Data.Map.Merge.Strict.merge, which is a > bit more efficient (going over the two data structures once only) > > ``` > module Main where > > import Data.List > import Data.Map.Strict (Map) > import qualified Data.Map.Merge.Strict as Map > import qualified Data.Map.Strict as Map > > nearest_k :: (Ord a) => Int -> [(Map a (), v)] -> Map a () -> [(Map a (), v)] > nearest_k k bs b = take k bs' where > bs' = sortOn (hamming b) bs > > hamming :: (Ord a)=> Map a () -> (Map a (), v) -> Int > hamming x (y, _) = hamming_distance x y > > hamming_distance :: (Ord a)=> Map a () -> Map a () -> Int > hamming_distance xs ys = Map.size (Map.merge Map.preserveMissing > Map.preserveMissing (Map.zipWithMaybeMatched (\_ _ _ -> Nothing)) xs > ys) > > subsets :: [a] -> [[a]] > subsets [] = [[]] > subsets (x:xs) = let rs = subsets xs in rs ++ map (x:) rs > > int_lists :: [[Int]] > int_lists = subsets [1..20] > > values :: [(Map Int (), Int)] > values = map f (zip [1..] int_lists) where > f (i, x) = (Map.fromList(zip x (repeat ())), i) > > test = nearest_k 8 values (Map.fromList (zip [1,2,3] (repeat ()))) > > > main = print test > ``` > > that took it to 1s, and now profiling indicates more than half the > time is spent in generation of the test values, so I'll leave it > there. > > I think if you wanted to do better than this you'd have to do some > algorithmic changes - for instance, once your worst candidate is n > steps away, you can stop calculating the hamming distance for anything > else once it's > n, as it can't contribute usefully to the nearest > neighbours. > > cheers, > Mark > > On Thu, May 24, 2018 at 12:15 PM, Richard Evans > wrote: >> Dear Haskell Cafe, >> >> Given a set of sets, and a particular target set, I want to find the sets >> that are nearest (in terms of Hamming distance) to the target set. >> >> I am using the following code: >> >> import Data.List >> import qualified Data.Set as Set >> >> nearest_k :: Ord a => Int -> [(Set.Set a, v)] -> Set.Set a -> [(Set.Set a, >> v)] >> nearest_k k bs b = take k bs' where >> bs' = sortOn (hamming b) bs >> >> hamming :: Ord a => Set.Set a -> (Set.Set a, v) -> Int >> hamming x (y, _) = hamming_distance x y >> >> hamming_distance :: Ord a => Set.Set a -> Set.Set a -> Int >> hamming_distance xs ys = Set.size (Set.difference xs ys) + Set.size >> (Set.difference ys xs) >> >> >> >> subsets :: [a] -> [[a]] >> subsets [] = [[]] >> subsets (x:xs) = subsets xs ++ map (x:) (subsets xs) >> >> int_lists :: [[Int]] >> int_lists = subsets [1..20] >> >> values :: [(Set.Set Int, Int)] >> values = map f (zip [1..] int_lists) where >> f (i, x) = (Set.fromList x, i) >> >> test = nearest_k 8 values (Set.fromList [1,2,3]) >> >> ---- >> >> This works ok for the test above (with sets of ints), but is rather slow in >> my actual application (in which the sets are large sets of ground atoms of >> first-order logic). Is there some major optimization I should be doing here? >> >> 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: 488 bytes Desc: OpenPGP digital signature URL: From mwotton at gmail.com Fri May 25 14:04:56 2018 From: mwotton at gmail.com (Mark Wotton) Date: Fri, 25 May 2018 10:04:56 -0400 Subject: [Haskell-cafe] Optimizing nearest-k code In-Reply-To: <1e445621-8900-16a9-af24-05843cf551f3@iohk.io> References: <1e445621-8900-16a9-af24-05843cf551f3@iohk.io> Message-ID: Yes. Showed up in testing - if you're using a decent chunk of the subsets, you can avoid computing twice. If the pressure is actually memory rather than cpu and you can consume lazily, you are quite right that the original could be better. On Fri, May 25, 2018, 10:00 AM Vanessa McHale wrote: > Also: are you sure > > let rs = subsets xs in rs ++ map (x:) rs > > is more efficient than > > subsets xs ++ map (x:) (subsets xs) > > > I would have assumed these would be the same due to laziness, etc. > > On 05/24/2018 12:36 PM, Mark Wotton wrote: > > there are a few things you can do. > > > > I ran it locally and got 3s cpu time and 3gb of allocation, more or less. > > > > first off, your subset implementation computes the subsets twice. > > taking that off took it down to 2s. > > > > After that it's mostly in the Set implementation. Using Map a () > > instead gives you access to Data.Map.Merge.Strict.merge, which is a > > bit more efficient (going over the two data structures once only) > > > > ``` > > module Main where > > > > import Data.List > > import Data.Map.Strict (Map) > > import qualified Data.Map.Merge.Strict as Map > > import qualified Data.Map.Strict as Map > > > > nearest_k :: (Ord a) => Int -> [(Map a (), v)] -> Map a () -> [(Map a > (), v)] > > nearest_k k bs b = take k bs' where > > bs' = sortOn (hamming b) bs > > > > hamming :: (Ord a)=> Map a () -> (Map a (), v) -> Int > > hamming x (y, _) = hamming_distance x y > > > > hamming_distance :: (Ord a)=> Map a () -> Map a () -> Int > > hamming_distance xs ys = Map.size (Map.merge Map.preserveMissing > > Map.preserveMissing (Map.zipWithMaybeMatched (\_ _ _ -> Nothing)) xs > > ys) > > > > subsets :: [a] -> [[a]] > > subsets [] = [[]] > > subsets (x:xs) = let rs = subsets xs in rs ++ map (x:) rs > > > > int_lists :: [[Int]] > > int_lists = subsets [1..20] > > > > values :: [(Map Int (), Int)] > > values = map f (zip [1..] int_lists) where > > f (i, x) = (Map.fromList(zip x (repeat ())), i) > > > > test = nearest_k 8 values (Map.fromList (zip [1,2,3] (repeat ()))) > > > > > > main = print test > > ``` > > > > that took it to 1s, and now profiling indicates more than half the > > time is spent in generation of the test values, so I'll leave it > > there. > > > > I think if you wanted to do better than this you'd have to do some > > algorithmic changes - for instance, once your worst candidate is n > > steps away, you can stop calculating the hamming distance for anything > > else once it's > n, as it can't contribute usefully to the nearest > > neighbours. > > > > cheers, > > Mark > > > > On Thu, May 24, 2018 at 12:15 PM, Richard Evans > > wrote: > >> Dear Haskell Cafe, > >> > >> Given a set of sets, and a particular target set, I want to find the > sets > >> that are nearest (in terms of Hamming distance) to the target set. > >> > >> I am using the following code: > >> > >> import Data.List > >> import qualified Data.Set as Set > >> > >> nearest_k :: Ord a => Int -> [(Set.Set a, v)] -> Set.Set a -> [(Set.Set > a, > >> v)] > >> nearest_k k bs b = take k bs' where > >> bs' = sortOn (hamming b) bs > >> > >> hamming :: Ord a => Set.Set a -> (Set.Set a, v) -> Int > >> hamming x (y, _) = hamming_distance x y > >> > >> hamming_distance :: Ord a => Set.Set a -> Set.Set a -> Int > >> hamming_distance xs ys = Set.size (Set.difference xs ys) + Set.size > >> (Set.difference ys xs) > >> > >> > >> > >> subsets :: [a] -> [[a]] > >> subsets [] = [[]] > >> subsets (x:xs) = subsets xs ++ map (x:) (subsets xs) > >> > >> int_lists :: [[Int]] > >> int_lists = subsets [1..20] > >> > >> values :: [(Set.Set Int, Int)] > >> values = map f (zip [1..] int_lists) where > >> f (i, x) = (Set.fromList x, i) > >> > >> test = nearest_k 8 values (Set.fromList [1,2,3]) > >> > >> ---- > >> > >> This works ok for the test above (with sets of ints), but is rather > slow in > >> my actual application (in which the sets are large sets of ground atoms > of > >> first-order logic). Is there some major optimization I should be doing > here? > >> > >> 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. > > > > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view 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 leah at vuxu.org Sat May 26 13:51:53 2018 From: leah at vuxu.org (Leah Neukirchen) Date: Sat, 26 May 2018 15:51:53 +0200 Subject: [Haskell-cafe] Munich Haskell Meeting, 2018-05-28 @ 19:30 Message-ID: <87k1rqed8m.fsf@gmail.com> Dear all, Next week, our monthly Munich Haskell Meeting will take place again on Monday, May 28 at Hirschgarten (self-service area) at 19h30. (The weather should be fine for sitting outside, else can move inside.) 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-may-2018/ Everybody is welcome! cu, -- Leah Neukirchen http://leah.zone From qdunkan at gmail.com Mon May 28 03:22:09 2018 From: qdunkan at gmail.com (Evan Laforge) Date: Sun, 27 May 2018 20:22:09 -0700 Subject: [Haskell-cafe] [ANN] karya, music editor Message-ID: This is an announcement for Karya, which is a music editor written in Haskell. There are more details at: http://ofb.net/~elaforge/karya/doc/overview.md.html or if you just want to listen to music: http://ofb.net/~elaforge/karya/doc/examples.md.html Source is at: https://github.com/elaforge/karya Even if you're not interested in the music part, it's an example of a haskell program with a GUI, REPL based interface, tests, profiling, and a shake-based build system, although probably idiosyncratic implementations of all of the above. It should run on OS X (well tested) and X11 (poorly tested). If you are interested in the music part, this is basically in the "score writing" genre of software, in that it's suitable for writing a score in a textual non-realtime way. But though non-realtime, it's still interactive, so you can hear what you just wrote. And though textual and language-oriented, it's also semi-graphical, so it's closer to the sequencer / music editor type application than a music-oriented DSL like Haskore. It's hard to describe because as far as I know there's nothing else similar. If you have used a DAW but wanted to define higher level abstractions, or if you used Haskore (or similar) but found it difficult to write music purely textually, you might be interested in this. Or if you want to use your own tunings or scales, or do expressive control of pitch and dynamics. You'll need an external MIDI synthesizer though. There is a direct synthesis backend, but it's not practically usable yet. It's somewhat mature, in that I've been using for all my own music for the last 5 years or so, but of course also has many areas of active development, from graphics, to language design and interpretation, to music notation design, to audio synthesis and numerics. There is some documentation, but it's undoubtedly sparse since I'm the only user. Ask if you have questions! Details will be materialized on demand. Some things not mentioned on the "official" page since they're in progress: - A DSL to notate solkattu, which is Carnatic percussion syllables, and is a sort of instrument-independent notation for rhythmic structures, along with rules for realizing on various instruments. This is closer to a traditional music DSL like Haskore, but winds up different since it's rhythmically oriented. There's a small library of compositions. - An offline synthesis framework, including a sampler and FAUST-based synthesizer, built on a streaming audio library. I'm currently working on implementing off-line incremental audio rendering, which as far as I know is unique. From johannes.waldmann at htwk-leipzig.de Mon May 28 14:47:27 2018 From: johannes.waldmann at htwk-leipzig.de (Johannes Waldmann) Date: Mon, 28 May 2018 16:47:27 +0200 Subject: [Haskell-cafe] (names for) invariants for Eq and Ord? Message-ID: <0aa941ff-89bd-d587-e8aa-bc1e09deaccc@htwk-leipzig.de> Dear Cafe, I am somewhat surprised that the Haskell Standard (*) https://www.haskell.org/onlinereport/haskell2010/haskellch6.html#x13-1270006.3 does not contain any notation for (intended) properties of Eq and Ord instances, and their relation. For Java (standard library), the API spec uses wording like "consistent with equals" https://docs.oracle.com/javase/10/docs/api/java/lang/Comparable.html I am well aware that semantics (transitivity, etc.) cannot be enforced statically, in either language. But both standards still speak of "total order". Do we (Haskell) need something similar to "consistent with equals"? It depends. E.g., looking at a (random) source in containers (Data.Map.Internal), it seems that it will always use the result of compare, never of (==), on keys. That's not obvious from the docs. I just checked -- I can make a type where (==) = undefined, but write a proper Ord instance, and use it as key type. I am asking this because I will be teaching type classes, with Eq and Ord as examples. I detected the funny situation that the Java specification looks "more mathematical" than the corresponding Haskell one. What will the students think ... - J.W. (*) The Haskell standard is what you find when you scroll down, down, down to the very bottom of https://www.haskell.org/documentation . So, probably not that important... From polux2001 at gmail.com Tue May 29 16:06:16 2018 From: polux2001 at gmail.com (Paul Brauner) Date: Tue, 29 May 2018 18:06:16 +0200 Subject: [Haskell-cafe] Selecting a transformer in a monad transformer stack Message-ID: Hello, I have a newtype for a monad transformer stack: newtype MyMonad a = MyMonad { runMyMonad :: ((ReaderT Env (ExceptT String (StateT Store (ListT Identity)))) a) } and I'd like to it derive MonadPlus. The default instance for MonadPlus I get via GeneralizedNewtypeDeriving is the ExceptT one because it is the outermost transformer implementing MonadPlus. I would like to use the ListT instance instead. The best solution I have come up with is to define: instance MonadPlus MyMonad where mzero = MyMonad $ ReaderT $ \e -> ExceptT $ StateT $ \s -> ListT $ Identity [] mplus a b = MyMonad $ ReaderT $ \e -> ExceptT $ StateT $ \s -> ListT $ Identity $ let run x = runIdentity (runListT (runStateT (runExceptT (runReaderT (runAbstract x) e)) s)) as = run a bs = run b in as ++ bs My questions are: - Is there a shorter way to define mplus? - Is there maybe some variation of monad transformer stacks where the layers are named and can be accessed by name? (I know of effects handlers but I'd like to stick to monad transformers for now.) Paul -------------- next part -------------- An HTML attachment was scrubbed... URL: From polux2001 at gmail.com Tue May 29 16:07:57 2018 From: polux2001 at gmail.com (Paul Brauner) Date: Tue, 29 May 2018 18:07:57 +0200 Subject: [Haskell-cafe] Selecting a transformer in a monad transformer stack In-Reply-To: References: Message-ID: There is a typo in the definition of mplus in my previous message: "runAbstract" should be "runMyMonad". On Tue, May 29, 2018 at 6:06 PM Paul Brauner wrote: > Hello, > > I have a newtype for a monad transformer stack: > > newtype MyMonad a = MyMonad { runMyMonad :: ((ReaderT Env (ExceptT String > (StateT Store (ListT Identity)))) a) } > > and I'd like to it derive MonadPlus. The default instance for MonadPlus I > get via GeneralizedNewtypeDeriving is the ExceptT one because it is the > outermost transformer implementing MonadPlus. I would like to use the ListT > instance instead. The best solution I have come up with is to define: > > instance MonadPlus MyMonad where > mzero = MyMonad $ ReaderT $ \e -> ExceptT $ StateT $ \s -> ListT $ > Identity [] > mplus a b = > MyMonad $ ReaderT $ \e -> ExceptT $ StateT $ \s -> ListT $ Identity $ > let > run x = runIdentity (runListT (runStateT (runExceptT (runReaderT > (runAbstract x) e)) s)) > as = run a > bs = run b > in > as ++ bs > > My questions are: > - Is there a shorter way to define mplus? > - Is there maybe some variation of monad transformer stacks where the > layers are named and can be accessed by name? (I know of effects handlers > but I'd like to stick to monad transformers for now.) > > Paul > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gershomb at gmail.com Tue May 29 18:05:01 2018 From: gershomb at gmail.com (Gershom B) Date: Tue, 29 May 2018 14:05:01 -0400 Subject: [Haskell-cafe] test Message-ID: Testing this list, due to a report. -g From allbery.b at gmail.com Tue May 29 19:24:28 2018 From: allbery.b at gmail.com (Brandon Allbery) Date: Tue, 29 May 2018 15:24:28 -0400 Subject: [Haskell-cafe] (names for) invariants for Eq and Ord? In-Reply-To: <0aa941ff-89bd-d587-e8aa-bc1e09deaccc@htwk-leipzig.de> References: <0aa941ff-89bd-d587-e8aa-bc1e09deaccc@htwk-leipzig.de> Message-ID: One thing to consider is that, if you look at the Report specification for derived Ord instances and of the default (compare), you'll find that it explicitly depends on (==). So you don't actually need a "law" here. On Tue, May 29, 2018 at 3:03 PM Johannes Waldmann < johannes.waldmann at htwk-leipzig.de> wrote: > Dear Cafe, > > I am somewhat surprised that the Haskell Standard (*) > > https://www.haskell.org/onlinereport/haskell2010/haskellch6.html#x13-1270006.3 > does not contain any > notation for (intended) properties of Eq and Ord instances, > and their relation. For Java (standard library), > the API spec uses wording like "consistent with equals" > https://docs.oracle.com/javase/10/docs/api/java/lang/Comparable.html > > I am well aware that semantics (transitivity, etc.) > cannot be enforced statically, in either language. > But both standards still speak of "total order". > Do we (Haskell) need something similar to "consistent with equals"? > > It depends. E.g., looking at a (random) source in containers > (Data.Map.Internal), it seems that it will always use the result of > compare, never of (==), on keys. That's not obvious from the docs. > I just checked -- I can make a type where (==) = undefined, > but write a proper Ord instance, and use it as key type. > > I am asking this because I will be teaching type classes, > with Eq and Ord as examples. I detected the funny situation > that the Java specification looks "more mathematical" > than the corresponding Haskell one. What will the students think ... > > - J.W. > > (*) The Haskell standard is what you find when you scroll > down, down, down to the very bottom of > https://www.haskell.org/documentation . So, probably not that important... > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view 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 simon.jakobi at googlemail.com Tue May 29 19:26:38 2018 From: simon.jakobi at googlemail.com (Simon Jakobi) Date: Tue, 29 May 2018 21:26:38 +0200 Subject: [Haskell-cafe] (names for) invariants for Eq and Ord? In-Reply-To: <0aa941ff-89bd-d587-e8aa-bc1e09deaccc@htwk-leipzig.de> References: <0aa941ff-89bd-d587-e8aa-bc1e09deaccc@htwk-leipzig.de> Message-ID: Hi Johannes, https://ghc.haskell.org/trac/ghc/ticket/15078 might be interesting to you. Cheers, Simon 2018-05-28 16:47 GMT+02:00 Johannes Waldmann < johannes.waldmann at htwk-leipzig.de>: > Dear Cafe, > > I am somewhat surprised that the Haskell Standard (*) > https://www.haskell.org/onlinereport/haskell2010/ > haskellch6.html#x13-1270006.3 > does not contain any > notation for (intended) properties of Eq and Ord instances, > and their relation. For Java (standard library), > the API spec uses wording like "consistent with equals" > https://docs.oracle.com/javase/10/docs/api/java/lang/Comparable.html > > I am well aware that semantics (transitivity, etc.) > cannot be enforced statically, in either language. > But both standards still speak of "total order". > Do we (Haskell) need something similar to "consistent with equals"? > > It depends. E.g., looking at a (random) source in containers > (Data.Map.Internal), it seems that it will always use the result of > compare, never of (==), on keys. That's not obvious from the docs. > I just checked -- I can make a type where (==) = undefined, > but write a proper Ord instance, and use it as key type. > > I am asking this because I will be teaching type classes, > with Eq and Ord as examples. I detected the funny situation > that the Java specification looks "more mathematical" > than the corresponding Haskell one. What will the students think ... > > - J.W. > > (*) The Haskell standard is what you find when you scroll > down, down, down to the very bottom of > https://www.haskell.org/documentation . So, probably not that important... > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From erkokl at gmail.com Tue May 29 20:00:42 2018 From: erkokl at gmail.com (Levent Erkok) Date: Tue, 29 May 2018 13:00:42 -0700 Subject: [Haskell-cafe] (names for) invariants for Eq and Ord? In-Reply-To: References: <0aa941ff-89bd-d587-e8aa-bc1e09deaccc@htwk-leipzig.de> Message-ID: Johannes: Heartily agreed. In fact, oft-used modules like Data.Map also need to be very clear regarding their requirements for Eq/Ord. It's well known in the folklore that the law: M.lookup k (M.insert k v M.empty) == Just v fails for maps when the key can be floating point: Prelude> import qualified Data.Map as M Prelude M> let k = 0/0 in let v = 0 in M.lookup k (M.insert k v M.empty) == Just v False Perhaps not a big deal as no-one should use floating-point values as a key to a map, but there's nothing stopping from anyone from doing so. Perhaps more worryingly, the Haskell report is largely silent about Eq/Ord instances that come out-of-the-box for such gotchas as you yourself observed. -Levent. On Tue, May 29, 2018 at 12:26 PM, Simon Jakobi via Haskell-Cafe < haskell-cafe at haskell.org> wrote: > Hi Johannes, > > https://ghc.haskell.org/trac/ghc/ticket/15078 might be interesting to you. > > Cheers, > Simon > > 2018-05-28 16:47 GMT+02:00 Johannes Waldmann leipzig.de>: > >> Dear Cafe, >> >> I am somewhat surprised that the Haskell Standard (*) >> https://www.haskell.org/onlinereport/haskell2010/haskellch6. >> html#x13-1270006.3 >> does not contain any >> notation for (intended) properties of Eq and Ord instances, >> and their relation. For Java (standard library), >> the API spec uses wording like "consistent with equals" >> https://docs.oracle.com/javase/10/docs/api/java/lang/Comparable.html >> >> I am well aware that semantics (transitivity, etc.) >> cannot be enforced statically, in either language. >> But both standards still speak of "total order". >> Do we (Haskell) need something similar to "consistent with equals"? >> >> It depends. E.g., looking at a (random) source in containers >> (Data.Map.Internal), it seems that it will always use the result of >> compare, never of (==), on keys. That's not obvious from the docs. >> I just checked -- I can make a type where (==) = undefined, >> but write a proper Ord instance, and use it as key type. >> >> I am asking this because I will be teaching type classes, >> with Eq and Ord as examples. I detected the funny situation >> that the Java specification looks "more mathematical" >> than the corresponding Haskell one. What will the students think ... >> >> - J.W. >> >> (*) The Haskell standard is what you find when you scroll >> down, down, down to the very bottom of >> https://www.haskell.org/documentation . So, probably not that >> important... >> _______________________________________________ >> Haskell-Cafe mailing list >> To (un)subscribe, modify options or view archives go to: >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe >> Only members subscribed via the mailman list are allowed to post. > > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben at well-typed.com Tue May 29 20:07:23 2018 From: ben at well-typed.com (Ben Gamari) Date: Tue, 29 May 2018 16:07:23 -0400 Subject: [Haskell-cafe] [ANNOUNCE] GHC 8.4.3 released Message-ID: <87lgc2kyyx.fsf@smart-cactus.org> Hello everyone, The GHC team is pleased to announce the availability of GHC 8.4.3. The source distribution, binary distributions, and documentation for this release are available at https://downloads.haskell.org/~ghc/8.4.3 This release includes a few bug fixes including: * A code generation bug resulting in crashing of some programs using UnboxedSums has been fixed (#15038). * #14381, where Cabal and GHC would disagree about abi-depends, resulting in build failures, has been worked around. Note that the work-around patch has already been shipped by several distributions in previous releases, so this change may not be visible to you. * By popular demand, GHC now logs a message when it reads a package environment file, hopefully eliminating some of the confusion wrought by this feature. * GHC now emits assembler agreeable to newer versions of Gnu binutils, fixing #15068. * SmallArray#s can now be compacted into a compact region Thanks to everyone who has contributed to developing, documenting, and testing this release! As always, let us know if you encounter trouble. How to get it ~~~~~~~~~~~~~ The easy way is to go to the web page, which should be self-explanatory: http://www.haskell.org/ghc/ We supply binary builds in the native package format for many platforms, and the source distribution is available from the same place. Packages will appear as they are built - if the package for your system isn't available yet, please try again later. Background ~~~~~~~~~~ Haskell is a standardized lazy functional programming language. GHC is a state-of-the-art programming suite for Haskell. Included is an optimising compiler generating efficient code for a variety of platforms, together with an interactive system for convenient, quick development. The distribution includes space and time profiling facilities, a large collection of libraries, and support for various language extensions, including concurrency, exceptions, and foreign language interfaces. GHC is distributed under a BSD-style open source license. A wide variety of Haskell related resources (tutorials, libraries, specifications, documentation, compilers, interpreters, references, contact information, links to research groups) are available from the Haskell home page (see below). On-line GHC-related resources ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Relevant URLs: GHC home page https://www.haskell.org/ghc/ GHC developers' home page https://ghc.haskell.org/trac/ghc/ Haskell home page https://www.haskell.org/ Supported Platforms ~~~~~~~~~~~~~~~~~~~ The list of platforms we support, and the people responsible for them, is here: https://ghc.haskell.org/trac/ghc/wiki/TeamGHC Ports to other platforms are possible with varying degrees of difficulty. The Building Guide describes how to go about porting to a new platform: https://ghc.haskell.org/trac/ghc/wiki/Building Developers ~~~~~~~~~~ We welcome new contributors. Instructions on accessing our source code repository, and getting started with hacking on GHC, are available from the GHC's developer's site: https://ghc.haskell.org/trac/ghc/ Mailing lists ~~~~~~~~~~~~~ We run mailing lists for GHC users and bug reports; to subscribe, use the web interfaces at https://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets There are several other haskell and ghc-related mailing lists on www.haskell.org; for the full list, see https://mail.haskell.org/cgi-bin/mailman/listinfo Many GHC developers hang out on #haskell on IRC: https://www.haskell.org/haskellwiki/IRC_channel Please report bugs using our bug tracking system. Instructions on reporting bugs can be found here: https://www.haskell.org/ghc/reportabug -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 487 bytes Desc: not available URL: From fa-ml at ariis.it Tue May 29 20:46:53 2018 From: fa-ml at ariis.it (Francesco Ariis) Date: Tue, 29 May 2018 22:46:53 +0200 Subject: [Haskell-cafe] [ANN] karya, music editor In-Reply-To: References: Message-ID: <20180529204653.frjmi557skcruouz@x60s.casa> Hello Evan, congrats on the release! On Sun, May 27, 2018 at 08:22:09PM -0700, Evan Laforge wrote: > Some things not mentioned on the "official" page since they're in progress: > > - A DSL to notate solkattu, which is Carnatic percussion syllables, > and is a sort of instrument-independent notation for rhythmic > structures, along with rules for realizing on various instruments. > This is closer to a traditional music DSL like Haskore, but winds up > different since it's rhythmically oriented. There's a small library > of compositions. Very very interested in this! From lysxia at gmail.com Tue May 29 21:14:47 2018 From: lysxia at gmail.com (Li-yao Xia) Date: Tue, 29 May 2018 17:14:47 -0400 Subject: [Haskell-cafe] Selecting a transformer in a monad transformer stack In-Reply-To: References: Message-ID: <10033134-9012-2218-cabb-813b63b58246@gmail.com> Hi Paul, We can use Data.Coerce.coerce to do the (un)wrapping and defer to the Alternative/MonadPlus instance at the right level. (MyMonad a) is representationally equivalent to (Stack (Either String a)), where Stack is defined as type Stack = ReaderT Env (StateT Store (ListT Identity)) Thus, we can coerce Stack's MonadPlus methods (which lift ListT's methods) as follows: import Data.Coerce instance MonadPlus MyMonad where mzero :: forall a. MyMonad a mzero = coerce (mzero @Stack @(Either String a)) mplus :: forall a. MyMonad a -> MyMonad a -> MyMonad a mplus = coerce (mplus @Stack @(Either String a)) The upcoming DerivingVia generalizes this pattern somewhat, although it will be necessary to pick a different equivalent type than above. newtype MyMonad = MyMonad { runMyMonad :: ((ReaderT Env (ExceptT String (StateT Store (ListT Identity)))) a) } deriving (Functor, Applicative, Monad) deriving (Alternative, MonadPlus) via (ReaderT Env (ExceptT' String (StateT Store (ListT Identity)))) where ExceptT' is a transformer identical to ExceptT, but it lifts the transformed monad's MonadPlus instance instead of providing its own. A different solution is monad-control, which generalizes MonadTrans. Like `lift`, `liftWith` moves an action "up" one level in a transformer stack, but in addition, it provides a way to move "down" as well, as a continuation given to the wrapped action. Although powerful, it is certainly not an easy interface to grasp, but my point here is to demonstrate one use of it. liftControl :: (MonadTransControl t, Monad m, Monad (t m)) => (Run t -> m (StT t a)) -> t m a liftControl f = liftWith f >>= restoreT . return instance Alternative MyMonad where empty = MyMonad ((lift . lift) empty) MyMonad a <|> MyMonad b = MyMonad $ liftControl $ \run1 -> liftControl $ \run2 -> (run2 . run1) a <|> (run2 . run1) b It's also not quite obvious this does the right thing so here are some QuickCheck tests that these two implementations are equivalent to the original one: https://lpaste.net/2697355636458389504 Cheers, Li-yao From sumitraja at gmail.com Wed May 30 04:16:16 2018 From: sumitraja at gmail.com (Sumit Raja) Date: Wed, 30 May 2018 14:16:16 +1000 Subject: [Haskell-cafe] Fwd: Safe TCP accept loop In-Reply-To: References: <59e4995b.0947620a.72c1d.9b14@mx.google.com> Message-ID: My apologies I've only just managed to get back to this. I've used your method described above, thanks for the clear explanation Now am unable to terminate the async thread that is running the accept call. Seems to me that Warp relies on the termination of the main thread to terminate the accept loop - is this correct? On 25 October 2017 at 17:30, Ömer Sinan Ağacan wrote: > Your pseudo code doesn't look right although I couldn't completely understand > it. You need something like this: > > {-# LANGUAGE ScopedTypeVariables #-} > > import Network.Socket > import Control.Concurrent > import Control.Exception > > acceptLoop :: Socket -> IO () > acceptLoop sock = > mask_ loop > where > loop = do > -- only safe point in the loop for exceptions > allowInterrupt > > (connected_sock, _) <- accept sock > -- use forkIOWithUnmask: we want the thread to be > interruptable no matter > -- what the inherited masking state is > _thr_id <- forkIOWithUnmask (handle_conn connected_sock) > > loop > > handle_conn connected_sock unmask = > -- register cleanup action, run the handler in interruptable state to be > -- able to kill the thread. > catch (unmask (handler connected_sock)) (\(_exc :: > SomeException) -> close connected_sock) > > handler connected_sock = > -- fill here > return () > > > Ömer > > 2017-10-25 8:52 GMT+03:00 Sumit Raja : >> Hi Ömer >> >>> You need to mask async exceptions between `accept()` and cleanup action >>> registration, because an exception in between these operations will cause the >>> socket to leak. >>> >>> You can take a look at warp's accept loop: >>> >>> https://github.com/yesodweb/wai/blob/master/warp/Network/Wai/Handler/Warp/Run.hs#L211 >>> >> >> Trying to map steps for the code you've pointed me to in bad pseudo code: >> >> finally (mask >> acceptLoop serverSocket) (close serverSocket) >> >> acceptLoop = >> unmask >> sock <- accept serverSock >> mask >> forkIO $ do >> mask >> finally (unmask >> process sock) (close sock) >> acceptLoop >> >> Is this correct? >> >> Thanks >> Sumit From sumitraja at gmail.com Wed May 30 05:41:44 2018 From: sumitraja at gmail.com (Sumit Raja) Date: Wed, 30 May 2018 15:41:44 +1000 Subject: [Haskell-cafe] 8.4.2 FreeBSD bindist not working with gold & lld Message-ID: Hi, Just got 8.4.2 running in my FreeBSD 11 environment and am getting the following: cabal: Failed to build entropy-0.4.1.1 (which is required by exe:test-ghoa from oauth2-simple-0.1.0.0). The failure occurred during the configure step. The exception was: dieVerbatim: user error (cabal: '/usr/local/bin/ghc' exited with an error: /usr/local/bin/ld.gold: error: /usr/local/lib/ghc-8.4.2/rts/libHSrts_thr.a(RTS.thr_o): unexpected reloc 8 in object file LLD fails with configure step. The exception was: dieVerbatim: user error (cabal: '/usr/local/bin/ghc' exited with an error: /usr/bin/ld.lld: error: do not know how to handle relocation 'R_X86_64_RELATIVE' (8) Saw another thread that discussed this but there was no resolution. Any ideas on how to fix this? Thanks Sumit -------------- next part -------------- An HTML attachment was scrubbed... URL: From qdunkan at gmail.com Wed May 30 06:15:31 2018 From: qdunkan at gmail.com (Evan Laforge) Date: Tue, 29 May 2018 23:15:31 -0700 Subject: [Haskell-cafe] [ANN] karya, music editor In-Reply-To: <20180529204653.frjmi557skcruouz@x60s.casa> References: <20180529204653.frjmi557skcruouz@x60s.casa> Message-ID: On Tue, May 29, 2018 at 1:46 PM, Francesco Ariis wrote: > Very very interested in this! It's all under the Solkattu/* directory. There are a lot of problems in there which are unsolved or solved in an unsatisfactory way, so input is definitely appreciated. There's the beginnings of a cross-referenced konnakol db at http://ofb.net/~elaforge/solkattu/ E.g. here's the basic "end of thani" mohra, in the kizhkalam/melkalam style: http://ofb.net/~elaforge/solkattu/Solkattu.Score.SolkattuMohra.c_mohra.html Since it's parameterized, I can plug in any patterns with the right duration and it comes out in the right structure. From qdunkan at gmail.com Wed May 30 06:18:10 2018 From: qdunkan at gmail.com (Evan Laforge) Date: Tue, 29 May 2018 23:18:10 -0700 Subject: [Haskell-cafe] [ANN] karya, music editor In-Reply-To: References: <20180529204653.frjmi557skcruouz@x60s.casa> Message-ID: As an aside, what happened to haskell-art? It seems to have been suddenly deactivated. On Tue, May 29, 2018 at 11:15 PM, Evan Laforge wrote: > On Tue, May 29, 2018 at 1:46 PM, Francesco Ariis wrote: >> Very very interested in this! > > It's all under the Solkattu/* directory. There are a lot of problems > in there which are unsolved or solved in an unsatisfactory way, so > input is definitely appreciated. > > There's the beginnings of a cross-referenced konnakol db at > http://ofb.net/~elaforge/solkattu/ > > E.g. here's the basic "end of thani" mohra, in the kizhkalam/melkalam > style: http://ofb.net/~elaforge/solkattu/Solkattu.Score.SolkattuMohra.c_mohra.html > > Since it's parameterized, I can plug in any patterns with the right > duration and it comes out in the right structure. From arrowd at freebsd.org Wed May 30 07:04:27 2018 From: arrowd at freebsd.org (Gleb Popov) Date: Wed, 30 May 2018 10:04:27 +0300 Subject: [Haskell-cafe] 8.4.2 FreeBSD bindist not working with gold & lld In-Reply-To: References: Message-ID: On Wed, May 30, 2018 at 8:41 AM, Sumit Raja wrote: > Hi, > > Just got 8.4.2 running in my FreeBSD 11 environment and am getting the > following: > cabal: Failed to build entropy-0.4.1.1 (which is required by exe:test-ghoa > from oauth2-simple-0.1.0.0). The failure occurred during the configure > step. > The exception was: > dieVerbatim: user error (cabal: '/usr/local/bin/ghc' exited with an error: > /usr/local/bin/ld.gold: error: > /usr/local/lib/ghc-8.4.2/rts/libHSrts_thr.a(RTS.thr_o): unexpected reloc > 8 in > object file > > LLD fails with > > configure step. The exception was: > dieVerbatim: user error (cabal: '/usr/local/bin/ghc' exited with an error: > /usr/bin/ld.lld: error: do not know how to handle relocation > 'R_X86_64_RELATIVE' (8) > > Saw another thread that discussed this but there was no resolution. Any > ideas on how to fix this? > At least LLD should be working by now on FreeBSD 12, see https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=226872 I don't know if there are plans to merge this fix to 11 branch, though. > Thanks > Sumit > > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view 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 polux2001 at gmail.com Wed May 30 07:32:51 2018 From: polux2001 at gmail.com (Paul Brauner) Date: Wed, 30 May 2018 09:32:51 +0200 Subject: [Haskell-cafe] Selecting a transformer in a monad transformer stack In-Reply-To: <10033134-9012-2218-cabb-813b63b58246@gmail.com> References: <10033134-9012-2218-cabb-813b63b58246@gmail.com> Message-ID: I think monad-control is what I was looking for but was missing when trying to come up with a solution involving lift. Thanks! Paul On Tue, May 29, 2018 at 11:15 PM Li-yao Xia wrote: > Hi Paul, > > We can use Data.Coerce.coerce to do the (un)wrapping and defer to the > Alternative/MonadPlus instance at the right level. > > (MyMonad a) is representationally equivalent to (Stack (Either String > a)), where Stack is defined as > > type Stack = ReaderT Env (StateT Store (ListT Identity)) > > Thus, we can coerce Stack's MonadPlus methods (which lift ListT's > methods) as follows: > > > import Data.Coerce > > instance MonadPlus MyMonad where > mzero :: forall a. MyMonad a > mzero = coerce (mzero @Stack @(Either String a)) > > mplus :: forall a. MyMonad a -> MyMonad a -> MyMonad a > mplus = coerce (mplus @Stack @(Either String a)) > > > The upcoming DerivingVia generalizes this pattern somewhat, although it > will be necessary to pick a different equivalent type than above. > > > newtype MyMonad = MyMonad { > runMyMonad :: ((ReaderT Env (ExceptT String > (StateT Store (ListT Identity)))) a) } > deriving (Functor, Applicative, Monad) > deriving (Alternative, MonadPlus) > via (ReaderT Env (ExceptT' String (StateT Store (ListT Identity)))) > > > where ExceptT' is a transformer identical to ExceptT, but it lifts the > transformed monad's MonadPlus instance instead of providing its own. > > A different solution is monad-control, which generalizes MonadTrans. > Like `lift`, `liftWith` moves an action "up" one level in a transformer > stack, but in addition, it provides a way to move "down" as well, as a > continuation given to the wrapped action. > > Although powerful, it is certainly not an easy interface to grasp, but > my point here is to demonstrate one use of it. > > > liftControl > :: (MonadTransControl t, Monad m, Monad (t m)) > => (Run t -> m (StT t a)) -> t m a > liftControl f = liftWith f >>= restoreT . return > > instance Alternative MyMonad where > empty = MyMonad ((lift . lift) empty) > MyMonad a <|> MyMonad b = MyMonad $ > liftControl $ \run1 -> liftControl $ \run2 -> > (run2 . run1) a <|> (run2 . run1) b > > > It's also not quite obvious this does the right thing so here are some > QuickCheck tests that these two implementations are equivalent to the > original one: > > https://lpaste.net/2697355636458389504 > > Cheers, > Li-yao > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view archives go to: > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe > Only members subscribed via the mailman list are allowed to post. -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.feuer at gmail.com Wed May 30 16:50:14 2018 From: david.feuer at gmail.com (David Feuer) Date: Wed, 30 May 2018 12:50:14 -0400 Subject: [Haskell-cafe] (names for) invariants for Eq and Ord? In-Reply-To: References: <0aa941ff-89bd-d587-e8aa-bc1e09deaccc@htwk-leipzig.de> Message-ID: I won't even commit to making sure Map operations are *deterministic* in the face of a non-reflexive ==. On Tue, May 29, 2018, 4:01 PM Levent Erkok wrote: > Johannes: > > Heartily agreed. In fact, oft-used modules like Data.Map also need to be > very clear regarding their requirements for Eq/Ord. It's well known in > the folklore that the law: > > M.lookup k (M.insert k v M.empty) == Just v > > fails for maps when the key can be floating point: > > Prelude> import qualified Data.Map as M > Prelude M> let k = 0/0 in let v = 0 in M.lookup k (M.insert k v > M.empty) == Just v > False > > Perhaps not a big deal as no-one should use floating-point values as a key > to a map, but there's nothing stopping from anyone from doing so. Perhaps > more worryingly, the Haskell report is largely silent about Eq/Ord > instances that come out-of-the-box for such gotchas as you yourself > observed. > > -Levent. > > > On Tue, May 29, 2018 at 12:26 PM, Simon Jakobi via Haskell-Cafe < > haskell-cafe at haskell.org> wrote: > >> Hi Johannes, >> >> https://ghc.haskell.org/trac/ghc/ticket/15078 might be interesting to >> you. >> >> Cheers, >> Simon >> >> 2018-05-28 16:47 GMT+02:00 Johannes Waldmann < >> johannes.waldmann at htwk-leipzig.de>: >> >>> Dear Cafe, >>> >>> I am somewhat surprised that the Haskell Standard (*) >>> >>> https://www.haskell.org/onlinereport/haskell2010/haskellch6.html#x13-1270006.3 >>> does not contain any >>> notation for (intended) properties of Eq and Ord instances, >>> and their relation. For Java (standard library), >>> the API spec uses wording like "consistent with equals" >>> https://docs.oracle.com/javase/10/docs/api/java/lang/Comparable.html >>> >>> I am well aware that semantics (transitivity, etc.) >>> cannot be enforced statically, in either language. >>> But both standards still speak of "total order". >>> Do we (Haskell) need something similar to "consistent with equals"? >>> >>> It depends. E.g., looking at a (random) source in containers >>> (Data.Map.Internal), it seems that it will always use the result of >>> compare, never of (==), on keys. That's not obvious from the docs. >>> I just checked -- I can make a type where (==) = undefined, >>> but write a proper Ord instance, and use it as key type. >>> >>> I am asking this because I will be teaching type classes, >>> with Eq and Ord as examples. I detected the funny situation >>> that the Java specification looks "more mathematical" >>> than the corresponding Haskell one. What will the students think ... >>> >>> - J.W. >>> >>> (*) The Haskell standard is what you find when you scroll >>> down, down, down to the very bottom of >>> https://www.haskell.org/documentation . So, probably not that >>> important... >>> _______________________________________________ >>> Haskell-Cafe mailing list >>> To (un)subscribe, modify options or view 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 carter.schonwald at gmail.com Wed May 30 18:54:52 2018 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Wed, 30 May 2018 14:54:52 -0400 Subject: [Haskell-cafe] ANN: primitive 0.6.4.0 Message-ID: This is a pretty exciting (albeit minor version) I'd like to especially thank David Feuer (treeowl ) and Andrew Martin (andrewthad) for their contributions the change log has a huge number of bug fixes relative to 0.6.2-3 also we added some new modules of features PrimArray --- unboxed nonsliceable vectors MVar -- Mvars that run in any PrimMonad augmented the Data.Primitive exports for increased consistency (the new .Ptr and .Mvar modules aren't exported in this minor version so users can easily migrate) Changes in version 0.6.4.0 - Introduce Data.Primitive.PrimArray, which offers types and function for dealing with a ByteArray tagged with a phantom type variable for tracking the element type. - Implement isByteArrayPinned and isMutableByteArrayPinned. - Add Eq1, Ord1, Show1, and Read1 instances for Array and SmallArray. - Improve the test suite. This includes having property tests for typeclasses from base such as Eq, Ord, Functor, Applicative, Monad, IsList, Monoid, Foldable, and Traversable. - Fix the broken IsList instance for ByteArray. The old definition would allocate a byte array of the correct size and then leave the memory unitialized instead of writing the list elements to it. - Fix the broken Functor instance for Array. The old definition would allocate an array of the correct size with thunks for erroring installed at every index. It failed to replace these thunks with the result of the function applied to the elements of the argument array. - Fix the broken Applicative instances of Array and SmallArray. The old implementation of <*> for Arrayfailed to initialize some elements but correctly initialized others in the resulting Array. It is unclear what the old behavior of <*> was for SmallArray, but it was incorrect. - Fix the broken Monad instances for Array and SmallArray. - Fix the implementation of foldl1 in the Foldable instances for Array and SmallArray. In both cases, the old implementation simply returned the first element of the array and made no use of the other elements in the array. - Fix the implementation of mconcat in the Monoid instance for SmallArray. - Implement Data.Primitive.Ptr, implementations of Ptr functions that require a Prim constraint instead of a Storable constraint. - Add PrimUnlifted instances for TVar and MVar. - Use compareByteArrays# for the Eq and Ord instances of ByteArray when building with GHC 8.4 and newer. - Add Prim instances for lots of types in Foreign.C.Types and System.Posix.Types. - Reexport Data.Primitive.SmallArray and Data.Primitive.UnliftedArray from Data.Primitive. - Add fold functions and map function to Data.Primitive.UnliftedArray. Add typeclass instances for IsList, Ord, and Show. - Add defaultSetByteArray# and defaultSetOffAddr# to Data.Primitive.Types. -------------- next part -------------- An HTML attachment was scrubbed... URL: From olf at aatal-apotheke.de Wed May 30 19:45:00 2018 From: olf at aatal-apotheke.de (Olaf Klinke) Date: Wed, 30 May 2018 21:45:00 +0200 Subject: [Haskell-cafe] (names for) invariants for Eq and Ord? Message-ID: <4E0FB9A2-2C85-42B8-9C3F-28958392199D@aatal-apotheke.de> Prelude> import qualified Data.Map as M Prelude M> let k = 0/0 in let v = 0 in M.lookup k (M.insert k v M.empty) == Just v False This one is not surprising because the presence of 0/0 destroys the total order of Double, so strictly speaking this should not have an Ord instance. Olaf From drkoster at qq.com Wed May 30 20:19:23 2018 From: drkoster at qq.com (=?gb18030?B?RHIuS29zdGVy?=) Date: Thu, 31 May 2018 04:19:23 +0800 Subject: [Haskell-cafe] ANN: primitive 0.6.4.0 Message-ID: I have make some comments on reddit, but still I want to record them here: After reading the new code, I got a feeling that there're some API lacking considerations. Here is some of my personal concerns: The generalized MVar is basically useless because ST is meant to seal its state token, you won't want to add a forkST. You can argue that the atomic operations on MutVar is already added, but still I want to justify its usefulness. There're too much combinators added to PrimArray, is there a plan to port these to other arrays? If we ever provide toList operations, then I would really want it to be a good producer in base's fold-build fusion' view, it's robust and easy to implement, and folding is basically the same speed with List.fold and toList. Anyway it seems I missed the bike shedding, but still I want to thank for all the efforts, I'll try to follow new GitHub workflow more closely. Cheers Winter 发自我的iPhone ------------------ Original ------------------ From: Carter Schonwald Date: Thu,May 31,2018 2:55 AM To: haskell-cafe , Haskell Libraries Subject: Re: [Haskell-cafe] ANN: primitive 0.6.4.0 This is a pretty exciting (albeit minor version) I'd like to especially thank David Feuer (treeowl ) and Andrew Martin (andrewthad) for their contributions the change log has a huge number of bug fixes relative to 0.6.2-3 also we added some new modules of features PrimArray --- unboxed nonsliceable vectors MVar -- Mvars that run in any PrimMonad augmented the Data.Primitive exports for increased consistency (the new .Ptr and .Mvar modules aren't exported in this minor version so users can easily migrate) Changes in version 0.6.4.0 Introduce Data.Primitive.PrimArray, which offers types and function for dealing with a ByteArray tagged with a phantom type variable for tracking the element type. Implement isByteArrayPinned and isMutableByteArrayPinned. Add Eq1, Ord1, Show1, and Read1 instances for Array and SmallArray. Improve the test suite. This includes having property tests for typeclasses from base such as Eq, Ord, Functor, Applicative, Monad, IsList, Monoid, Foldable, and Traversable. Fix the broken IsList instance for ByteArray. The old definition would allocate a byte array of the correct size and then leave the memory unitialized instead of writing the list elements to it. Fix the broken Functor instance for Array. The old definition would allocate an array of the correct size with thunks for erroring installed at every index. It failed to replace these thunks with the result of the function applied to the elements of the argument array. Fix the broken Applicative instances of Array and SmallArray. The old implementation of <*> for Arrayfailed to initialize some elements but correctly initialized others in the resulting Array. It is unclear what the old behavior of <*> was for SmallArray, but it was incorrect. Fix the broken Monad instances for Array and SmallArray. Fix the implementation of foldl1 in the Foldable instances for Array and SmallArray. In both cases, the old implementation simply returned the first element of the array and made no use of the other elements in the array. Fix the implementation of mconcat in the Monoid instance for SmallArray. Implement Data.Primitive.Ptr, implementations of Ptr functions that require a Prim constraint instead of a Storable constraint. Add PrimUnlifted instances for TVar and MVar. Use compareByteArrays# for the Eq and Ord instances of ByteArray when building with GHC 8.4 and newer. Add Prim instances for lots of types in Foreign.C.Types and System.Posix.Types. Reexport Data.Primitive.SmallArray and Data.Primitive.UnliftedArray from Data.Primitive. Add fold functions and map function to Data.Primitive.UnliftedArray. Add typeclass instances for IsList, Ord, and Show. Add defaultSetByteArray# and defaultSetOffAddr# to Data.Primitive.Types. -------------- next part -------------- An HTML attachment was scrubbed... URL: From olf at aatal-apotheke.de Wed May 30 20:24:26 2018 From: olf at aatal-apotheke.de (Olaf Klinke) Date: Wed, 30 May 2018 22:24:26 +0200 Subject: [Haskell-cafe] Config Files and monoids In-Reply-To: References: <55fac148-8f53-26ec-818c-45a163efd5c2@hexagoxel.de> Message-ID: <4523A76E-1F11-4E15-A541-949F288CF8B4@aatal-apotheke.de> Thanks to Lennart, Matt, Douglas and Sven for the links to the intetesting posts. Once you know it, the higher-kinded approach seems a natural solution to the problem at hand. I might even begin to like type families on account of their ability to eliminate the Identity constructor in `Option Identity`. I shall re-work my option parser type class an see how much easier it gets. Olaf From carter.schonwald at gmail.com Wed May 30 20:53:29 2018 From: carter.schonwald at gmail.com (Carter Schonwald) Date: Wed, 30 May 2018 16:53:29 -0400 Subject: [Haskell-cafe] ANN: primitive 0.6.4.0 In-Reply-To: References: Message-ID: I think your feedback makes perfect sense (to repeat what i said on reddit) for *MVar*: this was an addition Dan Doel and I discussed some years ago but never quite got to. The context is 1) its totally well behaved (though in isolation theres indeed a valid argument for MutVar instead) 2) it means theres some off the shelf substrate for userland / library land experimentation with approaches to deterministic parallism/concurrency (a la the LVar package or the like) 3) more tools for writing mutable thread safe data structures which may have both pure and mutable interfaces. as for *PrimArray* having more operations than the analogous Array and SmallArray, that was definitely an oversight. Its one of those things thats obvious once its said, but easy to lose track of if no one points it out when lost in the weeds as for lists/fusion, your points make perfect sense. please feel welcome to chip in on infrastructure/code review when you deem it worthwhile! Ryan and myself are definitely spread thin with our various other focii, and i'm told many collaborating hands make light work (ideally :) ) many thanks :) -Carter On Wed, May 30, 2018 at 4:19 PM, Dr.Koster wrote: > I have make some comments on reddit, but still I want to record them here: > After reading the new code, I got a feeling that there're some API lacking > considerations. Here is some of my personal concerns: > > 1. > > The generalized MVar is basically useless because ST is meant to seal > its state token, you won't want to add a forkST. You can argue that the > atomic operations on MutVar is already added, but still I want to justify > its usefulness. > 2. > > There're too much combinators added to PrimArray, is there a plan to > port these to other arrays? > 3. > > If we ever provide toList operations, then I would really want it to > be a good producer in base's fold-build fusion' view, it's robust and easy > to implement, and folding is basically the same speed with List.fold and > toList. > > Anyway it seems I missed the bike shedding, but still I want to thank for > all the efforts, I'll try to follow new GitHub workflow more closely. > Cheers > Winter > 发自我的iPhone > > > ------------------ Original ------------------ > *From:* Carter Schonwald > *Date:* Thu,May 31,2018 2:55 AM > *To:* haskell-cafe , Haskell Libraries < > libraries at haskell.org> > *Subject:* Re: [Haskell-cafe] ANN: primitive 0.6.4.0 > > This is a pretty exciting (albeit minor version) > > I'd like to especially thank David Feuer (treeowl ) and Andrew Martin > (andrewthad) for their contributions > > the change log has a huge number of bug fixes relative to 0.6.2-3 > > also we added some new modules of features > > PrimArray --- unboxed nonsliceable vectors > MVar -- Mvars that run in any PrimMonad > > augmented the Data.Primitive exports for increased consistency > (the new .Ptr and .Mvar modules aren't exported in this minor version so > users can easily migrate) > > Changes in version 0.6.4.0 > > - > > Introduce Data.Primitive.PrimArray, which offers types and function > for dealing with a ByteArray tagged with a phantom type variable for > tracking the element type. > - > > Implement isByteArrayPinned and isMutableByteArrayPinned. > - > > Add Eq1, Ord1, Show1, and Read1 instances for Array and SmallArray. > - > > Improve the test suite. This includes having property tests for > typeclasses from base such as Eq, Ord, Functor, Applicative, Monad, > IsList, Monoid, Foldable, and Traversable. > - > > Fix the broken IsList instance for ByteArray. The old definition would > allocate a byte array of the correct size and then leave the memory > unitialized instead of writing the list elements to it. > - > > Fix the broken Functor instance for Array. The old definition would > allocate an array of the correct size with thunks for erroring installed at > every index. It failed to replace these thunks with the result of the > function applied to the elements of the argument array. > - > > Fix the broken Applicative instances of Array and SmallArray. The old > implementation of <*> for Arrayfailed to initialize some elements but > correctly initialized others in the resulting Array. It is unclear > what the old behavior of <*> was for SmallArray, but it was incorrect. > - > > Fix the broken Monad instances for Array and SmallArray. > - > > Fix the implementation of foldl1 in the Foldable instances for Array > and SmallArray. In both cases, the old implementation simply returned > the first element of the array and made no use of the other elements in the > array. > - > > Fix the implementation of mconcat in the Monoid instance for SmallArray > . > - > > Implement Data.Primitive.Ptr, implementations of Ptr functions that > require a Prim constraint instead of a Storable constraint. > - > > Add PrimUnlifted instances for TVar and MVar. > - > > Use compareByteArrays# for the Eq and Ord instances of ByteArray when > building with GHC 8.4 and newer. > - > > Add Prim instances for lots of types in Foreign.C.Types and System. > Posix.Types. > - > > Reexport Data.Primitive.SmallArray and Data.Primitive.UnliftedArray > from Data.Primitive. > - > > Add fold functions and map function to Data.Primitive.UnliftedArray. > Add typeclass instances for IsList, Ord, and Show. > - > > Add defaultSetByteArray# and defaultSetOffAddr# to Data.Primitive.Types > . > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrew.thaddeus at gmail.com Thu May 31 00:03:59 2018 From: andrew.thaddeus at gmail.com (Andrew Martin) Date: Wed, 30 May 2018 20:03:59 -0400 Subject: [Haskell-cafe] ANN: primitive 0.6.4.0 In-Reply-To: References: Message-ID: <26A9C8F4-174A-402C-AAD2-ED772CECF909@gmail.com> Thanks for the feedback. Also, thanks for the giant PR you made a year ago. Several of the things I implemented in this release were just things I ripped out of it and put into smaller PRs. To address your questions: - There are more combinators in PrimArray than there are in the other modules. This is an inconsistency in the library design. We need to come up with a policy for what combinators are accepted. It’s weird to have a Foldable instance for Array but not get access to foldl’ and foldr for PrimArray and UnliftedArray. Similarly, functions for mapping and travsersing seem reasonable just so that you have access to the same interface if you switch from using Array to one of the other array types that isn’t fully polymorphic in its element type. I’ve considered removing some of the functions (like replicatePrimArray) in a future release. The maintainers of primitive don’t all share the same view on what exactly should be there, so we probably need to come up with a policy around this. - We should definitely have toList be a good producer. This has been discussed in other PRs. A PR for this would be accepted. - The generalized MVar is basically useless without unsafely extending it (ie forkST). But, everything provided is 100% deterministic. You have to write forkST on your own and take on the burden of proving that you use it in a way that results in deterministic behavior. I have written a package that implements a parallel variant of mergesort that needs this kind of this. I think there’s something Carter wanted to do with this as well. Sent from my iPhone > On May 30, 2018, at 4:19 PM, Dr.Koster wrote: > > I have make some comments on reddit, but still I want to record them here: > After reading the new code, I got a feeling that there're some API lacking considerations. Here is some of my personal concerns: > The generalized MVar is basically useless because ST is meant to seal its state token, you won't want to add a forkST. You can argue that the atomic operations on MutVar is already added, but still I want to justify its usefulness. > > There're too much combinators added to PrimArray, is there a plan to port these to other arrays? > > If we ever provide toList operations, then I would really want it to be a good producer in base's fold-build fusion' view, it's robust and easy to implement, and folding is basically the same speed with List.fold and toList. > > Anyway it seems I missed the bike shedding, but still I want to thank for all the efforts, I'll try to follow new GitHub workflow more closely. > > Cheers > Winter > 发自我的iPhone > > > ------------------ Original ------------------ > From: Carter Schonwald > Date: Thu,May 31,2018 2:55 AM > To: haskell-cafe , Haskell Libraries > Subject: Re: [Haskell-cafe] ANN: primitive 0.6.4.0 > > This is a pretty exciting (albeit minor version) > > I'd like to especially thank David Feuer (treeowl ) and Andrew Martin (andrewthad) for their contributions > > the change log has a huge number of bug fixes relative to 0.6.2-3 > > also we added some new modules of features > > PrimArray --- unboxed nonsliceable vectors > MVar -- Mvars that run in any PrimMonad > > augmented the Data.Primitive exports for increased consistency > (the new .Ptr and .Mvar modules aren't exported in this minor version so users can easily migrate) > > Changes in version 0.6.4.0 > > Introduce Data.Primitive.PrimArray, which offers types and function for dealing with a ByteArray tagged with a phantom type variable for tracking the element type. > > Implement isByteArrayPinned and isMutableByteArrayPinned. > > Add Eq1, Ord1, Show1, and Read1 instances for Array and SmallArray. > > Improve the test suite. This includes having property tests for typeclasses from base such as Eq, Ord, Functor, Applicative, Monad, IsList, Monoid, Foldable, and Traversable. > > Fix the broken IsList instance for ByteArray. The old definition would allocate a byte array of the correct size and then leave the memory unitialized instead of writing the list elements to it. > > Fix the broken Functor instance for Array. The old definition would allocate an array of the correct size with thunks for erroring installed at every index. It failed to replace these thunks with the result of the function applied to the elements of the argument array. > > Fix the broken Applicative instances of Array and SmallArray. The old implementation of <*> for Arrayfailed to initialize some elements but correctly initialized others in the resulting Array. It is unclear what the old behavior of <*> was for SmallArray, but it was incorrect. > > Fix the broken Monad instances for Array and SmallArray. > > Fix the implementation of foldl1 in the Foldable instances for Array and SmallArray. In both cases, the old implementation simply returned the first element of the array and made no use of the other elements in the array. > > Fix the implementation of mconcat in the Monoid instance for SmallArray. > > Implement Data.Primitive.Ptr, implementations of Ptr functions that require a Prim constraint instead of a Storable constraint. > > Add PrimUnlifted instances for TVar and MVar. > > Use compareByteArrays# for the Eq and Ord instances of ByteArray when building with GHC 8.4 and newer. > > Add Prim instances for lots of types in Foreign.C.Types and System.Posix.Types. > > Reexport Data.Primitive.SmallArray and Data.Primitive.UnliftedArray from Data.Primitive. > > Add fold functions and map function to Data.Primitive.UnliftedArray. Add typeclass instances for IsList, Ord, and Show. > > Add defaultSetByteArray# and defaultSetOffAddr# to Data.Primitive.Types. > > > _______________________________________________ > Haskell-Cafe mailing list > To (un)subscribe, modify options or view 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 vanessa.mchale at iohk.io Thu May 31 01:01:31 2018 From: vanessa.mchale at iohk.io (Vanessa McHale) Date: Wed, 30 May 2018 20:01:31 -0500 Subject: [Haskell-cafe] ANN: fast-arithmetic 0.6.0.7 Message-ID: <703774bd-8737-7c8f-4ef4-46cb6599f50f@iohk.io> Hi all, I have just published a new version of fast-arithmetic . It provides fast primitives for number theory and combinatorics on Linux and Mac. The latest release has few dependencies and thus builds should be quite robust. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 488 bytes Desc: OpenPGP digital signature URL: From juhpetersen at gmail.com Thu May 31 15:58:37 2018 From: juhpetersen at gmail.com (Jens Petersen) Date: Fri, 1 Jun 2018 00:58:37 +0900 Subject: [Haskell-cafe] [ANNOUNCE] GHC 8.4.3 released In-Reply-To: <87lgc2kyyx.fsf@smart-cactus.org> References: <87lgc2kyyx.fsf@smart-cactus.org> Message-ID: On 30 May 2018 at 05:07, Ben Gamari wrote: > https://downloads.haskell.org/~ghc/8.4.3 Thanks! I have built it for Fedora and EPEL 7 (RHEL/CentOS) in a Copr repo: https://copr.fedorainfracloud.org/coprs/petersen/ghc-8.4.3 Cheers, Jens From nikivazou at gmail.com Thu May 31 20:59:37 2018 From: nikivazou at gmail.com (Niki Vazou) Date: Thu, 31 May 2018 16:59:37 -0400 Subject: [Haskell-cafe] PLMW@ICFP: CALL FOR SCHOLARSHIP APPLICATIONS and PARTICIPATION (deadline June 30!) Message-ID: PLMW at ICFP: CALL FOR SCHOLARSHIP APPLICATIONS and PARTICIPATION (deadline June 30!) ACM SIGPLAN Programming Languages Mentoring Workshop Co-located with ICFP'18 PLMW web page: https://icfp18.sigplan.org/track/PLMW-ICFP-2018 The purpose of the programming languages mentoring workshop (PLMW) is to encourage senior undergraduate and early career (first or second year) to pursue careers in programming language research. We are specifically interested in attracting groups who have traditionally not had the opportunity to participate in research in functional programming. This workshop will be a combination of learning about the work being done in several areas of programming language research and mentoring with respect to helping students prepare for graduate school and the rest of their career. We will bring together leaders in programming language research from academia and industry to give talks on the kind of research typically performed after obtaining a Ph.D. The workshop will engage students, specifically interested in programming language research, in a process of imagining how they might contribute to the world. We especially encourage women and underrepresented minority students to attend PLMW. This workshop is part of the activities surrounding ICFP, the International Conference on Functional Programming, and takes place the day before the main conference. One goal of the workshop is to make ICFP conference more accessible to newcomers. We hope that participants will stay through the entire conference. ## Travel Scholarship Applications (Due 30 June) Please fill out this form https://goo.gl/forms/7o4nENLxzAo2zwYy1. by 30 June to apply for travel funding. See the PLMW web page for additional details. The workshop registration is open to all. Students with alternative sources of funding are welcome. Best, Niki Vazou -------------- next part -------------- An HTML attachment was scrubbed... URL: