Henk-Jan van Tuyl | 19 Apr 23:50
Picon

Creating a list of extensions to add to Haskell'


L.S.,

Many libraries on Hackage use language extensions, or depend on other
libraries that use extensions. When an extension is no longer supported,
or another Haskell compiler must be used,
this may lead to a lot of maintenance work.

To prevent an extreme amount of maintenance, I try to avoid using language
extensions, but many libraries on Hackage use them.

My proposal is:
Make an inventory, of the most used language extensions (based
on the number of Hackage downloads of packages depending directly or
indirectly on them).  If the most used extensions are theoretically sound
and improve software developed with them, they should be included in the
next Haskell standard.

Packages, using rejected extensions, should be redesigned or shunned
(marked as such in Hackage).

Regards,
Henk-Jan van Tuyl

--

-- 
http://Van.Tuyl.eu/
http://members.chello.nl/hjgtuyl/tourdemonad.html
Haskell programming
--
(Continue reading)

Picon

Faça parte da minha rede no LinkedIn

 
 
 
 
De Carlos Camarao Figueiredo
 
Professor na UFMG
Belo Horizonte e Região, Brasil
 
 
 

Eu gostaria de adicioná-lo à minha rede profissional no LinkedIn.
-Carlos Camarao

 
 
 
 
 
 
Você está recebendo convites de conexão por e-mail. Cancelar inscrição
© 2012, LinkedIn Corporation. 2029 Stierlin Ct. Mountain View, CA 94043, USA
 
_______________________________________________
Haskell-prime mailing list
Haskell-prime@...
http://www.haskell.org/mailman/listinfo/haskell-prime
Greg Weber | 17 Mar 02:44
Gravatar

String != [Char]

the text library and Text data type have shown the worth in real world
Haskell usage with GHC.
I try to avoid String whenever possible, but I still have to deal with
conversions and other issues.
There is a lot of real work to be done to convert away from [Char],
but I think we need to take it out of the language definition as a
first step.

I can only see one issue with the proposal: it can be convenient to
operate on a list of characters.
But I think there are plenty of solutions at our disposal. A simple
conversion from Text to a list of characters might suffice. In GHC,
OverloadedStrings means users would still be free to use String the
same way they are now.
Gabriel Dos Reis | 16 Mar 19:08

What is a punctuation character?

Hi,

The lexical structure chapter defines the non-terminal uniSymbol as

     uniSymbol ::= any Unicode symbol or punctuation

There is a slight ambiguity here: is that description supposed to
be parsed as:
   (a) "Unicode (symbol or punctuation)", or
   (b) "(Unicode symbol) or punctuation"?

If (b), then what qualifies as "punctuation"?  As far as I can tell,
that is not defined anywhere in the Report.  Is it "punctuation" in the
basic ASCII charset or in the extended ASCII charset?  Everywhere
else the Report has been careful in listing which ASCII characters
are meant.

Thanks,

-- Gaby
Gabriel Dos Reis | 15 Mar 18:14

Hierarchical module broken link

Hi,

The page with link

  http://www.haskell.org/hierarchical-modules/

from

  http://hackage.haskell.org/trac/haskell-prime/wiki/HierarchicalModules

is broken (404 error).

Thanks,

-- Gaby
John Meacham | 18 Feb 03:01
Favicon

simple extension to ghc's record disambiguation rules

Hi, I'd like to propose an extremely simple extension to ghc's record
disambiguation rules,

my motivation is that I often have record types with multiple constructors
but common fields.

so the handy idiom of

f Rec { .. } = do
        blah
        return Rec { .. }

won't work, because I don't know the specific constructor.

so, my proposal is that when you come across something like

(e::RecType) { blah = foo }

(with an explicit type signature like shown)

You interpret 'blah' as if it is a field of the record of type 'Rec'. This
gives the advantages of record field names being scoped by type but without
you having to specify the precise constructor.

It is also backwards compatible for expressions, but would be a new thing
for patterns which generally don't allow type signatures there.

It sidesteps type checker interactions by only being triggered when an
explicit type annotation is included.

ideally it would be combined with the 'update' and 'label-based
pattern-matching' extensions from this page
http://hackage.haskell.org/trac/haskell-prime/wiki/ExistingRecords

    John
Greg Weber | 10 Feb 03:11
Gravatar

