on master help sign in
Run ormolu
commit7df1dfba2c02d0999f958a1c28358074de8fd2df authorSridhar Ratnakumar <srid@srid.ca> dateFri 31 Jul 2020, 18:24 (6 years ago) parent5badc49
2 files changed+9−12
src/JRec.hs+4−5 test/JRecSpec.hs+5−7
src/JRec.hs+4−5
@@ -8,11 +8,11 @@ module JRec
88 pattern ExactRecord,
99 unField,
1010 union,
11− (:=)(..),
11+ (:=) (..),
1212 )
1313where
1414
15−import Control.Lens ((.~), coerced)
15+import Control.Lens ((&), (.~), (^.), coerced)
1616import qualified Data.Generics.Product.Fields as GL
1717import qualified Data.Generics.Wrapped as GL
1818import Data.Proxy
@@ -21,11 +21,10 @@ import GHC.Generics
2121import GHC.OverloadedLabels
2222import GHC.TypeLits
2323import Generic.Data
24+import JRec.Field
2425import qualified JRec.Super as R
25−import Control.Lens ((&), (^.))
26−import JRec.Super ((:=)(..))
26+import JRec.Super ((:=) (..))
2727import JRec.Tuple
28−import JRec.Field
2928import Unsafe.Coerce
3029
3130----------------------------------------------------------------------------
test/JRecSpec.hs+5−7
@@ -1,19 +1,19 @@
11module JRecSpec (spec) where
22
3−import Test.Hspec
4−import Control.Lens ((&), (^.), (.~))
3+import Control.Lens ((&), (.~), (^.))
54import JRec
5+import Test.Hspec
66
77spec :: Spec
8−spec = do
8+spec = do
99 it "polymorphic" $ do
1010 (ExactRecord (#u := True, #a := 5, #b := 6) & #u .~ 5)
11− `shouldBe` ExactRecord (#u := 5, #a := 5, #b := 6)
11+ `shouldBe` ExactRecord (#u := 5, #a := 5, #b := 6)
1212 it "show" $ do
1313 show (ExactRecord ()) `shouldBe` "{}"
1414 show (ExactRecord (#foo := True)) `shouldBe` "{foo = True}"
1515 show (ExactRecord (#foo := True, #bar := 0)) `shouldBe` "{foo = True, bar = 0}"
16− it "get" $ do
16+ it "get" $ do
1717 let getA1 :: Record ("a" := Int ': rest) -> Int
1818 getA1 = (^. #a)
1919 let getA2 :: Record ("u" := Bool ': "a" := Int ': rest) -> Int
@@ -39,5 +39,3 @@ spec = do
3939 `shouldBe` (ExactRecord (#u := True, #a := 8))
4040 setA2 (ExactRecord (#u := True, #a := 5, #b := 6))
4141 `shouldBe` (ExactRecord (#u := True, #a := 8, #b := 6))
42−
43−