This PR simplifies the API of clash-ffi by removing the monadic ContT transformer reducing the interface to some basic IO.
ContT is currently only used in clash-ffi for creating a unified interface for Foreign.Marshal.Alloc.alloca (stack allocation) and Foreign.Marshal.Alloc.malloc (heap allocation), which have different interfaces in base on purpose for reflecting the different characteristics of the stack and the heap. However, the introduced uniformization does not unify stack and heap usage in clash-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:
A bulky API, as basic operations must be lifted into ContT and the environment must be initiated via runSimAction.
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.