tyConHash -- quick fix?

ยอดดู 10 ครั้ง
ข้ามไปที่ข้อความที่ยังไม่อ่านรายการแรก

Simon Peyton Jones

ยังไม่อ่าน,
11 มี.ค. 2558 05:40:0111/3/58
ถึง ghc-...@haskell.org, core-librari...@haskell.org

data TyCon = TyCon {

   tyConHash    :: {-# UNPACK #-} !Fingerprint, -- ^ @since 4.8.0.0

   tyConPackage :: String, -- ^ @since 4.5.0.0

   tyConModule  :: String, -- ^ @since 4.5.0.0

   tyConName    :: String  -- ^ @since 4.5.0.0

}

 

Friends,

Is tyConHash a good name here?  Wouldn’t tyConFingerprint be better? 

·         Hash functions usually yield a Int.

·         tyConFingerprint :: TyCon -> Fingerprint makes the name match the type.

·         If we had fingerprintHash:: Fingerprint -> Int, then we might want
tyConHash :: TyCon -> Int
tyConHash = fingerprintHash . tyConFingerpring

 

This is new in 7.10, so we could fix it now with no trouble.

Simon

 

Edward Kmett

ยังไม่อ่าน,
11 มี.ค. 2558 05:44:5011/3/58
ถึง Simon Peyton Jones, ghc-...@haskell.org, core-librari...@haskell.org
I like your idea of using tyConHash for the Int version and tyConFingerprint to refer to the Fingerprint. 

The former fits more closely with the usage elsewhere e.g. hashUnique, hashStableName.

-Edward

--
You received this message because you are subscribed to the Google Groups "haskell-core-libraries" group.
To unsubscribe from this group and stop receiving emails from it, send an email to haskell-core-libr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Herbert Valerio Riedel

ยังไม่อ่าน,
11 มี.ค. 2558 05:47:4911/3/58
ถึง Simon Peyton Jones, ghc-...@haskell.org, core-librari...@haskell.org
On 2015-03-11 at 10:39:41 +0100, Simon Peyton Jones wrote:

[...]

> This is new in 7.10, so we could fix it now with no trouble.
> Simon

Here's a bit more background information:

Afaics, tyConHash was introduced in

http://git.haskell.org/ghc.git/commitdiff/e0b63e02b78d0bd31a073738b1154a93d22dccca

and it was recently re-exported via

http://git.haskell.org/ghc.git/commitdiff/56e0ac98c3a439b8757a2e886db259270bdc85f0

which followed the same questionable naming scheme for the really new
'typeRepHash' field accessor


Simon Peyton Jones

ยังไม่อ่าน,
11 มี.ค. 2558 10:38:3211/3/58
ถึง Herbert Valerio Riedel, ghc-...@haskell.org, core-librari...@haskell.org
Yes, but the original 'tyConHash' was not exported, so no one will be annoyed if we change its name. We only started exporting it recently. Hence my suggestion to change its name to tyConFingerprint.

Simon

Johan Tibell

ยังไม่อ่าน,
11 มี.ค. 2558 20:28:2711/3/58
ถึง Simon Peyton Jones, Herbert Valerio Riedel, core-librari...@haskell.org, ghc-...@haskell.org
SGTM. I'm probably the only user of the newly exported symbol (by using it in hashable).

_______________________________________________
ghc-devs mailing list
ghc-...@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

ตอบทุกคน
ตอบกลับผู้สร้าง
ส่งต่อ
ข้อความใหม่ 0 รายการ