# Botan bindings devlog

**URL:** <https://discourse.haskell.org/t/botan-bindings-devlog/6855>\
**Category:** Uncategorized\
**Created:** [July 5, 2023, 6:17pm UTC](https://discourse.haskell.org/t/botan-bindings-devlog/6855 "2023-07-05T18:17:27Z")\
**Posts on this page:** 1\
**Showing post:** 186

<div class="post-metadata">

**Author:** ![ApothecaLabs](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.haskell.org/apothecalabs/32/3215_2.png) [@ApothecaLabs](https://discourse.haskell.org/u/ApothecaLabs)\
**Post date:** [December 1, 2025, 5:09pm UTC](https://discourse.haskell.org/t/botan-bindings-devlog/6855/186 "2025-12-01T17:09:44Z")

</div>

# Weekly meeting notes

A sizeable update has been posted to the [Improving memory / memalloc](https://discourse.haskell.org/t/improving-memory-with-better-abstractions/12350/22) thread.

## Leo

- Published and updated `memalloc` repo
- Updated the Improving Memory thread with a deep dive explaining the new typeclass hierarchy
- Focused mostly on re-creating the most-used APIs from `memory`
  - Successfully split `ByteArray/Access` up into `Address`, `Layout` and `Allocator` plus various allocation types
    - Allocation types are `Handle`, `Ref`, `Array`, and `Pointer`
    - Non-specific allocation type-classes include `Castable` and `Retainable`

  - Reached parity with `ByteArray` by implementing `ByteArray.allocRet` using `Allocator.alloc`
  - `withAddress` neé `ByteArrayAccess.withByteArray` is part of `Allocator` now but might become an allocation access class
  - Combined with `Array`, we have achieved our core goal of re-creating the `ByteArray/Access` class API
    - We still need to implement the functions and instances that use them though

- Created an example of using `ImplicitParams` to hide the `alr :: Allocator alr` argument to better recover the original `memory` interface
  - There are a few other methods of doing this
    - eg if the monad supplies the allocator
    - or if the resulting allocation or data structure keeps a reference to its allocator
    - or if the allocator is a singleton so we can just infer it / use a Proxy

- Implemented the Std allocator that uses GHC’s wrapping of the C malloc and free
  - It isn’t finished yet but I used it to illustrate the problem that I’ll be dealing with next
  - Basically `Allocation` is of kind `*` but `Handle`, `Reference`, `Pointer`, `Array` are all of kind `* -> *`
  - But we need to allow both allocating eg a polymorphic `Ptr a` but also something like a monomorphic `ByteString` that is secretly a `Ptr Word8` that is secretly an `Addr#`
  - But I think I have a solution via parametric allocators / allocations - this is my main goal this week

## Joris

- Last week continued looking into using hs-bindgen
- Also was working w/ autoconf (legacy way of configuring packages w/ system dependencies) for build scripting - but now looking into cabal hooks instead for
  - Main reason wanted to do this was because he noticed he was trying to write actual programs in autoconf instead of scripts - eg parsing c macros, significant logic, at that point just use cabal hooks and write a haskell program
  - This makes the build scripts way more accessible to other devs

- also going to look at the memalloc stuff (thx!)
- main task is hs-bindgen

## Jose

- Unable to attend

## Outcome

This week:

- Leo
  - Have a 1:1 with Jose
  - Continue to work on `memalloc` in order to use it in `botan-low` for managing allocation (and in `botan` in the future)
  - Focus on parametric allocators / allocations
  - Update the `memalloc` repo again
  - Update the Improving Memory thread again

- Joris
  - Continue working on hs-bindgen
  - Look into cabal-hooks
  - Read up on the new `memalloc` stuff

Until next time!

---

_[View the full topic](https://discourse.haskell.org/t/botan-bindings-devlog/6855)._
