Skip to content

Commit

Permalink
Merge pull request #1 from nao1215/nchika/project-setup
Browse files Browse the repository at this point in the history
Add project settings
  • Loading branch information
nao1215 authored Jan 14, 2025
2 parents ecf130a + 96a67fc commit 54cb230
Show file tree
Hide file tree
Showing 11 changed files with 174 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: nao1215
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
45 changes: 45 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Test

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

permissions:
contents: read

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
ghc: ["9.8", "9.6"]

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Haskell
uses: haskell-actions/setup@v2
with:
ghc-version: ${{ matrix.ghc }}
enable-stack: true
stack-version: 'latest'

- name: Cache Stack dependencies
uses: actions/cache@v4
with:
path: ~/.stack
key: ${{ runner.os }}-stack-${{ matrix.ghc }}-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('stack.yaml') }}
restore-keys: |
${{ runner.os }}-stack-${{ matrix.ghc }}-
${{ runner.os }}-stack-
- name: Install dependencies
run: stack build --only-dependencies

- name: Build and Test
run: stack test
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Changelog for `clockwork-base32`

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to the
[Haskell Package Versioning Policy](https://pvp.haskell.org/).

## Unreleased

## 0.1.0.0 - YYYY-MM-DD
29 changes: 28 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,29 @@
# clockwork-base32
Clockwork-Base32 in Haskell

Clockwork Base32 is a simple variant of Base32 inspired by Crockford's Base32. See [Clockwork Base32 Specification](https://gist.github.com/szktty/228f85794e4187882a77734c89c384a8).

## Usage

```haskell
-- TODO: Write usage examples here
```

## Other Implementations

### Reference Implementations

- C: [szktty/c-clockwork-base32](https://github.com/szktty/c-clockwork-base32)
- Erlang: [shiguredo/erlang-base32](https://github.com/shiguredo/base32_clockwork)
- Go: [szktty/go-clockwork-base32](https://github.com/szktty/go-clockwork-base32)
- Swift: [szktty/swift-clockwork-base32](https://github.com/szktty/swift-clockwork-base32)

### Third-party Implementations

- C++: [wx257osn2/clockwork_base32_cxx](https://github.com/wx257osn2/clockwork_base32_cxx)
- C++: [objectx/cpp-clockwork-base32](https://github.com/mganeko/js_clockwork_base32)
- JavaScript: [mganeko/js_clockwork_base32](https://github.com/mganeko/js_clockwork_base32)
- AssemblyScript: [mganeko/as_clockwork_base32](https://github.com/mganeko/as_clockwork_base32)
- Rust: [woxtu/rust-clockwork-base32](https://github.com/woxtu/rust-clockwork-base32)
- Rust: [hnakamur/rs-clockwork-base32](https://github.com/hnakamur/rs-clockwork-base32)
- Go: [shogo82148/go-clockwork-base32](https://github.com/shogo82148/go-clockwork-base32)
- TypeScript: [niyari/base32-ts](https://github.com/niyari/base32-ts)
2 changes: 2 additions & 0 deletions Setup.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import Distribution.Simple
main = defaultMain
43 changes: 43 additions & 0 deletions clockwork-base32.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
cabal-version: 2.2

name: clockwork-base32
version: 0.1.0.0
-- synopsis:
-- description:
homepage: https://github.com/nao1215/clockwork-base32#readme
license: MIT
license-file: LICENSE
author: Naohiro CHIKAMATSU
maintainer: [email protected]
copyright: 2025 Naohiro CHIKAMATSU
category: Web
build-type: Simple
extra-source-files: README.md
CHANGELOG.md

library
exposed-modules: ClockworkBase32
hs-source-dirs: src
build-depends: base >= 4.7 && < 5,
bytestring,
containers
default-language: Haskell2010
ghc-options: -Wall
-Wcompat
-Widentities
-Wincomplete-record-updates
-Wincomplete-uni-patterns
-Wmissing-export-lists
-Wmissing-home-modules
-Wpartial-fields
-Wredundant-constraints

test-suite clockwork-base32-test
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: Spec.hs
build-depends: base >= 4.7 && < 5,
hspec,
clockwork-base32,
bytestring
default-language: Haskell2010
8 changes: 8 additions & 0 deletions src/ClockworkBase32.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module ClockworkBase32
( maxInList
) where

-- returns the maximum element in a list, if it exists
maxInList :: (Ord a) => [a] -> Maybe a
maxInList [] = Nothing
maxInList xs = Just (maximum xs)
3 changes: 3 additions & 0 deletions stack.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
snapshot: lts-23.4
packages:
- .
12 changes: 12 additions & 0 deletions stack.yaml.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This file was autogenerated by Stack.
# You should not edit this file by hand.
# For more information, please see the documentation at:
# https://docs.haskellstack.org/en/stable/topics/lock_files

packages: []
snapshots:
- completed:
sha256: 0d61fd2be255f5c425cd92dbb4a78d1f70af2c138f3ec921e98b97ae182b044c
size: 679291
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/23/4.yaml
original: lts-23.4
14 changes: 14 additions & 0 deletions test/Spec.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module Main (main) where

import ClockworkBase32 (maxInList)
import Test.Hspec


main :: IO ()
main = hspec $ do
describe "maxInList" $ do
it "returns Nothing for an empty list" $ do
maxInList ([] :: [Int]) `shouldBe` Nothing

it "returns the maximum element for a non-empty list" $ do
maxInList ([1, 2, 3] :: [Int]) `shouldBe` Just 3

0 comments on commit 54cb230

Please sign in to comment.