funcons-tools-0.1.0.0: manual/Funcons/Core/Abstractions/Thunk.hs
{-# LANGUAGE OverloadedStrings #-}
module Funcons.Core.Abstractions.Thunk where
import Funcons.EDSL
import Funcons.Types
library = libFromList [
("thunk", NonStrictFuncon stepThunk)
, ("thunks", StrictFuncon stepThunks)
]
thunk_ :: [Funcons] -> Funcons
thunk_ fargs = applyFuncon "thunk" fargs
stepThunk [f] = rewriteTo $ FValue $ Thunk f
stepThunk fs = sortErr (applyFuncon "thunk" fs) "thunk not applied to a single funcon"
stepThunks [ComputationType ct] = rewriteTo $ type_ $ Thunks ct
stepThunks vs = sortErr (applyFuncon "thunks" (fvalues vs))
"thunks not applied to computation-type"