8000 Support for linear arrows · Issue #11 · tweag/ghc · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Support for linear arrows #11
Open
@jeltsch

Description

@jeltsch

The linear types extension should make it possible to work with a linear variant of arrows.

First, it should be possible to change the Arrow class such that it covers both the linear and the non-linear case. The crucial feature for this is multiplicity constraint polymorphism. Using the interface proposed in #10, the proposed new version of Arrow could be defined as follows:

class Category a => Arrow a where

    type ArrowMultiplicityConstraint a :: MultiplicityConstraint

    arr :: Function (ArrowMultiplicityConstraint a) b c -> a b c

    first :: a b d -> a (b, c) (d, e)

Second, it should be possible to use arrow notation also for linear arrows. This is important, since arrow notation is often crucial when working with arrows. The syntactic restrictions for linear arrows should probably be analogous to the ones for linear functions.

An open question is how to deal with promotion. Functions of types a -+ b can be promoted to functions of types a -> b, as I understand. Something similar could be useful for arrows in cases where an arrow type has both a linear and a non-linear variant. However, it is not clear to me at the moment, how such arrow promotion could be realized.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0