Skip to content

b-studios/cats-reflect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NOTE: This project has been moved to https://github.com/lampepfl/monadic-reflection

Cats Reflect

This project provides support for monadic reflection (Filinski 1994, 2010) to integrate monadic code with direct style code.

The implementation makes use of cats/StackSafeMonad.tailRecM for stack safety. That is, for the user program to be stack safe all reflected monads have to override tailRecM in a stack safe way.

Usage

We collected some examples of how to use cats-reflect.

Dependencies

Dotty

The current cats-reflect API makes use of implicit function types of Dotty.

Runtime

To implement monadic reflection we require some implementation of (delimited) continuations. At the moment, cats-reflect only runs on a JVM branch called project loom with runtime support for coroutines / delimited continuations.

Download a Loom-enabled JDK

There are early-access builds available at https://jdk.java.net/loom/.

Build Loom

To build the custom JVM, clone the repository

git clone https://github.com/openjdk/loom

and checkout the continuation branch cont:

git checkout fibers

Detailed instructions on how to build the JDK can be found in the file doc/building.md, in short those are:

bash configure
make images

Run Sbt

Finally, run sbt with the newly built JVM. Assuming you checked out loom into PATH and built on a mac, run:

sbt -java-home $PATH/build/macosx-x86_64-server-release/images/jdk

Obviously the path needs to be adjusted for other operating systems.

Some performance optimizations of project loom can be enabled by

-XX:-DetectLocksInCompiledFrames -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseNewCode

Libraries

The implementation uses cats-core for its Monad typeclass.

The examples also use cats-effect.

Releases

No releases published

Packages

No packages published

Languages