uniplate 1.2 → 1.2.0.1
raw patch · 4 files changed
+22/−11 lines, 4 files
Files
- Data/Generics/Uniplate.hs +1/−1
- Data/Generics/UniplateOn.hs +1/−1
- Data/Generics/UniplateStr.hs +19/−8
- uniplate.cabal +1/−1
Data/Generics/Uniplate.hs view
@@ -1,5 +1,5 @@ {- |-/DEPRECATED/ Use "Data.Generics.UniplateStr" instead.+/RECOMMENDATION/ Use "Data.Generics.UniplateStr" instead. This is the main Uniplate module, which defines all the essential operations in a Haskell 98 compatible manner.
Data/Generics/UniplateOn.hs view
@@ -1,6 +1,6 @@ {-# OPTIONS_GHC -fno-warn-deprecations #-} {- |-/DEPRECATED/ Use "Data.Generics.UniplateStrOn" instead.+/RECOMMENDATION/ Use "Data.Generics.UniplateStrOn" instead. This module retained Haskell 98 compatability, but users who are happy with multi-parameter type classes should look towards "Data.Generics.Biplate".
Data/Generics/UniplateStr.hs view
@@ -11,7 +11,10 @@ -} -module Data.Generics.UniplateStr where+module Data.Generics.UniplateStr(+ module Data.Generics.UniplateStr,+ module Data.Generics.Str+ ) where import Control.Monad hiding (mapM) import Data.List(inits,tails)@@ -32,18 +35,26 @@ type UniplateType on = on -> (Str on, Str on -> on) -- | The standard Uniplate class, all operations require this.--- Must define one of 'uniplate' or 'uniplateStr', 'uniplateStr' is recommended class Uniplate on where- -- | The underlying method in the class+ -- | The underlying method in the class. --- -- > uniplateStr (Add (Val 1) (Neg (Val 2)))- -- > = (Two (One (Val 1)) (One (Neg (Val 2)))], \(Two (One a) (One b)) -> Add a b)- -- > uniplateStr (Val 1)- -- > = (Zero , \Zero -> Val 1 )+ -- Given @uniplate x = (cs, gen)@+ --+ -- @cs@ should be a @Str on@, constructed of @Zero@, @One@ and @Two@,+ -- containing all @x@'s direct children of the same type as @x@. @gen@+ -- should take a @Str on@ with exactly the same structure as @cs@,+ -- and generate a new element with the children replaced.+ --+ -- Example instance:+ --+ -- > instance Uniplate Expr where+ -- > uniplate (Val i ) = (Zero , \Zero -> Val i )+ -- > uniplate (Neg a ) = (One a , \(One a) -> Neg a )+ -- > uniplate (Add a b) = (Two (One a) (One b), \(Two (One a) (One b)) -> Add a b) uniplate :: UniplateType on --- | Compatibility method, for direct users of the 'uniplate' function+-- | Compatibility method, for direct users of the old list-based 'uniplate' function uniplateList :: Uniplate on => on -> ([on], [on] -> on) uniplateList x = (c, b . d) where
uniplate.cabal view
@@ -1,7 +1,7 @@ Cabal-Version: >= 1.2 Build-Type: Simple Name: uniplate-Version: 1.2+Version: 1.2.0.1 Copyright: 2006-8, Neil Mitchell Maintainer: ndmitchell@gmail.com Homepage: http://www-users.cs.york.ac.uk/~ndm/uniplate/