[Haskell-beginners] phantom types and record syntax

Brandon Allbery allbery.b at gmail.com
Wed Jun 17 04:55:38 UTC 2015


On Wed, Jun 17, 2015 at 12:14 AM, akash g <akaberto at gmail.com> wrote:

> The phantom type doesn't appear on the actual constructors, only on the
> type signatures.  In the function convertToReq, you are changing the
> following
> 1. The type.
> 2. The value of the price record (actually returning a new value with the
> price record changed to one and the rest of the fields being the same.
>

I'm not sure I see the difference between the given example and the
"effectively phantom" type in

    foo :: Maybe String -> Maybe Int
    foo x at Nothing = x -- error: Nothing :: Maybe String is not compatible
with Maybe Int
    foo x = ...

-- 
brandon s allbery kf8nh                               sine nomine associates
allbery.b at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20150617/e2bda278/attachment.html>


More information about the Beginners mailing list