module Vulkan.Utils.ShaderQQ.ShaderType
  ( ShaderType (..)
  ) where

import           Data.String (IsString (..))

data ShaderType
  = GLSL
  | HLSL

instance IsString ShaderType where
  fromString :: String -> ShaderType
fromString = \case
    String
"glsl" -> ShaderType
GLSL
    String
"hlsl" -> ShaderType
HLSL
    String
t -> String -> ShaderType
forall a. HasCallStack => String -> a
error (String -> ShaderType) -> String -> ShaderType
forall a b. (a -> b) -> a -> b
$ String
"not support '" String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
t String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"' shader"

instance Show ShaderType where
  show :: ShaderType -> String
show = \case
    ShaderType
GLSL -> String
"glsl"
    ShaderType
HLSL -> String
"hlsl"