Created
May 12, 2018 20:28
-
-
Save yihuang/866c5045572b0bb09bb3aad4b7945e91 to your computer and use it in GitHub Desktop.
Minimal demo for Data.Reflection usage.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {-# LANGUAGE FlexibleContexts, RecordWildCards, ConstraintKinds #-} | |
| import System.Environment | |
| import Data.Reflection | |
| newtype Config = Config{ | |
| cfgCount :: Int | |
| } | |
| type HasConfig = Given Config | |
| test :: HasConfig => Int | |
| test = cfgCount given | |
| main = do | |
| (n:_) <- getArgs | |
| print $ give (Config (read n)) test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment