-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 2a51c43
Showing
15 changed files
with
1,073 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 @@ | ||
use_flake |
This file contains 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,21 @@ | ||
name: build-project | ||
on: push | ||
# | ||
jobs: | ||
build-package: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
- name: install nix | ||
uses: cachix/install-nix-action@v18 | ||
- run: nix build | ||
|
||
build-dev-shell: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
- name: install nix | ||
uses: cachix/install-nix-action@v18 | ||
- run: nix build .#devShells.x86_64-linux.default |
This file contains 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,24 @@ | ||
name: update-flake-lock | ||
on: | ||
workflow_dispatch: # allows manual triggering | ||
schedule: | ||
- cron: '0 18 1 * *' | ||
|
||
jobs: | ||
lockfile: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
- name: Install Nix | ||
uses: cachix/install-nix-action@v16 | ||
with: | ||
extra_nix_config: | | ||
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} | ||
- name: Update flake.lock | ||
uses: DeterminateSystems/update-flake-lock@v15 | ||
with: | ||
pr-title: "Update flake.lock" # Title of PR to be created | ||
pr-labels: | # Labels to be set on the PR | ||
dependencies | ||
automated |
This file contains 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,29 @@ | ||
# Haskell | ||
dist | ||
dist-* | ||
cabal-dev | ||
*.o | ||
*.hi | ||
*.hie | ||
*.chi | ||
*.chs.h | ||
*.dyn_o | ||
*.dyn_hi | ||
.hpc | ||
.hsenv | ||
.cabal-sandbox/ | ||
cabal.sandbox.config | ||
*.prof | ||
*.aux | ||
*.hp | ||
*.eventlog | ||
.stack-work/ | ||
cabal.project.local | ||
cabal.project.local~ | ||
.HTF/ | ||
.ghc.environment.* | ||
|
||
# Nix | ||
result | ||
.direnv | ||
.pre-commit-config.yaml |
This file contains 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,134 @@ | ||
# Haskell's Dangerous Functions | ||
# For a how-to-use and the latest version of this file go to: | ||
# https://github.com/NorfairKing/haskell-dangerous-functions/ | ||
|
||
- ignore: { name: "Use unless" } | ||
- ignore: { name: "Use tuple-section" } | ||
|
||
- functions: | ||
- {name: unsafeDupablePerformIO, within: []} # Unsafe | ||
- {name: unsafeInterleaveIO, within: []} # Unsafe | ||
- {name: unsafeFixIO, within: []} # Unsafe | ||
- {name: unsafePerformIO, within: []} # Unsafe | ||
|
||
# _VERY_ hard to get right, use the async library instead. | ||
# See also https://github.com/informatikr/hedis/issues/165 | ||
- {name: forkIO, within: []} | ||
# Mostly impossible to get right, rethink what you're doing entirely. | ||
# See also https://www.reddit.com/r/haskell/comments/jsap9r/how_dangerous_is_forkprocess/ | ||
- {name: forkProcess, within: []} | ||
|
||
- {name: undefined, within: []} # Purposely fails. Deal with errors appropriately instead. | ||
- {name: throw, within: []} # Don't throw from pure code, use throwIO instead. | ||
- {name: Prelude.error, within: []} | ||
|
||
- {name: Data.List.head, within: []} # Partial, use `listToMaybe` instead. | ||
- {name: Data.List.tail, within: []} # Partial | ||
- {name: Data.List.init, within: []} # Partial | ||
- {name: Data.List.last, within: []} # Partial | ||
- {name: 'Data.List.!!', within: []} # Partial | ||
- {name: Data.List.genericIndex, within: []} # Partial | ||
- {name: Data.List.genericLength, within: []} | ||
|
||
# Same, but for Data.Text | ||
- {name: Data.Text.head, within: []} | ||
- {name: Data.Text.tail, within: []} | ||
- {name: Data.Text.init, within: []} | ||
- {name: Data.Text.last, within: []} | ||
|
||
- {name: minimum, within: []} # Partial | ||
- {name: minimumBy, within: []} # Partial | ||
- {name: maximum, within: []} # Partial | ||
- {name: maximumBy, within: []} # Partial | ||
|
||
# Same, but for Data.Text | ||
- {name: Data.Text.maximum, within: []} | ||
- {name: Data.Text.minimum, within: []} | ||
|
||
- {name: GHC.Enum.pred, within: []} # Partial | ||
- {name: GHC.Enum.succ, within: []} # Partial | ||
- {name: GHC.Enum.toEnum, within: []} # Partial | ||
- {name: GHC.Enum.fromEnum, within: []} # Does not do what you think it does. | ||
- {name: GHC.Enum.enumFrom, within: []} # Does not do what you think it does, depending on the type. | ||
- {name: GHC.Enum.enumFromThen, within: []} # Does not do what you think it does, depending on the type. | ||
- {name: GHC.Enum.enumFromTo, within: []} # Does not do what you think it does, depending on the type. | ||
- {name: GHC.Enum.enumFromThenTo, within: []} # Does not do what you think it does, depending on the type. | ||
|
||
- {name: unless, within: []} # Really confusing, use 'when' instead. | ||
- {name: either, within: []} # Really confusing, just use a case-match. | ||
|
||
- {name: nub, within: [ CLI ]} # O(n^2) | ||
|
||
- {name: Data.Foldable.foldl, within: []} # Lazy accumulator. Use foldl' instead. | ||
- {name: Data.Foldable.foldMap, within: []} # Lazy accumulator. Use foldMap' instead. | ||
- {name: Data.Foldable.sum, within: []} # Lazy accumulator | ||
- {name: Data.Foldable.product, within: []} # Lazy accumulator | ||
|
||
# Functions involving division | ||
- {name: Prelude.quot, within: []} # Partial, see https://github.com/NorfairKing/haskell-WAT#num-int | ||
- {name: Prelude.div, within: []} | ||
- {name: Prelude.rem, within: []} | ||
- {name: Prelude.mod, within: []} | ||
- {name: Prelude.quotRem, within: []} | ||
- {name: Prelude.divMod, within: []} | ||
|
||
# Does unexpected things, see | ||
# https://github.com/NorfairKing/haskell-WAT#real-double | ||
- {name: realToFrac, within: []} | ||
|
||
# Constructs rationals, which is either wrong or a bad idea. | ||
- {name: 'Data.Ratio.%', within: []} | ||
|
||
# Don't use string for command-line output. | ||
- {name: System.IO.putChar, within: []} | ||
- {name: System.IO.putStr, within: []} | ||
- {name: System.IO.putStrLn, within: []} | ||
- {name: System.IO.print, within: []} | ||
|
||
# Don't use string for command-line input either. | ||
- {name: System.IO.getChar, within: []} | ||
- {name: System.IO.getLine, within: []} | ||
- {name: System.IO.getContents, within: []} # Does lazy IO. | ||
- {name: System.IO.interact, within: []} | ||
- {name: System.IO.readIO, within: []} | ||
- {name: System.IO.readLn, within: []} | ||
|
||
# Don't use strings to interact with files | ||
- {name: System.IO.readFile, within: []} | ||
- {name: System.IO.writeFile, within: []} | ||
- {name: System.IO.appendFile, within: []} | ||
|
||
# Can succeed in dev, but fail in prod, because of encoding guessing | ||
# It's also Lazy IO. | ||
# See https://www.snoyman.com/blog/2016/12/beware-of-readfile/ for more info. | ||
- {name: Data.Text.IO.readFile, within: []} | ||
- {name: Data.Text.IO.Lazy.readFile, within: []} | ||
|
||
- {name: Data.Text.Encoding.decodeUtf8, within: []} # Throws on invalid UTF8 | ||
|
||
- {name: fromJust, within: [], message: 'Partial'} # Partial | ||
|
||
# Does silent truncation: | ||
# > fromIntegral (300 :: Word) :: Word8 | ||
# 44 | ||
- {name: fromIntegral, within: []} | ||
- {name: fromInteger, within: []} | ||
|
||
|
||
- {name: 'read', within: []} # Partial, use `Text.Read.readMaybe` instead. | ||
|
||
# Deprecated, use `pure` instead. | ||
# See https://gitlab.haskell.org/ghc/ghc/-/wikis/proposal/monad-of-no-return | ||
- {name: 'return', within: []} | ||
|
||
- modules: | ||
- { name: Control.Lens, within: [] } | ||
|
||
- extensions: | ||
- { name: DeriveAnyClass, within: [] } # Dangerous | ||
|
||
- { name: DuplicateRecordFields, within: [] } | ||
|
||
- { name: NamedFieldPuns, within: [] } | ||
- { name: TupleSections, within: [] } | ||
- { name: OverloadedLabels, within: [] } |
This file contains 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,19 @@ | ||
Copyright (c) 2022 damianfral <[email protected]> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains 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,22 @@ | ||
# Nix flake for a Haskell CLI application | ||
|
||
This flake contains a Nix package and a development shell for a sample Haskell | ||
CLI application called `hello`. | ||
|
||
The Haskell package is wrapped with `generateOptparseApplicativeCompletions`, | ||
which adds shell completion scripts. These scripts will be automatically picked | ||
up if the resulting derivation is installed. | ||
|
||
The development shell provides the following tools for Haskell development: | ||
|
||
- [cabal-install](https://www.haskell.org/cabal/) | ||
- [haskell-language-server](https://github.com/haskell/haskell-language-server) | ||
- [ghcid](https://github.com/ndmitchell/ghcid) | ||
- [pre-commit-hooks.nix](https://github.com/cachix/pre-commit-hooks.nix) | ||
- [actionlint](https://github.com/rhysd/actionlint) | ||
- [hlint](https://github.com/ndmitchell/hlint) | ||
- [hpack](https://github.com/sol/hpack) | ||
- [nil](https://github.com/oxalica/nil) | ||
- [nixpkgs-fmt](https://github.com/nix-community/nixpkgs-fmt) | ||
- [ormolu](https://github.com/tweag/ormolu) | ||
- [statix](https://github.com/nerdypeppercom/jez/statix) |
This file contains 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 @@ | ||
loops: | ||
run: | ||
command: cabal run |
Oops, something went wrong.