Skip to content

Instantly share code, notes, and snippets.

View sevanspowell's full-sized avatar

Samuel Bennett (Evans-Powell) sevanspowell

  • Australia
View GitHub Profile
@sevanspowell
sevanspowell / !cloudsmith-cli.nix
Last active July 2, 2020 05:19
Cloudsmith-cli pypi2nix
let
pkgs = import <nixpkgs> {};
python = import ./requirements.nix { inherit pkgs; };
in
python.mkDerivation rec {
pname = "cloudsmith-cli";
version = "0.22.2";
format = "wheel";
@sevanspowell
sevanspowell / BuildDependsIssue.hs
Last active April 2, 2020 03:45
Demonstrating missing buildInputs issue in Nixpkgs 20.03
module Main where
main :: IO ()
main = putStrLn "Hello, Haskell!"

Keybase proof

I hereby claim:

  • I am sevanspowell on github.
  • I am sevanspowell (https://keybase.io/sevanspowell) on keybase.
  • I have a public key ASAaO170tDIXDAN2Trvf5P4Rkh5c6QaN0y4Axrg-fq_rIAo

To claim this, I am signing this object:

x :: (MonadReader r m
, HasLogger r
, LoggerF r ~ m
, HasOther r
, OtherF r ~ m
, ...
)
x = undefined
@sevanspowell
sevanspowell / TypeFamily.hs
Created September 12, 2019 03:52
Haskell TypeFamilies confusion
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FunctionalDependencies #-}
type Logger m = Severity -> String -> m ()
-- Fundep
class HasLoggerFundep r m | r -> m where
loggerLFundep :: Lens' r (Logger m)
@sevanspowell
sevanspowell / WrappingFail.hs
Last active July 2, 2019 07:27
WrappingFail
data WrapperError = WrappingS3Error Jaws.S3Error
makeClassyPrisms ''WrapperError
instance Jaws.AsS3Error WrapperError where
_S3Error = _WrappingS3Error
data Lookup m a = Lookup (m a)
inner
:: ( AWS.MonadAWS m
@sevanspowell
sevanspowell / Wrapping.hs
Created July 2, 2019 06:57
Wrapping prismatic errors
data WrapperError = WrappingS3Error S3Error
makeClassyPrisms ''WrapperError
instance AsS3Error WrapperError where
_S3Error = _WrappingS3Error
inner
:: ( AWS.MonadAWS m
, MonadError e m
, AsS3Error e
@sevanspowell
sevanspowell / plfa.github.io\nixpkgs.json
Last active October 13, 2022 01:51
Agda NixOS Hacky Setup - Put these in appropriate dirs, cd to plfa dir and nix-shell, launch emacs from there. Thanks Brian McKenna and Isaac Elliot.
{
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "eabe7b845f867e696f8a11be04d47520b3ff4660",
"sha256": "068qbrp2fvpn437hwg932hm0pav2m10sj7v0kcj3wp8hsvsv088w"
}
@sevanspowell
sevanspowell / AsyncExc.hs
Created April 30, 2019 03:14
Asynchronous Exceptions
withFileSystem basePath fs = ContT $ \action -> bracket
(liftIO $ do
createDirectoryIfMissing True basePath
instantiateFs basePath fs
)
(\_ -> uninterruptibleMask $ \_ -> do
liftIO $ removeDirectoryRecursiveIfExists basePath
)
action
@sevanspowell
sevanspowell / AsyncExc.hs
Created April 30, 2019 03:14
Asynchronous Exceptions
withFileSystem basePath fs = ContT $ \action -> bracket
(liftIO $ do
createDirectoryIfMissing True basePath
instantiateFs basePath fs
)
(\_ -> uninterruptibleMask $ \_ -> do
liftIO $ removeDirectoryRecursiveIfExists basePath
)
action