Records in Haskell
J. Garrett Morris
jgmorris at cs.pdx.edu
Thu Mar 1 08:17:25 CET 2012
On Wed, Feb 29, 2012 at 11:05 PM, AntC <anthony_clayden at clear.net.nz> wrote:
> I repeat: nobody is using a "type-level string". You (or someone) is
> making it up.
It isn't clear where that idea came from.
On Thu, Sep 15, 2011 at 7:51 AM, Simon Peyton-Jones
<simonpj at microsoft.com> wrote:
> Yes, it would, and of course any impl of TDNR would need an internal
> constraint similar to your Select. Â In my original proposal I was
> hiding that, but it has to be there in the implementation. Â But you
> are right that making it explicit might be a good thing. Â Esp with
> Julien's new kind stuff (coming soon) we should be able to say
>
> class Select (rec :: *) (fld :: String) where
> type ResTy rec fld:: *
> get :: rec -> ResTy rec fld
>
> data T = MkT { x,y :: Int }
> instance Select T "x" where
> get (MkT {x = v}) = v
Oh.
On Mon, Jan 2, 2012 at 4:38 AM, Simon Peyton-Jones
<simonpj at microsoft.com> wrote:
> It seems to me that there's only one essential missing language feature,
> which is appropriately-kinded type-level strings (and, ideally, the ability
> to reflect these strings back down to the value level).
<snip>
> Specifically
>
> * Allow String as a new kind
>
> * Now you can define classes or types with kinds like
>
> MyCls :: String -> a -> Constraint
>
> T :: String -> *
>
> * Provide type-level string literals, so that “foo” :: String
Huh.
You may want to call your type-level-things-that-identify-fields
strings, labels, fieldLabels, or rumbledethumps, but surely that's not
the point of interest here?
/g
--
"Would you be so kind as to remove the apricots from the mashed potatoes?"
More information about the Glasgow-haskell-users
mailing list