universal 0.0.0.0 → 0.0.1.0
raw patch · 3 files changed
+27/−4 lines, 3 filesdep +categorysetup-changed
Dependencies added: category
Files
- Data/Universal.hs +24/−0
- Setup.hs +0/−2
- universal.cabal +3/−2
+ Data/Universal.hs view
@@ -0,0 +1,24 @@+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE DataKinds #-}++module Data.Universal where++import Prelude hiding (Functor (..))+import Control.Categorical.Functor+import Control.Category.Const2+import Data.Functor.Const++-- | Laws:+--+-- * @f = 'map' ('universal' f) . 'getConst' 'morphism'@+class Functor s t f => Universal (s :: α -> α -> *) (t :: β -> β -> *) (x :: β) (f :: α -> β) where+ type Element s t x f :: α+ morphism :: Const (t x (f (Element s t x f))) s+ universal :: t x (f a) -> s (Element s t x f) a++-- Terminal+instance Universal (Const2 () :: () -> () -> *) (->) () (Const ()) where+ type Element (Const2 ()) (->) () (Const ()) = '()+ morphism = Const Const+ universal = \ _ -> Const2 ()
− Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
universal.cabal view
@@ -1,5 +1,5 @@ name: universal-version: 0.0.0.0+version: 0.0.1.0 synopsis: Universal -- description: license: BSD3@@ -14,9 +14,10 @@ library hs-source-dirs: .- exposed-modules: + exposed-modules: Data.Universal build-depends: base >= 4.7 && < 5 , base-unicode-symbols+ , category , util default-language: Haskell2010 default-extensions: UnicodeSyntax