Re: [Haskell-cafe] [Haskell] Hackage 2 now available for beta testing

2013-09-10 Thread Ross Paterson
On Mon, Sep 09, 2013 at 07:23:59PM +0100, Duncan Coutts wrote:
 Well-Typed and the Industrial Haskell Group (IHG) are very pleased to
 announce that Hackage 2 is now available for public beta testing. The
 plan is to do the final switchover in late September, to coincide
 with ICFP.
 
 http://beta.hackage.haskell.org/

What's the story with haddock documentation?  I see that some packages
have docs imported from the old server, some have newly generated docs,
and some have none, but no indication whether a bot has tried to build
it or not.  There's mention of maintainer uploads of docs as a fallback,
but I couldn't find where one would do that.  (It would also need to
document the flags needed to get the links right.)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Best practices for Arrows?

2013-06-22 Thread Ross Paterson
On Sat, Jun 22, 2013 at 07:05:09PM +0100, Tom Ellis wrote:
 On Sat, Jun 22, 2013 at 03:36:15PM +0200, Ertugrul Söylemez wrote:
  If the interface is not under your control, make yourself comfortable
  with the complete arrow syntax, most notably how it handles operators,
  combinators and the `(| banana bracket notation |)`.  This is very
  valuable information.
 
 Interesting.  I hadn't noticed the `(| banana bracket notation |)` on the
 GHC Arrows page[1] before, but just saw it when I went back to check.

The banana brackets can be handy when you have operations on your arrow
type beyond the ones in Arrow and ArrowLoop.  But beware that the types of
the operations you can use with it will be changing in the next release
of GHC.  The change is the first one described on

http://hackage.haskell.org/trac/ghc/wiki/ArrowNotation

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Why isn't ArrowChoice a parent of of ArrowApply?

2013-06-20 Thread Ross Paterson
On Thu, Jun 20, 2013 at 09:02:48AM +0200, Petr Pudlák wrote:
 In Control.Arrow we have:
 
 leftApp :: ArrowApply a = a b c - a (Either b d) (Either c d)
 
 Any instance of ArrowApply can be made into an instance of ArrowChoice by
 defining left = leftApp.
 
 So why isn't ArrowChoice a parent of ArrowApply?

Probably because it wasn't in John Hughes's original paper.
I agree that it would make sense.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: rematch, an library for composable assertions with human readable failure messages

2013-04-16 Thread Ross Paterson
On Tue, Apr 16, 2013 at 10:17:48AM +0100, Tom Crayford wrote:
  The core API is very simple:
 
 data Matcher a = Matcher {
 match :: a - Bool
   -- ^ A function that returns True if the matcher should pass, False if it
 should fail
   , description :: String
   -- ^ A description of the matcher (usually of its success conditions)
   , describeMismatch :: a - String
   -- ^ A description to be shown if the match fails.
   }

How about combining match and describeMismatch as a single function
of type a - Match?  Then you wouldn't need the precondition on
describeMismatch.

Defining a Monoid instance for Match might also be useful.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] arrow notation

2013-02-12 Thread Ross Paterson
On Mon, Feb 11, 2013 at 09:32:25AM +0100, Petr Pudlák wrote:
 While the implementation of Applicative can be defined without actually using
 `delay`:
 
 newtype ArrowApp a b c = ArrowApp (a b c)
 
 instance Arrow a = Functor (ArrowApp a b) where
 fmap f (ArrowApp a) = ArrowApp (a ^ f)
 instance ArrowDelay a = Applicative (ArrowApp a b) where
 pure x =
 ArrowApp $ arr (const x)
 (ArrowApp af) * (ArrowApp ax) =
 ArrowApp $ (af  ax) ^ uncurry ($)
 
 I believe it only satisfies the laws only if the arrow satisfies delay/force
 laws.

This is a reader, which always satisfies the applicative laws.
What ArrowDelay does is pick out the arrows that are equivalent to
the static arrow, i.e. F(b-c), of some applicative functor F.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] arrow notation

2013-02-11 Thread Ross Paterson
On Sun, Feb 10, 2013 at 09:28:12PM +0100, Petr Pudlák wrote:
 2013/2/9 Conal Elliott co...@conal.net wrote:
  What I have in mind is a small collection of methods including fst  snd
  (and similarly for sums) that could be defined via arr but could instead
  form the basis of translating restricted arrow notation for (pseudo-)arrows
  that don't support arr.
  
 I also support this idea, I'd appreciate such a generalization.
 
 As an example, where it would be useful: One of my students was working on a
 (very nice) project where he used Haskell as a DSL for generating a FRP-like
 javascript code.  The arrow notation without arr would be ideal for this
 situation. He couldn't implement arr as it would require to translate an
 arbitrary Haskell function to JS. So having a more general variant of Arrow
 without arr and with a collection of methods sufficient for the arrow
 notation would be quite helpful. (I wonder what methods would have to be
 included in the collection.)

Let's try to break this down.  Suppose we split

  arr :: forall b c. (b - c) - a b c

into two primitives

  (^) :: forall b c d. (b - c) - a c d - a b d
  id :: forall b. a b b

The contravariant functor (^) is essential to arrow notation, but I
suspect the issue is the universally quantified b in the type of id (or
equivalently returnA).  One might instead use a variant of id constrained
to an ADT with just the operations you want.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] arrow notation

2013-02-08 Thread Ross Paterson
The proposed changes are described here:

http://hackage.haskell.org/trac/ghc/wiki/ArrowNotation

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] arrow notation

2013-02-07 Thread Ross Paterson
I'd like to hear from anyone who's using arrow notation as supported by GHC,
because I'm planning a couple of changes to parts of it.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] arrow notation

2013-02-07 Thread Ross Paterson
On Thu, Feb 07, 2013 at 02:49:40PM -0800, Conal Elliott wrote:
 I make some use of arrow notation, though sadly I often have to avoid
 it because my (pseudo-)arrows don't have arr. I'd love to see a
 variant that has restricted expressiveness in exchange for arr-freeness.

It's hard to imagine arrow notation without arr (or at least
contravariance in the first argument of the arrow) because forming
expressions using the local environment is so central to it.  That is,
I can't imagine what things you are trying to write in that situation.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] catamorphisms and attribute grammars

2013-01-29 Thread Ross Paterson
On Sun, Jan 27, 2013 at 12:20:25AM +, Roman Cheplyaka wrote:
 Very nice! This can be generalized to arbitrary arrows:
 
   {-# LANGUAGE ExistentialQuantification #-}
 
   import Prelude hiding (id)
   import Control.Arrow
   import Control.Applicative
   import Control.Category
 
   data F from to b c = forall d . F (from b d) (to d c)
 
   instance (Arrow from, Arrow to) = Functor (F from to b) where
 fmap f x = pure f * x
 
   instance (Arrow from, Arrow to) = Applicative (F from to b) where
 pure x = F (arr $ const x) id
 F from1 to1 * F from2 to2 =
   F (from1  from2) (to1 *** to2  arr (uncurry id))

You only require that from b is Applicative, so that in turn can be
generalized:

  data F g to c = forall d . F (g d) (to d c)
  
  instance (Applicative g, Arrow to) = Functor (F g to) where
fmap f x = pure f * x
  
  instance (Applicative g, Arrow to) = Applicative (F g to) where
pure x = F (pure x) id
F from1 to1 * F from2 to2 =
  F ((,) $ from1 * from2) (to1 *** to2  arr (uncurry id))

 I wonder what's a categorical interpretation of F itself.

It's a variety of left Kan extension (cf section 5 of Constructing
Applicative Functors at MPC'2012).

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] foldr (.) id

2012-10-27 Thread Ross Paterson
On Fri, Oct 26, 2012 at 07:41:18PM +0100, Greg Fitzgerald wrote:
 I've recently found myself using the expression: foldr (.) id to
 compose a list (or Foldable) of functions.  It's especially useful
 when I need to map a function over the list before composing.  Does
 this function, or the more general foldr fmap id, defined in a
 library anywhere?  I googled and hoogled, but no luck so far.

Alternatively: flip (foldr id)

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Sliding Window functional data structure

