npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

cleanlang

v0.3.1

Published

A Clean new programming Language

Downloads

9

Readme

Cleanlang

A clean compile to JavaScript language

Install

$ npm install cleanlang -g

Usage

$ clean hello.cl

Will compile and run hello.cl

$ clean --help

For more options

Hello World

include node-core
main = putLine 'Hello World!'

Define function main. It is called at the start of your program. putLine is an asynchronous function.

Factorial function

include node-core
factorial 1 = 1
factorial n = n * factorial (n - 1)

main = putLine (factorial 5)

You can use pattern matching (factorial 1 = 1) in function definitions in clean.

Express example

include node-core
express = require 'express'
app = express ()

do
  req res <- IO (app.get '/')
  res.send 'Hello World'

app.listen 3000

Use IO to create your own Evented IO function. The argument to IO is the IO call you want to make minus the callback. (Notice that we don't provide a callback to app.get).

There is no main in our program above. main is not mandatory. Since most of the IO you do is evented, the events will get activated in the do

Combining IO blocks example

Here is a command line program that gets a user input number. The factorial of the number is calculated, and ascii art from an API, for the factorial is printed.

include node-core
request = require 'request'

fact 1 = 1
fact n = n * fact (n - 1)

computeFact = do
  num <- getLine 'enter value for factorial: '
  let val = fact (parseInt num)
  putLine val
  return (String val)

do
  data <- computeFact
  let link = 'http://artii.herokuapp.com/make?text=' ++ data
  err res body <- IO (request link)
  maybeErr err (putLine err)
  putLine body

We define computeFact to be an IO function that takes the user input and returns the computed factorial as a string. Note the return statement. This is not the regular return statement in JavaScript or similar languages. This return lifts the string into an IO type. All do blocks evaluate to Evented IO Types internally. We need the return for this do block because computeFact will be used in the next do block.

In the next do block we bind computeFact to a variable called data. You can use let statements in a do block to create scoped variables. ++ is used for string concatenation. Then we create an evented IO that uses request. The created IO function is bound to err, res and body. maybeErr will terminate the do if err is an instance of JavaScript Error, and calls putLine err.

Docs

For the complete syntax, head over to the wiki