reflection 0.2.0 → 0.3.0
raw patch · 2 files changed
+6/−28 lines, 2 filesdep +tagged
Dependencies added: tagged
Files
- Data/Reflection.hs +3/−26
- reflection.cabal +3/−2
Data/Reflection.hs view
@@ -15,8 +15,8 @@ -- -- <http://www.cs.rutgers.edu/~ccshan/prepose/prepose.pdf> ----- Modified to work with an applicative phantom type parameter rather than --- explicit scope type variables by Edward Kmett.+-- Modified to minimize extensions and work with Data.Tagged rather than +-- explicit scoped type variables by Edward Kmett. -- ------------------------------------------------------------------------------- @@ -37,7 +37,6 @@ , Reifies , reflect , reify- , Tagged(..) ) where import Foreign.C.Types@@ -50,30 +49,12 @@ import System.IO.Unsafe import Control.Applicative import Prelude hiding (succ, pred)+import Data.Tagged class Unused t where unused :: t -> () -newtype Tagged a b = Tagged { unTagged :: b } deriving (Eq,Ord,Show,Read) type Retag f g = forall b. Tagged g b -> Tagged f b -instance Functor (Tagged a) where - fmap f (Tagged x) = Tagged (f x)- {-# INLINE fmap #-}--instance Applicative (Tagged a) where- pure = Tagged- {-# INLINE pure #-}- Tagged f <*> Tagged x = Tagged (f x)- {-# INLINE (<*>) #-}--instance Monad (Tagged a) where- return = Tagged- {-# INLINE return #-}- Tagged m >>= k = k m - {-# INLINE (>>=) #-}- _ >> n = n- {-# INLINE (>>) #-}- newtype Zero = Zero Zero deriving (Show) newtype Twice s = Twice (Twice s) deriving (Show) newtype Succ s = Succ (Succ s) deriving (Show)@@ -82,10 +63,6 @@ instance Unused (Twice s) where unused Twice{} = () instance Unused (Succ s) where unused Succ{} = () instance Unused (Pred s) where unused Pred{} = ()--retag :: Retag f g-retag = Tagged . unTagged -{-# INLINE retag #-} pop :: Retag (f s) s pop = retag
reflection.cabal view
@@ -1,5 +1,5 @@ name: reflection-version: 0.2.0+version: 0.3.0 license: BSD3 license-file: LICENSE author: Edward A. Kmett, Oleg Kiselyov and Chung-chieh Shan@@ -16,7 +16,8 @@ library build-depends: - base >= 4 && < 5+ base >= 4 && < 5,+ tagged >= 0.0 && < 0.1 exposed-modules: Data.Reflection