[number] add simple combinator

This commit is contained in:
Vincent Hanquez 2015-05-11 07:09:44 +01:00
parent 427541064d
commit 5c0daae88c

View File

@ -11,6 +11,7 @@
{-# LANGUAGE UnboxedTuples #-}
module Crypto.Number.Compat
( GmpSupported(..)
, onGmpUnsupported
, gmpGcde
, gmpLog2
, gmpPowModSecInteger
@ -39,6 +40,10 @@ data GmpSupported a = GmpSupported a
| GmpUnsupported
deriving (Show,Eq)
onGmpUnsupported :: GmpSupported a -> a -> a
onGmpUnsupported (GmpSupported a) _ = a
onGmpUnsupported GmpUnsupported f = f
gmpGcde :: Integer -> Integer -> GmpSupported (Integer, Integer, Integer)
#if MIN_VERSION_integer_gmp(0,5,1)
gmpGcde a b =