Skip to content

Commit

Permalink
Prepare 0.1.0.0 release.
Browse files Browse the repository at this point in the history
Reformatted.
Use new .github workflows.
Removed unused deps.
Updated package metadata.
  • Loading branch information
brianjosephmckeon authored Feb 14, 2024
1 parent 880a560 commit 1b80983
Show file tree
Hide file tree
Showing 12 changed files with 488 additions and 344 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@byteverse/l3c
11 changes: 11 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: build
on:
pull_request:
branches:
- "*"

jobs:
call-workflow:
uses: byteverse/.github/.github/workflows/build-matrix.yaml@main
with:
cabal-file: syslog.cabal
10 changes: 10 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: release
on:
push:
tags:
- "*"

jobs:
call-workflow:
uses: byteverse/.github/.github/workflows/release.yaml@main
secrets: inherit
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.vscode/
dist
dist-*
cabal-dev
Expand Down
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Revision history for syslog

## 0.1.0.0 -- YYYY-mm-dd
## 0.1.0.0 -- 2024-02-14

* First version. Released on an unsuspecting world.
* First version.
2 changes: 0 additions & 2 deletions Setup.hs

This file was deleted.

37 changes: 19 additions & 18 deletions examples/validate.hs
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
{-# language BangPatterns #-}
{-# language LambdaCase #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE LambdaCase #-}

import Data.Primitive (ByteArray)
import Data.ByteString (ByteString)
import Data.Bool (bool)
import Control.Exception
import System.IO.Error (isEOFError)
import Data.Bool (bool)
import Data.ByteString (ByteString)
import Data.Primitive (ByteArray)
import Foreign.C.Types (CChar)
import System.IO.Error (isEOFError)

import qualified Data.Primitive as PM
import qualified Data.Primitive.Ptr as PM
import qualified Data.ByteString as ByteString
import qualified Data.Bytes as Bytes
import qualified Data.Primitive as PM
import qualified Data.Primitive.Ptr as PM
import qualified Syslog.Bsd as Bsd

main :: IO ()
main = do
let go !ix = catchJust (bool Nothing (Just ()) . isEOFError) (Just <$> ByteString.getLine) (\() -> pure Nothing) >>= \case
Nothing -> pure ()
Just b0 -> do
b1 <- b2b b0
case Bsd.decode (Bytes.fromByteArray b1) of
Nothing -> fail $ "Decode failure on line " ++ show ix
Just r -> do
print r
go (ix + 1)
let go !ix =
catchJust (bool Nothing (Just ()) . isEOFError) (Just <$> ByteString.getLine) (\() -> pure Nothing) >>= \case
Nothing -> pure ()
Just b0 -> do
b1 <- b2b b0
case Bsd.decode (Bytes.fromByteArray b1) of
Nothing -> fail $ "Decode failure on line " ++ show ix
Just r -> do
print r
go (ix + 1)
go 0

b2b :: ByteString -> IO ByteArray
b2b !b = ByteString.useAsCStringLen b $ \(ptr,len) -> do
b2b !b = ByteString.useAsCStringLen b $ \(ptr, len) -> do
arr <- PM.newByteArray len
PM.copyPtrToMutablePrimArray (castArray arr) 0 ptr len
PM.unsafeFreezeByteArray arr
Expand Down
51 changes: 51 additions & 0 deletions fourmolu.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Number of spaces per indentation step
indentation: 2

# Max line length for automatic line breaking
column-limit: 200

# Styling of arrows in type signatures (choices: trailing, leading, or leading-args)
function-arrows: trailing

# How to place commas in multi-line lists, records, etc. (choices: leading or trailing)
comma-style: leading

# Styling of import/export lists (choices: leading, trailing, or diff-friendly)
import-export-style: leading

# Whether to full-indent or half-indent 'where' bindings past the preceding body
indent-wheres: false

# Whether to leave a space before an opening record brace
record-brace-space: true

# Number of spaces between top-level declarations
newlines-between-decls: 1

# How to print Haddock comments (choices: single-line, multi-line, or multi-line-compact)
haddock-style: multi-line

# How to print module docstring
haddock-style-module: null

# Styling of let blocks (choices: auto, inline, newline, or mixed)
let-style: auto

# How to align the 'in' keyword with respect to the 'let' keyword (choices: left-align, right-align, or no-space)
in-style: right-align

# Whether to put parentheses around a single constraint (choices: auto, always, or never)
single-constraint-parens: always

# Output Unicode syntax (choices: detect, always, or never)
unicode: never

# Give the programmer more choice on where to insert blank lines
respectful: true

# Fixity information for operators
fixities: []

# Module reexports Fourmolu should know about
reexports: []

Loading

0 comments on commit 1b80983

Please sign in to comment.