summaryrefslogtreecommitdiff
path: root/Coolbal/Target.hs
blob: ae938fdf3a2ac8b56fb48f0cbe86e88514ccfd0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE RankNTypes #-}
module Coolbal.Target (
    AnyTarget(..),
    useAnyTarget,
) where

import GHC.Generics (Generic)

import Coolbal.EnvBinary
import Coolbal.Target.Class
import Coolbal.Target.Executable


data AnyTarget = AnyTargetExe ExeTarget
  deriving (Show, Generic)

instance EnvBinary RestoreEnv AnyTarget

useAnyTarget :: (forall a. (Show a, IsTarget a) => a -> r) -> AnyTarget -> r
useAnyTarget f (AnyTargetExe x) = f x