1
1
mirror of https://github.com/coot/free-category.git synced 2024-11-23 00:56:58 +03:00

Rename emptyQ as nilQ

This commit is contained in:
Marcin Szamotulski 2019-09-07 17:45:10 +02:00
parent a874982209
commit d831cf752a
3 changed files with 11 additions and 11 deletions

View File

@ -63,7 +63,7 @@ arrArr bc = Arr bc Id
mapArr :: f b c
-> Arr f a b
-> Arr f a c
mapArr bc ac = Cons bc emptyQ . ac
mapArr bc ac = Cons bc nilQ . ac
foldArr :: forall f arr a b.
Arrow arr
@ -103,7 +103,7 @@ type instance AlgebraType0 Arr f = ()
type instance AlgebraType Arr c = Arrow c
instance FreeAlgebra2 Arr where
liftFree2 = \fab -> Cons fab emptyQ
liftFree2 = \fab -> Cons fab nilQ
{-# INLINE liftFree2 #-}
foldNatFree2 = foldArr

View File

@ -153,7 +153,7 @@ instance Show (Cat f a b) where
arrCat :: forall (f :: k -> k -> *) a b.
f a b
-> Cat f a b
arrCat ab = Cat emptyQ ab
arrCat ab = Cat nilQ ab
{-# INLINE arrCat #-}
foldCat :: forall f c a b.
@ -180,7 +180,7 @@ foldCat nat (Cat q0 tr0) =
-- @
-- op :: Cat f x y -> Cat (Op f) y x
-- op Id = Id
-- op (Cat q tr) = Cat emptyQ (Op tr) . foldNatQ unDual q
-- op (Cat q tr) = Cat nilQ (Op tr) . foldNatQ unDual q
-- @
--
-- where
@ -202,7 +202,7 @@ foldCat nat (Cat q0 tr0) =
-- > op Id = Id
-- > ~ Id
-- > op (Cat q tr)
-- > = c₀@(Cat emptyQ (Op tr)) . foldNatQ unDual q
-- > = c₀@(Cat nilQ (Op tr)) . foldNatQ unDual q
-- > Note that `.` here denotes composition in `Cat (Op f)`.
-- > Let us assume that `q = c₁ : c₂ : ⋯ : cₙ : NilQ`,
-- > where each `cᵢ :: Cat (Op (Op tr)) aᵢ aᵢ₊₁`
@ -211,7 +211,7 @@ foldCat nat (Cat q0 tr0) =
-- > `unDual cᵢ :: Cat tr aᵢ aᵢ₊₁` has the same representation as cᵢ,
-- > at this step we also need to rewrite `.` composition in
-- > `Cat (Op f)` using composition in `Cat f`, this reverses the order
-- > ~ cₙ . ⋯ . c₁ . Cat emptyQ tr
-- > ~ cₙ . ⋯ . c₁ . Cat nilQ tr
-- > By definition of composition in `Cat f`
-- > = Cat q tr
--
@ -232,7 +232,7 @@ unOp :: forall (f :: k -> k -> *) x y.
-> Cat f y x
unOp = unsafeCoerce
-- unOp Id = Id
-- unOp (Cat q (Op tr)) = Cat emptyQ tr . foldNatQ unDual q
-- unOp (Cat q (Op tr)) = Cat nilQ tr . foldNatQ unDual q
{-# INLINE unOp #-}
instance Arrow f => Arrow (Cat f) where

View File

@ -32,7 +32,7 @@ module Control.Category.Free.Internal
, ListTr (..)
, lengthListTr
, Queue (NilQ, ConsQ)
, emptyQ
, nilQ
, consQ
, ViewL (..)
, unconsQ
@ -267,8 +267,8 @@ instance ArrowChoice f => ArrowChoice (Queue f) where
NilQ +++ (ConsQ fxb cax) = (arr id +++ fxb) `ConsQ` (NilQ +++ cax)
NilQ +++ NilQ = NilQ
emptyQ :: Queue (f :: k -> k -> *) a a
emptyQ = Queue NilTr NilTr NilTr
nilQ :: Queue (f :: k -> k -> *) a a
nilQ = Queue NilTr NilTr NilTr
consQ :: forall (f :: k -> k -> *) a b c.
f b c
@ -303,7 +303,7 @@ pattern ConsQ a as <- (unconsQ -> a :< as) where
pattern NilQ :: () => a ~ b => Queue f a b
pattern NilQ <- (unconsQ -> EmptyL) where
NilQ = emptyQ
NilQ = nilQ
#if __GLASGOW_HASKELL__ > 802
{-# complete NilQ, ConsQ #-}