[Haskell-cafe] code in postings mangled?
Gregory Guthrie
guthrie at miu.edu
Wed Nov 17 14:34:34 UTC 2021
Why is code in postings so often mangled:
Subject: [Haskell-cafe] ContT and MonadSafe
...
Then I implement this kind of method
withHdf5PathP :: (MonadSafe m, Location l) => l -> Hdf5Path sh e -> (Dataset -> m r) -> m r withHdf5PathP loc (H5RootPath subpath) f = withHdf5PathP loc subpath f withHdf5PathP loc (H5GroupPath n subpath) f = withGroupP (openGroup loc n Nothing) $ \g -> withHdf5PathP g subpath f withHdf5PathP loc (H5GroupAtPath i subpath) f = withGroupAtP loc i $ \g -> withHdf5PathP g subpath f withHdf5PathP loc (H5DatasetPath n) f = withDatasetP (openDataset' loc n Nothing) f withHdf5PathP loc (H5DatasetPathAttr (a, c)) f = withDatasetP (openDatasetWithAttr loc a c) f withHdf5PathP loc (H5Or l r) f = withHdf5PathP loc l f `catchAll` const (withHdf5PathP loc r f)
I decided to switch to the ContT transfomer and try to implement this like this
withHdf5PathP :: (MonadSafe m, Location l) => l -> Hdf5Path sh e -> ContT r m Dataset withHdf5PathP loc (H5RootPath subpath) = withHdf5PathP loc subpath withHdf5PathP loc (H5GroupPath n subpath) = do
g <- withGroupP (openGroup loc n Nothing)
withHdf5PathP g subpath
withHdf5PathP loc (H5GroupAtPath i subpath) = do
g <- withGroupAtP loc i
withHdf5PathP g subpath
withHdf5PathP loc (H5DatasetPath n) = withDatasetP (openDataset' loc n Nothing) withHdf5PathP loc (H5DatasetPathAttr (a, c)) = withDatasetP (openDatasetWithAttr loc a c) withHdf5PathP loc (H5Or l r) = ???
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20211117/c7c5e358/attachment.html>
More information about the Haskell-Cafe
mailing list