<div dir="ltr">Right now I'm using Variant.weaken (where Variant is from the meta library in <a href="http://hg.impredicative.com/meta">http://hg.impredicative.com/meta</a> ) in a record fold in hopes that I can turn a value like<div>
<br></div><div style>{ PS1 = ..., PS2 = ... }</div><div style><br></div><div style>into</div><div style><br></div><div style>[ { Id = make [#PS1] (), ... },</div><div style> { Id = make [#PS2] (), ... } ]</div><div style>
<br></div><div style>which I can then insert into a database. My code so far is </div><div style><br></div><div style><br></div><div style>con assns :: {Unit} = [PS1, PS2, PS3]<br></div><div style>type assignmentVariant = variant (mapU unit assns)</div>
<div style>type assignmentData = { Title : string, Description : string }<br></div><div style><br></div><div style><div>fun formResultToRows (fl : folder assns) (result : $(mapU assignmentData assns)) : list assignmentVariant =</div>
<div> @foldUR [assignmentData] [fn cols => list (variant (mapU unit cols))]</div><div> (fn [nam :: Name] [rest ::_] [[nam] ~ rest] res acc =></div><div> make [nam] () :: List.mp Variant.weaken acc</div>
<div> )</div><div> [] fl result</div><div><br></div><div style>(I can provide the full source file if necessary; right now I'm just focusing on getting the IDs out.) The problem is that when I compile it I get: </div>
<div style><br></div><div style><div>/home/phurst/code/assignments/assignments.ur:34:27: (to 34:41) Can't resolve type class instance</div><div>Class constraint: Top.folder[[Type]] (map (fn _ :: Unit => {}) rest)</div>
<div><br></div><div style>so I assume I need to explicitly pass in a folder somewhere (possibly to Variant.weaken?), but I'm not sure how. Any advice?</div></div></div></div>