From 63eb857862c0301197dd64648ad41dc225b531f7 Mon Sep 17 00:00:00 2001 From: robashton Date: Fri, 16 Apr 2021 18:18:42 +0100 Subject: [PATCH] iolist_size --- src/Erl/Data/Binary/IOList.erl | 4 +++- src/Erl/Data/Binary/IOList.purs | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Erl/Data/Binary/IOList.erl b/src/Erl/Data/Binary/IOList.erl index e7a3940..a15e16d 100644 --- a/src/Erl/Data/Binary/IOList.erl +++ b/src/Erl/Data/Binary/IOList.erl @@ -1,5 +1,5 @@ -module(erl_data_binary_iOList@foreign). --export([mempty_/0, append_/2, concat/1, toBinary/1, fromBinary/1]). +-export([mempty_/0, append_/2, concat/1, toBinary/1, fromBinary/1, byteSize/1]). mempty_() -> []. append_(X,Y) -> [X,Y]. @@ -7,3 +7,5 @@ concat(Xs) -> Xs. fromBinary(X) -> [X]. toBinary(X) -> erlang:iolist_to_binary(X). + +byteSize(X) -> iolist_size(X). diff --git a/src/Erl/Data/Binary/IOList.purs b/src/Erl/Data/Binary/IOList.purs index 2aa47b1..87400ad 100644 --- a/src/Erl/Data/Binary/IOList.purs +++ b/src/Erl/Data/Binary/IOList.purs @@ -1,5 +1,5 @@ -- | Representation of Erlang iolist(). -module Erl.Data.Binary.IOList (IOList, concat, fromBinary, toBinary) where +module Erl.Data.Binary.IOList (IOList, concat, fromBinary, toBinary, byteSize) where import Prelude import Erl.Data.Binary.Type (Binary) @@ -26,3 +26,5 @@ foreign import fromBinary :: Binary -> IOList -- | Collapse an IOList to a Binary foreign import toBinary :: IOList -> Binary +-- | Calls iolist_size +foreign import byteSize :: IOList -> Int