{-# LANGUAGE DeriveFunctor #-}

module Language.Docker.EDSL.Types where

import Data.List.NonEmpty (NonEmpty)
import Data.String
import Data.Text (Text)
import qualified Language.Docker.Syntax as Syntax

data EBaseImage
  = EBaseImage
      Syntax.Image
      (Maybe Syntax.Tag)
      (Maybe Syntax.Digest)
      (Maybe Syntax.ImageAlias)
      (Maybe Syntax.Platform)
  deriving (Int -> EBaseImage -> ShowS
[EBaseImage] -> ShowS
EBaseImage -> String
(Int -> EBaseImage -> ShowS)
-> (EBaseImage -> String)
-> ([EBaseImage] -> ShowS)
-> Show EBaseImage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EBaseImage] -> ShowS
$cshowList :: [EBaseImage] -> ShowS
show :: EBaseImage -> String
$cshow :: EBaseImage -> String
showsPrec :: Int -> EBaseImage -> ShowS
$cshowsPrec :: Int -> EBaseImage -> ShowS
Show, EBaseImage -> EBaseImage -> Bool
(EBaseImage -> EBaseImage -> Bool)
-> (EBaseImage -> EBaseImage -> Bool) -> Eq EBaseImage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EBaseImage -> EBaseImage -> Bool
$c/= :: EBaseImage -> EBaseImage -> Bool
== :: EBaseImage -> EBaseImage -> Bool
$c== :: EBaseImage -> EBaseImage -> Bool
Eq, Eq EBaseImage
Eq EBaseImage
-> (EBaseImage -> EBaseImage -> Ordering)
-> (EBaseImage -> EBaseImage -> Bool)
-> (EBaseImage -> EBaseImage -> Bool)
-> (EBaseImage -> EBaseImage -> Bool)
-> (EBaseImage -> EBaseImage -> Bool)
-> (EBaseImage -> EBaseImage -> EBaseImage)
-> (EBaseImage -> EBaseImage -> EBaseImage)
-> Ord EBaseImage
EBaseImage -> EBaseImage -> Bool
EBaseImage -> EBaseImage -> Ordering
EBaseImage -> EBaseImage -> EBaseImage
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: EBaseImage -> EBaseImage -> EBaseImage
$cmin :: EBaseImage -> EBaseImage -> EBaseImage
max :: EBaseImage -> EBaseImage -> EBaseImage
$cmax :: EBaseImage -> EBaseImage -> EBaseImage
>= :: EBaseImage -> EBaseImage -> Bool
$c>= :: EBaseImage -> EBaseImage -> Bool
> :: EBaseImage -> EBaseImage -> Bool
$c> :: EBaseImage -> EBaseImage -> Bool
<= :: EBaseImage -> EBaseImage -> Bool
$c<= :: EBaseImage -> EBaseImage -> Bool
< :: EBaseImage -> EBaseImage -> Bool
$c< :: EBaseImage -> EBaseImage -> Bool
compare :: EBaseImage -> EBaseImage -> Ordering
$ccompare :: EBaseImage -> EBaseImage -> Ordering
$cp1Ord :: Eq EBaseImage
Ord)

instance IsString EBaseImage where
  fromString :: String -> EBaseImage
fromString String
s = Image
-> Maybe Tag
-> Maybe Digest
-> Maybe ImageAlias
-> Maybe Platform
-> EBaseImage
EBaseImage (String -> Image
forall a. IsString a => String -> a
fromString String
s) Maybe Tag
forall a. Maybe a
Nothing Maybe Digest
forall a. Maybe a
Nothing Maybe ImageAlias
forall a. Maybe a
Nothing Maybe Platform
forall a. Maybe a
Nothing

data EInstruction next
  = From
      EBaseImage
      next
  | AddArgs
      (NonEmpty Syntax.SourcePath)
      Syntax.TargetPath
      Syntax.Chown
      Syntax.Chmod
      next
  | User
      Text
      next
  | Label
      Syntax.Pairs
      next
  | StopSignal
      Text
      next
  | CopyArgs
      (NonEmpty Syntax.SourcePath)
      Syntax.TargetPath
      Syntax.Chown
      Syntax.Chmod
      Syntax.CopySource
      next
  | RunArgs
      (Syntax.Arguments Text)
      Syntax.RunFlags
      next
  | CmdArgs
      (Syntax.Arguments Text)
      next
  | Shell
      (Syntax.Arguments Text)
      next
  | Workdir
      Syntax.Directory
      next
  | Expose
      Syntax.Ports
      next
  | Volume
      Text
      next
  | EntrypointArgs
      (Syntax.Arguments Text)
      next
  | Maintainer
      Text
      next
  | Env
      Syntax.Pairs
      next
  | Arg
      Text
      (Maybe Text)
      next
  | Comment
      Text
      next
  | Healthcheck
      (Syntax.Check Text)
      next
  | OnBuildRaw
      (Syntax.Instruction Text)
      next
  | Embed
      [Syntax.InstructionPos Text]
      next
  deriving (a -> EInstruction b -> EInstruction a
(a -> b) -> EInstruction a -> EInstruction b
(forall a b. (a -> b) -> EInstruction a -> EInstruction b)
-> (forall a b. a -> EInstruction b -> EInstruction a)
-> Functor EInstruction
forall a b. a -> EInstruction b -> EInstruction a
forall a b. (a -> b) -> EInstruction a -> EInstruction b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> EInstruction b -> EInstruction a
$c<$ :: forall a b. a -> EInstruction b -> EInstruction a
fmap :: (a -> b) -> EInstruction a -> EInstruction b
$cfmap :: forall a b. (a -> b) -> EInstruction a -> EInstruction b
Functor)