Builtins

This section contains the proof that all nix builtins can be meaningfully and correctly annotated with the proposed type system.

There are currently 89 builtin functions, that can be discovered with

run nix __dump-builtins

Every builtins signature can be found below (sorted alphabetically)

Following symbols are used below

  • ✅ - Compliant
  • ⚠️ - Under construction.

Builtins - TODO: The type signatures are not compliant yet

abort ⚠️

String -> Error

add ✅

Number -> Number -> Number

all ✅

(a -> Bool) -> [a] -> Bool

any ✅

(a -> Bool) -> [a] -> Bool

attrNames ✅

{ ${key} :: a } -> [String]

attrValues ✅

{ ${key} :: a } -> [a]

baseNameOf ✅

( String | Path ) -> String

bitAnd ✅

Int -> Int -> Int

bitOr ✅

Int -> Int -> Int

bitXor ✅

Int -> Int -> Int

break ✅

a -> a

catAttrs ✅

String -> [ { ${name} :: a } ] -> [a]

ceil ✅

Number -> Int

compareVersions ✅

String -> String -> (-1 | 0 | 1)

concatLists ✅

[ [ a ] ] -> [ a ]

concatMap ✅

( a -> [ b ] ) -> [ a ] -> [ b ]

concatStringsSep ✅

String -> [ ( String | Path ) ] -> String

deepSeq ✅

a -> b -> b

dirOf ✅

a = (Path | String)
a -> a

div ⚠️

Number -> Number -> Number

elem ⚠️

a -> [b] -> Bool

elemAt ⚠️

[a] -> Int -> b

fetchClosure ⚠️

AttrSet -> AttrSet

fetchGit ⚠️

AttrSet -> AttrSet

fetchTarball ⚠️

AttrSet -> AttrSet

fetchurl ⚠️

String -> AttrSet

filter ⚠️

(a -> Bool) -> [a] -> [b]

filterSource ⚠️

(Path -> String -> Bool) -> Path -> Path

floor ⚠️

Float -> Int

foldl' ⚠️

(a -> b -> c) -> a -> [b] -> c

fromJSON ⚠️

String -> a

functionArgs ⚠️

(a) -> AttrSet

genList ⚠️

(a -> b) -> a -> [b]

genericClosure ⚠️

AttrSet -> [AttrSet]

getAttr ⚠️

String -> AttrSet -> a

getEnv ⚠️

String -> String

getFlake ⚠️

AttrSet -> AttrSet

groupBy ⚠️

(a -> b) -> [a] -> AttrSet

hasAttr ⚠️

String -> AttrSet -> Bool

hashFile ⚠️

String -> Path -> String

hashString ⚠️

String -> String -> String

head ⚠️

[a] -> a

import ⚠️

Path -> a

intersectAttrs ⚠️

AttrSet -> AttrSet -> AttrSet

isAttrs ⚠️

a -> Bool

isBool ⚠️

a -> Bool

isFloat ⚠️

a -> Bool

isFunction ⚠️

a -> Bool

isInt ⚠️

a -> Bool

isList ⚠️

a -> Bool

isNull ⚠️

a -> Bool

isPath ⚠️

a -> Bool

isString ⚠️

a -> Bool

length ⚠️

[a] -> Int

lessThan ⚠️

Number -> Number -> Bool

listToAttrs ⚠️

[{name :: String, value :: a}] -> AttrSet

map ⚠️

(a -> b) -> [a] -> [b]

mapAttrs ⚠️

(a -> b -> c) -> AttrSet -> AttrSet

match ⚠️

String -> String -> ( Null | [ String ] )

mul ⚠️

Number -> Number -> Number

parseDrvName ⚠️

String -> AttrSet

partition ⚠️

(a -> Bool) -> [a] -> AttrSet

Path ⚠️

AttrSet -> StorePath

pathExists ⚠️

Path -> Bool

placeholder ⚠️

String -> String

readDir ⚠️

Path -> AttrSet

readFile ⚠️

Path -> String

removeAttrs ⚠️

AttrSet -> [a] -> AttrSet

replaceStrings ⚠️

[String] -> [String] -> String -> String

seq ✅

a -> b -> b

sort ✅

(a -> a -> Bool) -> [a] -> [a]

split ⚠️

String -> String -> [String]

splitVersion ⚠️

String -> [String]

StorePath ⚠️

StorePath -> StorePath

stringLength ⚠️

String -> Int

sub ⚠️

Number -> Number -> Number

substring ⚠️

Int -> Int -> String -> String

tail ⚠️

[a] -> a

throw ⚠️

String

toFile ⚠️

Path -> String -> StorePath 

toJSON ⚠️

a -> String

toPath ⚠️

String -> Path

toString ⚠️

a -> String

toXML ⚠️

a -> String

trace ⚠️

a -> b -> b

traceVerbose ⚠️

a -> b -> b

tryEval ⚠️

a -> a

typeOf ✅

a -> "bool" | "int" | "float" | "string" | "set" | "list" | "path" | "null" | "lambda" 

zipAttrsWith ⚠️

(String -> [a] ) -> [a] -> AttrSet