{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
module Examples.RemoveComments where
import Protolude
import qualified Hyrax.Abif as H
import qualified Hyrax.Abif.Read as H
import qualified Hyrax.Abif.Write as H
removeComments :: IO ()
removeComments = do
abif' <- H.readAbif "example.ab1"
case abif' of
Left e -> putStrLn $ "error reading ABIF: " <> e
Right abif -> do
let modified = abif { H.aDirs = filter noComments $ H.aDirs abif }
H.writeAbif "example.modified.ab1" modified
where
noComments :: H.Directory -> Bool
noComments dir = H.dTagName dir /= "CMNT"