On Mon, Jul 30, 2007 at 05:31:40AM -0400, Dan Licata wrote:
> With the functional dependency, you can't work with the view datatypes
> at all.  Once you write
> 
> type Typ
> data TypView = Unit | Arrow Typ Typ
> 
> instance View Typ TypView where
>   view = ...
> 
> you're no longer allowed to take apart a TypView at all!

Exactly.  And I'm 100% convinced it's a non-issue, since all the
heavyweight view proposals don't allow you to manipulate view objects
*at all*.  My approach is no worse.

> E.g. you can't write
> 
> outUnit :: TypView -> Bool
> outUnit Unit = True
> outUnit _    = False
> 
> because the implicit application of the view function will mean that
> outUnit must consume a Typ.  

What would you use it for, anyway?  TypView objects don't exist
anywhere except internally in case-expressions.

> Personally, I'd rather have special syntax in the pattern (-> pat) than
> have these global effects on what you can do with certain types.

You can only declare the instance for TypView in the same module as
TypView itself, since otherwise it would conflict with the implicit
instance.  Therefore, providing an instance is no more "global" than
just renaming the type.

Stefan

Attachment: signature.asc
Description: Digital signature

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

Reply via email to