Fork me on GitHub

Is there an option for m/parse that disables returning tagged values for :orn / :altn / :multi / etc?


currently, no. What is your use case for this?


if you want to disable all, just call validate and return the original value in case of success ..


I have a large, complex schema that implements a for Hiccup elements. I leverage :orn throughout to preserve contextual information about elements (such as whether they're flow content or phrasing content). This is what it looks like when using a parser to parse a small element:

(site.fabricate.prototype.html/parse-element [:p "text" [:em "with emphasis"]])
  {:tag :p,
   :attrs nil,
   [[:atomic-element [:text "text"]]
      {:tag :em,
       :attrs nil,
       :contents [[:atomic-element [:text "with emphasis"]]]}]]]}]]
While this contextual information is sometimes useful, I also want the option of returning parsed values without it: just the {:tag t :attrs {} :contents [...]} structure so that every result from m/parse is returned in a uniform way. Perhaps, as you suggest, I'm relying too heavily on m/parse here; there's not much stopping me from pattern matching on the head & tail of the actual elements (so long as they validate) using ordinary sequence functions.


just as an aside, the fact that it's possible and performant to implement this much contextual information using seqexes speaks to the expressive power of malli. 🔥


after rewriting the schema manually, I think I was confused about how tagged entries work. if tagging were disabled for the schema, then I wouldn't even get the map syntax from the result.


my intended result was a mixture of tagged and untagged parse results, so it wouldn't even have been achieved by disabling tagging for :orn.