File: RCategory.hs.prettyprinter.golden

package info (click to toggle)
haskell-src-exts 1.23.1-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 25,852 kB
  • sloc: haskell: 13,707; makefile: 12
file content (41 lines) | stat: -rw-r--r-- 1,026 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{-# LANGUAGE TypeFamilies, ConstraintKinds, MultiParamTypeClasses
  #-}
module Control.RCategory where
import qualified Prelude
import GHC.Prim

infixr 9 .

infixr 1 >>>, <<<

class RCategory cat where
        type RCategoryCtxt cat a b :: Constraint
        
        id :: RCategoryCtxt cat a a => cat a a
        
        (.) ::
              (RCategoryCtxt cat b c, RCategoryCtxt cat a b,
               RCategoryCtxt cat a c) =>
              cat b c -> cat a b -> cat a c

{-# RULES
"identity/left" forall p . id . p = p
"identity/right" forall p . p . id = p
 #-}

instance RCategory (->) where
        type RCategoryCtxt (->) a a = ()
        id = Prelude.id
        (.) = (Prelude..)

(<<<) ::
        (RCategoryCtxt cat a c, RCategoryCtxt cat a b,
         RCategoryCtxt cat b c, RCategory cat) =>
        cat b c -> cat a b -> cat a c
(<<<) = (.)

(>>>) ::
        (RCategoryCtxt cat a c, RCategoryCtxt cat a b,
         RCategoryCtxt cat b c, RCategory cat) =>
        cat a b -> cat b c -> cat a c
f >>> g = g . f