2012-08-31 Thread Ross Paterson
On Fri, Aug 31, 2012 at 05:45:27AM +0100, Richard O'Keefe wrote:
 Consider the following interface
 
   type Ord k = Sliding_Window k v
 
   entries :: Sliding_Window k v - [(k,v)]
   The cost is expected to be linear in the length of
   the result.  The pairs are listed in increasing
   order of k.
 
   add :: Ord k = k - v - Sliding_Window k v - Sliding_Window k v
   precondition: all ( k) [k' | (k',_) - entries q]
   The cost should be at most O((log . length . entries) q).
   post: entries (add k v q) = entries q ++ [(k,v)]
 
   since :: Ord k = k - Sliding_Window k v - [(k,v)]
   answers [(k',v) | (k',v) - entries q, k'  k]
   The cost should be at most O((log . length . entries) q
  + length result)
 
   purge :: Ord k = k - Sliding_Window k v - Sliding_Window k v
   answers q' such that entries q' = [(k',v) | (k',v) - entries q,
k'  k]
   The cost should be at most O((log . length . entries) q
+ length [k' | (k',v) - entries q,
   k' = k])

Any search tree implementation will do add and purge in O(log n) time.
A finger tree will do add in O(1) and purge in O(log(min(r, n-r))) time,
where r in the length of the result.

{-# LANGUAGE MultiParamTypeClasses #-}

module SlidingWindow where

import Data.FingerTree
import Data.Foldable
import Data.Monoid

data Entry k v = Entry k v

data Max k = Bot | Lift k
deriving (Eq, Ord)

instance Ord k = Monoid (Max k) where
mempty = Bot
mappend = max

instance Ord k = Measured (Max k) (Entry k v) where
measure (Entry k _) = Lift k

newtype SlidingWindow k v = SW (FingerTree (Max k) (Entry k v))

entries :: SlidingWindow k v - [(k,v)]
entries (SW t) = [(k, v) | Entry k v - toList t]

emptySW :: Ord k = SlidingWindow k v
emptySW = SW empty

add :: Ord k = k - v - SlidingWindow k v - SlidingWindow k v
add k v (SW t) = SW (t | Entry k v)

since :: Ord k = k - SlidingWindow k v - [(k,v)]
since k = entries . purge k

purge :: Ord k = k - SlidingWindow k v - SlidingWindow k v
purge k (SW t) = SW (dropUntil ( Lift k) t)

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Cabal install fails due to recent HUnit

2012-08-27 Thread Ross Paterson
On Mon, Aug 27, 2012 at 07:39:39PM +0100, Erik Hesselink wrote:
 If we do agree that we want to prevent this problem for a while (which
 I'm not sure about), we should probably do it by preventing uploads
 for packages like this. That way, package maintainers will know what
 is going on, just like with the other 'package quality' issues hackage
 enforces.

The place to check is Distribution.PackageDescription.Check.checkPackage
(in Cabal).  If this returns anything other than PackageDistSuspicious,
hackage will reject the upload.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Cabal install fails due to recent HUnit

2012-08-27 Thread Ross Paterson
On Mon, Aug 27, 2012 at 09:03:18PM +0100, Brent Yorgey wrote:
 On Mon, Aug 27, 2012 at 10:52:59AM -0700, Bryan O'Sullivan wrote:
  On Mon, Aug 27, 2012 at 9:57 AM, Erik Hesselink hessel...@gmail.com wrote:
  
   I'm seeing this again, on abstract-deque-0.1.6. Ross, can you fix it 
   again?
  
  
  Hang on a second.
  
  The reason you're seeing build breakage is that the .cabal files of the
  broken packages were edited in-place without communicating with any of the
  package authors.
  
  I understand that the collective intentions around this were good, but by
  fixing things without telling anyone, package maintainers have no way to
  know that anything has happened. Now we are seeing the problem begin to
  recur as people issue new releases that don't incorporate those changes.
 
 For the record, abstract-deque was neither one of the packages fixed
 previously, nor does its .cabal file even contain a test section at
 all, much less one with a conditional.

It did a couple of hours ago.

 But I
 agree with Bryan in principle that we need a more principled approach.

Yes, and Cabal is the place to test for this.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Cabal install fails due to recent HUnit

2012-07-30 Thread Ross Paterson
On Mon, Jul 30, 2012 at 01:46:24PM +0100, Niklas Broberg wrote:
 On Wed, Jul 25, 2012 at 12:22 PM, Ross Paterson r...@soi.city.ac.uk wrote:
 
 As I understand it, the plan is to modify the following packages in
 hackage in-situ to remove the test sections (which contain the troublesome
 conditionals):
 
   HUnit-1.2.5.0
   bloomfilter-1.2.6.10
   codemonitor-0.1
   codemonitor-0.2
   fixhs-0.1.4
   leksah-server-0.12.0.3
   leksah-server-0.12.0.4
   leksah-server-0.12.0.5
   pqc-0.5
   pqc-0.5.1
 
 Does anyone object?
 
 No objections, but some impatience. ;-)

OK, done.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Reddy on Referential Transparency

2012-07-27 Thread Ross Paterson
On Fri, Jul 27, 2012 at 01:08:31PM +0100, Chris Dornan wrote:
 For those who haven’t seen it Uday Reddy has a comprehensive answer to a
 request to explain referential transparency on Stack Overflow.
  
 http://stackoverflow.com/questions/210835/what-is-referential-transparency/9
 859966#9859966
 
 For good measure he finishes with a rather scathing assessment of functional
 programmers’ claim to ownership of RT:
 
 Functional programmers don't know much of this research.
Their ideas on referential transparency are to be taken
with a large grain of salt.
 
 Marvellous! 'Tis rare to find such a robust assessment combined with
 understanding (and it certainly makes me think a bit).

So a language is referentially transparent if replacing a sub-term with
another with the same denotation doesn't change the overall meaning?
But then isn't any language RT with a sufficiently cunning denotational
semantics?  Or even a dumb one that gives each term a distinct denotation.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Reddy on Referential Transparency

2012-07-27 Thread Ross Paterson
On Fri, Jul 27, 2012 at 07:19:40PM +0100, Chris Dornan wrote:
  So a language is referentially transparent if replacing a sub-term with 
  another with the same
  denotation doesn't change the overall meaning?
 
 Isn't this just summarizing the distinguishing characteristic of a 
 denotational semantics?

Right, so where's the substance here?

 My understanding is that RT is about how easy it is to carry out
 _syntactical_ transformations of a program that preserve its meaning.
 For example, if you can freely and naively inline a function definition
 without having to worry too much about context then your PL is deemed
 to possess lots of RT-goodness (according to FP propaganda anyway; note
 you typically can't freely inline function definitions in a procedural
 programming language because the actual arguments to the function may
 involve dastardly side effects; even with a strict function-calling
 semantics divergence will complicate matters).

Ah, but we only think that because of our blinkered world-view.

Another way of looking at it is that the denotational semanticists have
created a beautiful language to express the meanings of all those ugly
languages, and we're programming in it.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Applicative functors with branch/choice ?

2012-07-26 Thread Ross Paterson
On Wed, Jul 25, 2012 at 09:22:23PM +0100, Евгений Пермяков wrote:
 So, it seems for me, that Applicative API should be extended with 
 typeclass for making choice what actions to execute depending on result 
 of some test (pattern matching). Is there any reasonable definition of 
 such typeclass or clear explanation, why such typeclass is unneeded?
 
 The possible extension may look somehow like this:
 
 class Applicative a = Branching a where
   branch :: a (Either b c) - (a b - a d) - (a c - a d) - a d

Do you have any instances in mind?

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Cabal install fails due to recent HUnit

2012-07-25 Thread Ross Paterson
On Wed, Jul 25, 2012 at 09:43:48AM +0100, Simon Hengel wrote:
 On Fri, Jul 20, 2012 at 10:02:18AM +0100, Ross Paterson wrote:
  On Fri, Jul 20, 2012 at 09:34:16AM +0100, Simon Hengel wrote:
   Hi Ross,
   can you fix this on Hackage?  My suggested solution is to again just
   remove the test-suite sections from the cabal file, if that is fine with
   Richard.
  
  I'll modify the packages in-place if there's a consensus on what to do.
 
 I think Richard gave his consent.  Is there still anything we need to
 sort out?
 
 BTW: Here is a reddit story on the issue:
 http://www.reddit.com/r/haskell/comments/x16h7/hackage_b0rked_for_cabal_0102/

As I understand it, the plan is to modify the following packages in
hackage in-situ to remove the test sections (which contain the troublesome
conditionals):

  HUnit-1.2.5.0
  bloomfilter-1.2.6.10
  codemonitor-0.1
  codemonitor-0.2
  fixhs-0.1.4
  leksah-server-0.12.0.3
  leksah-server-0.12.0.4
  leksah-server-0.12.0.5
  pqc-0.5
  pqc-0.5.1

Does anyone object?

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Cabal install fails due to recent HUnit

2012-07-20 Thread Ross Paterson
On Fri, Jul 20, 2012 at 09:34:16AM +0100, Simon Hengel wrote:
 Hi Ross,
 can you fix this on Hackage?  My suggested solution is to again just
 remove the test-suite sections from the cabal file, if that is fine with
 Richard.

I'll modify the packages in-place if there's a consensus on what to do.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Fwd: hackage compile failure with QuickCheck 2.5

2012-07-19 Thread Ross Paterson
On Wed, Jul 18, 2012 at 09:35:52AM +0100, Erik Hesselink wrote:
 I don't think you can install this package on 7.4. As Andres said, it
 requires containers 0.5, but ghc 7.4's base libraries (in this case,
 template-haskell) use containers 0.4, and can't be reinstalled. I
 guess your best bet is to use sbv-2.1, which depends on containers =
 0.3, or to unpack it and see if you can loosen the containers
 dependency and see if it still works with 0.4

So the moral of this story is that libraries should avoid depending on
features of the containers package that have not yet been released with GHC.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Fwd: hackage compile failure with QuickCheck 2.5

2012-07-18 Thread Ross Paterson
On Wed, Jul 18, 2012 at 06:50:31AM +0100, Andres Löh wrote:
 Using --avoid-reinstalls blindly or as a default flag is also
 unfortunately not a good idea in general. There are simply too many
 cases where installing older versions of packages (which is often the
 only thing that helps) is not really the solution you want. That's
 also the reason why it's not enabled by default.

I need a combination of flags that I can use blindly with the greatest
chance of success.  The default doesn't work on packages like this one:

% cabal --version
cabal-install version 0.14.0
using version 1.14.0 of the Cabal library
% cabal install sbv-2.2
Resolving dependencies...
In order, the following would be installed:
HUnit-1.2.4.3 (new package)
containers-0.5.0.0 (new version)
random-1.0.1.1 (new package)
strict-concurrency-0.2.4.1 (new package)
syb-0.3.7 (new package)
template-haskell-2.7.0.0 (reinstall) changes: containers-0.4.2.1 - 0.5.0.0
QuickCheck-2.5 (new package)
transformers-0.3.0.0 (new package)
mtl-2.1.2 (new package)
sbv-2.2 (new package)
cabal: The following packages are likely to be broken by the reinstalls:
ghc-7.4.1
Use --force-reinstalls if you want to install anyway.

So should I be blindly using --force-reinstalls?  Each build is in a
clean environment, so breaking the installation isn't so serious.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Fwd: hackage compile failure with QuickCheck 2.5

2012-07-18 Thread Ross Paterson
On Wed, Jul 18, 2012 at 09:35:52AM +0100, Erik Hesselink wrote:
 I don't think you can install this package on 7.4. As Andres said, it
 requires containers 0.5, but ghc 7.4's base libraries (in this case,
 template-haskell) use containers 0.4, and can't be reinstalled. I
 guess your best bet is to use sbv-2.1, which depends on containers =
 0.3, or to unpack it and see if you can loosen the containers
 dependency and see if it still works with 0.4

I'm talking about unattended automated builds, so tweaking isn't an
option.  On the other hand breaking the package environment isn't so bad,
because I'm throwing it away after each build.

 So in short, no combination of flags will work in this case, I think.
 Failure is the best option.

Actually --force-reinstalls does work in this case, and this thread began
with Levent being unhappy with the failure option for his package, so
I'm tempted to use that flag on all hackage builds.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Fwd: hackage compile failure with QuickCheck 2.5

2012-07-18 Thread Ross Paterson
On Wed, Jul 18, 2012 at 10:37:31AM +0100, Gregory Collins wrote:
 Is there any reason QuickCheck specifically requires containers = 0.5?
 Perhaps its lower bound could be relaxed.

It is sbv-2.2 that has that constraint.

 On Wed, Jul 18, 2012 at 11:29 AM, Ross Paterson r...@soi.city.ac.uk wrote:
 Actually --force-reinstalls does work in this case, and this thread began
 with Levent being unhappy with the failure option for his package, so
 I'm tempted to use that flag on all hackage builds.

On the other hand, if installing a package is going to break people's
package environments, maybe documenting the package on hackage isn't
so important.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Cabal install fails due to recent HUnit

2012-07-18 Thread Ross Paterson
On Wed, Jul 18, 2012 at 05:16:19PM +0100, Simon Hengel wrote:
 CCing: Ross Paterson and Richard G.
 
 On Wed, Jul 18, 2012 at 05:54:44PM +0200, Martijn Schrage wrote:
  On 18-07-12 17:37, Erik Hesselink wrote:
  Hi Martijn,
  
  Yes, upgrading will obviously fix things (we do use 0.14 on our
  development machines)
  Well, to me it wasn't entirely obvious that upgrading to
  Cabal-1.10.2.0 fixes the problem for cabal-install-0.12, and I still
  think this is a good solution for most people that use version
  2012.2.0.0 of the platform.
  
  I'd suggest you ask Duncan to patch the hackage repository, and
  maybe contact the maintainer of HUnit to prevent future problems.
 
 This also breaks all travis-ci builds.  I think it is critical to
 refrain from using conditionals in test-suite stanzas for some time +
 fix the broken release on Hackage.
 
 Is there a way to make this issue more well-know.  Would a warning on
 the upload page help?

Other packages in hackage with conditionals in test-suites:

fixhs-0.1.4
bloomfilter-1.2.6.10
pqc-0.5
pqc-0.5.1
leksah-server-0.12.0.3
leksah-server-0.12.0.4
leksah-server-0.12.0.5
codemonitor-0.1
codemonitor-0.2

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Fwd: hackage compile failure with QuickCheck 2.5

2012-07-17 Thread Ross Paterson
With ghc 7.4.1, cabal-install 0.13.3 and Cabal 1.14.0,

% cabal install --avoid-reinstalls sbv-2.2

fails to find a plan without reinstalls, and recommends --solver=modular.

% cabal install --solver=modular --avoid-reinstalls sbv-2.2

reinstalls template-haskell-2.6.0.0, which breaks the GHC installation.

I've added the suggested --constraint='template-haskell==2.7.0.0'
option as a workaround, but it seems the --avoid-reinstalls option is
being ignored.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Fwd: hackage compile failure with QuickCheck 2.5

2012-07-17 Thread Ross Paterson
On Wed, Jul 18, 2012 at 12:14:12AM +0100, Antoine Latter wrote:
 Cabal doesn't play well with version constraints on the template-haskell
 package - it doesn't know it can't reinstall template-haskell.
 
 The workaround is to figure out why QuickCheck has version constraints on
 template-haskell and solve that problem in the QuickCheck package a different
 way - perhaps with CPP conditonal compilation macros - and then remove the
 problematic version constraints.

QuickCheck's constraint is template-haskell = 2.4, which doesn't explain
why cabal wanted to install 2.6.0.0 when 2.7.0.0 was already present.

Also, I'd expect --avoid-reinstalls to stop it reinstalling anything,
but apparently it doesn't do that with the modular solver.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Plain lambda inside banana brackets in the arrow notation

2012-07-15 Thread Ross Paterson
On Sun, Jul 15, 2012 at 06:51:07PM +0100, Tsuyoshi Ito wrote:
 Thank you for the response.  This sounds exciting, but sadly, I must
 admit that it is a little (?) above my head, and I cannot relate this
 extension to my original question….

Sorry about that -- I got a bit side-tracked.  The combinator you wanted
to use was

repeat :: Int - (Int - MyArr e a) - MyArr e a

That won't be possible, but with this extension you could use

repeat' :: Int - StaticArrow ((-) Int) MyArr e a - MyArr e a

The definition of StaticArrow (in the arrows package) is a wrapper

newtype StaticArrow f a b c = StaticArrow (f (a b c))

so StaticArrow ((-) Int) MyArr e a ~= Int - MyArr e a.
Now you could write

test2 :: MyArr [Double] String
test2 = proc xs - do
let y = func1 xs
z - job1 - xs
(|(repeat' 100) (StaticArrow (\i - job3 (i * 2)) - xs !! y + z)|)

which isn't quite what you wanted, because i wouldn't be in the environment,
but we could put it there as you did in your original post, or something
like

test2 :: MyArr [Double] String
test2 = proc xs - do
let y = func1 xs
z - job1 - xs
(|(repeat' 100) (do
i - StaticArrow (arr . const) - ()
StaticArrow (\i - job3 (i * 2)) - xs !! i + y + z)|)

I did say it would be clunky, but at least there's no dumping the tuple
and picking it up again.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Plain lambda inside banana brackets in the arrow notation

2012-07-15 Thread Ross Paterson
Silly me -- that code works with the current GHC (module attached).
I still think the generalization is worth doing, though.
-
{-# LANGUAGE Arrows #-}
module ArrowTest where

import Control.Applicative
import Control.Arrow
import Control.Category
import Prelude hiding (id, (.), repeat)

-- copied from Control.Arrow.Transformer.Static (in the arrows package)
newtype StaticArrow f a b c = StaticArrow (f (a b c))

instance (Category a, Applicative f) = Category (StaticArrow f a) where
id = StaticArrow (pure id)
StaticArrow f . StaticArrow g = StaticArrow ((.) $ f * g)

instance (Arrow a, Applicative f) = Arrow (StaticArrow f a) where
arr f = StaticArrow (pure (arr f))
first (StaticArrow f) = StaticArrow (first $ f)

newtype MyArr b c = MyArr (b - c)

instance Category MyArr
instance Arrow MyArr

repeat :: Int - (Int - MyArr e a) - MyArr e a
repeat = undefined

func1 :: [Double] - Double
func1 = undefined

job1 :: MyArr [Double] Double
job1 = undefined

job3 :: Int - MyArr Double String
job3 = undefined

repeat' :: Int - StaticArrow ((-) Int) MyArr e a - MyArr e a
repeat' n (StaticArrow f) = repeat n f

test2 :: MyArr [Double] String
test2 = proc xs - do
let y = func1 xs
z - job1 - xs
(|(repeat' 100) (do
i - StaticArrow (arr . const) - ()
StaticArrow (\i - job3 (i * 2)) - xs !! i + y + z)|)

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Plain lambda inside banana brackets in the arrow notation

2012-07-13 Thread Ross Paterson
On Thu, Jul 12, 2012 at 02:47:57PM +0100, Ross Paterson wrote:
 Though one possibility that might get
 us most of the way there would be to refactor the Arrow class as
 
   class PreArrow a where
 premap :: (b - b') - a b' c - a b c
 
   class (Category a, PreArrow a) = Arrow a where
 arr :: (b - c) - a b c
 arr f = premap f id
 
 first :: a b c - a (b,d) (c,d)

I've done this and the associated GHC changes locally; it yields a simple
rule for determining which instances are needed, based on the keywords used:

* all commands (proc and operator arguments) need PreArrow
  * do needs Arrow
* rec needs ArrowLoop
  * case or if need ArrowChoice

I'm warming to it as a worthwhile generalization (though not exactly what
was asked for).

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Plain lambda inside banana brackets in the arrow notation

2012-07-12 Thread Ross Paterson
On Thu, Jul 05, 2012 at 10:55:07PM +0100, Tsuyoshi Ito wrote:
 In a program, I have an arrow MyArr and a combinator called repeat of
 the following type:
 
 repeat :: Int - (Int - MyArr e a) - MyArr e a
 
 My problem is that the code becomes messy when I use this combinator
 inside the arrow notation, and I am looking for a way to write the
 code in a more readable way.
 [...]
 It does not seem possible to use banana brackets here because the type
 of the subcomputation does not meet the requirements stated in
 http://www.haskell.org/ghc/docs/7.4.2/html/users_guide/arrow-notation.html#id686230.
 
 How can I use combinators like repeat, which takes a plain function as
 an argument, in the arrow notation in a more readable way?  Or am I
 trying to do an impossible thing?

Unfortunately the arrow notation doesn't support this.  There's no
semantic reason why it wouldn't work with arguments of the form

  f (a (...(e,t1), ... tn) t)

for any functor f, or even

  g (...(e,t1), ... tn)

for any contravariant functor g.  The limitation is due to Haskell's
structural matching of types.  Though one possibility that might get
us most of the way there would be to refactor the Arrow class as

  class PreArrow a where
premap :: (b - b') - a b' c - a b c

  class (Category a, PreArrow a) = Arrow a where
arr :: (b - c) - a b c
arr f = premap f id

first :: a b c - a (b,d) (c,d)

  instance PreArrow (-) where
premap f g = g . f

  instance PreArrow (Kleisli m) where
premap f (Kleisli g) = Kleisli (g . f)

  instance (PreArrow a, Functor f) = PreArrow (StaticArrow f a) where
premap f (StaticArrow g) = StaticArrow (fmap (premap f) g)

The PreArrow class would be sufficient for the low-level translation
(i.e. excluding if, case and do).  You'd need to fiddle with newtypes
to use it in your example, though.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] hackage hackage accounts

2012-05-15 Thread Ross Paterson
On Tue, May 15, 2012 at 08:11:05PM +0100, Dmitry Malikov wrote:
 1) Did anyone successfully get their hackage account in last 2 months? 

About 40 of them.  But I slipped up with two of you, I think.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Fail-back monad

2012-03-31 Thread Ross Paterson
On Wed, Mar 28, 2012 at 01:34:29AM +0100, Alberto G. Corona  wrote:
 In my package MFlow [1] I program an entire web  navigation in a
 single procedure. That happened  in the good-old WASH web application
 framework.
 The problem is the back button in the Browser.
 To go back in the code to the previous interactions when the data
 input does not match the expected because the user pressed the back
 button one or more times, i came across this Monad specimen,: that
 solves the problem.

This definition does not satisfy the right identity law (m = return = m)
included in the monad definition:

*FailBack BackT [BackPoint 1] = return
BackT [NoBack 1]

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Hackage 2 maintainership

2012-02-13 Thread Ross Paterson
On Mon, Feb 13, 2012 at 11:44:18PM +, Ben Gamari wrote:
 Those of you who follow the Haskell subreddit no doubt saw today's post
 regarding the status of Hackage 2. As has been said many times in the
 past, the primary blocker at this point to the adoption of Hackage 2
 appears to be the lack of an administrator.
 
 It seems to me this is a poor reason for this effort to be held
 up. Having taken a bit of time to consider, I would be willing to put in
 some effort to get things moving and would be willing to maintain the
 haskell.org Hackage 2.0 instance going forward if necessary.

Hurrah!  After 5 years, 1 month and 7 days of doing this, I'm keen
to stop.  (I've been waiting since Hackage 2 was announced in the Nov
2008 HCAR.)

 It seems that this process will go something like this,
   1) Bring Hackage trac back from the dead
   2) Bring up a Hackage 2 instance along-side the existing
  hackage.haskell.org
   3) Enlist testers
   4) Let things simmer for a few weeks/months ensuring nothing explodes
   5) After it's agreed that things are stable, eventually swap the
  Hackage 1 and 2 instances

