Before any answer came up, I used HList to make the table like this:
hsNames = [ ("user", [ ("ident", UserIdent), ("password", UserPassword) ]) ]
So when the formula requires "user.magicloud.password", I successfully turned it into:
let tn = hsNames .!. user .!. "ident"
selectList [ tn ==. "magicloud" ]
This part seemed smooth until I compiled it, and got:
Couldn't match type `PersistEntityBackend val0'
with `persistent-1.2.1:Database.Persist.Sql.Types.SqlBackend'
The type variable `val0' is ambiguous
Possible fix: add a type signature that fixes these type variable(s)
Expected type: PersistMonadBackend
(persistent-1.2.1:Database.Persist.Sql.Types.SqlPersistT
(HandlerT App IO))
Actual type: PersistEntityBackend val0
In the expression:
selectList [tn ==. n, tt <=. twoweeksago] [Asc tt]
In the expression:
let
tn = hsNames .!. t .!. "name"
tt = hsNames .!. t .!. "cutime"
in selectList [tn ==. n, tt <=. twoweeksago] [Asc tt]
In the first argument of `mapM', namely
`(\ (t, n)
-> let
tn = hsNames .!. t .!. "name"
tt = hsNames .!. t .!. "cutime"
in selectList [tn ==. n, tt <=. twoweeksago] [Asc tt])'