Skip to content

Add Backwards #2

@treeowl

Description

@treeowl

The indexed equivalent of Control.Applicative.Backwards.Backwards:

newtype IxBackwards m i j a = IxBackwards {ixForwards :: m j i a}

instance IxFunctor f => IxFunctor (IxBackwards f) where
  imap f (IxBackwards x) = IxBackwards (imap f x)

instance IxPointed f => IxPointed (IxBackwards f) where
  ireturn = IxBackwards . ireturn

instance IxApplicative f => IxApplicative (IxBackwards f) where
  iap (IxBackwards fs) (IxBackwards xs) =
    IxBackwards $ imap (flip ($)) xs `iap` fs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions