-
Notifications
You must be signed in to change notification settings - Fork 0
Discussion about hnix #24
Comments
First thing I discovered is that hnix has Nix's expressions defined in https://github.com/haskell-nix/hnix/blob/master/src/Nix/Expr/Types.hs Specifically: https://github.com/haskell-nix/hnix/blob/738ef09bf9add0f0f21d7a72dd5ce31dbd200f67/src/Nix/Expr/Types.hs#L93-L140 The comments mention that this data type is polymorphic in order to make use of Functor and other typeclasses. This is an interesting pattern called the type-level Fix pattern. It is explained here: http://mainisusuallyafunction.blogspot.com.au/2010/12/type-level-fix-and-generic-folds.html and https://www.schoolofhaskell.com/user/bartosz/understanding-algebras Later: I believe this is just done to make the Nix expression algebraic data type to be more generic so they can use generic higher order functions like fmap and other things to work with the abstract evaluation tree. |
A nix atom is something that evaluates to themselves. They are the "literals". These are defined here: https://github.com/haskell-nix/hnix/blob/738ef09bf9add0f0f21d7a72dd5ce31dbd200f67/src/Nix/Atoms.hs#L18-L32 These atoms include only ints, floats, booleans and null. |
Note that Nix is an dynamically/unityped language. So the |
Should find out what all the strictness used in constructors for. This commit added in the strictness annotations haskell-nix/hnix@77bc4cb With the comment that while it doesn't improve speed, it appears to reduce memory usage. For further reference: http://blog.johantibell.com/2011/06/memory-footprints-of-some-common-data.html |
Continuing integration into hnix here: MatrixAI/Architect#14 |
hnix (https://github.com/haskell-nix/hnix) is a Haskell re-implementation of the Nix language.
This can be useful for artifact bindings when binding to Nix artifacts.
It is also useful as a foundation to write the Architect language parser and compiler.
The text was updated successfully, but these errors were encountered: