mirror of
https://github.com/github/semantic.git
synced 2024-11-24 08:54:07 +03:00
7251c1c4b4
Co-Authored-By: Patrick Thomson <patrickt@users.noreply.github.com>
15 lines
485 B
Haskell
15 lines
485 B
Haskell
{-# LANGUAGE TypeFamilies #-}
|
|
module Generators
|
|
( source
|
|
) where
|
|
|
|
import Hedgehog
|
|
import qualified Hedgehog.Gen as Gen
|
|
import qualified Data.Source
|
|
import Data.Functor.Identity
|
|
|
|
source :: (GenBase m ~ Identity, MonadGen m) => Hedgehog.Range Int -> m Data.Source.Source
|
|
source r = Gen.frequency [ (1, empty), (20, nonEmpty) ]
|
|
where empty = pure mempty
|
|
nonEmpty = Data.Source.fromUTF8 <$> Gen.utf8 r (Gen.frequency [ (1, pure '\r'), (1, pure '\n'), (20, Gen.unicode) ])
|