Code Monkey home page Code Monkey logo

purescript-console'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-console's People

Contributors

fehrenbach avatar garyb avatar hdgarrood avatar iarthstar avatar jordanmartinez avatar justinwoo avatar kl0tl avatar kritzcreek avatar liamgoodacre avatar matoruru avatar meoyawn avatar mhmdanas avatar milesfrain avatar natefaubion avatar paf31 avatar pete-murphy avatar thomashoneyman avatar zudov avatar zyla avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

purescript-console's Issues

Bower package needs updating

I'm getting 50 compile warnings from purescript-console and I see that the bower package is behind this repo. Could someone update?

add a console clear function

In the Getting Started[0] guide is a solution to a Project Euler question. I continued working through questions using the Try Purescript REPL[1] and noticed I couldn't clear out my console easily. It would be nice to go console.clear() at the top of my solutions :)

Clear is missing in
https://pursuit.purescript.org/packages/purescript-console/2.0.0/docs/Control.Monad.Eff.Console

As described here
https://developer.mozilla.org/en-US/docs/Web/API/Console/clear

[0] http://www.purescript.org/learn/getting-started/
[1] http://try.purescript.org

Naming scheme question

Since there's like a thousand different console functions, would it be worthwhile to consider renaming print to log' and following this scheme for all the other functions?

error :: forall eff. String -> Eff (console :: CONSOLE | eff) Unit
error' :: forall a eff. (Show a) => a -> Eff (console :: CONSOLE | eff) Unit
log :: forall eff. String -> Eff (console :: CONSOLE | eff) Unit
log' :: forall a eff. (Show a) => a -> Eff (console :: CONSOLE | eff) Unit
warn :: forall eff. String -> Eff (console :: CONSOLE | eff) Unit
warn' :: forall a eff. (Show a) => a -> Eff (console :: CONSOLE | eff) Unit

etc.

Log arbitrary JSON-like object?

Looks like traceAny :: a -> Effect Unit was added to this library awhile ago, then later removed.

Some arguments against that type signature:

It violates free theorem which says it ignores its argument
Implementations not violating such derived theorems is generally assumed of APIs
For example:
f :: forall a b. Tuple a b -> Tuple b a swaps the elements of the tuple given
f :: forall a. List a -> List a all elements in the output also exist in the input
f :: forall a b. a -> List b ignores its argument and returns the empty list
It’s something you can say about a (polymorphic) function given only its type
@rightfold

There's also the argument that it's possibly not referentially transparent.

I think it should exist here, though, in some form.

The console.log docs on MDN says it accepts any JS object. All PS types are JS objects at runtime, so we could say that a -> Effect Unit is a good description.

On the other hand, we could describe it as Json -> Effect Unit, where Json is a type which represents a data structure of "idiomatic primitive JSON types" in JavaScript, like plain-old objects (not classes), arrays, numbers, and strings.

We could do a constraint on a and implement that constraint like justinwoo/simple-json did: Json a => a -> Effect Unit.

Logging an `Error`

Logging an Error has the effect of logging the original stack trace, just as if the exception was caught by the runtime. Using error with a string, or via show, erases the trace. Can we provide a function error' :: forall eff. Error -> Eff (console :: CONSOLE | eff) Unit?

0.12: change file paths

The module name has been changed for 0.12, but the file path still follows the Control.Monad.Effect hierarchy.

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.