Skip to content

Commit

Permalink
Merge pull request #3 from robashton/master
Browse files Browse the repository at this point in the history
iolist_size
  • Loading branch information
nwolverson authored Apr 16, 2021
2 parents 9155275 + 63eb857 commit c9d899c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/Erl/Data/Binary/IOList.erl
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
-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].
concat(Xs) -> Xs.

fromBinary(X) -> [X].
toBinary(X) -> erlang:iolist_to_binary(X).

byteSize(X) -> iolist_size(X).
4 changes: 3 additions & 1 deletion src/Erl/Data/Binary/IOList.purs
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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

0 comments on commit c9d899c

Please sign in to comment.