Skip to content

Commit d71f934

Browse files
author
Ahan Malhotra
committed
Initial Commit
Signed-off-by: Ahan Malhotra <ahanmalhotra@college.harvard.edu>
0 parents  commit d71f934

13 files changed

+456
-0
lines changed

.github/workflows/workflow.yml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
2+
name: Main Workflow
3+
4+
on:
5+
pull_request:
6+
branches:
7+
- main
8+
push:
9+
branches:
10+
- main
11+
12+
jobs:
13+
build:
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
os:
18+
- ubuntu-latest
19+
ocaml-version:
20+
- 4.08.1
21+
- 4.09.1
22+
- 4.10.1
23+
- 4.11.1
24+
25+
runs-on: ${{ matrix.os }}
26+
27+
steps:
28+
- name: Checkout code
29+
uses: actions/checkout@v2
30+
31+
- name: Retrieve opam cache
32+
uses: actions/cache@v2
33+
id: cache-opam
34+
with:
35+
path: ~/.opam
36+
key: v1-${{ runner.os }}-cs51_utils-${{ matrix.ocaml-version }}-${{ hashFiles('*.opam') }}
37+
38+
- name: Use OCaml ${{ matrix.ocaml-version }}
39+
uses: avsm/setup-ocaml@v1
40+
with:
41+
ocaml-version: ${{ matrix.ocaml-version }}
42+
43+
- run: opam pin add cs51-utils . --no-action
44+
45+
- run: opam depext cs51-utils --yes --with-doc --with-test
46+
47+
- run: opam install . --deps-only --with-doc --with-test
48+
49+
- run: opam exec -- dune build --no-buffer
50+
51+
- run: opam exec -- dune runtest --no-buffer

.gitignore

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
*~
3+
_build
4+
.merlin
5+
.vscode
6+
/_drom
7+
/_opam
8+
/_build
9+
10+
11+

.ocamlformat

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
profile=default
2+
quiet=false
3+
max-iters=10
4+
comment-check=true
5+
wrap-fun-args=true
6+
wrap-comments=false
7+
type-decl-indent=2
8+
type-decl=compact
9+
stritem-extension-indent=0
10+
space-around-variants=true
11+
space-around-records=true
12+
space-around-lists=true
13+
space-around-arrays=true
14+
single-case=compact
15+
sequence-style=terminator
16+
sequence-blank-line=preserve-one
17+
parse-docstrings=false
18+
parens-tuple-patterns=multi-line-only
19+
parens-tuple=always
20+
parens-ite=false
21+
ocp-indent-compat=false
22+
nested-match=wrap
23+
module-item-spacing=sparse
24+
max-indent=68
25+
match-indent-nested=never
26+
match-indent=0
27+
margin=80
28+
let-open=preserve
29+
let-module=compact
30+
let-binding-spacing=compact
31+
let-binding-indent=2
32+
let-and=compact
33+
leading-nested-match-parens=false
34+
infix-precedence=indent
35+
indicate-nested-or-patterns=unsafe-no
36+
indicate-multiline-delimiters=no
37+
indent-after-in=0
38+
if-then-else=compact
39+
function-indent-nested=never
40+
function-indent=2
41+
field-space=loose
42+
extension-sugar=preserve
43+
extension-indent=2
44+
exp-grouping=parens
45+
dock-collection-brackets=true
46+
doc-comments-tag-only=default
47+
doc-comments-padding=2
48+
doc-comments=after-when-possible
49+
disambiguate-non-breaking-match=false
50+
disable=false
51+
cases-matching-exp-indent=normal
52+
cases-exp-indent=4
53+
break-struct=force
54+
break-string-literals=auto
55+
break-sequences=true
56+
break-separators=after
57+
break-infix-before-func=false
58+
break-infix=wrap
59+
break-fun-sig=wrap
60+
break-fun-decl=wrap
61+
break-collection-expressions=fit-or-vertical
62+
break-cases=fit
63+
break-before-in=fit-or-vertical
64+
assignment-operator=end-line
65+
align-variants-decl=false
66+
align-constructors-decl=false
67+
align-cases=false

.ocamlint

Whitespace-only changes.

.ocp-indent

