unification-fd 0.8.0 → 0.8.1
raw patch · 14 files changed
+68/−27 lines, 14 filesdep ~basePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base
API changes (from Hackage documentation)
+ Control.Unification.Types: instance Foldable t => Foldable (UnificationFailure t)
+ Control.Unification.Types: instance Functor t => Functor (UnificationFailure t)
+ Control.Unification.Types: instance Traversable t => Traversable (UnificationFailure t)
- Control.Unification: UTerm :: !t (UTerm t v) -> UTerm t v
+ Control.Unification: UTerm :: !(t (UTerm t v)) -> UTerm t v
- Control.Unification.Types: Rank :: {-# UNPACK #-} !Word8 -> !Maybe (UTerm t v) -> Rank t v
+ Control.Unification.Types: Rank :: {-# UNPACK #-} !Word8 -> !(Maybe (UTerm t v)) -> Rank t v
- Control.Unification.Types: UTerm :: !t (UTerm t v) -> UTerm t v
+ Control.Unification.Types: UTerm :: !(t (UTerm t v)) -> UTerm t v
Files
- AUTHORS +4/−2
- LICENSE +1/−1
- README +5/−3
- VERSION +3/−1
- src/Control/Monad/State/UnificationExtras.hs +1/−1
- src/Control/Unification.hs +4/−4
- src/Control/Unification/IntVar.hs +1/−1
- src/Control/Unification/Ranked.hs +1/−1
- src/Control/Unification/Ranked/IntVar.hs +1/−1
- src/Control/Unification/Ranked/STVar.hs +1/−1
- src/Control/Unification/STVar.hs +1/−1
- src/Control/Unification/Types.hs +23/−2
- src/Data/Functor/Fixedpoint.hs +15/−4
- unification-fd.cabal +7/−4
AUTHORS view
@@ -1,6 +1,6 @@ === Haskell unification-fd package AUTHORS/THANKS file === -The unification-fd package was written by wren ng thornton and is+The unification-fd package was written by wren gayle romano and is released under the terms in the LICENSE file. @@ -18,10 +18,12 @@ suggsting the switch to having variables be of kind * rather than *->* -Roman Cheplyaka -- for suggesting the switching of type parameter+Roman Cheplyaka --- for suggesting the switching of type parameter order on UTerm so that it actually is the free monad. And for providing the freshenAll implementation. +Graham Rogers --- for suggesting the addition of Functor, Foldable,+ and Traversable instances for UnificationFailure. === Related Work ===
LICENSE view
@@ -10,7 +10,7 @@ === unification-fd license === -Copyright (c) 2007, 2008, 2011, 2012, wren ng thornton.+Copyright (c) 2007, 2008, 2011, 2012, 2013, 2014, wren gayle romano. ALL RIGHTS RESERVED. Redistribution and use in source and binary forms, with or without
README view
@@ -17,10 +17,12 @@ $> runhaskell Setup.hs build $> runhaskell Setup.hs test $> runhaskell Setup.hs haddock --hyperlink-source- $> runhaskell Setup.hs install+ $> runhaskell Setup.hs copy+ $> runhaskell Setup.hs register -The test step is optional and currently does nothing. If you see-some stray lines that look like this:+The test step is optional and currently does nothing. The Haddock+step is also optional. If you see some stray lines that look like+this: mkUsageInfo: internal name? t{tv a7XM}
VERSION view
@@ -1,4 +1,6 @@-0.8.0 (2012-00-00):+0.8.1 (2014-05-27):+ - Control.Unification.Types: added Functor, Foldable, and Traversable instances for UnificationFailure. (h/t Graham Rogers)+0.8.0 (2012-07-11): - Control.Unification.Types: Changed the type of Unifiable.zipMatch 0.7.0 (2012-03-19): - Renamed MutTerm to UTerm (and MutVar to UVar)
src/Control/Monad/State/UnificationExtras.hs view
@@ -4,7 +4,7 @@ -- ~ 2011.07.05 -- | -- Module : Control.Monad.State.UnificationExtras--- Copyright : Copyright (c) 2008--2012 wren ng thornton+-- Copyright : Copyright (c) 2008--2014 wren gayle romano -- License : BSD -- Maintainer : wren@community.haskell.org -- Stability : perpetually unstable
src/Control/Unification.hs view
@@ -4,7 +4,7 @@ -- ~ 2012.03.25 -- | -- Module : Control.Unification--- Copyright : Copyright (c) 2007--2012 wren ng thornton+-- Copyright : Copyright (c) 2007--2014 wren gayle romano -- License : BSD -- Maintainer : wren@community.haskell.org -- Stability : experimental@@ -64,7 +64,7 @@ , getFreeVarsAll , applyBindingsAll , freshenAll- -- subsumesAll -- to ensure that there's a single coherent substitution allowing the schema to subsume all the terms in some collection. + -- subsumesAll -- to ensure that there's a single coherent substitution allowing the schema to subsume all the terms in some collection. -- * Helper functions -- | Client code should not need to use these functions, but@@ -129,7 +129,7 @@ mb <- lookupVar v0 case mb of Nothing -> return t0- Just t -> + Just t -> case t of UTerm _ -> return t0 UVar v -> do@@ -212,7 +212,7 @@ where -- TODO: is that the most efficient direction/associativity? loopAll = foldrM (\t r -> IM.union r <$> loop t) IM.empty- + loop t0 = do t0 <- lift $ semiprune t0 case t0 of
src/Control/Unification/IntVar.hs view
@@ -7,7 +7,7 @@ -- ~ 2012.03.18 -- | -- Module : Control.Unification.IntVar--- Copyright : Copyright (c) 2007--2012 wren ng thornton+-- Copyright : Copyright (c) 2007--2014 wren gayle romano -- License : BSD -- Maintainer : wren@community.haskell.org -- Stability : experimental
src/Control/Unification/Ranked.hs view
@@ -4,7 +4,7 @@ -- ~ 2012.03.25 -- | -- Module : Control.Unification.Ranked--- Copyright : Copyright (c) 2007--2012 wren ng thornton+-- Copyright : Copyright (c) 2007--2014 wren gayle romano -- License : BSD -- Maintainer : wren@community.haskell.org -- Stability : highly experimental
src/Control/Unification/Ranked/IntVar.hs view
@@ -7,7 +7,7 @@ -- ~ 2012.03.18 -- | -- Module : Control.Unification.Ranked.IntVar--- Copyright : Copyright (c) 2007--2012 wren ng thornton+-- Copyright : Copyright (c) 2007--2014 wren gayle romano -- License : BSD -- Maintainer : wren@community.haskell.org -- Stability : highly experimental
src/Control/Unification/Ranked/STVar.hs view
@@ -8,7 +8,7 @@ -- ~ 2012.03.18 -- | -- Module : Control.Unification.Ranked.STVar--- Copyright : Copyright (c) 2007--2012 wren ng thornton+-- Copyright : Copyright (c) 2007--2014 wren gayle romano -- License : BSD -- Maintainer : wren@community.haskell.org -- Stability : highly experimental
src/Control/Unification/STVar.hs view
@@ -8,7 +8,7 @@ -- ~ 2012.03.18 -- | -- Module : Control.Unification.STVar--- Copyright : Copyright (c) 2007--2012 wren ng thornton+-- Copyright : Copyright (c) 2007--2014 wren gayle romano -- License : BSD -- Maintainer : wren@community.haskell.org -- Stability : experimental
src/Control/Unification/Types.hs view
@@ -5,10 +5,10 @@ {-# OPTIONS_GHC -Wall -fwarn-tabs #-} ------------------------------------------------------------------- ~ 2012.03.25+-- ~ 2014.05.27 -- | -- Module : Control.Unification.Types--- Copyright : Copyright (c) 2007--2012 wren ng thornton+-- Copyright : Copyright (c) 2007--2014 wren gayle romano -- License : BSD -- Maintainer : wren@community.haskell.org -- Stability : experimental@@ -38,6 +38,7 @@ import Data.Word (Word8) import Data.Functor.Fixedpoint (Fix(..))+import Data.Monoid (Monoid(..), (<>)) import Data.Foldable (Foldable(..)) import Data.Traversable (Traversable(..)) import Control.Applicative (Applicative(..), (<$>), Alternative(..))@@ -136,6 +137,8 @@ -- could be given more accurate types if we used ad-hoc combinations -- of these constructors (i.e., because they can only throw one of -- the errors), the extra complexity is not considered worth it.+--+-- /Updated: 0.8.1/ added 'Functor', 'Foldable', and 'Traversable' instances. data UnificationFailure t v = OccursIn v (UTerm t v)@@ -196,6 +199,24 @@ instance Error (UnificationFailure t v) where noMsg = UnknownError "" strMsg = UnknownError+++instance (Functor t) => Functor (UnificationFailure t) where+ fmap f (OccursIn v t) = OccursIn (f v) (fmap f t)+ fmap f (TermMismatch tl tr) = TermMismatch (fmap f <$> tl) (fmap f <$> tr)+ fmap _ (UnknownError msg) = UnknownError msg++instance (Foldable t) => Foldable (UnificationFailure t) where+ foldMap f (OccursIn v t) = f v <> foldMap f t+ foldMap f (TermMismatch tl tr) = foldMap (foldMap f) tl+ <> foldMap (foldMap f) tr+ foldMap _ (UnknownError _) = mempty++instance (Traversable t) => Traversable (UnificationFailure t) where+ traverse f (OccursIn v t) = OccursIn <$> f v <*> traverse f t+ traverse f (TermMismatch tl tr) = TermMismatch <$> traverse (traverse f) tl + <*> traverse (traverse f) tr+ traverse _ (UnknownError msg) = pure (UnknownError msg) ----------------------------------------------------------------
src/Data/Functor/Fixedpoint.hs view
@@ -2,15 +2,26 @@ {-# LANGUAGE UndecidableInstances #-} -- For 'build' and 'hmap' {-# LANGUAGE Rank2Types #-}--- To parse rules. The language extension is for hackery in rules.-{-# OPTIONS_GHC -O2 -fglasgow-exts #-} +-- Unfortunately GHC < 6.10 needs -fglasgow-exts in order to actually+-- parse RULES (see -ddump-rules); the -frewrite-rules flag only+-- enables the application of rules, instead of doing what we want.+-- Apparently this is fixed in 6.10. In newer GHC (e.g., 7.6.1) the+-- -frewrite-rules flag is deprecated in favor of -fenable-rewrite-rules.+-- It's unclear whether we can use CPP to switch between -fglasgow-exts+-- -frewrite-rules and -fenable-rewrite-rules based on the GHC+-- version...+--+-- http://hackage.haskell.org/trac/ghc/ticket/2213+-- http://www.mail-archive.com/glasgow-haskell-users@haskell.org/msg14313.html+{-# OPTIONS_GHC -O2 -fenable-rewrite-rules #-}+ {-# OPTIONS_GHC -Wall -fwarn-tabs #-} ------------------------------------------------------------------- 2012.07.10+-- 2013.05.11 -- | -- Module : Data.Functor.Fixedpoint--- Copyright : Copyright (c) 2007--2012 wren ng thornton+-- Copyright : Copyright (c) 2007--2014 wren gayle romano -- License : BSD -- Maintainer : wren@community.haskell.org -- Stability : provisional
unification-fd.cabal view
@@ -1,5 +1,5 @@ ------------------------------------------------------------------- wren ng thornton <wren@community.haskell.org> ~ 2012.03.25+-- wren gayle romano <wren@community.haskell.org> ~ 2014.05.27 ---------------------------------------------------------------- -- By and large Cabal >=1.2 is fine; but >= 1.6 gives tested-with:@@ -8,12 +8,12 @@ Build-Type: Simple Name: unification-fd-Version: 0.8.0+Version: 0.8.1 Stability: experimental Homepage: http://code.haskell.org/~wren/-Author: wren ng thornton+Author: wren gayle romano Maintainer: wren@community.haskell.org-Copyright: Copyright (c) 2007--2012 wren ng thornton+Copyright: Copyright (c) 2007--2014 wren gayle romano License: BSD3 License-File: LICENSE @@ -21,6 +21,9 @@ Synopsis: Simple generic unification algorithms. Description: Simple generic unification algorithms. +-- BUG: does not work with GHC 7.8.0. Need to fix that+Tested-With:+ GHC == 6.12.1, GHC == 7.6.1 Extra-source-files: AUTHORS, README, VERSION Source-Repository head