PatternSignatures (rant)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

PatternSignatures (rant)

Johannes Waldmann
Dear all, (this is a rant - please ignore)

why has "PatternSignatures"
been renamed to "ScopedTypeVariables" (in ghc-6.10)?

show me the alleged "type variable" in this code:
do x :: Int <- [ 1 .. 10 ] ; return $ x^2

and why on earth do I need to use a language extension at all
to get to the most basic thing of declarative programming:
to declare the type of an identifier?

This seriously hurts (me, at least) when teaching Haskell.

Thanks - J.W.



_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe

signature.asc (265 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: PatternSignatures (rant)

Neil Mitchell
Hi,

> why has "PatternSignatures"
> been renamed to "ScopedTypeVariables" (in ghc-6.10)?

It's unfortunate that 6.8 doesn't have ScopedTypeVariables and 6.10
warns on PatternSignatures. It would have been nice if you could
support N.M and N.M+2 with the same code without having to turn off
warnings.

> show me the alleged "type variable" in this code:
> do x :: Int <- [ 1 .. 10 ] ; return $ x^2
>
> and why on earth do I need to use a language extension at all
> to get to the most basic thing of declarative programming:
> to declare the type of an identifier?

Because it isn't in Haskell 98, and GHC (very kindly) only accepts
Haskell 98 by default. By doing so they've kept the standard alive,
and we should be very grateful for this. I think this is a guaranteed
feature for H', it's really an oversight that it isn't in H98.

Thanks

Neil
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: PatternSignatures (rant)

Johannes Waldmann

> [...] and GHC (very kindly) only accepts Haskell 98 by default.

as in, hierarchical modules?

continuing the rant, I'd say that "ScopedTypeVariables"
is a kludge that tries to repair another hack,
namely, allowing to not declare type variables.
That's again counter to the very idea of declarative programming.

I mean, if we'd write

let  f1 :: forall a . T1 a
     f1 = let f2 :: forall a . T2 a
              f3 :: T3 a
          in ...
in ...

then there'd be no need to look up the meaning
of the inner  a's  in some command line option
or pragma in the file header, both of which
are miles away from the source location.

(I already said it is a rant, OK?) - J.W.


_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe

signature.asc (265 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: PatternSignatures (rant)

Henning Thielemann
In reply to this post by Johannes Waldmann

On Wed, 8 Apr 2009, Johannes Waldmann wrote:

> Dear all, (this is a rant - please ignore)
>
> why has "PatternSignatures"
> been renamed to "ScopedTypeVariables" (in ghc-6.10)?
>
> show me the alleged "type variable" in this code:
> do x :: Int <- [ 1 .. 10 ] ; return $ x^2
>
> and why on earth do I need to use a language extension at all
> to get to the most basic thing of declarative programming:
> to declare the type of an identifier?

This would work:
   do x <- [ 1 .. 10 ] ; return $ (x::Int)^2

but I assume, that you want to declare the type on binding, right?
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: PatternSignatures (rant)

Joachim Breitner-2
In reply to this post by Johannes Waldmann
Hi Johannes,

Am Mittwoch, den 08.04.2009, 03:00 +0000 schrieb Johannes Waldmann:

> Dear all, (this is a rant - please ignore)
>
> why has "PatternSignatures"
> been renamed to "ScopedTypeVariables" (in ghc-6.10)?
>
> show me the alleged "type variable" in this code:
> do x :: Int <- [ 1 .. 10 ] ; return $ x^2
>
> and why on earth do I need to use a language extension at all
> to get to the most basic thing of declarative programming:
> to declare the type of an identifier?
>
> This seriously hurts (me, at least) when teaching Haskell.

I agree, and it has bothered me for quite a while. But better late than
never:
https://github.com/ghc-proposals/ghc-proposals/pull/119

If if this still seriously hurts you, feel free to express your support
in the proposal.

Cheers,
Joachim


--
Joachim Breitner
  [hidden email]
  http://www.joachim-breitner.de/

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.

signature.asc (849 bytes) Download Attachment