Sounds like a good plan.  I expect there are a number of small things
that still need doing to make the new server a complete replacement.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Is the haddock generator on Hackage down?

2012-01-03 Thread Ross Paterson
On Tue, Jan 03, 2012 at 07:14:58PM +, Bardur Arantsson wrote:
 No Haddock documentation seems to have been generated on Hackage in the 
 past few days.

The machine's down, I think.  I'll give it a kick tomorrow.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Splitting off many/some from Alternative

2011-12-14 Thread Ross Paterson
The current definition says that some and many should be the least
solutions of the equations

some v = (:) $ v * many v
many v = some v | pure []

We could relax that to just requiring that they satisfy these equations
(which I think is what John wants).  In that case there would be another
possible definition for Maybe:

some Nothing = Nothing
some (Just x) = Just (repeat x)

many Nothing = Just []
many (Just x) = Just (repeat x)

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Splitting off many/some from Alternative

2011-12-14 Thread Ross Paterson
On Thu, Dec 15, 2011 at 02:19:34AM +, Gregory Crosswhite wrote:
 On Dec 15, 2011, at 12:03 PM, Ross Paterson wrote:
 
 The current definition says that some and many should be the least
 solutions of the equations
 
some v = (:) $ v * many v
many v = some v | pure []
 
 We could relax that to just requiring that they satisfy these equations
 (which I think is what John wants).  In that case there would be another
 possible definition for Maybe:
 
