This commit is contained in:
Lysxia 2018-07-11 00:27:07 -04:00
parent 45484e1996
commit 5c0b4c86b2
3 changed files with 30 additions and 0 deletions

View File

@ -1 +1,8 @@
# First-class type families
See `src/Fcf`.
---
Contributions are welcome. Feel free to open an issue or make a PR on
[Github](https://github.com/Lysxia/first-class-families)!

View File

@ -5,6 +5,8 @@ synopsis:
description:
First class type families,
eval-style defunctionalization
.
See "Fcf".
homepage: https://github.com/Lysxia/first-class-families#readme
license: MIT
license-file: LICENSE

View File

@ -7,6 +7,27 @@
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
-- | First-class type families
--
-- For example, here is a regular type family:
--
-- @
-- type family FromMaybe (a :: k) (m :: Maybe k) :: k
-- type instance FromMaybe a 'Nothing = a
-- type instance FromMaybe a ('Just b) = b
-- @
--
-- With @Fcf@, it translates to a @data@ declaration:
--
-- @
-- data FromMaybe :: k -> Maybe k -> 'Exp' k
-- type instance 'Eval' (FromMaybe a 'Nothing) = a
-- type instance 'Eval' (FromMaybe a ('Just b)) = b
-- @
--
-- - Fcfs can be higher-order.
-- - The kind constructor 'Exp' is a monad: there's @('=<<')@ and 'Pure'.
module Fcf where
import Data.Kind (Type)