Proposal: require spaces around the dot operator

Similar to proposal #20, which wants to remove it, but immediately
less drastic, even though the long-term goal is the same.
This helps clear the way for the usage of the unspaced dot as a record
field selector as shown in proposal #129.

After this proposal shows clear signs of moving forward I will add a
proposal to support a unicode dot for function composition.
After that we can all have a lively discussion about how to fully
replace the ascii dot with an ascii alternative such as <~ or <<<
After that we can make the dot operator illegal by default.

This has already been discussed as part of a records solution on the
ghc-users mail list and documented here:
http://hackage.haskell.org/trac/ghc/wiki/Records/DotOperator
Simon Peyton-Jones | 23 Dec 18:41
Picon
Favicon
Gravatar

FW: 7.4.1-pre: Show & Integral

I'm confused too.  I'd welcome clarification from the Haskell Prime folk.

S

-----Original Message-----
From: Serge D. Mechveliani [mailto:mechvel@...] 
Sent: 23 December 2011 17:36
To: Simon Peyton-Jones
Subject: Re: 7.4.1-pre: Show & Integral

On Thu, Dec 22, 2011 at 08:14:54PM +0000, Simon Peyton-Jones wrote:
> |  2011/12/22 Edward Kmett <ekmett@...>:
> |  > The change, however, was a deliberate _break_ with the standard that
> |  > passed through the library review process a few months ago, and is now
> |  > making its way out into the wild.
> |  
> |  Is it reasonable to enquire how many standard-compliant implementations
> |  of Haskell there are?
> 
> Just to be clear, the change IS the standard.  GHC has to change to be compliant. 
> At least that's how I understand it.

I am confused.
I am looking now at the on-line specification of  Haskell-2010, 
6.3 Standard Haskell Classes.
It shows that  Integral  includes  Show:  

                           Eq     Show 
                             \   /
                              Num 
                              |
                       Enum  Real 
                          \   |
                           Integral

This is also visible in the further standard class declarations in this chapter.

Hence, for  `x :: Integral a => a'  it is correct to write  (shows x "").
And  ghc-7.4.0.20111219  does not allow this.
So,  ghc-7.4.0.20111219  breaks the 2010 standard. Now, Edward Kmett writes that
this break is done deliberately.

Am I missing something?

I witness this for the first time: that GHC deliberately breaks the current 
Haskell standard.
Probably, many people (as myself) dislike this point of the standard.
Well, they can write a dummy Show implementation for their type T:
      showsPrec _ _ = showString "(<t> :: T)",

and wait for an improved standard, say, Haskell-II
-- ?

Regards,

------
Sergei
mechvel@...
Christian Maeder | 30 Sep 14:21
Picon
Favicon

left and right sections extended

Hi,

the following sections are currently legal in Haskell:

   (a + b +) and (++ a ++ b)

because + is left and ++ is right associative.

I would like to write

    (+ 1 +) and (++ " " ++)

as legal generalized sections, too, to stay for (\ a -> (a + 1 +)) and 
(\ a b -> a ++ " " ++ b) respectively.

The right-associative case would be "flip (\ b -> (++ " " ++ b))"

Such an extension would be easy to implement and it would also be a 
generalization of putting parenthesis around symbols as in (+) or (++).

Extending the grammar is easy:

aexp 	-> ...
	| 	( infixexp qop ) 	    (left section)
	| 	( qop⟨-⟩ infixexp ) 	    (right section)

Some thoughts are needed to exclude the illegal cases (as done for left 
and right sections).

Is this worth a formal proposal or is this too confusing?

Cheers Christian

_______________________________________________
Haskell-prime mailing list
Haskell-prime <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-prime
Cale Gibbard | 8 Sep 02:07
Picon

Please apply the comparison function given to nubBy to elements of the list in the order in which they occur in the list.

I just tried this in ghci-7.0.3:

ghci> nubBy (>=) [1,2,3,4]
[1]

Think about what this is doing: it is excluding 2 from the list
because 2 >= 1, rather than including it because 1 >= 2 fails.

I think an important convention when it comes to higher order
functions on lists is that to the extent which is possible, the
function parameters take elements from the list (or things computed
from those) in the order in which they occur in the original list.

If we reimplement it in the obvious way:
ghci> let nubBy f [] = []; nubBy f (x:xs) = x : filter (not . f x) (nubBy f xs)
ghci> nubBy (>=) [1,2,3,4]
[1,2,3,4]

I'm aware that the Report (strangely!) explicitly leaves the behaviour
of nubBy unspecified for functions which are not equivalence
relations, but the behaviour given by the Report implementation (the
opposite of the current behaviour in GHC) is useful and desirable
nonetheless.

I'm sure I've written about this before. I'm not entirely sure what
happened to the previous thread of discussion about this, but it just
came up again for me, and I decided that I was sufficiently irritated
by it to post again.

Another thing perhaps worth pointing out is that the parameters to
mapAccumR have always been backwards (compare it with foldr). Few
enough people use this function that I'm fairly sure we could just
change it without harm.

 - Cale
Anthony Clayden | 26 Jul 13:33
Picon

Re: TypeFamilies vs. FunctionalDependencies & type-level recursion

> 
> Sorry for the late reply.
Thanks Oleg, I take it the Northern hemisphere is now on
academic summer holidays.
> 
> [snip]
> 
> > Finally, I still think most of the "magic" in everything
> > we've been talking about boils down to being able to
> > have a type variable that can take on any type *except*
> > a certain handful.  This would allow us to avoid
> > overlapping instances of both classes and type families,
> would allow us to define TypeEq, etc.  Moreover, it would
> > be a more direct expression of what programmers intend,
> > and so make code easier to read.  Such a constraint
> cannot be part of the context, because
> 
> Alas, such `type variables' with inequality constraints
> are quite complex, and the consequences of their
> introduction are murky. Let me illustrate. First of all,
> the constraint /~ (to be used as t1 /~ Int) doesn't help
> to define TypeEq, etc. because constraints are not used
> when selecting an instance. ...

