Skip to content

Instantly share code, notes, and snippets.

View NorfairKing's full-sized avatar
🎯
Focusing

Tom Sydney Kerckhove NorfairKing

🎯
Focusing
View GitHub Profile
@NorfairKing
NorfairKing / TH.hs
Last active November 17, 2015 16:30
Template Haskell Errors
module TH where
import Language.Haskell.TH
precompute :: [Int] -> DecsQ
precompute xs = do
let name = mkName "lookupTable"
patterns = map intToPat xs
fnBodies = map precomputeInteger xs
precomputedClauses =
module Problem where
bigBadMathProblem :: Integer -> Integer
bigBadMathProblem = (* 5)
newtype Deprecated a b = Deprecated { undeprecate :: a -> b }
(💩 ) :: Deprecated a b -> a -> b
(💩 ) = undeprecate
myDeprecatedFunction :: Deprecated Int Int
myDeprecatedFunction = Deprecated myFunction
where
myFunction :: Int -> Int
@NorfairKing
NorfairKing / Thoughts
Created April 19, 2018 12:15
Thoughts about Algebra for QA
I've been thinking about where one would get started to find problems in code.
Ideally I'd come up with some mathematical properties to spot that would be
likely to indicate that bugs are more common.
Part 1: Possible implementations
One idea I've had stems from algebra. It starts with the concept of cardinality.
Out of all possible implementations of a solution to a certain problem, there
are only few of them that correctly solve the problem.
resolver: lts-11.13
packages:
- .
# https://github.com/NorfairKing/validity/tree/development
extra-deps:
- git: git@github.com:NorfairKing/validity.git
commit: 4de0a0eff895ee2dc7f0bc17cf65d3acb0a0cd5a
subdirs:
02/12 15:38:50: Launching app
$ adb shell am start -n "eu.cs_syd.intray/eu.cs_syd.intray.android.ui.activity.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Client not ready yet..Waiting for process to come online
Connected to process 18258 on device ulefone-power_3s-0123456789ABCDEF
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
W/System: ClassLoader referenced unknown path: /data/app/eu.cs_syd.intray-1/lib/arm64
I/art: Starting a blocking GC HeapTrim
I/InstantRun: starting instant run server: is main process
W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
V/PhoneWindow: D
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE FlexibleInstances #-}
module Lib where
import Control.Monad
import Data.Function
import Data.List
## Preliminary data:
Upgrades to validity: be40c0a0b0bf6a1d58f4a6a5c6770c4a544c4450
- better generators for
- Int, Int8, Int16, Int32, Int64
- Word, Word8, Word16, Word32, Word64
- Float, Double
- Integer, Natural
( someFunc,
)
where
import qualified Data.Aeson as JSON
import qualified Data.Yaml as Yaml
import qualified Env
import Options.Applicative
import Text.Read
import qualified YamlParse.Applicative as YamlParse
@NorfairKing
NorfairKing / orjson.nix
Created April 20, 2021 11:30 — forked from glittershark/orjson.nix
Horrible, hacky packaging of orjson with Nix
{ fetchFromGitHub
, python
, maturin
, arrow
, dataclasses
, numpy
, pendulum
, psutil
, pytest
, pytz