packages feed

ribosome-host-0.9.9.9: lib/Ribosome/Host/Interpreter/Id.hs

module Ribosome.Host.Interpreter.Id where

import Conc (interpretAtomic)
import Polysemy.Input (Input (Input))

-- |Interpret 'Input' by incrementing a numeric type starting from @1@.
interpretInputNum ::
  ∀ a r .
  Num a =>
  Member (Embed IO) r =>
  InterpreterFor (Input a) r
interpretInputNum =
  interpretAtomic @a 1 .
  reinterpret \ Input ->
    atomicState' \ i -> (i + 1, i)