some Nothing = Nothing
some (Just x) = Just (repeat x)
 
many Nothing = Just []
many (Just x) = Just (repeat x)
 
 That is a really good idea!  In fact, this behavior was exactly what my
 intuition had at first suggested to me that these methods should do.
 
 But the part that still confuses me is:  why are these not considered the
 least solutions of the equations?

It has to do with the termination partial ordering -- the least solutions
give a denotational description that's equivalent to what recursion computes.

In this case, the least solutions are

some Nothing = Nothing
some (Just x) = _|_

many Nothing = Just []
many (Just x) = _|_

It's easy to verify that these are solutions, and that they're less
defined than the versions above.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Splitting off many/some from Alternative

2011-12-14 Thread Ross Paterson
On Thu, Dec 15, 2011 at 02:36:52AM +, Antoine Latter wrote:
 This seems to generalize to list:
 
 some [] = []
 some xs = [cycle xs]
 
 many [] = [[]]
 many xs = [cycle xs]

More like

some [] = []
some (x:xs) = repeat (repeat x)

many [] = [[]]
many (x:xs) = repeat (repeat x)

 Although I'm still not sure why I would be using these operations in
 maybe or list.

That's true.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Cabal upload failure

2011-05-24 Thread Ross Paterson
Version skew problem -- I hope it's fixed now.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Hackage build failure

2011-05-10 Thread Ross Paterson
On Tue, May 10, 2011 at 10:46:53AM +0200, Jonas Almström Duregård wrote:
 Is there something wrong with the Hackage build system?
 It fails to build BNFC-meta: http://hackage.haskell.org/package/BNFC-meta
 
 It complains about a missing dep even though it (the dependency) has
 been built successfully. Also the dependencies are exactly the same as
 in the previous version (which configures fine but fails to build
 because of some bug in HsColor).

happy-meta is one of those packages that won't build again after you
clean them (it has files under dist/build to work around a bug in Happy).
Fixed now.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] how to force hackage to use ghc 6.12.3

2011-05-09 Thread Ross Paterson
On Mon, May 09, 2011 at 11:38:47AM +0200, Daniel Fischer wrote:
 On Monday 09 May 2011 08:54:49, Michal Konečný wrote:
  I was hoping hackage will try also ghc 6.12.3 but it does not.  Is there
  some way I can change the cabal file to help hackage to compile it with
  6.12.3 and generate haddock?  The package requires base = 4 so I
  cannot try base  4.
 
 base = 4   4.3
 
 should do it

That will stop users from building it with ghc 7.0, but I'm afraid the
build client only uses the latest version, so these won't be fixed
until ghc 7.2 is released.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: unordered-containers - a new, faster hashing-based containers library

2011-02-24 Thread Ross Paterson
On Wed, Feb 23, 2011 at 08:45:47AM +, Max Bolingbroke wrote:
  3. Some map combining algorithms work more efficiently when one of
 their two arguments are smaller. For example, Data.Map.union is most
 efficient for (bigmap `union` smallmap). If you don't care about which
 of the two input maps wins when they contain the same keys, you can
 improve constant factors by testing the size of the map input to size
 (in O(1)) and flipping the arguments if you got (smallmap `union`
 bigmap) instead of the desirable way round.

This is a most unfortunate feature of Data.Map, forcing users to bend the
logic of their application to suit the library.  Ideally you'd want binary
operations that are symmetric and associative performance-wise, freeing
users to follow the structure of their problem domain.  The documentation
(and the original paper) doesn't quantify the gain for such unions,
but hopefully it achieves the optimum: O(m log(n/m)), where m and n are
the sizes of the smaller and larger trees respectively.  Then building
a tree costs O(n log(n)), regardless of the way you do it.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] upgrading mtl1 to mtl2

2011-02-16 Thread Ross Paterson
On Tue, Feb 15, 2011 at 07:46:29PM -0800, Evan Laforge wrote:
 Do I really have to add (Functor m) to the 300 or so functions with
 (Monad m) on them?  Or just not use fmap or applicative?

If you're using Monad m to get Functor or Applicative instances for a
functor built from m, then I'm afraid you will need to add (Functor m)
or (Applicative m) to the constraints in most cases.

 So I thought if it's going to be this much of a hassle I might as well
 just port to transformers, which I gather is supposed to be the future
 anyway.  But transformers is lacking the classes, and I gather they're
 in monads-tf and monads-fd.  But monads-fd says it's now deprecated
 because of the existence of mtl-2.  So what's the story?  Has
 transformers now turned around and been deprecated in favor of mtl-2?

monads-fd is deprecated is favour of mtl-2, but transformers isn't.
Now you have a choice: use the portable transformers or the functional
dependencies of mtl.  Either choice is compatible with other packages,
because both ultimately rest on transformers.

 http://haskell.org/haskellwiki/Monad_Transformers
 
 Says that the only benefit of 'transformers' is that it's haskell 98
 and thus more portable, but doesn't that come with the caveat that
 only if you don't use classes and do all the lifting manually?

