All Projects → Nymphium → eff.lua

Nymphium / eff.lua

Licence: MIT License
ONE-SHOT Algebraic Effects for Lua!

Programming Languages

lua
6591 projects
shell
77523 projects
Makefile
30231 projects

Projects that are alternatives of or similar to eff.lua

multithread-mpp
This is the best architecture of Kotlin Multiplatform Project I think! This project works on background thread using kotlinx.Coroutines.
Stars: ✭ 16 (-50%)
Mutual labels:  coroutines
moko-errors
Automated exceptions handler for mobile (android & ios) Kotlin Multiplatform development.
Stars: ✭ 45 (+40.63%)
Mutual labels:  coroutines
GitHubApplication
GitHubApplication 📱 is an Android application built to demonstrate the use of modern Android development tools - (Kotlin, Coroutines, Hilt, LiveData, View binding, Data Store, Architecture components, MVVM, Room, Retrofit, Navigation).
Stars: ✭ 11 (-65.62%)
Mutual labels:  coroutines
boost beast websocket echo
A collection of Demo applications to try to help you understand how Asio and Beast work
Stars: ✭ 12 (-62.5%)
Mutual labels:  coroutines
GitKtDroid
A sample Android application📱 built with Kotlin for #30DaysOfKotlin
Stars: ✭ 53 (+65.63%)
Mutual labels:  coroutines
koru
Simple coroutine wrappers for Kotlin Native. Generated from annotations. Compatible with RxSwift, Combine etc.
Stars: ✭ 141 (+340.63%)
Mutual labels:  coroutines
framework-x
A reasonable programming framework.
Stars: ✭ 19 (-40.62%)
Mutual labels:  algebraic-effects
jda-ktx
Collection of useful Kotlin extensions for JDA
Stars: ✭ 49 (+53.13%)
Mutual labels:  coroutines
Paging-3-Sample
This app is created as a sample app which loads movies from Tmdb api and uses Paging 3 library to show it in a Recycler view.
Stars: ✭ 96 (+200%)
Mutual labels:  coroutines
Keemun
No description or website provided.
Stars: ✭ 13 (-59.37%)
Mutual labels:  coroutines
SixtyPical
A 6502-oriented low-level programming language supporting advanced static analysis
Stars: ✭ 25 (-21.87%)
Mutual labels:  effect-system
NYTimesMostPopularArticles
A simple app to hit the NY Times Most Popular Articles API and show a list of articles, that shows details when items on the list are tapped (a typical master/detail app), also user able to browse/ add articles to favorite list that implements MVVM architecture using Dagger2, Retrofit, Coroutines, LiveData, RoomDatabase, Database Debugging, Data…
Stars: ✭ 38 (+18.75%)
Mutual labels:  coroutines
JustJava-Android
JustJava is a mock food ordering and delivery application for a coffee shop.
Stars: ✭ 59 (+84.38%)
Mutual labels:  coroutines
korte
Kotlin cORoutines Template Engine for Multiplatform Kotlin
Stars: ✭ 69 (+115.63%)
Mutual labels:  coroutines
kit
C++11 libs: await, channels, reactive/signals, timelines, alarms, logging, args, etc.
Stars: ✭ 21 (-34.37%)
Mutual labels:  coroutines
RxCoroutineSchedulers
Kotlin Coroutines as RxJava Schedulers 😈
Stars: ✭ 31 (-3.12%)
Mutual labels:  coroutines
Retrofit2-Flow-Call-Adapter
A Retrofit 2 adapter for Kotlin Flows.
Stars: ✭ 41 (+28.13%)
Mutual labels:  coroutines
facet
a functional programming language with algebraic effects and handlers
Stars: ✭ 71 (+121.88%)
Mutual labels:  algebraic-effects
Saga
Saga pattern implementation in Kotlin build in top of Kotlin's Coroutines.
Stars: ✭ 24 (-25%)
Mutual labels:  coroutines
kotlinx-sockets
Kotlinx coroutines sockets
Stars: ✭ 54 (+68.75%)
Mutual labels:  coroutines

eff.lua

Build Status

ONE-SHOT Algebraic Effects for Lua!

installation

$ luarocks --local install eff

usage

eff provides four objects, inst, perform and handler.

effect instantiation and invocation

inst generates an effect instance. perform invoke the passed effect.

local Write = inst() -- instantiation
perform(Write("Hello!")) -- invocation

effect handler

handler(h)

handler requires a table and returns a handling function. The table has fields, a value handler as val and [Eff] as an effect handler corresponding to Eff. "Handling an expression with a handler" is translated into an application passing a thunk, containing the expression, to the handling function.

local printh = handler {
  val = function(v) print("printh ended", v) end,
  [Write] = function(k, arg)
      print(arg)
      k()
    end,
  [Read] = function(k)
      return k("baa")
    end
}

printh(function()
  local x = perform(Write("hello"))
  return x
end)

--[[ prints:
hello
printh ended    nil
]]

restriction about continuation

The continuation effect handler received is ONE-SHOT, in other words, the continuatoin cannot run more than twice.

handler({
  val = function(v) print("printh ended", v) end,
  [Write] = function(k, arg)
      print(arg)
      k()
      k() -- call continuation twice
    end
})(function()
  perform(Write("Foo"))
end)

--[[prints
lua: ./eff.lua:91: ./eff.lua:82: continuation cannot be performed twice
stack traceback:
        [C]: in function 'error'
        ./eff.lua:91: in local 'printh'
        ../example/example.lua:28: in main chunk
        [C]: in ?
]]

LICENSE

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].