Commit b08634ce authored by Camil Staps's avatar Camil Staps 🚀

Allow spaces (and other funny characters) in property names (resolves #12)

parent fbb9aa59
Subproject commit a18ebf4d7b782c1e8b0a7fbae0d546f20b1a64a8
Subproject commit 23b05936be80efc2d30df8c09d347bc04754655d
......@@ -321,14 +321,15 @@ where
, gp_implementation = join "\n"
[ tname +++ " :: Property"
, tname +++ " = name \"" +++ fname +++ ": " +++ name` +++ "\""
, "\t(" +++ lambda +++ join " " [name` +++ "`":map snd3 ts`] +++ ")"
, "\t(" +++ lambda +++ join " " [name`` +++ "`":map snd3 ts`] +++ ")"
, "where"
, "\t" +++ name` +++ "` :: " +++ toString type`
, "\t" +++ join " " [name` +++ "`":map fst3 ts`] +++ " = prop $\n\t\t" +++ replaceSubString "\n" "\n\t\t" imp
, "\t" +++ name`` +++ "` :: " +++ toString type`
, "\t" +++ join " " [name`` +++ "`":map fst3 ts`] +++ " = prop $\n\t\t" +++ replaceSubString "\n" "\n\t\t" imp
]
}
where
tname = fname +++ "_" +++ name` // TODO generate a different name if fname contains funny characters
tname = fname +++ "_" +++ name``
name`` = fixname name`
name` = if (i == 1) name (name +++ "_" +++ toString i)
type = fromJust $ assignAll vis $ Func (map thd3 ts`) (Type "Property" []) []
type` = fromJust $ assignAll vis $ Func (map snd ts) (Type "Property" []) []
......@@ -342,4 +343,7 @@ where
resolveGenerators (arg,t) = case [(n,i) \\ (n,Func [i] r _,_) <- generators | r == t] of
[(n,i):_] -> (arg,"(" +++ n +++ " " +++ arg +++ ")",i)
[] -> (arg,arg,t)
fixname :: String -> String
fixname s = {if (isAlphanum c) c '_' \\ c <-: s}
generateProperties _ _ _ _ = []
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment