Skip to content

Commit

Permalink
more inlining
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeplus64 committed Dec 14, 2012
1 parent 93ba4ae commit 82954fb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion record.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: record
version: 0.1.0.28
version: 0.1.0.50
synopsis: Efficient, type safe records implemented using GADTs and type level strings.
homepage: http://quasimal.com/projects/records
license: BSD3
Expand Down
7 changes: 6 additions & 1 deletion src/Data/Record.hs
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,11 @@ class Unbox r where
unbox :: (forall a. w a -> a) -> Record (w :: * -> *) r -> Record P r

instance Unbox '[] where
{-# INLINE unbox #-}
unbox _ _ = end

instance Unbox xs => Unbox (x ': xs) where
{-# INLINE unbox #-}
unbox f (C x xs) = f x & unbox f xs

class Box r where
Expand All @@ -111,9 +113,11 @@ class Box r where
box :: (forall a. a -> w a) -> Record P r -> Record (w :: * -> *) r

instance Box '[] where
{-# INLINE box #-}
box _ _ = end

instance Box xs => Box (x ': xs) where
{-# INLINE box #-}
box f (C x xs) = C (f x) (box f xs)

class Transform r where
Expand Down Expand Up @@ -148,9 +152,11 @@ class Runtrans r where
runtrans :: Monad o => (forall a. (i :: * -> *) a -> (o :: * -> *) a) -> Record i r -> o (Record P r)

instance Runtrans '[] where
{-# INLINE runtrans #-}
runtrans _ _ = return end

instance Runtrans xs => Runtrans (x ': xs) where
{-# INLINE runtrans #-}
runtrans f (C x xs) = do
y <- f x
ys <- runtrans f xs
Expand Down Expand Up @@ -211,4 +217,3 @@ instance Append xs ys => Append (x ': xs) ys where
{-# INLINE append #-}
append (C x xs) ys = C x (append xs ys)


0 comments on commit 82954fb

Please sign in to comment.