Yes indeed we can't use constraints when selecting an
instance, 
several posters have pointed this out.
I've suggested we call these inequality 'restraints' rather
than 'constraints'.
And a different syntax has been proposed, similar to pattern
guards:
      type instance TypeEq a b   | a /~ b   = HTrue

> Instances are selected only by
> matching a type to the instance head. Instance selection
> based on constraints is quite a change in the type checker
> , and is unlikely to be implemented.

I agree that selecting instances based on constraints would
be abig change, but ...

Selecting instances based on inequalities is already
implemented in GHC and Hugs.
(And has been successfully used for over a decade.) You've
used it extensively yourself in the HList work, and much
other type-level manipulation (such as IsFunction).

Unfortunately, it's not called 'instance selection based on
inequalities' (or some such), and its implementation got all
mixed up with Functional Dependencies, which to my mind is
an orthogonal part of the design.

Instance selection based on inequalities is called
'Overlapping Instances'.
The difficulty in adopting it into Haskell prime is that it
isn't thoroughly specified,
and you can currently only use it with FunDeps.

To avoid confusion with FunDeps, let's imagine we could use
overlapping instances
 with Type Families:
       type family HMember e l
       type instance HMember a HNil         = HFalse
       type instance HMember a (HCons a l') = HTrue
       type instance HMember a (HCons b l') = HMember a l'
Selecting that last instance implies a /~ b.
(Otherwise the HTrue instance would be selected).
Using inequality restraints, we'd write that last instance
as:
       type instance HMember a (HCons b l') | a /~ b =
HMember a l'

And by putting an explicit inequality we are in fact
avoiding the trouble with
overlaps and all their implicit logic:
  The compiler can check that although the instance heads do
overlap,
     the inequality disambiguates the instances.
  So type inference could only select one instance at most.

I think this could be implemented under the new OutsideIn(X)
type inference:
   Inference for the ordinary instances proceeds as usual.
   Inequalities give rise to implication terms(as used for
GADTs),
      with the inequality in the antecedent:
       (a /~ b) implies (TypeEq a b ~ HFalse) 
   As with GADTs, inference needs evidence that a /~ b
before applying the consequent.
   There is no danger of clashing with other instances of
TypeEq,
      because the instance (including inequality) doesn't
overlap any of them.

(I made some long posts to the Haskell-prime list last
month, explaining in more detail, and responding to your
TTypeable suggestion.)

> 
> _______________________________________________
> Haskell-prime mailing list
> Haskell-prime@...
> http://www.haskell.org/mailman/listinfo/haskell-prime

Gmane