module Imp.Type.Source where import qualified Control.Monad.Catch as Exception import qualified GHC.Plugins as Plugin import qualified Imp.Extra.ModuleName as ModuleName data Source = Implicit | Explicit Plugin.ModuleName deriving (Source -> Source -> Bool (Source -> Source -> Bool) -> (Source -> Source -> Bool) -> Eq Source forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a $c== :: Source -> Source -> Bool == :: Source -> Source -> Bool $c/= :: Source -> Source -> Bool /= :: Source -> Source -> Bool Eq, Int -> Source -> ShowS [Source] -> ShowS Source -> String (Int -> Source -> ShowS) -> (Source -> String) -> ([Source] -> ShowS) -> Show Source forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a $cshowsPrec :: Int -> Source -> ShowS showsPrec :: Int -> Source -> ShowS $cshow :: Source -> String show :: Source -> String $cshowList :: [Source] -> ShowS showList :: [Source] -> ShowS Show) fromModuleName :: Plugin.ModuleName -> Source fromModuleName :: ModuleName -> Source fromModuleName = ModuleName -> Source Explicit fromString :: (Exception.MonadThrow m) => String -> m Source fromString :: forall (m :: * -> *). MonadThrow m => String -> m Source fromString String s = if String s String -> String -> Bool forall a. Eq a => a -> a -> Bool == String "_" then Source -> m Source forall a. a -> m a forall (f :: * -> *) a. Applicative f => a -> f a pure Source Implicit else ModuleName -> Source fromModuleName (ModuleName -> Source) -> m ModuleName -> m Source forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> String -> m ModuleName forall (m :: * -> *). MonadThrow m => String -> m ModuleName ModuleName.fromString String s isImplicit :: Source -> Bool isImplicit :: Source -> Bool isImplicit Source s = case Source s of Source Implicit -> Bool True Explicit ModuleName _ -> Bool False