Good point -- I've added such a caveat.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Byte Histogram

2011-02-07 Thread Ross Paterson
On Mon, Feb 07, 2011 at 11:05:53AM +, John Lato wrote:
 From: Ivan Lazar Miljenovic ivan.miljeno...@gmail.com
 
 On 7 February 2011 12:30, wren ng thornton w...@freegeek.org wrote:
  On 2/6/11 4:53 PM, Ivan Lazar Miljenovic wrote:
 
  On 7 February 2011 08:12, Alexey Khudyakovalexey.sklad...@gmail.com
  ?wrote:
 
  Also there is a container-classes package which provide set of type
 class
  for containers.
 
  [1] http://hackage.haskell.org/package/container-classes
 
  Don't use that package: it's broken. ?I did start on a re-write that
  works (and there are similar libraries around that I believe do work),
  but gave up because it was a) too fiddly, and b) I decided that the
  use case I had for them wasn't worth it (as it would just make that
  library more complicated and difficult to use, possibly also less
  efficient). ?If anyone wants it I can certainly send them what I've
  got though.
 
  Any chance you could push a 0.0.0.1 version which tells people this, so
 that
  they know to avoid it?
 
 Didn't think about that; I'll try to do so tonight.
 
 Perhaps a better approach would be to ask the hackage maintainer (Ross
 Patterson, if I'm not mistaken) to deprecate container-classes.

Done.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Incrementially updating an array

2010-12-28 Thread Ross Paterson
On Tue, Dec 28, 2010 at 08:46:24PM +0800, Robert Clausecker wrote:
 I have the following problem. As code is most time easier to understand,
 let give an example what I try to do in C:
 
 unsigned int i,j;
 unsigned int r[100];
 for (i = 0; i  100; i++) {
   j = makeResult(); //j is known to be smaller than 100.
   r[j] = r[j] + 1;
 }
 
 (My C is poor, so please don't laugh)
 
 Currently I'm using a Data.Map for this, but as the result is bounded in
 this area, an array seems to be more appropreate. I don't want to mess
 with mutable arrays, but I can't find anything which does the same like
 Data.Map.insertWith for arrays in a reasonable way.
 
 In my example, the input comes from a lazy list and is than folded into
 the Map by insertWith (+) j 1 r. Is there any nice, quick way to do this
 with Arrays without using mutable ones?

accumArray is designed for situations like this.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] List of numbers to list of ranges

2010-12-23 Thread Ross Paterson
On Thu, Dec 23, 2010 at 10:57:43PM +0530, C K Kashyap wrote:
 Here's my attempt to convert a list of integers to a list of range tuples -
 
 Given [1,2,3,6,8,9,10], I need [(1,3),(6,6),8,10)]

import Data.Function
import Data.List

ranges ns =
[(head gp, last gp) |
gp - map (map fst) $ groupBy ((==) `on` snd) $
zip ns (zipWith (-) ns [1..])]

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Problem with class Control.Monad.Error noMsg usage

2010-12-21 Thread Ross Paterson
On Tue, Dec 21, 2010 at 03:28:22PM +, Aaron Gray wrote:
 I have been trying to build the Scheme in 24 Hours on WikiBooks :-
 
 http://en.wikibooks.org/wiki/Write_Yourself_a_Scheme_in_48_Hours
 
 http://jonathan.tang.name/files/scheme_in_48/code/listing10.hs
 
 But I am getting an error :- 
 
 scheme.hs:289:6: `noMsg' is not a (visible) method of class `Error'
 
 scheme.hs:290:6:
  `strMsg' is not a (visible) method of class `Error'

I don't get that here.  Perhaps you're using an old version of monads-fd
(0.1.0.0).  I'd recommend installing mtl-2.0.1.0 instead.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Rendering of hask in new wiki (MSIE6)

2010-12-15 Thread Ross Paterson
On Wed, Dec 15, 2010 at 09:01:49AM -0500, Dimitry Golubovsky wrote:
 HTML (a small piece of it):
 
 provides the classes div class=inline-codediv dir=ltr
 style=text-align: left;div class=source-haskell
 style=font-family: monospace;MonadTrans/div/div/div
 
 Words MonadTrans, MonadIO, StateT etc are enclosed in hask tags.
 They show up in monospace, each starting a new line. Is this only
 MSIE6, or this is how it is supposed to render?

They're inline in FireFox.  That text-align: seems unnecessary.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Hackage down?

2010-12-04 Thread Ross Paterson
On Sat, Dec 04, 2010 at 02:01:44PM +, Ozgur Akgun wrote:
 http://downforeveryoneorjustme.com/http://hackage.haskell.org

Apparently {darcs,hackage}.haskell.org is out for the day -- announced
on Reddit but not here.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] category-extras clash with transformers

2010-11-20 Thread Ross Paterson
On Sat, Nov 20, 2010 at 10:58:44PM +1000, Tony Morris wrote:
 I have installed mtl-1.1.1.0 so that xmonad-contrib-0.9.1 would compile
 with GHC 6.12.1.
 http://permalink.gmane.org/gmane.comp.lang.haskell.xmonad/10603
 
 Then I tried to installed category-extras-0.53.5, which clashed with
 transformers-0.2.2.0 for the Applicative/Monad instances for Either.
 
 Is there any way out of this problem? Thanks for any pointers.

The instance in question is in the base package from GHC 7, which should
avoid this problem of clashing orphans in the future.  Unfortunately
that doesn't help you -- I think both xmonad-contrib and category-extras
need to be updated.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] cabal update error

2010-11-13 Thread Ross Paterson
On Sat, Nov 13, 2010 at 08:33:18PM +1100, Ivan Lazar Miljenovic wrote:
 I would guess that it's related to
 http://www.reddit.com/r/haskell/comments/e5db7/alert_hackage_downtime_tomorrow_0600_1200_pst/

That would be 14:00 - 20:00 UTC, wouldn't it?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] new version of the mtl package

2010-11-08 Thread Ross Paterson
After lengthy discussion on the libraries list, the mtl package has been
updated to depend on the transformers package, from which mtl re-exports
the monad transformers and the MonadTrans and MonadIO classes.  This makes
the two packages compatible.  The monads-fd package is now a deprecated
stub re-exporting the mtl modules.

Ths transformers/mtl-2 combination is under consideration for inclusion
in the Haskell Platform:

http://trac.haskell.org/haskell-platform/wiki/Proposals/transformers

Discussion is on the libraries list.  So far there have been no objections.

The new version has a few incompatibilities with the old, which will break
a few packages, though the great majority build unchanged.  The above
web page lists the incompatibilities and suggested fixes.  You might
also consider whether the portable transformers package suffices for
your package.

As packages move to the new version, there will be increasing dependency
clashes with packages that currently specify a bound on their mtl
dependency excluding the new version.  In some cases the dependency can
be simply relaxed with no other change, or with small changes obtain
compatibility with both versions.  In other cases one must choose a
version, or use cpp hackery to support both.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] What do you call Applicative Functor Morphism?

2010-11-06 Thread Ross Paterson
On Fri, Nov 05, 2010 at 11:49:27PM -0400, rocon...@theorem.ca wrote:
 An applicative functor morphism is a polymorphic function,
 eta : forall a. A1 a - A2 a between two applicative functors A1 and
 A2 that preserve pure and *:
 
 eta (pure c) = pure c
 eta (f * x) = eta f * eta x
 
 What do you guys call such a thing?  My leading candidate is
 idomatic transformation.

An applicative functor is a functor with some extra structure.  Such a
function is a natural transformation between the underlying functors
that preserves the extra structure.  So applicative transformation
seems a logical name.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Is Curry alive?

2010-11-05 Thread Ross Paterson
On Thu, Nov 04, 2010 at 06:06:40PM -0400, Dan Doel wrote:
 Implementing type inference can be very easy in a logic language,
 because most of the work in a non-logic language is implementing
 unification:

Provided the implementation includes the occurs check.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Red links in the new haskell theme

2010-10-30 Thread Ross Paterson
On Sat, Oct 30, 2010 at 05:26:33PM +0200, Henning Thielemann wrote:
 Two notes on the Classic style:
 
 The package field names like Version, Dependencies, License are
 centered, which was not the case in the original style. Also in the
 original style the table cells had a grey background, what I found
 quite useful for recognizing the table structure.

This refers to the hackage package pages using the haddock style files,
which have no provision for two-tone tables.  The alignment is fixed
now, though.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Red links in the new haskell theme

2010-10-30 Thread Ross Paterson
On Sat, Oct 30, 2010 at 06:39:00PM +0200, Henning Thielemann wrote:
 It's still vertically centered, which makes it difficult to see,
 e.g. where the dependency list starts and where it ends if it is
 several lines long.

Not any more.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] HackageDB: Haddock parse failure

2010-09-27 Thread Ross Paterson
On Mon, Sep 27, 2010 at 06:22:09PM +0200, Jonas Almström Duregård wrote:
 Also, perhaps HackageDB should ignore errors in building the
 documentation? Currently the reported build failure propagates to the
 dependencies of the library...

The only reason it's building is to generate the documentation, and to do
that you need the interface files haddock creates for the pre-requisite
packages.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: happstack-auth-0.2

