Coder Social home page Coder Social logo

rybla / eff Goto Github PK

View Code? Open in Web Editor NEW

This project forked from matijapretnar/eff

0.0 1.0 1.0 10.32 MB

A functional programming language based on algebraic effect handlers

Home Page: http://www.eff-lang.org/

License: BSD 2-Clause "Simplified" License

Makefile 0.29% Emacs Lisp 0.64% OCaml 98.70% Shell 0.37%

eff's Introduction

Eff

Eff is a functional programming language based on algebraic effects and their handlers.

Algebraic effects are a way of adding computational effects to a pure functional setting. In a technical sense they are subsumed by the monadic approach to computational effects, but they offer new ways of programming that are not easily achieved with monads. In particular, algebraic effects are combined seamlessly, whereas monad transformers are needed in the monadic style.

The main idea of Eff is that computational effects are accessed through a set of operations, for example lookup and update for state, read and write for I/O, raise for exceptions, etc. The behavior of operations is determined by handlers. Just like an exception handler determines what happens when an exception is raised, a general handler describes the actions taken when an operation is triggered. Examples of handlers include state, transactions, non-determinism, stream redirection, backtracking, delimited continuations, and many others.

Because Eff supports first-class effects and handlers, programmers may define new computational effects, combine existing ones, and handle effects in novel ways. For instance, ML-style references are a defined concept in Eff.

Eff code looks and feels like that of OCaml because Eff uses OCaml syntax extended with constructs for effects and handlers. Furthermore, Eff is a statically typed language with parametric polymorphism and type inference. The types are similar to those of OCaml and other variants of ML in the sense that they do not express any information about computational effects.

For further information visit the Eff page or contact the authors Andrej Bauer [email protected] and Matija Pretnar [email protected].

Installation & Usage

Prerequisites

We have tested Eff on Mac OS X and Linux, and it should work on other Unix-like systems. In principle, nothing prevents Eff from running on Windows, we just have not tested it yet.

To install Eff, you need a standard Unix-style build environment as well as

  1. OCaml, version 4.02.3 or newer,
  2. Menhir parser generator, and
  3. js_of_ocaml OCaml to Javascript compiler.

We do not require, but recommend a command-line editing wrapper such as rlwrap or ledit. Eff uses these automatically.

Installing with OPAM

This is the easiest way to install Eff. Follow these steps:

  1. Install the OPAM package manager if you do not have it yet.

  2. Make sure you have the correct OCaml compiler activated. Since Eff compiles with all recent version of OCaml you probably need not worry about this step.

  3. Run

     opam pin add -k git eff https://github.com/matijapretnar/eff.git
    

    OPAM will download and build the necessary dependencies first, then download and build Eff itself.

Manual installation

To compile Eff manually, first clone the GitHub repository

git clone https://github.com/matijapretnar/eff.git
cd eff

and run

./configure

If it complains you will have to install missing prerequisites. In case of problems, make clean distclean might help. The configuration script takes standard GNU Autoconf arguments, such as --prefix which determines where to install Eff. Type ./configure --help for more information. Next, run

make

If all goes well, you should be able to run Eff in-place by typing ./eff.

You can also run a battery of tests with

make test

Finally, to install the command eff, run

sudo make install

See the file etc/README.txt for editor support.

Using Eff

There are examples of Eff in examples subdirectory that should get you started. The Eff syntax is very close to that of OCaml. You can find further material about Eff on the Eff page.

Copyright and license

Copyright (c) 2015, Andrej Bauer and Matija Pretnar Copyright (c) 2012, Timotej Lazar

Eff is distributed under the abbreviated BSD License, see LICENSE.txt for licensing information.

eff's People

Contributors

matijapretnar avatar zigaluksic avatar andrejbauer avatar rokkolesa avatar ngzhian avatar jameskraus avatar yallop avatar kayceesrk avatar mjdominus avatar

Watchers

James Cloos avatar

Forkers

zeta1999

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.