mirror of
https://github.com/github/semantic.git
synced 2024-11-24 00:42:33 +03:00
Add a Random instance over Ratios.
This commit is contained in:
parent
ce838de9b4
commit
226be486c8
@ -60,6 +60,7 @@ library
|
||||
, filepath
|
||||
, hashable
|
||||
, mtl
|
||||
, MonadRandom
|
||||
, pointed
|
||||
, QuickCheck >= 2.8.1
|
||||
, quickcheck-text
|
||||
|
@ -1,6 +1,7 @@
|
||||
module Data.Gram where
|
||||
|
||||
import Data.DList
|
||||
import Control.Monad.Random
|
||||
import Data.Hashable
|
||||
import Prologue
|
||||
|
||||
@ -15,3 +16,6 @@ type Bag = DList
|
||||
instance Hashable label => Hashable (Gram label) where
|
||||
hashWithSalt _ = hash
|
||||
hash = hash . serialize
|
||||
|
||||
instance (Random a, Integral a) => Random (Ratio a) where
|
||||
random = first (% 1) . random
|
||||
|
Loading…
Reference in New Issue
Block a user