Skip to content

Commit c9d899c

Browse files
authored
Merge pull request #3 from robashton/master
iolist_size
2 parents 9155275 + 63eb857 commit c9d899c

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/Erl/Data/Binary/IOList.erl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
-module(erl_data_binary_iOList@foreign).
2-
-export([mempty_/0, append_/2, concat/1, toBinary/1, fromBinary/1]).
2+
-export([mempty_/0, append_/2, concat/1, toBinary/1, fromBinary/1, byteSize/1]).
33

44
mempty_() -> [].
55
append_(X,Y) -> [X,Y].
66
concat(Xs) -> Xs.
77

88
fromBinary(X) -> [X].
99
toBinary(X) -> erlang:iolist_to_binary(X).
10+
11+
byteSize(X) -> iolist_size(X).

src/Erl/Data/Binary/IOList.purs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
-- | Representation of Erlang iolist().
2-
module Erl.Data.Binary.IOList (IOList, concat, fromBinary, toBinary) where
2+
module Erl.Data.Binary.IOList (IOList, concat, fromBinary, toBinary, byteSize) where
33

44
import Prelude
55
import Erl.Data.Binary.Type (Binary)
@@ -26,3 +26,5 @@ foreign import fromBinary :: Binary -> IOList
2626
-- | Collapse an IOList to a Binary
2727
foreign import toBinary :: IOList -> Binary
2828

29+
-- | Calls iolist_size
30+
foreign import byteSize :: IOList -> Int

0 commit comments

Comments
 (0)