Skip to content

Instantly share code, notes, and snippets.

@dminuoso

dminuoso/f.hs Secret

Created November 30, 2022 09:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dminuoso/d8558ad3235d6d2b93194d7bd49106ce to your computer and use it in GitHub Desktop.
Save dminuoso/d8558ad3235d6d2b93194d7bd49106ce to your computer and use it in GitHub Desktop.
-- | Turn a redundancy group into an inventory.ini block. We assume it's already grouped, so we just look at the first
-- element to figure out the redundancy group label.
rdGroup :: NE.NonEmpty HostMeta -> Maybe (Doc ())
rdGroup (x NE.:| xs) = case hostRdGrp x of
Nothing -> Nothing
Just label -> Just $ (vsep (brackets (rdGrpLabel label)
: (toHost rf `mapMaybe` (x : xs))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment