[Haskell-cafe] Question about Newtype "op()" function arguments.

Joe Quinn headprogrammingczar at gmail.com
Sat Jun 8 00:40:21 CEST 2013

On 6/7/2013 4:51 PM, Tom Ellis wrote:
> On Fri, Jun 07, 2013 at 04:05:09PM -0400, Joe Q wrote:
>> The phantom parameter solves the same problem as scoped type variables.
>> Granted, if you find yourself in that kind of polymorphic soup you have
>> deeper problems...
> I don't understand this.  Scoped type variables are used when you want to
> use a type variable from the top level within the body of a function.  If
> you use "op" and specify a particular constructor then you don't have a
> variable but a concrete instance of a type.  But maybe I'm missing some more
> powerful way this can be used ...
> Tom

You can use scoped type variables to correct an ambiguous type error.

You can think of op as a variation on asTypeOf, as documented here on 

If I tried to come up with an example that's specific to op, it would 
only be horribly contrived.

More information about the Haskell-Cafe mailing list