Skip to content

Instantly share code, notes, and snippets.

@aiya000
Created January 29, 2021 07:36
Show Gist options
  • Save aiya000/66b2a30b14187d248fb4e2a87891612e to your computer and use it in GitHub Desktop.
Save aiya000/66b2a30b14187d248fb4e2a87891612e to your computer and use it in GitHub Desktop.
(Hask)

                f
    Maybe Int ---> Int
       |            |
fmap a |            | a
       v        g   v
    Maybe Bool --> Bool
       |            |
fmap b |            | b
       v        h   v
    Maybe Char --> Char

簡単のため、ある対象xへの*xは、組(Maybe x, x, w :: Maybe x -> x)を表すことにする。 縦の射への*y(fmap y, y)とする。 (一般的な記号じゃないよ! 今だけの記法!🐕)

例: *Int = (Maybe Int, Int, f)

(Maybe-Algebra)

*Int
  |
  | *a
  v
*Bool
  |
  | *b
  v
*Char

Fixはこんな感じ!

(Maybe-Algebra)

*Int  <--\
  |       \  cata f
  | *a     \
  v         \
*Bool <------- *(Fix Maybe)
  |         /
  | *b     /
  v       / cata h
*Char <--/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment