tfp 1.0.1.1 → 1.0.2
raw patch · 3 files changed
+30/−5 lines, 3 files
Files
- src/Type/Data/Bool.hs +16/−1
- src/Type/Data/Num/Unary.hs +10/−0
- tfp.cabal +4/−4
src/Type/Data/Bool.hs view
@@ -3,9 +3,13 @@ {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE GADTs #-} module Type.Data.Bool- ( True+ ( C(switch)+ , Singleton(False, True)+ , singleton+ , True , true , False , false@@ -24,6 +28,17 @@ import qualified Prelude ++class C bool where switch :: f False -> f True -> f bool+instance C False where switch f _ = f+instance C True where switch _ f = f++data Singleton bool where+ False :: Singleton False+ True :: Singleton True++singleton :: (C bool) => Singleton bool+singleton = switch False True data True deriving (Typeable) true :: Proxy True
src/Type/Data/Num/Unary.hs view
@@ -2,8 +2,10 @@ {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-}+{-# LANGUAGE GADTs #-} module Type.Data.Num.Unary ( Unary, unary, Un, Zero, Succ, zero, succ,+ HeadSingleton(Zero, Succ), headSingleton, Singleton(..), singleton, singletonFromProxy, integerFromSingleton, integralFromSingleton, integralFromProxy,@@ -69,6 +71,14 @@ type instance _x :*: Zero = Zero type instance x :*: Succ y = x :+: (x :*: y) +++data HeadSingleton n where+ Zero :: HeadSingleton Zero+ Succ :: (Natural n) => HeadSingleton (Succ n)++headSingleton :: (Natural n) => HeadSingleton n+headSingleton = switchNat Zero Succ newtype Singleton n = Singleton Integer
tfp.cabal view
@@ -1,5 +1,5 @@ name: tfp-version: 1.0.1.1+version: 1.0.2 build-type: Simple license: BSD3 license-file: LICENSE@@ -24,12 +24,12 @@ source-repository head type: darcs- location: http://hub.darcs.net/thielema/tfp/+ location: https://hub.darcs.net/thielema/tfp/ source-repository this- tag: 1.0.1.1+ tag: 1.0.2 type: darcs- location: http://hub.darcs.net/thielema/tfp/+ location: https://hub.darcs.net/thielema/tfp/ library {