← All posts tagged code

agr
code Haskell
type family FragmentUnique api :: Constraint where
  FragmentUnique (sa :<|> sb)       = Or (FragmentUnique sa) (FragmentUnique sb)
  FragmentUnique (Fragment a :> sa) = FragmentNotIn sa (Fragment a :> sa)
  FragmentUnique (x :> sa)          = FragmentUnique sa
  FragmentUnique (Fragment a)       = ()
  FragmentUnique x                  = ()

type family FragmentNotIn api orig :: Constraint where
  FragmentNotIn (sa :<|> sb)       orig =
    And (FragmentNotIn sa orig) (FragmentNotIn sb orig)
  FragmentNotIn (Fragment c :> sa) orig = TypeError (NotUniqueFragmentInApi orig)
  FragmentNotIn (x :> sa)          orig = FragmentNotIn sa orig
  FragmentNotIn (Fragment c)       orig = TypeError (NotUniqueFragmentInApi orig)
  FragmentNotIn x                  orig = ()

type NotUniqueFragmentInApi api =
    'Text "Only one Fragment allowed per api ‘"
    ':<>: 'ShowType api
    ':<>: 'Text "’."
agr
code systemd yesod
[Unit]
Description=My awesome website
After=nginx.service

[Install]
WantedBy=multi-user.target

[Service]
WorkingDirectory=/absolute/path/to/directory
User=user
ExecStart=/absolute/path/to/executable config/settings.yml