Giter VIP home page Giter VIP logo

purescript-nested-functor's Introduction

purescript-nested-functor

Generalized map for nested functors.

-- (a -> b) <$$> f (g (h (i a))) :: f (g (h (i b)))
example1 :: Identity (Either Void (Maybe (Array Int)))
example1 = do
  let x = Identity (Right (Just [ 1, 2, 3 ])) -- :: Identity (Either Void (Maybe (Array Int)))
  (_ * 10) <$$> x -- Identity (Right (Just [ 10, 20, 30 ]))

-- (h (i a) -> x) <$$> f (g (h (i a))) :: f (g x)
example2 :: Identity (Either Void Int)
example2 = do
  let x = Identity (Right (Just [ 1, 2, 3 ])) -- :: Identity (Either Void (Maybe (Array Int)))
  maybe 0 sum <$$> x -- Identity (Right 6)

-- (a -> b) <$$> (r -> f a) :: r -> f b
example3 :: forall m. Monad m => m String
example3 = do
  let f = show <$$> pure -- :: forall a. Show a => a -> m String
  f 123

purescript-nested-functor's People

Contributors

acple avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

paluh ursi

purescript-nested-functor's Issues

Less enough Functional dependencies

For type inference, I think this should/can have fundeps as:

class NestedFunctor fa fb a b | fb a b -> fa, fa fb b -> a, fa a b -> fb, fa fb a -> b where

But it doesn't work.

I don't know why. Please HELP!
Is this a compiler issue or not?

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.