@@ 89,16 89,19 @@ commaSpace = ", "
commaNewline :: String
commaNewline = "," ++ newline
-shouldBeGolden :: ParagraphLayout -> FilePath -> Golden ParagraphLayout
-shouldBeGolden output_ name = Golden
- { output = output_
- , encodePretty = show
- , writeToFile = \path -> writeFile path . prettyShow
- , readFromFile = \path -> readFile path >>= return . read
- , goldenFile = ".golden" </> name </> "golden"
- , actualFile = Just (".golden" </> name </> "actual")
- , failFirstTime = False
- }
+class ShouldBeGolden a where
+ shouldBeGolden :: a -> FilePath -> Golden a
+
+instance ShouldBeGolden ParagraphLayout where
+ shouldBeGolden output_ name = Golden
+ { output = output_
+ , encodePretty = show
+ , writeToFile = \path -> writeFile path . prettyShow
+ , readFromFile = \path -> readFile path >>= return . read
+ , goldenFile = ".golden" </> name </> "golden"
+ , actualFile = Just (".golden" </> name </> "actual")
+ , failFirstTime = False
+ }
emptyLayout :: ParagraphLayout
emptyLayout = ParagraphLayout (Rect 0 0 0 0) []