Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
GHC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
kraai
GHC
Commits
076c1a10
Commit
076c1a10
authored
5 months ago
by
Bodigrim
Committed by
Marge Bot
5 months ago
Browse files
Options
Downloads
Patches
Plain Diff
documentation: more examples for Control.Category
parent
fbbbd010
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libraries/ghc-internal/src/GHC/Internal/Control/Category.hs
+20
-0
20 additions, 0 deletions
libraries/ghc-internal/src/GHC/Internal/Control/Category.hs
with
20 additions
and
0 deletions
libraries/ghc-internal/src/GHC/Internal/Control/Category.hs
+
20
−
0
View file @
076c1a10
...
...
@@ -49,6 +49,26 @@ infixr 1 >>>, <<<
-- f . g = \\x -> f (g x)
-- @
--
-- Isomorphisms form a category as well:
--
-- @
-- data Iso a b = Iso (a -> b) (b -> a)
--
-- instance Category Iso where
-- id = Iso id id
-- Iso f1 g1 . Iso f2 g2 = Iso (f1 . f2) (g2 . g1)
-- @
--
-- Natural transformations are another important example:
--
-- @
-- newtype f ~> g = NatTransform (forall x. f x -> g x)
--
-- instance Category (~>) where
-- id = NatTransform id
-- NatTransform f . NatTransform g = NatTransform (f . g)
-- @
--
-- Using the `TypeData` language extension, we can also make a category where `k` isn't
-- `Type`, but a custom kind `Door` instead:
--
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment