Proposal: Don't require users to use undefined

wren ng thornton wren at
Wed Oct 27 19:29:40 EDT 2010

On 10/27/10 3:43 AM, Simon Peyton-Jones wrote:
> I'm not keen on this proposal.
>    a) The improvement is minor
>    b) A lot of exixting code has to be changed
>    c) There is a better way to do the job
> [...]
> What we *want* is
> 	newSizeOf :: forall a. Storable a =>  Int
> [...]
> The obvious solution is something Haskell badly needs: explicit type applications. Instead of writing
> 	sizeOf (undefined :: Int)
> we should write
> 	newSizeOf @ Int
> where the "@" says that the next argument is a type. As Haskell's type system becomes more sophisticated, the lack of type applications becomes more and more annoying.
> [...]
> Given explicit type applications and scoped type variables, it's easy to do the Right Thing for your examples. And the Right Thing works at higher kinds too.  Eg
> 	class Typeable1 (a :: *->*) where
> 	  typeOf1 :: TypeRep
> Then we can say (typeOf1 @ Maybe).  This is harder with proxies; I don't think it's covered by your proposal.
> Now, none of this is H98, of course.  But we already have a H98 solution.  I don't really think it's worth the disruption to switch from one workaround to another, even aside from dealing with the long-running deprecation and compatibility issues that then show up.


Live well,

More information about the Libraries mailing list