Skip to content

nbun/efci

Repository files navigation

efci - Effective Curry Interpreter

This repository contains the implementation of efci, a Curry interpreter based on effects and handlers.

Installation (tested with stack 3.7.1 and cabal 3.16.1.0)

git clone https://github.com/nbun/efci
cd efci
git submodules pull --init
stack install

Usage

Run

efci [filename]

from the directory where filename.curry is located. If efci is called without an argument, only the Prelude module is loaded. If you have rlwrap installed, use rlwrap efci [filename] to get an input history for the interpreter.

Options

  • Without an option, the input is interpreted as a Curry expression within the loaded file.
  • :q exits interpreter.
  • :o rotates between the available interpretation modes
  • :time toggles printing time elapsed during interpretation
  • :fcy toggles printing of the main expression generated from the input.

Run tests

stack test effective-curry-interpreter

Run benchmarks

stack bench effective-curry-interpreter

Generate documentation

stack haddock --open effective-curry-interpreter

Repository structure

  • src: implementation of the interpreter(s)
    • Data.Union: open unions used for implementing signatures
    • Effect: implementations of (Curry-specific) effects
      • FlatCurry: Curry-specific effects
      • General: commonly known effects
        • Error: (unexpected) error effect
        • Memoization: lazy evaluation effect
        • ND: non-determinism effect
        • State: state effect
      • Transformation: transformation functions
        • AE2Result: transformation from effects to results
        • FCY2AE: transformation from FlatCurry to effects
      • App: REPL logic and front end integration
      • Debug: flags for toggling debug output
      • Forwarding: forwarding functions and carrier classes
      • Free: effect representations (tree-based, continuation-based, smart views)
      • InterpFL: implementation of A Monadic Semantics for Core Curry
      • Pipeline: pipelines for different effect representations
      • Signature: adapters, type operators, and injection functions for signatures
      • Type: auxiliary functions and type definitions
  • tests/Main.hs: test suite runner
  • examples: example programs for the test suite
  • benchmarks: benchmark programs

Known issues

  • Ambiguous types are not defaulted. For example, 1 + 2 needs to be annotated as 1 + 2 :: Int.
  • Not all external functions are implemented.

Historic releases

Haskell'24 paper Making a Curry Interpreter using Effects and Handlers:

  • 4db98c2 for the original interpreter
  • 1421632 for an extended version featuring unification
  • 90dfb99 for 'fusion all the way'

About

No description, website, or topics provided.

Resources

License

Stars

6 stars

Watchers

3 watching

Forks

Packages

 
 
 

Contributors