Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR simplifies the API of
clash-ffi
by removing the monadicContT
transformer reducing the interface to some basicIO
.ContT
is currently only used inclash-ffi
for creating a unified interface forForeign.Marshal.Alloc.alloca
(stack allocation) andForeign.Marshal.Alloc.malloc
(heap allocation), which have different interfaces inbase
on purpose for reflecting the different characteristics of the stack and the heap. However, the introduced uniformization does not unify stack and heap usage inclash-ffi
. The user still has to choose among different API calls depending on where objects have to be allocated. Thus,ContT
really only provides a uniform type interface for both allocation methods, which is a weak achievement compared to the API modifications resulting from the additional monadic context it introduces.Overall, the usage of
ContT
comes with the following downsides:ContT
and the environment must be initiated viarunSimAction
.ContT
(as a monad transformer) is limited in preserving several properties of the underlying monad onlift
. For example,ContT
is not a functor on the category of monads, and thus cannot implementMonadBaseControl
.Therefore, we propose to ditch
ContT
fromclash-ffi
.This is a breaking API change, which is reflected in a version number increment.