2010-09-18 Thread Ross Paterson
On Sat, Sep 18, 2010 at 08:19:33PM +0200, Nils Schweinsberg wrote:
 Am 17.09.2010 22:06, schrieb Nils Schweinsberg:
 [1] http://hackage.haskell.org/package/happstack-auth
 
 Hackage fails to build this package:
 
 http://hackage.haskell.org/packages/archive/happstack-auth/0.2/logs/failure/ghc-6.12
 
 However, Crypto == 4.* should be on hackage:
 
 http://hackage.haskell.org/package/Crypto-4.2.1
 
 Is there anything I can do with my package to get this to build?

Unfortunately Crypto-4.2.1 was broken by the latest version of QuickCheck
(2.3), which introduced Arbitrary instances for the Word types:

http://hackage.haskell.org/packages/archive/Crypto/4.2.1/logs/failure/ghc-6.12

A new release of Crypto, without those instances, is needed.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] A new cabal odissey: cabal-1.8 breaking its own neck by updating its dependencies

2010-09-13 Thread Ross Paterson
On Sat, Sep 11, 2010 at 12:17:27PM -0700, Jason Dagit wrote:
 From the FAQ linked by Paolo:
 
 http://www.haskell.org/cabal/FAQ.html#dependencies-conflict
 
 To avoid this problem in the future, avoid upgrading core packages.
 The latest version of cabal-install has disabled the upgrade command
 to make it a bit harder for people to break their systems in this
 way.

It's not always possible.  In particular, random-1.0.0.2 (shipped with
GHC 6.12.*) depends on the time package, of which more recent versions
have been released.  That can trigger rebuilding of random-1.0.0.2,
and thus haskell98-1.0.1.1.

It might help if the release of random with GHC 7.0 had a tight dependency
on the version of the time package shipped with it.  Maybe all the core
packages need tight dependencies.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Combining applicative with arrows?

2010-09-10 Thread Ross Paterson
On Fri, Sep 10, 2010 at 10:34:04AM +0200, Nils Schweinsberg wrote:
 I just wondered if you can define Applicative instances for arrows?
 Basicly what I thought of is:
 
 I have a type for my arrow which is CollectA (using HXT here):
 
 type CollectA a = SomeArrow XmlTree a

If you do

  import Control.Applicative

  type CollectA = WrappedArrow SomeArrow XmlTree

then CollectA will be an instance of Applicative.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Is bumping the version number evil, if it's not mandated by the PVP?

2010-08-14 Thread Ross Paterson
On Sat, Aug 14, 2010 at 11:13:19AM +0200, Sebastian Fischer wrote:
 I wonder whether (and how) I should increase the version number of a
 library when the API does not change but the implementation gets
 more efficient.
 
 Should I bump a.b.C or even a.B to signal that it's worth using the
 new version or should I bump only a.b.c.D such that packages that
 depend on a.b get installed with the new version automatically?
 
 When bumping only a.b.c.D, the new version is not installed as a
 dependency if the old version already is installed (unless the new
 version is explicitly demanded.) It seems bumping a.b.c.D has
 advantages for some users and disadvantages for others.

How would bumping the major version change that?  Let's suppose a
package depending on your declares a version constraint a.b.* (which
would be good practice).  If you bump the patch level, anyone installing
the other package with get the latest version of your package; if you
bump the major version, they won't, until the maintainer of the other
package releases a new version to update their dependencies.  (Some
maintainers might be annoyed by that; if you annoy maintainers too
much, they might look for less annoying dependencies.)

Whenever you bump a version number, you are signalling that the new
version is worth using.  If you bump the patchlevel, you're also
signalling that the new version is compatible with the old, so using
it is a no-brainer.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] dear traversable

2010-07-31 Thread Ross Paterson
On Fri, Jul 30, 2010 at 08:13:43PM -0700, Ben wrote:
 dear traversable geniuses --
 
 i am looking for better implementations of
 
 unzipMap :: M.Map a (b, c) - (M.Map a b, M.Map a c)
 unzipMap m = (M.map fst m, M.map snd m)
 
 unliftMap :: (Ord a) = M.Map a (b - c) - M.Map a b - M.Map a c
 unliftMap mf ma = M.mapWithKey (\k v - mf M.! k $ v) ma
 
 the first is obviously inefficient as it traverses the map twice.  the
 second just seems like it is some kind of fmap.

The second one assumes that every key in ma is also in mf.  A generalization
without that assumption is

  unliftMap = intersectionWith id

As Wren said, it looks like a * operator, but in this case there's no
corresponding pure function.  To make the laws work, pure x would have
to be a map that took every key to x.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Monad transformers, design

2010-07-31 Thread Ross Paterson
On Sat, Jul 31, 2010 at 10:56:31PM +1000, Tony Morris wrote:
 -- Suppose some data type
 newtype Inter a = Inter (Int - a)
 
 -- and a monad transformer for that data type.
 newtype InterT m a = InterT (m (Inter a))

The monad transformer should be Inter (m a).
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Weird behavior with arrow commands

2010-07-24 Thread Ross Paterson
On Sat, Jul 24, 2010 at 01:10:56PM +0200, Jürgen Doser wrote:
 This seems to be a bug in ghc. First, let's fix bar to give the full
 three arguments (Int, Float, Double)  to g:
 
 bar f g  = proc x - do
   (f - x) `foo` (\n m k - g - (n,m,k))
 
 ghc infers the type:
 
 bar :: (t - String) - ((Double, Float, Int) - String) - t - String
 
 and we see that the argument order in the second argument to bar is
 reversed. But the arguments are still given to bar in the order (Int,
 Float, Double). For example, the 6.0 in foo is interpreted as an Int and
 outputs a 0 (the first 32 bits in such a small double are zeros).
 When one varies the numbers in foo, one can see the effects in bar. Can
 someone from GHC HQ confirm my understanding, or is this just not
 supposed to work with multiple arguments?

You're right: it's getting the argument order wrong, so -dcore-lint
fails on this example and all bets are off.  Definitely a bug.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] cabal, Setup.lhs example

2010-07-22 Thread Ross Paterson
On Wed, Jul 21, 2010 at 09:43:16AM -0700, Rogan Creswick wrote:
 On Wed, Jul 21, 2010 at 3:00 AM, Magnus Therning mag...@therning.org wrote:
  I am successfully using hooks with the following in my .cabal file:
 
     Build-Type    : Simple
 
 I've been unable to reproduce this -- flipping the build type to
 Custom has been necessary in every configuration I've tried.  I'd like
 to see what I'm doing differently -- is this used in a publicly
 available package I could take a look at?

Magnus is building by directly running the Setup.hs himself, which ignores
the Build-Type.  To get cabal-install to use his Setup.hs, the Build-Type
must be set to Custom.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] cabal, Setup.lhs example

2010-07-22 Thread Ross Paterson
On Thu, Jul 22, 2010 at 11:31:21AM +0100, Magnus Therning wrote:
 On Thu, Jul 22, 2010 at 10:59, Ross Paterson r...@soi.city.ac.uk wrote:
  Magnus is building by directly running the Setup.hs himself, which ignores
  the Build-Type.  To get cabal-install to use his Setup.hs, the Build-Type
  must be set to Custom.
 
 Oh, why*2?
 
 Why is the header there if it's not used by Cabal, and why does cabal care?

The field allows cabal to avoid compiling the Setup.hs in this case.
It might also be used by other tools, e.g. one might only trust Simple
packages.  Not all fields are used by all tools, and several of them
do not affect the operation of the library (e.g. Home-page).
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Transformers versus monadLib versus...

2010-07-09 Thread Ross Paterson
On Fri, Jul 09, 2010 at 03:13:19PM -0400, Edward Kmett wrote:
 On Thu, Jul 8, 2010 at 12:37 PM, Yitzchak Gale g...@sefer.org wrote:
 btw, does this overhaul include adding Applicative instances,
 perchance?
 
 They are already part of monads-fd and would, I presume, come along for the
 ride when an mtl = monads-fd + transformers release occurs.  =)

Actually they're in transformers with the type constructors.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Build problems on Hackage server

2010-07-08 Thread Ross Paterson
On Wed, Jul 07, 2010 at 10:22:25AM +0200, Emil Axelsson wrote:
 Last week I uploaded new versions of feldspar-language and
 feldspar-compiler. Both packages build just fine on our local
 machines with GHC 6.10 and 6.12.
 
 But Hackage reports the following build failure:
 
 cabal: dependencies conflict: ghc-6.12.2 requires array ==0.3.0.1 however
 array-0.3.0.1 was excluded because ghc-6.12.2 requires array ==0.3.0.0
 
 Any idea of what might be causing this?

I think the problem was that containers-0.3.0.0 had been rebuilt
(using array-0.3.0.1, which released at the same time as GHC 6.12.3).
Upgrading to GHC 6.12.3 has fixed this (until the next GHC release).
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Type classes

2010-07-04 Thread Ross Paterson
On Sun, Jul 04, 2010 at 09:55:53PM +1000, Ivan Lazar Miljenovic wrote:
 Andrew Coppin andrewcop...@btinternet.com writes:
  In summary, I think we need to devise a way of better-documenting
  class instances. 
 
 Haddock 2.7 supports documenting instance implementations; I don't know
 how this works, but according to the Changelog it's available.

Now we need to go round and document our instances.

Hmm, it seems only partial: documentation attached to an instance is shown
in the list of instances under a type, but not the list under a class.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Type classes

