Skip to content

Instantly share code, notes, and snippets.

View chessai's full-sized avatar

chessai chessai

View GitHub Profile
type Message = ([String],String)
parse :: Monad m
=> AB.Parser a
-> Stream (Of ByteString) m r
-> m (Either a Message, Stream (Of ByteString) m r)
parse parser bs = do
(e,rest) <- apply parser bs
pure (either Right Left e, rest)
#include <iostream>
#define yeet int
#define Yeet main
#define yEet std
#define yeEt cout
#define yeeT return
#define Yeeet (
#define yeeeT )
#define Yeeeet {
xrandr --output eDP-1 --fb 1280x720 --mode 1920x1080 --scale-from 1280x720 --output HDMI-1 --scale 1x1 --mode 1280x720 --same-as eDP-1
@chessai
chessai / conv.hs
Created October 4, 2019 13:48
bytearray <===> bytestring
-- | Like 'unsafeByteArrayToByteString', but might perform a copy
-- if the 'ByteArray' is not pinned.
byteArrayToByteString :: ByteArray -> ByteString
byteArrayToByteString b@(ByteArray b#)
| isTrue# (isByteArrayPinned# b#) = unsafeByteArrayToByteString b
| otherwise = runST $ do
let len = sizeofByteArray b
marr@(MutableByteArray marr#) <- newPinnedByteArray len
copyByteArray marr 0 b 0 len
/nix/store/yhlyxjn0s57g0y18gnmak9fj33ynff5h-ghc-8.6.5-with-packages/lib/ghc-8.6.5/package.conf.d
Cabal-2.4.0.1
HUnit-1.6.0.0
QuickCheck-2.12.6.1
RSA-2.3.1
SHA-1.6.4.4
StateVar-1.1.1.1
adjunctions-4.4
aeson-1.4.4.0
ansi-terminal-0.9.1
@chessai
chessai / regex.hs
Created November 8, 2019 02:24
regex
data Regex t
= RegexLiteral t t
--^ low and high, inclusive
| RegexEmpty
| RegexRejection
| RegexUnion (Regex t) (Regex t)
| RegexAppend (Regex t) (Regex t)
| RegexStar (Regex t)
instance Semiring (Regex t) where

Programmer: Atlanta, GA, No Remote, Full-Time

Layer 3 Communications is a professional services organization and network systems integrator. We use Haskell to build network security applications that revolve around either analyzing network data or configuring networks.

Networking knowledge can be learned on the job, and thus is not required.

Our stack:

  • Backend: Haskell
  • Frontend: Small amounts of JavaScript
  • Database: Postgres
@chessai
chessai / haskell.hs
Created January 15, 2020 03:12
Swift typegen
data M (a :: k) = MkM
getShwifty ''M
data OneTyVar a = OneTyVar
{ one :: Either (Maybe a) (Maybe a)
, two :: Maybe (Maybe (Maybe (Maybe a)))
}
getShwifty ''OneTyVar
data K a = K { getK :: a, getInt :: Int }
{-# language QuasiQuotes #-}
import Examples.Sudoku
import Text.RawString.QQ (r)
-- | The world's hardest sudoku problem, with only 4 starting numbers.
-- Found here: youtube.com/watch?v=hAyZ9K2EBF0
ultimateProblem :: String
ultimateProblem = [r|
.........
//swiftlint:disable line_length type_name
//
// DO NOT EDIT THIS FILE
// IT HAS BEEN AUTOMATICALLY GENERATED
// BY THE FOLLOWING CODE: https://github.com/MercuryTechnologies/mercury-web-backend
// AT TIME: 2021-01-25T19:56:58 UTC
//
import Foundation