-
Notifications
You must be signed in to change notification settings - Fork 31
Add simple template #884
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ulrikstrid
wants to merge
2
commits into
master
Choose a base branch
from
ulrikstrid--simple-template
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add simple template #884
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
_build | ||
result |
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
(lang dune 3.8) |
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
nixConfig = { | ||
extra-substituters = "https://ocaml.nix-cache.com"; | ||
extra-trusted-public-keys = "ocaml.nix-cache.com-1:/xI2h2+56rwFfKyyFVbkJSeGqSIYMC/Je+7XXqGKDIY="; | ||
}; | ||
|
||
inputs = { | ||
nixpkgs.url = "github:nix-ocaml/nix-overlays"; | ||
flake-utils.url = "github:numtide/flake-utils"; | ||
flake-utils.follows = "nixpkgs/flake-utils"; | ||
nix-filter.url = "github:numtide/nix-filter"; | ||
}; | ||
|
||
outputs = { self, nixpkgs, flake-utils, nix-filter }: | ||
flake-utils.lib.eachDefaultSystem (system: | ||
let pkgs = nixpkgs.legacyPackages.${system}; in | ||
{ | ||
packages = { | ||
default = pkgs.callPackage ./nix { | ||
inherit nix-filter; | ||
doCheck = true; | ||
}; | ||
}; | ||
|
||
devShells = { | ||
default = pkgs.mkShell { | ||
inputsFrom = [ | ||
self.packages.${system}.default | ||
]; | ||
|
||
nativeBuildInputs = with pkgs.ocamlPackages; [ | ||
ocaml | ||
dune | ||
|
||
ocaml-lsp | ||
|
||
ocamlformat | ||
dune-release | ||
odoc | ||
]; | ||
}; | ||
}; | ||
}); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ pkgs | ||
, stdenv | ||
, lib | ||
, nix-filter | ||
, ocamlPackages | ||
, static ? false | ||
, doCheck | ||
}: | ||
with ocamlPackages; | ||
buildDunePackage { | ||
pname = "example"; | ||
version = "1.0.0"; | ||
|
||
src = with nix-filter.lib; | ||
filter { | ||
# Root of the project relative to this file | ||
root = ./..; | ||
# If no include is passed, it will include all the paths. | ||
include = [ | ||
# Include the "src" path relative to the root. | ||
"src" | ||
"test" | ||
# Include this specific path. The path must be under the root. | ||
../example.opam | ||
../dune-project | ||
]; | ||
}; | ||
|
||
checkInputs = [ | ||
# Put test dependencies here | ||
alcotest | ||
]; | ||
|
||
propagatedBuildInputs = [ | ||
# Put dependencies here if you're creating a library | ||
]; | ||
|
||
buildInputs = [ | ||
# Put build-time dependencies here | ||
]; | ||
|
||
inherit doCheck; | ||
|
||
meta = { | ||
description = "Describe your project here"; | ||
# license = stdenv.lib.licenses.bsd3; | ||
}; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
(executable | ||
(name main) | ||
(public_name example) | ||
(libraries example)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
let main () = | ||
print_string "First number: "; | ||
let first = read_line () |> int_of_string_opt in | ||
print_string "Second number: "; | ||
let second = read_line () |> int_of_string_opt in | ||
let output = | ||
match (first, second) with | ||
| None, Some _ -> "First input is not a number" | ||
| Some _, None -> "Second input is not a number" | ||
| None, None -> "Neither of the inputs is a number" | ||
| Some f, Some s -> | ||
let number = Package.add f s in | ||
Printf.sprintf "%i + %i = %i" f s number | ||
in | ||
print_endline output | ||
;; | ||
|
||
main () |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
(library | ||
(name example) | ||
(public_name example)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
let add a b = a + b |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
(test | ||
(name test) | ||
(libraries alcotest package)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
let test_add () = Alcotest.(check int) "adds numbers" 5 (Package.add 2 3) | ||
|
||
let () = | ||
let open Alcotest in | ||
run "Package" [ ("numbers", [ test_case "add" `Quick test_add ]) ] |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.