2010-07-04 Thread Ross Paterson
On Sun, Jul 04, 2010 at 02:32:35PM +0200, Daniel Fischer wrote:
 On Sunday 04 July 2010 14:07:03, Ivan Lazar Miljenovic wrote:
  Ross Paterson r...@soi.city.ac.uk writes:
   Hmm, it seems only partial: documentation attached to an instance is
   shown in the list of instances under a type, but not the list under a
   class.
 
  I'm guessing that's to reduce noise...
 
 I'm guessing it might have something to do with the fact that often the 
 module containing the class definition isn't processed together with the 
 module containing the instance declaration.

It could be either way: sometimes you define a new class with instances
for existing types, and with the current implementation that produces
no documentation.

(I tested with type, class and instance in the same package.)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Call for comments: neither package

2010-06-29 Thread Ross Paterson
On Tue, Jun 29, 2010 at 02:56:18PM -0500, Jeremy Shaw wrote:
 On Jun 29, 2010, at 6:02 AM, Stephen Tetley wrote:
 The Applicative Programming with Effects Paper has the monodial
 accumulating applicative instance on a sum type Conor McBride and
 Ross Paterson call Except:
 
 data Except err a = OK a | Failed err
 
 The applicatives-extra package defines a type:
 
 type ErrorMsg = String
 data Failing a = Failure [ErrorMsg] | Success a
 
 Which is a less general version of that type.

There's also a generalization, which I was going to put in transformers,
but couldn't decide on the best name:

data Sum p a = Return a | Others (p a)

instance Functor p = Functor (Sum p) where
fmap f (Return x) = Return (f x)
fmap f (Others m) = Others (fmap f m)

instance Applicative p = Applicative (Sum p) where
pure = Return
Return x * Return y = Return (x y)
Return x * Others my = Others (x $ my)
Others mx * Return y = Others (mx * pure y)
Others mx * Others my = Others (mx * my)

instance Alternative p = Alternative (Sum p) where
empty = Others empty
Return x | _ = Return x
Others _ | Return y = Return y
Others mx | Others my = Others (mx | my)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] IO (Either a Error) question

2010-05-07 Thread Ross Paterson
On Sat, May 08, 2010 at 07:49:57AM +1000, Ivan Lazar Miljenovic wrote:
 Limestraël limestr...@gmail.com writes:
  2010/5/1 John Millikin jmilli...@gmail.com
 
  You might want to make a local version of ErrorT in your library, to
  avoid the silly 'Error' class restriction. This is pretty easy; just
  copy it from the 'transformers' or 'mtl' package.
 
  Yes, I wonder why mtl is not updated so as to remove this restriction.
 
 Presumably because its in maintenance mode (i.e. it only gets
 changed/updated to reflect changes in GHC that might affect it and the
 API is frozen).

The API isn't frozen -- it can be changed with a library proposal,
if you can get people to agree to it.

As Ryan said, the Error constraint is there to support a definition of
the fail method in the Monad instance for ErrorT.  (Personally I think
fail is a terrible wart, and should be shunned.)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] IO (Either a Error) question

2010-05-07 Thread Ross Paterson
On Sat, May 08, 2010 at 01:54:21AM +0200, Limestraël wrote:
  Personally I think fail is a terrible wart, and should be shunned.
 
 So do I.
 I can't understand its purpose since monads which can fail can be implemented
 through MonadPlus.

It was introduced to implement pattern match failure in do-notation,
in Section 3.14 of the Haskell Report:

  do {p - e; stmts} = let ok p = do {stmts}
   ok _ = fail ...
   in e = ok
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] The instability of Haskell libraries

2010-04-25 Thread Ross Paterson
On Mon, Apr 26, 2010 at 06:47:27AM +1000, Ivan Lazar Miljenovic wrote:
 My main problem with this is if you want a custom variant of that
 instance.  Let's take FGL graphs for example with instances for
 QuickCheck's Arbitrary class.  Maybe you want arbitrary graphs that are
 simple, or maybe multiple edges are fine.  Even when considering
 Arbitrary instances for something like String you may wish to have a
 custom variant that makes sense for what you're testing.

Being able to use different instances in different contexts would be
handy, and there have been some proposed extensions to allow this.
But in the current state of Haskell, orphan instances are unworkable --
they invariably lead to trouble sooner or later.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] The instability of Haskell libraries

2010-04-24 Thread Ross Paterson
On Sat, Apr 24, 2010 at 08:21:04PM +1000, Ivan Lazar Miljenovic wrote:
 Mads Lindstrøm mads.lindstr...@gmail.com writes:
  But that would be an API change. It is of cause a question of how strict
  we want to be. I have seen several times that commercial software
  developers denies changes bugs, as the fix would constitute API changes.
  We obviously do not want to go there, but we could bump the version
  number as it would require little work.
 
 I would argue that it would involve bumping a minor version number, not
 a major version number (which indicates an API change) since it's just a
 bug fix.

I think we need a simpler, declarative, definition from which these
details can be worked out, e.g.

Same minor version: any code that worked with the old version will
work with the new version, in the same way.

Same major version: any code using fully explicit imports that worked
with the old version will work with the new version, in the same way.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] The instability of Haskell libraries

2010-04-24 Thread Ross Paterson
On Sat, Apr 24, 2010 at 08:48:07PM +1000, Ivan Lazar Miljenovic wrote:
 Ross Paterson r...@soi.city.ac.uk writes:
  Same major version: any code using fully explicit imports that worked
  with the old version will work with the new version, in the same way.
 
 By this you mean that additions have been made?

According to these definitions, adding exports would require a new
minor version, while adding instances of already exported classes
and types would require a new major version.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: haskell-src-exts 1.9.0

2010-04-15 Thread Ross Paterson
On Thu, Apr 15, 2010 at 10:52:51AM +0200, Sean Leather wrote:
 Any idea why the Haddock docs have not been generated for this
 version? There's also no built on available. Is it an issue with
 the server?

A glitch when I was switching the builds to use cabal install --dry-run.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: GSoC: Hackage 2.0

2010-04-13 Thread Ross Paterson
On Fri, Apr 09, 2010 at 09:23:51PM -0400, Matthew Gruen wrote:
 The proposal as I submitted it is here:
 
 http://docs.google.com/View?docid=0Afa5MxwyB_zYZGhjanNrdjNfMjkzZjloOWNienYpageview=1hgd=1hl=en
 [...]
 The work on bringing hackage-server up to feature parity is primary.

Absolutely.  I would go further: all the new features (1-3) should be
deferred until the new server is not just deployable, but in service.
(After all, that's the only way to be sure it really is deployable.)
If you can do that, you'll get much more input on the new features when
you come to them.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Hackage accounts and real names

2010-04-06 Thread Ross Paterson
On Tue, Apr 06, 2010 at 10:10:09AM +0100, David House wrote:
 3. Privacy issues. Some people simply cannot reveal their real names.

I've already said I was prepared to make exceptions in such cases, but
perhaps you missed that.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Why does Haskell not infer most general type?

2010-04-06 Thread Ross Paterson
On Tue, Apr 06, 2010 at 03:56:32PM -0400, Job Vranish wrote:
 f _ = undefined
   where
 _ = y :: Int - Int
 
 y x = undefined
   where
 _ = f x

Because f and y are mutually recursive, their types are inferred together,
so y gets the type Int - Int (as given), which forces f :: Int - a.

If you add the type signature f :: a - b, you break the cycle: that
type is used in inferring the type of y (namely a - b), which is then
used in checking the typeof f.  Ditto if you add y :: a - b instead.
(This is not Haskell 98, but the implementations have done this for
years, and it will be in Haskell 2010.)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Why does Haskell not infer most general type?

2010-04-06 Thread Ross Paterson
On Tue, Apr 06, 2010 at 05:18:34PM -0400, Job Vranish wrote:
 So in Haskell 98, would the added constraints result in a type error?

Yes, because the types of the mutually recursive identifiers would be
inferred together without using the type signatures, and then would
fail to match the declared types.

But then there aren't any implementations of Haskell 98 to test this on.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Hackage accounts and real names

2010-04-05 Thread Ross Paterson
On Sun, Apr 04, 2010 at 10:28:26PM +0100, David House wrote:
 An issue came up on #haskell recently with Hackage accounts requiring
 real names. The person in question (who didn't send this email as he's
 wishing to remain anonymous) applied for a Hackage account and was
 turned down, as he refused to offer his real name for the username.
 
 Those of us in the conversation thought this a bit of an odd policy,
 and were wondering where this came from. It also emerged that a couple
 of other people had been held back from getting Hackage accounts
 because of this reason.

Basically http://meatballwiki.org/wiki/RealNameUserAdvantages, especially
simplicity, trust and recognizability.  At root, I find it convenient
to run username allocation that way.

I am prepared to make exceptions for privacy concerns, and have done
so once, but that wasn't the case with the person you're referring to.
Their real name is all over the Internet, and they wanted to use their
first name only, which is easily linked to their full name.

I don't recall anyone else refusing to use their real name, though
a number of people have not responded to enquiries I made of them.
Of course some may have been put off by the User accounts page.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: ANN: data-category, restricted categories

2010-03-30 Thread Ross Paterson
On Tue, Mar 30, 2010 at 11:26:39PM +0100, Conor McBride wrote:
 Getting back to the question, whatever happened to empty case expressions? We
 should not need bottom to write total functions from empty types.

Empty types?  Toto, I've a feeling we're not in Haskell anymore.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] breadth first search one-liner?

2010-03-22 Thread Ross Paterson
On Mon, Mar 22, 2010 at 11:02:32AM +0100, Johannes Waldmann wrote:
 Dear all, there is this neat one-line BFS implementation
 
 bfs :: Eq a
 = ( a - [a] ) - a - [a]
 bfs next start =
 let xs = nub $ start : ( xs = next )
 in  xs
 
 but it has a problem: it only works for infinite graphs. This is fine:
 
 take 20 $  bfs ( \ x - [2*x, x+1] ) 1
 
 but this is not:
 
 take 20 $  bfs ( \ x - filter (0) [ div x 2, x - 1 ] ) 10
 
 Is there a nice way to repair this?

