on develop help sign in
Adding spec name for pretty generator output
16e558fBrendan Hay
gen/src/Gen/Types.hs+4−3
@@ -54,18 +54,19 @@ data Versions = Versions
54-- FIXME: need a more comprehensive 'vm_alpha' vs 'vm1.1' etc check.
54-- FIXME: need a more comprehensive 'vm_alpha' vs 'vm1.1' etc check.
55data Spec = Spec
55data Spec = Spec
56 { _specName :: Text
56 { _specName :: Text
57+ , _specPrefix :: Text
57 , _specVersion :: Text
58 , _specVersion :: Text
58 , _specPath :: Path
59 , _specPath :: Path
59 }
60 }
60
61
61instance Eq Spec where
62instance Eq Spec where
62− (==) = on (==) _specName
63+ (==) = on (==) _specPrefix
63
64
64instance Ord Spec where
65instance Ord Spec where
65− compare a b = on compare _specName a b <> on compare _specVersion a b
66+ compare a b = on compare _specPrefix a b <> on compare _specVersion a b
66
67
67specFromPath :: Path -> Spec
68specFromPath :: Path -> Spec
68−specFromPath x = Spec (n <> v) v x
69+specFromPath x = Spec (n <> v) p v x
69 where
70 where
70 n = Text.intercalate "/"
71 n = Text.intercalate "/"
71 . drop 1
72 . drop 1
gen/src/Main.hs+2−2
@@ -128,9 +128,9 @@ main = do
128 say ("Found " % int % " model specifications.") (length _optModels)
128 say ("Found " % int % " model specifications.") (length _optModels)
129 say ("Selected " % int % " newest models.") (length ss)
129 say ("Selected " % int % " newest models.") (length ss)
130
130
131− forM_ (zip [1..] ss) $ \(j, Spec n _ f) -> do
131+ forM_ (zip [1..] ss) $ \(j, s) -> do
132 title ("[" % int % "/" % int % "] model:" % stext)
132 title ("[" % int % "/" % int % "] model:" % stext)
133− (j :: Int) (length ss) n
133+ (j :: Int) (length ss) (_specName s)
134
134
135 -- m <- listDir f >>= hoistEither . loadModel f
135 -- m <- listDir f >>= hoistEither . loadModel f
136
136