Re: [Haskell-cafe] The maximum/minimum asymmetry

2011-09-05 Thread Alexander Dunlap
On 4 September 2011 21:44, Mario Blažević blama...@acanac.net wrote:    I was recently surprised to discover that the maximum and maximumBy functions always return the *last* maximum, while minimum and minimumBy return the *first* minimum in the list. The following GHCi session demonstrates

[Haskell-cafe] Lens with merge (Semigroup)

2011-09-05 Thread Tony Morris
A regular Lens can be represented as follows: data CoState a = CoState (a - b) a newtype Lens a b = Lens (a - CoState b a) I once read about a lens representation that permits a general merge operation. I forget where I read it -- I think it was #haskell IRC. However, as I recall, perhaps

Re: [Haskell-cafe] Smarter do notation

2011-09-05 Thread Max Bolingbroke
On 5 September 2011 02:38, Sebastian Fischer fisc...@nii.ac.jp wrote: These are important questions. I think there is a trade-off between supporting many cases and having a simple desugaring. We should find a sweet-spot where the desugaring is reasonably simple and covers most idiomatic cases.

Re: [Haskell-cafe] Smarter do notation

2011-09-05 Thread Max Bolingbroke
On 5 September 2011 08:35, Max Bolingbroke batterseapo...@hotmail.com wrote: (If you do want to support the type checker only generating requests for an Applicative constraint you could just insist that user code writes pure instead of return, in which case this would be quite easy to

Re: [Haskell-cafe] The maximum/minimum asymmetry

2011-09-05 Thread Daniel Fischer
On Monday 05 September 2011, 08:35:30, Alexander Dunlap wrote: On 4 September 2011 21:44, Mario Blažević blama...@acanac.net wrote: I was recently surprised to discover that the maximum and maximumBy functions always return the *last* maximum, while minimum and minimumBy return the

Re: [Haskell-cafe] Smarter do notation

2011-09-05 Thread Sebastian Fischer
Hi Max, thanks for you proposal! Using the Applicative methods to optimise do desugaring is still possible, it's just not that easy to have that weaken the generated constraint from Monad to Applicative since only degenerate programs like this one won't use a Monad method: Is this still

Re: [Haskell-cafe] Idiomatic usage of the fixpoint library

2011-09-05 Thread Sean Leather
On Sun, Sep 4, 2011 at 13:03, Roman Cheplyaka wrote: * Sean Leather [2011-09-04 12:48:38+0200] On Sun, Sep 4, 2011 at 12:31, Roman Cheplyaka wrote: I'm looking for an example of idiomatic usage of the fixpoint library[1]. [1]: http://hackage.haskell.org/package/fixpoint-0.1.1

Re: [Haskell-cafe] Smarter do notation

2011-09-05 Thread Sebastian Fischer
Hi again, I think the following rules capture what Max's program does if applied after the usual desugaring of do-notation: a = \p - return b -- (\p - b) $ a a = \p - f $ b -- 'free p' and 'free b' disjoint -- ((\p - f) $ a) * b a = \p - f $ b -- 'free p' and 'free f' disjoint -- f $ (a =

Re: [Haskell-cafe] Idiomatic usage of the fixpoint library

2011-09-05 Thread Roman Leshchinskiy
Roman Cheplyaka wrote: {-# LANGUAGE TypeFamilies, FlexibleContexts, UndecidableInstances, FlexibleInstances #-} import Data.Fixpoint newtype Expr = Expr { unExpr :: Pre Expr Expr } instance Functor (Pre Expr) = Fixpoint Expr where data Pre Expr a = Add

Re: [Haskell-cafe] Smarter do notation

2011-09-05 Thread Thomas Schilling
On 5 September 2011 13:41, Sebastian Fischer fisc...@nii.ac.jp wrote: Hi again, I think the following rules capture what Max's program does if applied after the usual desugaring of do-notation: a = \p - return b -- (\p - b) $ a a = \p - f $ b -- 'free p' and 'free b' disjoint --

[Haskell-cafe] Package descriptions on hackage

2011-09-05 Thread Joachim Breitner
Dear hackage package authors, this is a short message from your distribution package creators: Please, if possible, write good, not too short descriptions, and also keep them up to date. Of course, users browsing hackage will benefit as well. Keep in mind that the users do not know what other

Re: [Haskell-cafe] The maximum/minimum asymmetry

2011-09-05 Thread Albert Y. C. Lai
On 11-09-05 12:44 AM, Mario Blažević wrote: I was recently surprised to discover that the maximum and maximumBy functions always return the *last* maximum, while minimum and minimumBy return the *first* minimum in the list. Though not beautifully symmetric, it's beautifully dual!

Re: [Haskell-cafe] The maximum/minimum asymmetry

2011-09-05 Thread Sjoerd Visscher
This way these laws hold for non-empty lists: maximumBy f xs = last (sortBy f xs) minimumBy f xs = head (sortBy f xs) Sjoerd Visscher On Sep 5, 2011, at 6:44 AM, Mario Blažević wrote: I was recently surprised to discover that the maximum and maximumBy functions always return the *last*

Re: [Haskell-cafe] Smarter do notation

2011-09-05 Thread Sebastian Fischer
On Mon, Sep 5, 2011 at 10:19 PM, Thomas Schilling nomin...@googlemail.comwrote: a = \p - f $ b -- 'free p' and 'free b' disjoint -- ((\p - f) $ a) * b Will there also be an optimisation for some sort of simple patterns? I.e., where we could rewrite this to: liftA2 (\pa pb - f ...) a

[Haskell-cafe] Fwd: Smarter do notation

2011-09-05 Thread Alberto G. Corona
-- Forwarded message -- From: Alberto G. Corona agocor...@gmail.com Date: 2011/9/5 Subject: Re: [Haskell-cafe] Smarter do notation To: Sebastian Fischer fisc...@nii.ac.jp Cc: Max Bolingbroke batterseapo...@hotmail.com, haskell-cafe@haskell.org The problem in the parallel

Re: [Haskell-cafe] Smarter do notation

2011-09-05 Thread Alberto G. Corona
The problem in the parallel distribution of monadic computations that may have been Applicative seems to be the operator But if Monad is defined as a subclass of applicative: http://www.haskell.org/haskellwiki/Functor-Applicative-Monad_Proposal then can be defined as () = (*) and

Re: [Haskell-cafe] The maximum/minimum asymmetry

2011-09-05 Thread Mario Blažević
On 11-09-05 10:42 AM, Sjoerd Visscher wrote: This way these laws hold for non-empty lists: maximumBy f xs = last (sortBy f xs) minimumBy f xs = head (sortBy f xs) That's not a bad justification for the way implementation works, even if it's not the original reason behind it. I think

[Haskell-cafe] GHC/Cabal on AFS

2011-09-05 Thread Tristan Ravitch
I have the Haskell Platform (and my home directory with my cabal-installed packages) installed on an AFS (a network filesystem) volume and have been noticing a strange issue. Whenever I install a package using cabal-install and it gets to a phase of the build where it needs to load a bunch of

Re: [Haskell-cafe] GHC/Cabal on AFS

2011-09-05 Thread Neil Davies
Yep We get this as well - as you say, once it is in the cache it works fine Neil On 5 Sep 2011, at 18:06, Tristan Ravitch wrote: I have the Haskell Platform (and my home directory with my cabal-installed packages) installed on an AFS (a network filesystem) volume and have been noticing a

[Haskell-cafe] Solving the configuration problem with parametrized modules

2011-09-05 Thread Joachim Breitner
Hi Cafe, this is an idea that has been floating in my head for a while, and I’m wondering about its feasibility and, if feasible, complexity (in the range from „trivial“ over “blog post” over “paper” to “thesis”). Application authors in Haskell often face the problem of run-time constants, e.g.

Re: [Haskell-cafe] Solving the configuration problem with parametrized modules

2011-09-05 Thread Gwern Branwen
On Mon, Sep 5, 2011 at 1:43 PM, Joachim Breitner m...@joachim-breitner.de wrote: Do you think this could be useful (from a user point of view)? Has this idea maybe already been proposed? How does it compare with Oleg's typeclass approach? http://okmij.org/ftp/Haskell/types.html#Prepose --

Re: [Haskell-cafe] Solving the configuration problem with parametrized modules

2011-09-05 Thread Joachim Breitner
Hi, Am Montag, den 05.09.2011, 14:35 -0400 schrieb Gwern Branwen: On Mon, Sep 5, 2011 at 1:43 PM, Joachim Breitner m...@joachim-breitner.de wrote: Do you think this could be useful (from a user point of view)? Has this idea maybe already been proposed? How does it compare with Oleg's

Re: [Haskell-cafe] Smarter do notation

2011-09-05 Thread Thomas Schilling
On 5 September 2011 15:49, Sebastian Fischer fisc...@nii.ac.jp wrote: On Mon, Sep 5, 2011 at 10:19 PM, Thomas Schilling nomin...@googlemail.com wrote: a = \p - f $ b -- 'free p' and 'free b' disjoint  -- ((\p - f) $ a) * b Will there also be an optimisation for some sort of simple

Re: [Haskell-cafe] Solving the configuration problem with parametrized modules

2011-09-05 Thread Erik de Castro Lopo
Joachim Breitner wrote: The big downside is the verbosity of the approach: A lot of parameters need to be passed, and if one such value is suddenly required in a function where it was not before, this function’s signature and all functions using it have to be modified. Also, I expect that the

Re: [Haskell-cafe] Package descriptions on hackage

2011-09-05 Thread Ivan Lazar Miljenovic
On 5 September 2011 23:59, Joachim Breitner m...@joachim-breitner.de wrote: Dear hackage package authors, this is a short message from your distribution package creators: Please, if possible, write good, not too short descriptions, and also keep them up to date. Of course, users browsing

Re: [Haskell-cafe] Solving the configuration problem with parametrized modules

2011-09-05 Thread David Barbour
On Mon, Sep 5, 2011 at 3:15 PM, Erik de Castro Lopo mle...@mega-nerd.comwrote: Can't this be mostly solved by putting all these configuration parameters in a struct and then using implicit parameters: Implicit parameters seem like a fair option. And propagating: (?fooConf :: FooConf) =