Code Monkey home page Code Monkey logo

purescript-const's Introduction

PureScript

A small strongly typed programming language with expressive types that compiles to JavaScript, written in and inspired by Haskell.

Hackage Build Status

Language info

Resources

Help!

Community Spaces

The following spaces are governed by the PureScript Community Code of Conduct. The majority of PureScript users use these spaces to discuss and collaborate on PureScript-related topics:

Unaffiliated Spaces

Some PureScript users also collaborate in the below spaces. These do not fall under the code of conduct linked above. They may have no code of conduct or one very different than the one linked above.

purescript-const's People

Contributors

garyb avatar joneshf avatar jordanmartinez avatar kl0tl avatar liamgoodacre avatar mankykitty avatar milesfrain avatar monoidmusician avatar paf31 avatar paluh avatar rhendric avatar safareli avatar thomashoneyman avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

purescript-const's Issues

Defined instances

Do we think the instances for Monoid and Contravariant should be defined in here, or would it be better to require Const in those packages and provide instances there instead?

I'm asking as if we move Identity out into its own package we'll have the same quandary there too. It seems to me like we'll end up having less problems later if Const and Identity have no dependencies but rather are required in a lot of places. It might end up similar to the situation with purecript-control where almost everything will end up requiring them transitively, but they're fairly fundamental things anyway - in fact they should never need to change again unless we alter the classes in Prelude.

Thoughts? (@paf31, @joneshf)

Question concerning the Bind instance

Currently, Const a has a Bind instance that is defined as:

instance bindConst :: Semigroup a => Bind (Const a) where
  bind (Const x) _ = Const x

This instance fulfills the associativity law of the Bind class trivially:

-- To show:
(x >>= f) >>= g = x >>= (\k -> f k >>= g)

(x >>= f) >>= g
  = x >>= g
  = x
  = x >>= (\k -> f k >>= g)

I have two questions:

  • Is there a reason for the Semigroup a constraint? It is not used in the code and it is not required in order to fulfill the laws... Nevermind, it needs the Semigroup a constraint in order to be an Apply, of course...
  • Is this instance useful in any sense? I see that it fulfills the associativity law of Bind, but it is not powerful enough to make Const a a Monad (even though Const is also an Applicative), because the following law can never be fulfilled:
pure x >>= f = f x

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.