Created
January 12, 2022 07:16
-
-
Save ksqsf/14e5c76c4fec5590310646bf61a0fbe6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedLabels #-} | |
{-# LANGUAGE UndecidableInstances #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE DataKinds #-} | |
import Control.Monad.IO.Class | |
import Data.Proxy | |
import GHC.Exts | |
import GHC.OverloadedLabels (IsLabel(..)) | |
import GHC.TypeLits | |
import System.Process.Typed | |
instance (MonadIO m, | |
str ~ String, | |
ret ~ ([str] -> m ExitCode), | |
KnownSymbol cmd) | |
=> IsLabel cmd ret where | |
fromLabel = \args -> | |
runProcess (proc (symbolVal (Proxy :: Proxy cmd)) args) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment