intern 0.5.0 → 0.5.1
raw patch · 4 files changed
+11/−5 lines, 4 filessetup-changedPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Data.Interned: modifyAdvice :: Interned t => IO t -> IO t
+ Data.Interned.Internal: modifyAdvice :: Interned t => IO t -> IO t
- Data.Interned: class (Eq (Description t), Hashable (Description t)) => Interned t where { data family Description t; type family Uninterned t; { seedIdentity _ = 0 } }
+ Data.Interned: class (Eq (Description t), Hashable (Description t)) => Interned t where { data family Description t; type family Uninterned t; { seedIdentity _ = 0 modifyAdvice = id } }
- Data.Interned.Internal: class (Eq (Description t), Hashable (Description t)) => Interned t where { data family Description t; type family Uninterned t; { seedIdentity _ = 0 } }
+ Data.Interned.Internal: class (Eq (Description t), Hashable (Description t)) => Interned t where { data family Description t; type family Uninterned t; { seedIdentity _ = 0 modifyAdvice = id } }
Files
- Data/Interned/Internal.hs +3/−2
- Setup.hs +0/−2
- Setup.lhs +7/−0
- intern.cabal +1/−1
Data/Interned/Internal.hs view
@@ -37,7 +37,6 @@ mkCache = result where result = Cache $ unsafePerformIO $ newMVar $ CacheState (seedIdentity result) HashMap.empty - type Id = Int class ( Eq (Description t)@@ -50,13 +49,15 @@ identity :: t -> Id seedIdentity :: p t -> Id seedIdentity _ = 0+ modifyAdvice :: IO t -> IO t+ modifyAdvice = id cache :: Cache t class Interned t => Uninternable t where unintern :: t -> Uninterned t intern :: Interned t => Uninterned t -> t-intern bt = unsafeDupablePerformIO $ modifyMVar (getCache cache) go +intern bt = unsafeDupablePerformIO $ modifyAdvice $ modifyMVar (getCache cache) go where dt = describe bt go (CacheState i m) = case HashMap.lookup dt m of
− Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
+ Setup.lhs view
@@ -0,0 +1,7 @@+#!/usr/bin/runhaskell+> module Main (main) where++> import Distribution.Simple++> main :: IO ()+> main = defaultMain
intern.cabal view
@@ -1,6 +1,6 @@ name: intern category: Data, Data Structures-version: 0.5.0+version: 0.5.1 license: BSD3 cabal-version: >= 1.6 license-file: LICENSE