Skip to content

Instantly share code, notes, and snippets.

@ksqsf
Created January 12, 2022 07:16
Show Gist options
  • Save ksqsf/14e5c76c4fec5590310646bf61a0fbe6 to your computer and use it in GitHub Desktop.
Save ksqsf/14e5c76c4fec5590310646bf61a0fbe6 to your computer and use it in GitHub Desktop.
{-# 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