Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
c216c6c
Changes to debug macros
bipthelin Sep 6, 2013
2b9053e
erronus comma
bipthelin Sep 6, 2013
d51a3b7
Add ESTATSD support
bipthelin Sep 19, 2013
7d73b62
Changes to time function for estats
bipthelin Sep 19, 2013
7ac7a1c
Add timed diff
bipthelin Sep 19, 2013
71e6daa
Use catch instead of try/catch
bipthelin Sep 19, 2013
2d989a5
SHA1 on file
b3rnie Sep 20, 2013
00f7645
New hash functions, require R16
b3rnie Sep 20, 2013
5e57461
Change how estats:timing is reported
bipthelin Sep 20, 2013
112588a
ensure list before concat
bipthelin Sep 20, 2013
e73cb0f
Avoid name clashing
bipthelin Sep 24, 2013
946b308
Logg milliseconds, not microseconds
bipthelin Sep 24, 2013
e247b58
Make compatible with erlang.mk
bipthelin Jan 13, 2014
7d5798b
Use erlang.mk instead of rebar
bipthelin Apr 30, 2014
9c95909
Change import
bipthelin Apr 30, 2014
7af19d7
Update erlang.mk
bipthelin May 12, 2014
df53831
Cleanup
bipthelin May 12, 2014
0fff105
Add luhn implementation
Nov 26, 2014
9ae9183
Merge pull request #1 from kivra/luhn
jbothma Dec 1, 2014
d09fd7f
move dsort to stdlib2, sort outer list and add unit tests
Jan 22, 2015
1e54436
Use os:timestamp() as default for stamp()
bipthelin Mar 18, 2015
96db85f
dict() is deprecated in R17+
bipthelin May 26, 2015
6b592fa
Merge branch 'bt-erlang_R17+'
bipthelin May 27, 2015
f7d11d8
erlang:now() is deprecated in R18.
bipthelin Sep 3, 2015
55ebce6
Add s2_math with ceiling and floor functions.
plux-kivra Oct 2, 2015
b4f0f99
Merge pull request #2 from kivra/hn-stdlib2-math
plux Oct 2, 2015
4e22794
add a2b and b2a
bipthelin Feb 9, 2016
bcbadf2
Revert
bipthelin Feb 9, 2016
80f3d12
Add i2b and b2i
bipthelin Feb 9, 2016
dc5e541
Use Katja for Riemann integration
bipthelin May 2, 2016
c6c7afe
Add unix_epoch
bipthelin May 3, 2016
bac26f8
Merge branch 'riemann'
bipthelin May 4, 2016
00df6e9
Add header files for convenient constants
plux-kivra Sep 28, 2016
379bd49
Adds 'position/2'
zigge-zagge Feb 16, 2017
0b66e47
Merge pull request #5 from kivra/jz-additions-to-deltabatch
bipthelin Feb 16, 2017
587a106
Merge pull request #4 from kivra/hn-constant-headers
bipthelin Feb 16, 2017
539939a
Adds possibility to keep error_logger for errors while using lager fo…
zigge-zagge Apr 6, 2017
5ccd9b2
Merge pull request #7 from kivra/jz-use-raven_error_loger
JYZR Apr 10, 2017
449493c
crypto:rand_uniform/2 is deprecated, use rand:uniform/1 instead
plux-kivra Oct 10, 2017
7aac629
Add support for using katja_pool
plux-kivra Nov 30, 2017
063124d
Merge pull request #10 from kivra/hn-riemann-pool
plux Dec 5, 2017
8fc233d
Add sha256 function that returns binary hexstring
bipthelin Jan 12, 2018
b02d338
Merge pull request #8 from kivra/use-rand-uniform
bipthelin Aug 1, 2018
3ebcfe5
Add failed log macro (#11)
plux Sep 3, 2018
4cf3a70
Add macro a2b(X) for atom_to_binary(X, utf8)
kampiliira Sep 28, 2018
8fd42a0
Print function a bit nicer in failed macro (#12)
plux Nov 13, 2018
2e527b6
Adds exception log macro (#13)
JYZR Nov 26, 2018
761ef88
feat: Implement kivra_metrics
bipthelin Apr 2, 2019
44ce030
feat: Implement kivra_metrics
kbip Apr 10, 2019
2e0b30e
Old ?hence was shit, use ?assert instead (#14)
zigge-zagge May 10, 2019
b3007f9
feat: add md5-hashing (#16)
kbip May 23, 2019
c457e95
Adds 's2_io:format/2', an alternative to 'io_lib:format/2' (#17)
zigge-zagge May 23, 2019
a5c0388
chore: convert to Rebar3
bipthelin May 23, 2019
287f791
Merge branch 'master' of github.com:kivra/stdlib2
bipthelin May 23, 2019
78e1172
feat: Implement mod97-validation
bipthelin Aug 14, 2019
b79bf91
fix s2_dot formatting for justification
chsukivra Oct 23, 2019
9fdc9f8
Merge pull request #19 from kivra/cs-dot-formatting
chsukivra Oct 23, 2019
920fd6c
remove include of eunit on no tests
baronbosse Nov 21, 2019
ad69b08
ifdef all tests an eunit includes
baronbosse Nov 21, 2019
a3ba852
ifdef eunit even in tests
baronbosse Nov 21, 2019
d195499
ifdef spin_lock test
baronbosse Nov 21, 2019
4c5f7a3
export recv/3
baronbosse Nov 21, 2019
854dc66
Merge pull request #20 from kivra/ifdef-all-tests
maxnordlund Nov 21, 2019
fc6f577
Fixed bug in test regarding s2_time:stamp()
rolkar-kivra Feb 18, 2020
4486bcd
feat: Add histogram to kivra_metrics
rolkar-kivra Feb 18, 2020
e851cb5
Merge pull request #21 from kivra/add-histogram-for-kivra-metrics
huss-kivra Feb 19, 2020
cc881ee
feat: Support for structured warning messages to Sentry (#23)
zigge-zagge Dec 10, 2020
945eb5c
feat: Support mapping over maybes; add functor type class (#24)
moritzploss-k Mar 3, 2021
c86a292
feat: otp logger support (#26)
jakobsvenning Apr 15, 2021
2733090
chore: Allow separate import of maybe monads (#27)
moritzploss-k Apr 23, 2021
139d630
chore: Add pipeline for build, test and release (#28)
moritzploss-k Apr 23, 2021
12d7e7c
fix: Syntax error in prelude.hrl (#29)
moritzploss-k May 4, 2021
d66ce8b
feat: Add 'sequence' and 'liftm' for maybe monads (#31)
moritzploss-k May 12, 2021
e96e4a1
feat: Add foldl_while (#32)
moritzploss-k May 21, 2021
c4dd4a8
no-release: Use OTP 24 (#33)
moritzploss-k Aug 9, 2021
6dfffb2
feat: define exception/failed depending on logger (#34)
chsukivra Oct 5, 2021
c8676dd
chore: create exception reports lazily (#35)
chsukivra Oct 7, 2021
0d9242b
fix: Logger macro syntax errors (#37)
moritzploss-k Dec 14, 2021
86c3a18
fix: keep stacktrace as is, raven will format it for sentry (#38)
chsukivra Jan 21, 2022
de7a447
chore: Added s2_par:filtermap/2,3 functions (#39)
ssepml May 2, 2022
de77ba6
fix: prepare for OTP 27 when maybe becomes a keyword
kivra-pergus Jul 15, 2024
0af3e44
fix: change beam setup driver
kivra-pergus Jul 15, 2024
961eb41
fix: extra maybes
kivra-pergus Jul 15, 2024
3408672
fix: OTP27 dialyzer issues
kivra-pergus Jul 15, 2024
27acbaa
fix: add back 23.2
kivra-pergus Jul 15, 2024
e009d03
fix: remove 23.2 again
kivra-pergus Jul 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Erlang CI

on: [push]

jobs:
build_and_test:
runs-on: ubuntu-latest
name: OTP ${{matrix.otp}}
strategy:
matrix:
otp: ["24.0", "25.0", "26.0", "27.0"]
steps:
- uses: actions/checkout@v2.0.0
- uses: erlef/setup-beam@v1.18.0
with:
otp-version: ${{ matrix.otp }}
rebar3-version: "3.23.0"
- name: Compile
run: make compile
- name: Run xref
run: make xref
- name: Run dialyzer
run: make dialyze
- name: Run eunit tests
run: make eunit

release:
if: github.ref == 'refs/heads/master' && startsWith(github.event.head_commit.message, 'no-release:') == false
needs: build_and_test
runs-on: ubuntu-latest
steps:
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/github-tag-action@v5.3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Create a GitHub release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.tag_version.outputs.new_tag }}
release_name: Release ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ deps/
*.app
.eunit/
*.plt
_build
/test_db*/
59 changes: 0 additions & 59 deletions GNUmakefile

This file was deleted.

16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
all: compile

compile:
rebar3 compile

clean:
rebar3 clean

eunit:
rebar3 eunit

dialyze:
rebar3 dialyzer

xref:
rebar3 as test xref
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,17 @@ jakob@sleepy.primat.es:~/git/stdlib2$ gmake test
Manifest
========
* include/:
* prelude.hrl -- Useful macros and type aliases.
* prelude.hrl -- Complete collection of macros and type aliases.
* byte.hrl -- Macros and type aliases for byte unit conversion.
* maybe.hrl -- Macros and type aliases for maybe monads.
* time.hrl -- Macros and type aliases related to time and date.
* src/:
* s2_atoms.erl -- Atom-related utilities.
* s2_csets.erl -- Counting sets.
* s2_env.erl -- Environment access and setup.
* s2_export.erl -- Export unexported functions from the REPL.
* s2_fs.erl -- Filesystem-related utilities.
* s2_functors.erl -- The functor typeclass.
* s2_funs.erl -- Combinators.
* s2_gen_db.erl -- Behaviour for persistent state.
* s2_gen_lattice.erl -- Behaviour for lattices.
Expand Down
Empty file removed bin/.gitignore
Empty file.
Empty file removed doc/.gitignore
Empty file.
Empty file removed ebin/.gitignore
Empty file.
13 changes: 13 additions & 0 deletions include/byte.hrl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
-ifndef(__S2_BYTE_HRL).
-define(__S2_BYTE_HRL, true).

-define(BITS(Bytes), (Bytes * 8)).
-define(BYTES(Bits), (Bits div 8)).

-define(KB(X), (X * 1024)).
-define(MB(X), (X * 1024 * 1024)).
-define(GB(X), (X * 1024 * 1024 * 1024)).
-define(TB(X), (X * 1024 * 1024 * 1024 * 1024)).
-define(PB(X), (X * 1024 * 1024 * 1024 * 1024 * 1024)).

-endif.
126 changes: 126 additions & 0 deletions include/maybe.hrl
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% @doc Maybe Monads
%%% @end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%_* Types ============================================================
-type functor(A) :: s2_functors:functor(A).
-type thunk(A) :: fun(() -> A).
-type collection(A) :: [A] | #{_ := A}.

-type ok(A) :: {ok, A}.
-type error(A) :: {error, A}.
-type 'maybe'(A, B) :: ok(A) | error(B).
-type whynot(A) :: ok | error(A).

%%%_* Macros ===========================================================
-define(lift(E), s2_maybe:lift(fun() -> E end)).
-define(unlift(E), s2_maybe:unlift(fun() -> E end)).

-define(do(F0, F1),
s2_maybe:do([F0, F1])).
-define(do(F0, F1, F2),
s2_maybe:do([F0, F1, F2])).
-define(do(F0, F1, F2, F3),
s2_maybe:do([F0, F1, F2, F3])).
-define(do(F0, F1, F2, F3, F4),
s2_maybe:do([F0, F1, F2, F3, F4])).
-define(do(F0, F1, F2, F3, F4, F5),
s2_maybe:do([F0, F1, F2, F3, F4, F5])).
-define(do(F0, F1, F2, F3, F4, F5, F6),
s2_maybe:do([F0, F1, F2, F3, F4, F5, F6])).
-define(do(F0, F1, F2, F3, F4, F5, F6, F7),
s2_maybe:do([F0, F1, F2, F3, F4, F5, F6, F7])).
-define(do(F0, F1, F2, F3, F4, F5, F6, F7, F8),
s2_maybe:do([F0, F1, F2, F3, F4, F5, F6, F7, F8])).
-define(do(F0, F1, F2, F3, F4, F5, F6, F7, F8, F9),
s2_maybe:do([F0, F1, F2, F3, F4, F5, F6, F7, F8, F9])).

-define(fmap(F, Functor),
s2_functors:fmap(F, Functor)).

-define(ido(F0, F1),
?ido([F0, F1])).
-define(ido(F0, F1, F2),
?ido([F0, F1, F2])).
-define(ido(F0, F1, F2, F3),
?ido([F0, F1, F2, F3])).
-define(ido(F0, F1, F2, F3, F4),
?ido([F0, F1, F2, F3, F4])).
-define(ido(F0, F1, F2, F3, F4, F5),
?ido([F0, F1, F2, F3, F4, F5])).
-define(ido(F0, F1, F2, F3, F4, F5, F6),
?ido([F0, F1, F2, F3, F4, F5, F6])).
-define(ido(F0, F1, F2, F3, F4, F5, F6, F7),
?ido([F0, F1, F2, F3, F4, F5, F6, F7])).
-define(ido(F0, F1, F2, F3, F4, F5, F6, F7, F8),
?ido([F0, F1, F2, F3, F4, F5, F6, F7, F8])).
-define(ido(F0, F1, F2, F3, F4, F5, F6, F7, F8, F9),
?ido([F0, F1, F2, F3, F4, F5, F6, F7, F8, F9])).

%% Instrumented do.
-define(ido(Fs),
(case ?TIME(?FUNCTION, s2_maybe:do(Fs)) of
{ok, ___Res} = ___Ok ->
?debug("~p: ok: ~p", [?FUNCTION, ___Res]),
?increment(?FUNCTION, ok),
___Ok;
{error, ___Rsn} = ___Err ->
?error("~p: error: ~p", [?FUNCTION, ___Rsn]),
?increment(?FUNCTION, error),
___Err
end)).

-define(thunk(E0),
fun() -> E0 end).
-define(thunk(E0, E1),
fun() -> E0, E1 end).
-define(thunk(E0, E1, E2),
fun() -> E0, E1, E2 end).
-define(thunk(E0, E1, E2, E3),
fun() -> E0, E1, E2, E3 end).
-define(thunk(E0, E1, E2, E3, E4),
fun() -> E0, E1, E2, E3, E4 end).
-define(thunk(E0, E1, E2, E3, E4, E5),
fun() -> E0, E1, E2, E3, E4, E5 end).
-define(thunk(E0, E1, E2, E3, E4, E5, E6),
fun() -> E0, E1, E2, E3, E4, E5, E6 end).
-define(thunk(E0, E1, E2, E3, E4, E5, E6, E7),
fun() -> E0, E1, E2, E3, E4, E5, E6, E7 end).
-define(thunk(E0, E1, E2, E3, E4, E5, E6, E7, E8),
fun() -> E0, E1, E2, E3, E4, E5, E6, E7, E8 end).
-define(thunk(E0, E1, E2, E3, E4, E5, E6, E7, E8, E9),
fun() -> E0, E1, E2, E3, E4, E5, E6, E7, E8, E9 end).

-define(liftm(F, A1),
s2_maybe:liftm(F, [?thunk(A1)])).
-define(liftm(F, A1, A2),
s2_maybe:liftm(F, [?thunk(A1), ?thunk(A2)])).
-define(liftm(F, A1, A2, A3),
s2_maybe:liftm(F, [?thunk(A1), ?thunk(A2), ?thunk(A3)])).
-define(liftm(F, A1, A2, A3, A4),
s2_maybe:liftm(F, [?thunk(A1), ?thunk(A2), ?thunk(A3), ?thunk(A4)])).
-define(liftm(F, A1, A2, A3, A4, A5),
s2_maybe:liftm(F, [?thunk(A1), ?thunk(A2), ?thunk(A3), ?thunk(A4),
?thunk(A5)])).
-define(liftm(F, A1, A2, A3, A4, A5, A6),
s2_maybe:liftm(F, [?thunk(A1), ?thunk(A2), ?thunk(A3), ?thunk(A4),
?thunk(A5), ?thunk(A6)])).
-define(liftm(F, A1, A2, A3, A4, A5, A6, A7),
s2_maybe:liftm(F, [?thunk(A1), ?thunk(A2), ?thunk(A3), ?thunk(A4),
?thunk(A5), ?thunk(A6), ?thunk(A7)])).
-define(liftm(F, A1, A2, A3, A4, A5, A6, A7, A8),
s2_maybe:liftm(F, [?thunk(A1), ?thunk(A2), ?thunk(A3), ?thunk(A4),
?thunk(A5), ?thunk(A6), ?thunk(A7), ?thunk(A8)])).
-define(liftm(F, A1, A2, A3, A4, A5, A6, A7, A8, A9),
s2_maybe:liftm(F, [?thunk(A1), ?thunk(A2), ?thunk(A3), ?thunk(A4),
?thunk(A5), ?thunk(A6), ?thunk(A7), ?thunk(A8),
?thunk(A9)])).

%%%_* Guards ===========================================================
-define(is_thunk(X), is_function(X, 0)).

%%% Local Variables:
%%% allout-layout: t
%%% erlang-indent-level: 2
%%% End:
Loading