depot/nix/tag, branch refs/r/2214 monorepo for the virus lounge http://code.tvl.fyi/depot/atom?h=refs%2Fr%2F2214 2021-01-30T15:41:08+00:00 feat(nix): add nix.tag, a way of discriminating via tagged unions 2021-01-30T15:41:08+00:00 Profpatsch mail@profpatsch.de 2021-01-23T16:23:39+00:00 urn:sha1:e4a7704583812786d90ddc1f3aa639b2866e18e2 Introduces the concept of a “tag”, a single-keyed attrset which annotates a nix value with a name. This can be used to implement tagged unions (by implying the list of possible tags is well-known), which has some overlap with how `nix.yants` does it. However, the more fascinating use-case is in concert with a so-called discriminator, `match` and hylomorphisms. The discriminator can take a nix value, and add tags to it based on some predicate. With `match`, we can then use that information to convert the discriminated values again. With `hylo`, we can combine both the “constructive” discriminator step with the “destructive” match step to recursively walk over a nix data structure (based on a description of how to recurse, e.g. through attrset values or list values), and then apply a transformation in one go. Change-Id: Ia335ca8b0881447fbbcb6bcd80f49feb835f1715 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2434 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<feed xmlns="http://www.w3.org/2005/Atom">
<title>depot/nix/tag, branch refs/r/2214</title>
<subtitle>monorepo for the virus lounge</subtitle>
<id>http://code.tvl.fyi/depot/atom?h=refs%2Fr%2F2214</id>
<link rel="self" href="http://code.tvl.fyi/depot/atom?h=refs%2Fr%2F2214"/>
<link rel="alternate" type="text/html" href="http://code.tvl.fyi/"/>
<updated>2021-01-30T15:41:08+00:00</updated>
<entry>
<title>feat(nix): add nix.tag, a way of discriminating via tagged unions</title>
<updated>2021-01-30T15:41:08+00:00</updated>
<author>
<name>Profpatsch</name>
<email>mail@profpatsch.de</email>
</author>
<published>2021-01-23T16:23:39+00:00</published>
<link rel="alternate" type="text/html" href="http://code.tvl.fyi/commit/?id=e4a7704583812786d90ddc1f3aa639b2866e18e2"/>
<id>urn:sha1:e4a7704583812786d90ddc1f3aa639b2866e18e2</id>
<content type="text"> Introduces the concept of a “tag”, a single-keyed attrset which annotates a nix value with a name. This can be used to implement tagged unions (by implying the list of possible tags is well-known), which has some overlap with how `nix.yants` does it. However, the more fascinating use-case is in concert with a so-called discriminator, `match` and hylomorphisms. The discriminator can take a nix value, and add tags to it based on some predicate. With `match`, we can then use that information to convert the discriminated values again. With `hylo`, we can combine both the “constructive” discriminator step with the “destructive” match step to recursively walk over a nix data structure (based on a description of how to recurse, e.g. through attrset values or list values), and then apply a transformation in one go. Change-Id: Ia335ca8b0881447fbbcb6bcd80f49feb835f1715 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2434 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org> </content>
</entry>
</feed>