Git Product home page Git Product logo

hs-ten's Introduction

ten

A mirrored typeclass hierarchy of Functor etc. for (k -> Type) -> Type.

Stack CI

Disclaimer

This is not an officially supported Google product.

Hackage Status

  • ten Uploaded Haddock
  • ten-lens Uploaded Haddock
  • ten-unordered-containers Uploaded Haddock

Overview

This gives equivalents of Functor, Applicative, Foldable, Traversable, and Representable for types whose parameter is a "wrapper" type constructor rather than just a concrete type.

The naming convention Functor10 comes from the fact that it's a functor from the category of objects with one type parameter to the category of objects with zero type parameters. See hakaru for precedent for this naming convention. From there, since everyone will end up pronouncing it "functor-ten", we pick "ten" as the package name and module namespace.

The two categories involved are:

The source category Hask{k}, denoting the category whose objects are Haskell type constructors of kind k -> Type, and whose morphisms m ~> n are quantified functions forall a. m a -> n a. Objects in this category are commonly Functors, although they don't have to be; examples include Identity, Const String, and Maybe. Morphisms in this category are parametric functions, such as maybeToList :: Maybe ~> [] or Const . length :: [] ~> Const Int. Note this is actually a collection of related categories: Type -> Type is a different category from Nat -> Type; for convenience we often hand-wave this fact away and say "the" category. Since these categories' defining characteristic is that their objects have one type parameter, we abbreviate it to "1".

The target category Hask, the normal category of Haskell types and functions. By the same convention as the last paragraph, we abbreviate this category to "0".

Then, functors from Hask{k} to Hask are functors from "1" to "0", and thus we call them Functor10. One common kind of functor between these two categories is "higher-kinded-data" records like data Thing f = Thing (f Int) (f Bool). This kind of usage is the main focus of the library, and has the most fully-formed functionality. Other things exist, too, which might have different instances of f in each value, or even existentially-quantified instances of f. These are available in varying states of completeness.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.