bfs :: (a - [a]) - a - [a]
bfs f s = concat $ takeWhile (not . null) $ iterate (= f) [s]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: breadth first search one-liner?

2010-03-22 Thread Ross Paterson
On Mon, Mar 22, 2010 at 10:30:32AM +, Johannes Waldmann wrote:
 Nice! - Where's the 'nub'?

A bit longer:

bfs :: Eq a = (a - [a]) - a - [a]
bfs f s = concat $ takeWhile (not . null) $ map snd $ iterate step ([], [s])
  where step (seen, xs) = let seen' = xs++seen in (seen', nub $ [y | x - xs, y 
- f x, notElem y seen'])
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: breadth first search one-liner?

2010-03-22 Thread Ross Paterson
A bit closer to the original:

bfs :: Eq a = (a - [a]) - a - [a]
bfs f s = concat $ takeWhile (not . null) levels
  where levels = foldr trim [] $ [s] : map (nub . (= f)) levels
trim xs xss = xs : map (\\ xs) xss
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Seen on reddit: or, foldl and foldr considered slightly harmful

2010-02-11 Thread Ross Paterson
On Thu, Feb 11, 2010 at 11:00:51AM +0100, Ketil Malde wrote:
 Johann Höchtl johann.hoec...@gmail.com writes:
  In a presentation of Guy Steele for ICFP 2009 in Edinburgh:
  http://www.vimeo.com/6624203
  he considers foldl and foldr harmful as they hinder parallelism
  because of Process first element, then the rest Instead he proposes
  a divide and merge aproach, especially in the light of going parallel.
 
 In Haskell foldl/foldr apply to linked lists (or lazy streams, if you
 prefer) which are already inherently sequential, and gets a rather harsh
 treatment.  I notice he points to finger trees, which I though was
 implemented in Data.Sequence.

Direct URL for the slides:
http://research.sun.com/projects/plrg/Publications/ICFPAugust2009Steele.pdf

As he says, associativity is the key to parallelism -- an old observation,
but still underappreciated.  Even without parallelism, associativity also
gives us greater freedom in structuring our solutions.  The moral is that
our datatypes need associative binary operations more than asymmetric ones.
We use lists too much (because they're so convenient) and apart from the
loss of parallelism it constrains our thinking to the sequential style
criticised by Backus back in 1978.

Regarding finger trees, he's just referring to the idea of caching the
results of monoidal folds in nodes of a tree.  That's crucial to the
applications of finger trees, but it can be applied to any kind of tree.
As he mentions, it's related to the Ladner-Fischer parallel prefix
algorithm, which has an upward pass accumulating sums for each subtree
followed by a downward accumulation passing each sum into the subtree
to the right.   But it's not just for parallelism: when you have these
cached values in a balanced tree, you can compute the sum of any prefix
in O(log n) steps.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: data-ordlist-0.2

2010-02-07 Thread Ross Paterson
Why not wrap lists as Set and Bag abstract datatypes?  An added bonus
is that you could make them instances of Monoid.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] HList darcs repo missing?

2010-01-25 Thread Ross Paterson
On Mon, Jan 25, 2010 at 05:27:57PM -0500, Gwern Branwen wrote:
 It was there as of 15 September 2009 when I sent Oleg my last patch.
 Maybe some of the server changes since messed around with it?

Most things that could be moved to community.haskell.org weren't moved
across to the new machine:

http://www.haskell.org/pipermail/haskell/2010-January/021861.html
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Non-termination due to context

2010-01-22 Thread Ross Paterson
On Fri, Jan 22, 2010 at 12:24:37PM +0100, Emil Axelsson wrote:
 Consider the following program:
 
 {-# LANGUAGE FlexibleInstances, OverlappingInstances, UndecidableInstances 
 #-}
 class B a = A a
 
 instance A Int
 
 class Eq a = B a
 
 instance (A a, Eq a) = B a
 [...]
 Although I don't know all the details of the class system, it seems
 unintuitive that I can make a program non-terminating just by
 changing the context of a function (regardless of
 UndecidableInstances etc.).
 
 Is this a bug or a feature?

I'm afraid you voided the warranty when you used UndecidableInstances.

You really do have a circularity between A and B here, so it's not
surprising that you get a loop.  By changing the context, you demanded
more instances, undecidable ones in fact.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Non-ASCII characters in .cabal files break Haddock?

2010-01-20 Thread Ross Paterson
On Tue, Jan 19, 2010 at 01:00:07PM -0800, John Millikin wrote:
 I recently uploaded a package to Hackage[1], which contains a
 non-ASCII character in the .cabal file. That file is encoded with
 UTF-8, and it displays fine in Vim, Firefox, and even the Hackage
 package landing page. However, Haddock is failing to build it[2] --
 apparently it can't handle UTF-8 encoded text properly.

It seems that openTempFile writes the text without any encoding (#3832).
Haddock quite reasonably fails because it expects encoded text.

 In documentation sections, Haddock supports special syntax for
 escaping non-ASCII. Is there any equivalent syntax for Cabal files?

The Description field is haddock markup, so that should be a workaround.
(or you could use more naive spelling)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Parse error

2010-01-17 Thread Ross Paterson
On Sun, Jan 17, 2010 at 10:33:45AM +, Andrew Coppin wrote:
 Tony Morris wrote:
 main = do
  putStrLn Line 1
  putStrLn Line 2
 
  let xs = do x - [1..10]
  y - [1..10]
  return (x+y)
 
  print xs
 
 Urg, but that's *ugly*. Is there no way I can reduce the amount of
 indentation to something more reasonable?

Sure: start a new line and indentation level after every where, let, do or of.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: amqp-0.1

2010-01-17 Thread Ross Paterson
On Sun, Jan 17, 2010 at 12:35:08PM +0100, Holger Reinhardt wrote:
 Get it here: http://hackage.haskell.org/package/amqp
 
 For some reason it doesn't compile on Hackage. It says At least the following
 dependencies are missing: network-bytestring =0.1.2. Is there a way to solve
 this?

Sorry, that was a glitch in the upgrade to GHC 6.12.1.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Hackage strangeness

2010-01-15 Thread Ross Paterson
On Fri, Jan 15, 2010 at 03:45:56PM +0100, Roel van Dijk wrote:
 I wrote a small cronjob to update my hackage reverse-deps. When
 checking if it worked I noticed that my hackage appears to be more
 up-to-date than the real thing!
 
 [...]
 
 Is this a case of data loss or something else?

It's in the process of moving to a new (and hopefully more reliable) host.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Hackage strangeness

2010-01-15 Thread Ross Paterson
On Fri, Jan 15, 2010 at 03:08:36PM +, Ross Paterson wrote:
 It's in the process of moving to a new (and hopefully more reliable) host.

Done.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haddock question: hiding internal instances

2010-01-15 Thread Ross Paterson
On Fri, Jan 15, 2010 at 09:16:03PM +0100, Niklas Broberg wrote:
 The question I have is this: How can I get Haddock to omit listing
 instances of package-internal data types for exported classes?

It's a known limitation: http://trac.haskell.org/haddock/ticket/37
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] HackageDB Question

2010-01-09 Thread Ross Paterson
On Sat, Jan 09, 2010 at 01:44:03PM -0800, Gregory Crosswhite wrote:
 How does HackageDB generate the documentation for uploaded packages?  
 Specifically, if I am using my own build system rather than Cabal, then what 
 do I need to do (e.g., what interface do I need to supply) for HackageDB to 
 correctly generate the documentation?

I assume you're using Cabal, but you mean a custom Setup.hs.

It relies on your Setup.hs doing the same as the simple one
(as documented in the Cabal User's Guide) for

setup configure --haddock-option=...
setup haddock --html-location=... --hyperlink-source
setup haddock --hoogle
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANNOUNCE: error-message

2009-12-06 Thread Ross Paterson
On Sun, Dec 06, 2009 at 03:50:55PM -0500, Brent Yorgey wrote:
 So what we have here, it seems, is a type with at least two reasonable
 Applicative instances, one of which does *not* correspond to a Monad
 instance.  My argument is that it is very strange (I might even go so
 far as to call it a bug) to have a type with an Applicative instance
 and a Monad instance which do not correspond, in the sense that
 
   pure  = return
   (*) = ap

There are several of these.  Another is the possible Applicative instance
for lists with

pure  = repeat
(*) = zipWith id

In these cases we usually make the Applicative instance match the Monad
one and define an equivalent type for each other Applicative instance
(e.g. ZipList in Control.Applicative).
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] New Hackage category: Error Handling

2009-12-05 Thread Ross Paterson
On Sat, Dec 05, 2009 at 05:52:11PM +0200, Michael Snoyman wrote:
 For the record, I find this pedanticism misplaced, ...

I think you'll find that's pedantry.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] module export question

2009-12-01 Thread Ross Paterson
On Tue, Dec 01, 2009 at 05:11:42PM -0500, Sean McLaughlin wrote:
 The problem is that I explicitly didn't export 't' as an element of T
 (by not writing T(..)).
 Am I just misunderstanding how exports work?  I couldn't figure out
 what the correct behavior should be by looking at the 98 report.

Exports (and imports) merely enumerate names, not their relationships,
so the original export is equivalent to T(T, t) or T(..).
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


  1   2   3   4   >