Skip to content

Commit

Permalink
QuickCheck instances for unit disks.
Browse files Browse the repository at this point in the history
  • Loading branch information
leftaroundabout committed Apr 21, 2019
1 parent f938696 commit eca2e70
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions manifolds/Data/Manifold/Types/Primitive.hs
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,14 @@ instance QC.Arbitrary ℝP² where
| θ' <- QC.shrink (θ*6/pi)
, φ' <- QC.shrink (φ*12/pi) ]

instance QC.Arbitrary D¹ where
arbitrary = D¹ . (\x -> (x`mod'`2) - 1) <$> QC.arbitrary
shrink (D¹ p) = D¹ . (\x -> (x`mod'`2) - 1) <$> QC.shrink p
instance QC.Arbitrary D² where
arbitrary = D²Polar . (\x -> x`mod'`1) <$> QC.arbitrary
<*> (φParamS¹ <$> QC.arbitrary)
shrink (D²Polar r φ) = D²Polar . (\x -> (x`mod'`2) - 1) <$> QC.shrink r
<*> (φParamS¹ <$> QC.shrink (S¹Polar φ))

instance (SP.Show m, SP.Show f) => SP.Show (FibreBundle m f) where
showsPrec p (FibreBundle m v) = showParen (p>9)
Expand Down

0 comments on commit eca2e70

Please sign in to comment.