bound 0.6.1 → 0.7
raw patch · 12 files changed
+175/−21 lines, 12 filesdep +hashabledep +hashable-extrasPVP ok
version bump matches the API change (PVP)
Dependencies added: hashable, hashable-extras
API changes (from Hackage documentation)
+ Bound.Name: instance Hashable a => Hashable (Name n a)
+ Bound.Name: instance Hashable1 (Name n)
+ Bound.Name: instance Hashable2 Name
+ Bound.Scope: instance (Hashable b, Monad f, Hashable1 f) => Hashable1 (Scope b f)
+ Bound.Scope: instance (Hashable b, Monad f, Hashable1 f, Hashable a) => Hashable (Scope b f a)
+ Bound.Var: instance (Hashable b, Hashable a) => Hashable (Var b a)
+ Bound.Var: instance Hashable b => Hashable1 (Var b)
+ Bound.Var: instance Hashable2 Var
Files
- .ghci +1/−0
- .gitignore +13/−0
- .travis.yml +18/−0
- .vim.custom +31/−0
- CHANGELOG.markdown +14/−0
- README.markdown +4/−4
- bound.cabal +14/−17
- src/Bound/Name.hs +14/−0
- src/Bound/Scope.hs +10/−0
- src/Bound/Var.hs +13/−0
- travis/cabal-apt-install +27/−0
- travis/config +16/−0
+ .ghci view
@@ -0,0 +1,1 @@+:set -isrc -idist/build/autogen -optP-include -optPdist/build/autogen/cabal_macros.h
+ .gitignore view
@@ -0,0 +1,13 @@+dist+docs+wiki+TAGS+tags+wip+.DS_Store+.*.swp+.*.swo+*.o+*.hi+*~+*#
.travis.yml view
@@ -1,4 +1,19 @@ language: haskell+before_install:+ # Uncomment whenever hackage is down.+ # - mkdir -p ~/.cabal && cp travis/config ~/.cabal/config && cabal update+ - cabal update++ # Try installing some of the build-deps with apt-get for speed.+ - travis/cabal-apt-install $mode++install:+ - cabal configure $mode+ - cabal build++script:+ - $script && hlint src --cpp-define HLINT+ notifications: irc: channels:@@ -6,3 +21,6 @@ skip_join: true template: - "\x0313bound\x03/\x0306%{branch}\x03 \x0314%{commit}\x03 %{build_url} %{message}"++env:+ - mode="--enable-tests" script="cabal test --show-details=always"
+ .vim.custom view
@@ -0,0 +1,31 @@+" Add the following to your .vimrc to automatically load this on startup++" if filereadable(".vim.custom")+" so .vim.custom+" endif++function StripTrailingWhitespace()+ let myline=line(".")+ let mycolumn = col(".")+ silent %s/ *$//+ call cursor(myline, mycolumn)+endfunction++" enable syntax highlighting+syntax on++" search for the tags file anywhere between here and /+set tags=TAGS;/++" highlight tabs and trailing spaces+set listchars=tab:‗‗,trail:‗+set list++" f2 runs hasktags+map <F2> :exec ":!hasktags -x -c --ignore src"<CR><CR>++" strip trailing whitespace before saving+" au BufWritePre *.hs,*.markdown silent! cal StripTrailingWhitespace()++" rebuild hasktags after saving+au BufWritePost *.hs silent! :exec ":!hasktags -x -c --ignore src"
CHANGELOG.markdown view
@@ -1,3 +1,17 @@+0.7+---+* Added `Hashable`, `Hashable1` and `Hashable2` instances where appropriate for `Name`, `Var` and `Scope`.++0.6.1+-----+* More aggressive inlining+* Added `unvar`, `_B`, `_F` to `Bound.Var`.+* Added `_Name` to `Bound.Name`.++0.6+---+* Support for `prelude-extras` 0.3+ 0.5.1 ----- * Removed my personal inter-package dependency upper bounds
README.markdown view
@@ -19,10 +19,10 @@ data Exp a = V a | Exp a :@ Exp a | Lam (Scope () Exp a) deriving (Eq,Ord,Show,Read,Functor,Foldable,Traversable) - instance Eq1 Exp where (==#) = (==)- instance Ord1 Exp where compare1 = compare- instance Show1 Exp where showsPrec1 = showsPrec- instance Read1 Exp where readsPrec1 = readsPrec+ instance Eq1 Exp+ instance Ord1 Exp+ instance Show1 Exp+ instance Read1 Exp instance Applicative Exp where pure = V; (<*>) = ap instance Monad Exp where
bound.cabal view
@@ -1,6 +1,6 @@ name: bound category: Language, Compilers/Interpreters-version: 0.6.1+version: 0.7 license: BSD3 cabal-version: >= 1.9.2 license-file: LICENSE@@ -35,10 +35,15 @@ extra-source-files: .travis.yml+ .ghci+ .gitignore+ .vim.custom examples/Simple.hs examples/Deriving.hs examples/Overkill.hs tests/doctests.hs+ travis/cabal-apt-install+ travis/config README.markdown CHANGELOG.markdown @@ -58,26 +63,19 @@ Bound.Var build-depends:- base >= 4 && < 5,- bifunctors >= 3 && < 4,- comonad >= 3 && < 4,- prelude-extras >= 0.3 && < 1,- profunctors >= 3.3 && < 4,- transformers >= 0.2 && < 0.4+ base >= 4 && < 5,+ bifunctors >= 3 && < 4,+ comonad >= 3 && < 4,+ hashable >= 1.1 && < 1.3,+ hashable-extras >= 0.1 && < 1,+ prelude-extras >= 0.3 && < 1,+ profunctors >= 3.3 && < 4,+ transformers >= 0.2 && < 0.4 ghc-options: -Wall -O2 -fspec-constr -fdicts-cheap -funbox-strict-fields if impl(ghc>=7.4) build-depends: ghc-prim --- Stating these, despite being more correct, causes spurious warnings to--- end-users of older Cabal versions, so we don't.---- other-extensions: CPP--- if impl(ghc)--- other-extensions: DeriveDataTypeable--- if impl(ghc>=7.4)--- other-extensions: DeriveGeneric DefaultSignatures- test-suite Simple type: exitcode-stdio-1.0 main-is: Simple.hs@@ -91,7 +89,6 @@ prelude-extras, transformers --- Verify the results of the examples test-suite doctests type: exitcode-stdio-1.0 main-is: doctests.hs
src/Bound/Name.hs view
@@ -55,6 +55,8 @@ import GHC.Generics # endif #endif+import Data.Hashable+import Data.Hashable.Extras import Data.Profunctor import Prelude.Extras @@ -102,6 +104,18 @@ instance Eq b => Eq (Name n b) where Name _ a == Name _ b = a == b {-# INLINE (==) #-}++instance Hashable2 Name where+ hashWithSalt2 m (Name _ a) = hashWithSalt m a+ {-# INLINE hashWithSalt2 #-}++instance Hashable1 (Name n) where+ hashWithSalt1 m (Name _ a) = hashWithSalt m a+ {-# INLINE hashWithSalt1 #-}++instance Hashable a => Hashable (Name n a) where+ hashWithSalt m (Name _ a) = hashWithSalt m a+ {-# INLINE hashWithSalt #-} instance Ord b => Ord (Name n b) where Name _ a `compare` Name _ b = compare a b
src/Bound/Scope.hs view
@@ -50,6 +50,8 @@ import Data.Bifoldable import Data.Bitraversable import Data.Foldable+import Data.Hashable+import Data.Hashable.Extras import Data.Monoid import Data.Traversable import Prelude.Extras@@ -142,6 +144,14 @@ instance Bound (Scope b) where Scope m >>>= f = Scope (liftM (fmap (>>= f)) m) {-# INLINE (>>>=) #-}++instance (Hashable b, Monad f, Hashable1 f) => Hashable1 (Scope b f) where+ hashWithSalt1 n m = hashWithSalt1 n (fromScope m)+ {-# INLINE hashWithSalt1 #-}++instance (Hashable b, Monad f, Hashable1 f, Hashable a) => Hashable (Scope b f a) where+ hashWithSalt n m = hashWithSalt1 n (fromScope m)+ {-# INLINE hashWithSalt #-} ------------------------------------------------------------------------------- -- Abstraction
src/Bound/Var.hs view
@@ -29,6 +29,8 @@ import Data.Foldable import Data.Traversable import Data.Monoid (mempty)+import Data.Hashable+import Data.Hashable.Extras import Data.Bifunctor import Data.Bifoldable import Data.Bitraversable@@ -39,6 +41,7 @@ # endif #endif import Data.Profunctor+import Data.Word import Prelude.Extras ----------------------------------------------------------------------------@@ -67,6 +70,16 @@ # endif #endif )++distinguisher :: Int+distinguisher = fromIntegral $ (maxBound :: Word) `quot` 3++instance Hashable2 Var+instance Hashable b => Hashable1 (Var b)+instance (Hashable b, Hashable a) => Hashable (Var b a) where+ hashWithSalt s (B b) = hashWithSalt s b+ hashWithSalt s (F a) = hashWithSalt s a `hashWithSalt` distinguisher+ {-# INLINE hashWithSalt #-} unvar :: (b -> r) -> (a -> r) -> Var b a -> r unvar f _ (B b) = f b
+ travis/cabal-apt-install view
@@ -0,0 +1,27 @@+#! /bin/bash+set -eu++APT="sudo apt-get -q -y"+CABAL_INSTALL_DEPS="cabal install --only-dependencies --force-reinstall"++$APT update+$APT install dctrl-tools++# Find potential system packages to satisfy cabal dependencies+deps()+{+ local M='^\([^ ]\+\)-[0-9.]\+ (.*$'+ local G=' -o ( -FPackage -X libghc-\L\1\E-dev )'+ local E="$($CABAL_INSTALL_DEPS "$@" --dry-run -v 2> /dev/null \+ | sed -ne "s/$M/$G/p" | sort -u)"+ grep-aptavail -n -sPackage \( -FNone -X None \) $E | sort -u+}++$APT install $(deps "$@") libghc-quickcheck2-dev # QuickCheck is special+$CABAL_INSTALL_DEPS "$@" # Install the rest via Hackage++if ! $APT install hlint ; then+ $APT install $(deps hlint)+ cabal install hlint+fi+
+ travis/config view
@@ -0,0 +1,16 @@+-- This provides a custom ~/.cabal/config file for use when hackage is down that should work on unix+--+-- This is particularly useful for travis-ci to get it to stop complaining+-- about a broken build when everything is still correct on our end.+--+-- This uses Luite Stegeman's mirror of hackage provided by his 'hdiff' site instead+--+-- To enable this, uncomment the before_script in .travis.yml++remote-repo: hdiff.luite.com:http://hdiff.luite.com/packages/archive+remote-repo-cache: ~/.cabal/packages+world-file: ~/.cabal/world+build-summary: ~/.cabal/logs/build.log+remote-build-reporting: anonymous+install-dirs user+install-dirs global