-
-
Save mithrandi/d3d02aedab4b8cf900c2a566a90a06d1 to your computer and use it in GitHub Desktop.
This file contains 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
genDefunSymbols [''Leverage] | |
promoteOnly | |
[d| | |
validLeverageAmt :: Nat -> Symbol -> Symbol -> () | |
validLeverageAmt l b q = | |
if l `elem` leverage b q | |
then () | |
else | |
typeError | |
( ShowType l | |
:<>: Text " is not an available leverage multiplier for pair " | |
:<>: Text b | |
:<>: Text "/" | |
:<>: Text q | |
) | |
|] | |
type ValidLeverage l b q = | |
( KnownNat l, | |
MarginPair b q, | |
ValidLeverageAmt l b q ~ '() | |
) |
This file contains 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
type family ValidLeverageAmt l b q s :: Constraint where | |
ValidLeverageAmt l b q '[] = | |
TypeError | |
( 'ShowType l | |
':<>: 'Text " is not an available leverage multiplier for pair " | |
':<>: 'Text b | |
':<>: 'Text "/" | |
':<>: 'Text q | |
) | |
ValidLeverageAmt l b q (l ': s) = () | |
type ValidLeverage l b q = | |
( KnownNat l, | |
MarginPair b q, | |
ValidLeverageAmt l b q (Leverage b q) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment