├── assets └── img │ └── nasfwgtd.jpg ├── README.md ├── LICENSE ├── acme-fucks.cabal ├── src └── Acme │ └── Fucks.hs ├── stack.yaml └── .travis.yml /assets/img/nasfwgtd.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Akii/acme-fucks/HEAD/assets/img/nasfwgtd.jpg -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # acme-fucks ![alt tag](https://travis-ci.org/Akii/acme-fucks.svg?branch=master) 2 | 3 | ![Not a single fuck was given that day](/assets/img/nasfwgtd.jpg) 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 2 | Version 2, December 2004 3 | 4 | Copyright (C) 2004 Sam Hocevar 5 | 6 | Everyone is permitted to copy and distribute verbatim or modified 7 | copies of this license document, and changing it is allowed as long 8 | as the name is changed. 9 | 10 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 11 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 12 | 13 | 0. You just DO WHAT THE FUCK YOU WANT TO. 14 | -------------------------------------------------------------------------------- /acme-fucks.cabal: -------------------------------------------------------------------------------- 1 | name: acme-fucks 2 | version: 0.1.0.1 3 | synopsis: 4 | description: Provides the Fucks Monoid 5 | homepage: https://github.com/Akii/acme-fucks#readme 6 | license: PublicDomain 7 | license-file: LICENSE 8 | author: Akii 9 | copyright: 2016 Akii 10 | category: Library 11 | build-type: Simple 12 | tested-with: GHC == 8.0.1, GHC == 8.1.* 13 | cabal-version: >=1.10 14 | 15 | library 16 | hs-source-dirs: src 17 | exposed-modules: Acme.Fucks 18 | build-depends: base >= 4.7 && < 5 19 | default-language: Haskell2010 20 | 21 | source-repository head 22 | type: git 23 | location: https://github.com/Akii/acme-fucks 24 | -------------------------------------------------------------------------------- /src/Acme/Fucks.hs: -------------------------------------------------------------------------------- 1 | module Acme.Fucks 2 | ( Fucks 3 | , Amount 4 | , giveFucks 5 | ) where 6 | 7 | import Control.Monad 8 | 9 | type Amount = Int 10 | 11 | -- | Tells us how many fucks were given that day. 12 | -- We make it a phantom type (parametrized over `f`) because we would like to pretend we're able to give a fuck about anything. 13 | newtype Fucks f = Fucks Amount 14 | 15 | -- | The essence of how many fucks should be given. 16 | -- It first, we don't give a fuck. If at any point, somehow a fuck is given, we make sure to not give a fuck again. 17 | instance Monoid (Fucks f) where 18 | mempty = Fucks 0 19 | mappend _ _ = mempty 20 | 21 | -- | This functor instance makes a ton of sense but is not law-abiding. 22 | -- 23 | -- It makes sense because: regardless how much fuck we give, we're only fooling ourselves. 24 | -- We can't and so, wont, give a single fuck. 25 | -- 26 | -- It is not law-abiding because: 27 | -- Law #1: fmap id = id 28 | -- We notice that applying any transformation, even something like `id`, always results in no fucks given. 29 | -- Law #2: fmap (p . q) = (fmap p) . (fmap q) 30 | -- We don't even have to give this one a fuck because law #1 has been broken. 31 | instance Functor Fucks where 32 | fmap _ _ = mempty 33 | 34 | -- | Provided something that wants to make us give a fuck (raise awareness) in regards to the low amount of fucks given, 35 | -- we ignore the problem and still do not give a fuck. 36 | -- 37 | -- "TODO": Laws 38 | instance Applicative Fucks where 39 | pure = mempty 40 | _ <*> _ = mempty 41 | 42 | -- | No one really gives a fuck about Monads. 43 | -- 44 | -- "TODO": Laws 45 | instance Monad Fucks where 46 | _ >>= _ = mempty 47 | 48 | giveFucks :: Amount -> Maybe (Fucks f) 49 | giveFucks 0 = Just mempty 50 | giveFucks _ = Nothing 51 | -------------------------------------------------------------------------------- /stack.yaml: -------------------------------------------------------------------------------- 1 | # This file was automatically generated by 'stack init' 2 | # 3 | # Some commonly used options have been documented as comments in this file. 4 | # For advanced use and comprehensive documentation of the format, please see: 5 | # http://docs.haskellstack.org/en/stable/yaml_configuration/ 6 | 7 | # Resolver to choose a 'specific' stackage snapshot or a compiler version. 8 | # A snapshot resolver dictates the compiler version and the set of packages 9 | # to be used for project dependencies. For example: 10 | # 11 | # resolver: lts-3.5 12 | # resolver: nightly-2015-09-21 13 | # resolver: ghc-7.10.2 14 | # resolver: ghcjs-0.1.0_ghc-7.10.2 15 | # resolver: 16 | # name: custom-snapshot 17 | # location: "./custom-snapshot.yaml" 18 | resolver: lts-7.14 19 | 20 | # User packages to be built. 21 | # Various formats can be used as shown in the example below. 22 | # 23 | # packages: 24 | # - some-directory 25 | # - https://example.com/foo/bar/baz-0.0.2.tar.gz 26 | # - location: 27 | # git: https://github.com/commercialhaskell/stack.git 28 | # commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a 29 | # - location: https://github.com/commercialhaskell/stack/commit/e7b331f14bcffb8367cd58fbfc8b40ec7642100a 30 | # extra-dep: true 31 | # subdirs: 32 | # - auto-update 33 | # - wai 34 | # 35 | # A package marked 'extra-dep: true' will only be built if demanded by a 36 | # non-dependency (i.e. a user package), and its test suites and benchmarks 37 | # will not be run. This is useful for tweaking upstream packages. 38 | packages: 39 | - '.' 40 | # Dependency packages to be pulled from upstream that are not in the resolver 41 | # (e.g., acme-missiles-0.3) 42 | extra-deps: [] 43 | 44 | # Override default flag values for local packages and extra-deps 45 | flags: {} 46 | 47 | # Extra package databases containing global packages 48 | extra-package-dbs: [] 49 | 50 | # Control whether we use the GHC we find on the path 51 | # system-ghc: true 52 | # 53 | # Require a specific version of stack, using version ranges 54 | # require-stack-version: -any # Default 55 | # require-stack-version: ">=1.2" 56 | # 57 | # Override the architecture used by stack, especially useful on Windows 58 | # arch: i386 59 | # arch: x86_64 60 | # 61 | # Extra directories used by stack for building 62 | # extra-include-dirs: [/path/to/dir] 63 | # extra-lib-dirs: [/path/to/dir] 64 | # 65 | # Allow a newer minor version of GHC than the snapshot specifies 66 | # compiler-check: newer-minor -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # This file has been generated -- see https://github.com/hvr/multi-ghc-travis 2 | language: c 3 | sudo: false 4 | 5 | cache: 6 | directories: 7 | - $HOME/.cabsnap 8 | - $HOME/.cabal/packages 9 | 10 | before_cache: 11 | - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log 12 | - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.tar 13 | 14 | matrix: 15 | include: 16 | - env: CABALVER=1.24 GHCVER=8.0.1 17 | compiler: ": #GHC 8.0.1" 18 | addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.1], sources: [hvr-ghc]}} 19 | - env: CABALVER=head GHCVER=head 20 | compiler: ": #GHC head" 21 | addons: {apt: {packages: [cabal-install-head,ghc-head], sources: [hvr-ghc]}} 22 | 23 | allow_failures: 24 | - env: CABALVER=head GHCVER=head 25 | 26 | before_install: 27 | - unset CC 28 | - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH 29 | 30 | install: 31 | - cabal --version 32 | - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]" 33 | - if [ -f $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz ]; 34 | then 35 | zcat $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz > 36 | $HOME/.cabal/packages/hackage.haskell.org/00-index.tar; 37 | fi 38 | - travis_retry cabal update -v 39 | - sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config 40 | - cabal install --only-dependencies --enable-tests --enable-benchmarks --dry -v > installplan.txt 41 | - sed -i -e '1,/^Resolving /d' installplan.txt; cat installplan.txt 42 | 43 | # check whether current requested install-plan matches cached package-db snapshot 44 | - if diff -u installplan.txt $HOME/.cabsnap/installplan.txt; 45 | then 46 | echo "cabal build-cache HIT"; 47 | rm -rfv .ghc; 48 | cp -a $HOME/.cabsnap/ghc $HOME/.ghc; 49 | cp -a $HOME/.cabsnap/lib $HOME/.cabsnap/share $HOME/.cabsnap/bin $HOME/.cabal/; 50 | else 51 | echo "cabal build-cache MISS"; 52 | rm -rf $HOME/.cabsnap; 53 | mkdir -p $HOME/.ghc $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin; 54 | cabal install --only-dependencies --enable-tests --enable-benchmarks; 55 | fi 56 | 57 | # snapshot package-db on cache miss 58 | - if [ ! -d $HOME/.cabsnap ]; 59 | then 60 | echo "snapshotting package-db to build-cache"; 61 | mkdir $HOME/.cabsnap; 62 | cp -a $HOME/.ghc $HOME/.cabsnap/ghc; 63 | cp -a $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin installplan.txt $HOME/.cabsnap/; 64 | fi 65 | 66 | # Here starts the actual work to be performed for the package under test; 67 | # any command which exits with a non-zero exit code causes the build to fail. 68 | script: 69 | - if [ -f configure.ac ]; then autoreconf -i; fi 70 | - cabal configure --enable-tests --enable-benchmarks -v2 # -v2 provides useful information for debugging 71 | - cabal build # this builds all libraries and executables (including tests/benchmarks) 72 | - cabal test 73 | # - cabal check 74 | - cabal sdist # tests that a source-distribution can be generated 75 | 76 | # Check that the resulting source distribution can be built & installed. 77 | # If there are no other `.tar.gz` files in `dist`, this can be even simpler: 78 | # `cabal install --force-reinstalls dist/*-*.tar.gz` 79 | - SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz && 80 | (cd dist && cabal install --force-reinstalls "$SRC_TGZ") 81 | 82 | # EOF 83 | --------------------------------------------------------------------------------