packages feed

data-named 0.4.0 → 0.5.0

raw patch · 2 files changed

+14/−2 lines, 2 filesdep +binaryPVP ok

version bump matches the API change (PVP)

Dependencies added: binary

API changes (from Hackage documentation)

+ Data.Named.IOB: instance Binary a => Binary (Atom a)
+ Data.Named.IOB: instance Functor Atom

Files

Data/Named/IOB.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE DeriveFunctor #-}+ {- |     IOB encoding method extended to forests. @@ -38,6 +40,7 @@  import Control.Applicative ((<$>)) import Data.Maybe (fromJust)+import Data.Binary (Binary, get, put) import Data.Named.Tree hiding (span)  -- | An 'IOB' data structure consists of a word with a corresponding@@ -53,7 +56,15 @@ -- | An 'Atom' is the atomic label with additional marker. data Atom a  = B a      -- ^ Beginning marker              | I a      -- ^ Inside marker -             deriving (Show, Eq, Ord)+             deriving (Show, Eq, Ord, Functor)++instance Binary a => Binary (Atom a) where+    put (B x) = put '1' >> put x+    put (I x) = put '2' >> put x+    get = get >>= \i -> case i of+        '1' -> B <$> get+        '2' -> I <$> get+        _   -> error "Atom Binary instance: invalid code"  push :: Atom a -> IOB w a -> IOB w a push x (IOB w xs) = IOB w (x:xs)
data-named.cabal view
@@ -1,5 +1,5 @@ name:               data-named-version:            0.4.0+version:            0.5.0 synopsis:           Data types for named entities description:     The library provides data types which can be used to represent@@ -32,6 +32,7 @@       , containers       , text       , attoparsec+      , binary      exposed-modules:         Data.Named.Tree