Inital Commit

This commit is contained in:
Nathan McCarty 2023-06-21 23:29:19 -04:00
commit 00740bb311
Signed by: thatonelutenist
SSH Key Fingerprint: SHA256:hwQEcmak9E6sdU9bXc98RHw/Xd1AhpB5HZT7ZSVJkRM
9 changed files with 420 additions and 0 deletions

2
.envrc Normal file
View File

@ -0,0 +1,2 @@
use flake
watch_file ringlorn-sources.json

9
.gitignore vendored Normal file
View File

@ -0,0 +1,9 @@
.DS_Store
.idea
*.log
tmp/
result
.idr2nix/
build/
.direnv/
target/

95
LICENSE.md Normal file
View File

@ -0,0 +1,95 @@
# The Parity Public License 7.0.0
Contributor: Nathan McCarty
Source Code: https://git.sr.ht/~thatonelutenist/ringlorn
## Purpose
This license allows you to use and share this software for free, but you have to share software that
builds on it alike.
## Agreement
In order to receive this license, you have to agree to its rules. Those rules are both obligations
under that agreement and conditions to your license. Don't do anything with this software that
triggers a rule you can't or won't follow.
## Notices
Make sure everyone who gets a copy of any part of this software from you, with or without changes,
also gets the text of this license and the contributor and source code lines above.
## Copyleft
[Contribute](#contribute) software you develop, operate, or analyze with this software, including
changes or additions to this software. When in doubt, [contribute](#contribute).
## Prototypes
You don't have to [contribute](#contribute) any change, addition, or other software that meets all
these criteria:
1. You don't use it for more than thirty days.
1. You don't share it outside the team developing it, other than for non-production user testing.
1. You don't develop, operate, or analyze other software with it for anyone outside the team
developing it.
## Reverse Engineering
You may use this software to operate and analyze software you can't [contribute](#contribute) in
order to develop alternatives you can and do [contribute](#contribute).
## Contribute
To [contribute](#contribute) software:
1. Publish all source code for the software in the preferred form for making changes through a
freely accessible distribution system widely used for similar source code so the contributor and
others can find and copy it.
1. Make sure every part of the source code is available under this license or another license that
allows everything this license does, such as
[the Blue Oak Model License 1.0.0](https://blueoakcouncil.org/license/1.0.0),
[the Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0.html),
[the MIT license](https://spdx.org/licenses/MIT.html), or
[the two-clause BSD license](https://spdx.org/licenses/BSD-2-Clause.html).
1. Take these steps within thirty days.
1. Note that this license does _not_ allow you to change the license terms for this software. You
must follow [Notices](#notices).
## Excuse
You're excused for unknowingly breaking [Copyleft](#copyleft) if you [contribute](#contribute) as
required, or stop doing anything requiring this license, within thirty days of learning you broke
the rule. You're excused for unknowingly breaking [Notices](#notices) if you take all practical
steps to comply within thirty days of learning you broke the rule.
## Defense
Don't make any legal claim against anyone accusing this software, with or without changes, alone or
with other technology, of infringing any patent.
## Copyright
The contributor licenses you to do everything with this software that would otherwise infringe their
copyright in it.
## Patent
The contributor licenses you to do everything with this software that would otherwise infringe any
patents they can license or become able to license.
## Reliability
The contributor can't revoke this license.
## No Liability
***As far as the law allows, this software comes as is, without any warranty or condition, and the
contributor won't be liable to anyone for any damages related to this software or this license,
under any kind of legal claim.***

46
PrimeSieve.ipkg Normal file
View File

@ -0,0 +1,46 @@
package Euler
version = 0.0.0
authors = "Nathan McCarty <nathan@mccarty.io>"
license = "Parity Public License 7.0.0"
-- brief =
-- readme =
-- homepage =
-- sourceloc =
-- bugtracker =
-- the Idris2 version required (e.g. langversion >= 0.5.1)
-- langversion
-- packages to add to search path
-- depends =
-- modules to install
modules = PrimeSieve
-- main file (i.e. file to load at REPL)
main = PrimeSieve
-- name of executable
executable = primesieve
-- opts =
sourcedir = "src"
-- builddir =
-- outputdir =
-- script to run before building
-- prebuild =
-- script to run after building
-- postbuild =
-- script to run after building, before installing
-- preinstall =
-- script to run after installing
-- postinstall =
-- script to run before cleaning
-- preclean =
-- script to run after cleaning
-- postclean =

1
README.md Normal file
View File

@ -0,0 +1 @@
# Prime sieve in idris 2

236
flake.lock Normal file
View File

@ -0,0 +1,236 @@
{
"nodes": {
"advisory-db": {
"flake": false,
"locked": {
"lastModified": 1685821301,
"narHash": "sha256-4XRcnSboLJw1XKjDpg2jBU70jEw/8Bgx4nUmnq3kXbY=",
"owner": "RustSec",
"repo": "advisory-db",
"rev": "af3f3d503f82056785841bee49997bae65eba1c0",
"type": "github"
},
"original": {
"owner": "RustSec",
"repo": "advisory-db",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1685518550,
"narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1681202837,
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"idr2nix": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [
"nixpkgs"
],
"rust": "rust"
},
"locked": {
"lastModified": 1686465942,
"narHash": "sha256-+6ake+PQ9zVKrKaz3g8haA/t0woq1XLmbxYtoQwLgd8=",
"ref": "trunk",
"rev": "b306a4aff0f183268bd11d96ab3043638097f6f0",
"revCount": 72,
"type": "git",
"url": "https://git.sr.ht/~thatonelutenist/idr2nix"
},
"original": {
"ref": "trunk",
"type": "git",
"url": "https://git.sr.ht/~thatonelutenist/idr2nix"
}
},
"naersk": {
"inputs": {
"nixpkgs": [
"idr2nix",
"rust",
"nixpkgs"
]
},
"locked": {
"lastModified": 1679567394,
"narHash": "sha256-ZvLuzPeARDLiQUt6zSZFGOs+HZmE+3g4QURc8mkBsfM=",
"owner": "nix-community",
"repo": "naersk",
"rev": "88cd22380154a2c36799fe8098888f0f59861a15",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "naersk",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1686398752,
"narHash": "sha256-nGWNQVhSw4VSL+S0D0cbrNR9vs9Bq7rlYR+1K5f5j6w=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "a30520bf8eabf8a5c37889d661e67a2dbcaa59e6",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"idr2nix": "idr2nix",
"nixpkgs": "nixpkgs"
}
},
"rust": {
"inputs": {
"advisory-db": "advisory-db",
"naersk": "naersk",
"nixpkgs": [
"idr2nix",
"nixpkgs"
],
"rust-overlay": "rust-overlay",
"utils": "utils"
},
"locked": {
"lastModified": 1686275778,
"narHash": "sha256-LjwqskHXyHCgRvnGroso6RdiJojWseTfSh8Af852GXg=",
"ref": "refs/heads/trunk",
"rev": "97d99b872d3840e08d5c51ffa7c87b144fbb2afa",
"revCount": 22,
"type": "git",
"url": "https://git.stranger.systems/nix/Rust"
},
"original": {
"type": "git",
"url": "https://git.stranger.systems/nix/Rust"
}
},
"rust-overlay": {
"inputs": {
"flake-utils": "flake-utils_2",
"nixpkgs": [
"idr2nix",
"rust",
"nixpkgs"
]
},
"locked": {
"lastModified": 1686191569,
"narHash": "sha256-8ey5FOXNms9piFGTn6vJeAQmSKk+NL7GTMSoVttsNTs=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "b4b71458b92294e8f1c3a112d972e3cff8a2ab71",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_3": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"utils": {
"inputs": {
"systems": "systems_3"
},
"locked": {
"lastModified": 1685518550,
"narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

18
flake.nix Normal file
View File

@ -0,0 +1,18 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
idr2nix = {
url = "git+https://git.sr.ht/~thatonelutenist/idr2nix?ref=trunk";
inputs.nixpkgs.follows = "nixpkgs";
};
};
description = "Prime Sieve";
outputs = { self, nixpkgs, idr2nix }:
idr2nix.idris.single {
packageName = "primesieve";
sources = builtins.fromJSON (builtins.readFile ./primesieve-sources.json);
ipkg = "PrimeSieve.ipkg";
src = ./.;
};
}

9
primesieve-sources.json Normal file
View File

@ -0,0 +1,9 @@
{
"sources": {},
"sorted": [],
"idris2": {
"url": "https://github.com/idris-lang/Idris2",
"rev": "5dcf62499df5cb861d153372ef3b4386dba25c98",
"sha256": "sha256-P9fVZNtgu08cvJmanL88W4F2l0PWKbSk8h8SS5JEN/M="
}
}

4
src/PrimeSieve.idr Normal file
View File

@ -0,0 +1,4 @@
module PrimeSieve
main : IO ()
main = putStrLn "Hello!"