+131
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
2+
# -*- conf -*-
3+
# This is an example configuration file for ocp-indent
4+
#
5+
# Copy to the root of your project with name ".ocp-indent", customise, and
6+
# transparently get consistent indentation on all your ocaml source files.
7+
8+
# Starting the configuration file with a preset ensures you won't fallback to
9+
# definitions from "~/.ocp/ocp-indent.conf".
10+
# These are `normal`, `apprentice` and `JaneStreet` and set different defaults.
11+
normal
12+
13+
#
14+
# INDENTATION VALUES
15+
#
16+
17+
# Number of spaces used in all base cases, for example:
18+
# let foo =
19+
# ^^bar
20+
base = 2
21+
22+
# Indent for type definitions:
23+
# type t =
24+
# ^^int
25+
type = 2
26+
27+
# Indent after `let in` (unless followed by another `let`):
28+
# let foo = () in
29+
# ^^bar
30+
in = 0
31+
32+
# Indent after `match/try with` or `function`:
33+
# match foo with
34+
# ^^| _ -> bar
35+
with = 0
36+
37+
# Indent for clauses inside a pattern-match (after the arrow):
38+
# match foo with
39+
# | _ ->
40+
# ^^^^bar
41+
# the default is 2, which aligns the pattern and the expression
42+
match_clause = 4 # this is non-default
43+
44+
# Indentation for items inside extension nodes:
45+
# [%% id.id
46+
# ^^^^contents ]
47+
# [@@id
48+
# ^^^^foo
49+
# ]
50+
ppx_stritem_ext = 2
51+
52+
# When nesting expressions on the same line, their indentation are in
53+
# some cases stacked, so that it remains correct if you close them one
54+
# at a line. This may lead to large indents in complex code though, so
55+
# this parameter can be used to set a maximum value. Note that it only
56+
# affects indentation after function arrows and opening parens at end
57+
# of line.
58+
#
59+
# for example (left: `none`; right: `4`)
60+
# let f = g (h (i (fun x -> # let f = g (h (i (fun x ->
61+
# x) # x)
62+
# ) # )
63+
# ) # )
64+
max_indent = 4
65+
66+
67+
#
68+
# INDENTATION TOGGLES
69+
#
70+
71+
# Wether the `with` parameter should be applied even when in a sub-block.
72+
# Can be `always`, `never` or `auto`.
73+
# if `always`, there are no exceptions
74+
# if `auto`, the `with` parameter is superseded when seen fit (most of the time,
75+
# but not after `begin match` for example)
76+
# if `never`, `with` is only applied if the match block starts a line.
77+
#
78+
# For example, the following is not indented if set to `always`:
79+
# let f = function
80+
# ^^| Foo -> bar
81+
strict_with = never
82+
83+
# Controls indentation after the `else` keyword. `always` indents after the
84+
# `else` keyword normally, like after `then`.
85+
# If set to `never', the `else` keyword won't indent when followed by a newline.
86+
# `auto` indents after `else` unless in a few "unclosable" cases (`let in`,
87+
# `match`...).
88+
#
89+
# For example, with `strict_else=never`:
90+
# if cond then
91+
# foo
92+
# else
93+
# bar;
94+
# baz
95+
# `never` is discouraged if you may encounter code like this example,
96+
# because it hides the scoping error (`baz` is always executed)
97+
strict_else = always
98+
99+
# Ocp-indent will normally try to preserve your in-comment indentation, as long
100+
# as it respects the left-margin or starts with `(*\n`. Setting this to `true`
101+
# forces alignment within comments.
102+
strict_comments = false
103+
104+
# Toggles preference of column-alignment over line indentation for most
105+
# of the common operators and after mid-line opening parentheses.
106+
#
107+
# for example (left: `false'; right: `true')
108+
# let f x = x # let f x = x
109+
# + y # + y
110+
align_ops = true
111+
112+
# Function parameters are normally indented one level from the line containing
113+
# the function. This option can be used to have them align relative to the
114+
# column of the function body instead.
115+
# if set to `always`, always align below the function
116+
# if `auto`, only do that when seen fit (mainly, after arrows)
117+
# if `never`, no alignment whatsoever
118+
#
119+
# for example (left: `never`; right: `always or `auto)
120+
# match foo with # match foo with
121+
# | _ -> some_fun # | _ -> some_fun
122+
# ^^parameter # ^^parameter
123+
align_params = auto
124+
125+
126+
#
127+
# SYNTAX EXTENSIONS
128+
#
129+
130+
# You can also add syntax extensions (as per the --syntax command-line option):
131+
# syntax = mll lwt

CS51Utils.opam

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# This file is generated by dune, edit dune-project instead
2+
opam-version: "2.0"
3+
build: [
4+
["dune" "subst"] {pinned}
5+
["dune" "build" "-p" name "-j" jobs]
6+
["dune" "runtest" "-p" name "-j" jobs] {with-test}
7+
["dune" "build" "-p" name "@doc"] {with-doc}
8+
]
9+
maintainer: ["heads@cs51.io"]
10+
authors: ["CS51 Heads"]
11+
bug-reports: "https://github.com/cs51/utils/issues"
12+
homepage: "https://github.com/cs51/utils"
13+
version: "1.0.0"
14+
dev-repo: "git+https://github.com/cs51/utils.git"
15+
synopsis: "CS51 Utilities"
16+
description: "Utilities that might be helpful during CS51."
17+
depends: [
18+
"alcotest" {>= "1.2.0"}
19+
"qcheck" {>= "0.16"}
20+
"qcheck-alcotest" {>= "0.16"}
21+
]

Makefile

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Frontend to dune.
2+
3+
.PHONY: default build install uninstall test clean
4+
5+
default: build
6+
7+
build:
8+
dune build
9+
10+
test:
11+
dune runtest -f
12+
13+
install:
14+
dune install
15+
16+
uninstall:
17+
dune uninstall
18+
19+
clean:
20+
dune clean
21+
# Optionally, remove all files/folders ignored by git as defined
22+
# in .gitignore (-X).
23+
git clean -dfXq

dune-project

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
(lang dune 1.10)
2+
(name CS51Utils)
3+
(source (github cs51/utils))
4+
(authors "CS51 Heads")
5+
(maintainers "heads@cs51.io")
6+
(version 1.0.0)
7+
(generate_opam_files true)
8+
9+
(package
10+
(name CS51Utils)
11+
(synopsis "CS51 Utilities")
12+
(description "Utilities that might be helpful during CS51.")
13+
(depends
14+
(alcotest (>= 1.2.0))
15+
(qcheck (>= 0.16))
16+
(qcheck-alcotest (>= 0.16))
17+
)
18+
)

0 commit comments

Comments
 (0)