{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
module Examples.ReadAb1 where
import Protolude
import qualified Hyrax.Abif.Read as H
readAbif :: IO ()
readAbif :: IO ()
readAbif = do
Either Text Abif
abif' <- FilePath -> IO (Either Text Abif)
H.readAbif "example.ab1"
case Either Text Abif
abif' of
Left e :: Text
e -> Text -> IO ()
forall a (m :: * -> *). (Print a, MonadIO m) => a -> m ()
putStrLn (Text -> IO ()) -> Text -> IO ()
forall a b. (a -> b) -> a -> b
$ "error reading ABIF: " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
e
Right abif :: Abif
abif ->
Abif -> IO ()
forall (m :: * -> *) a. (MonadIO m, Show a) => a -> m ()
print (Abif -> IO ()) -> Abif -> IO ()
forall a b. (a -> b) -> a -> b
$ Abif -> Abif
H.clearAbif Abif
abif