1. Dhall

  2. Dhall is…

  3. A programming language

  4. Purely functional

  5. Strongly typed

  6. Not Turing complete

  7. … YAML?

  8. Data

    
    {
    	user = "singpolyma",
    	groups = ["web", "xmpp"]
    }
    	
  9. Code

    
    let map = https://prelude.dhall-lang.org/v9.0.0/List/map
    let UserConfig = { user : Text, groups : List Text }
    let users = ["singpolyma", "otherguy"]
    in
    map
    	Text
    	UserConfig
    	(\(user: Text) -> { user = user, groups = ["web", "xmpp"] })
    	users
    	
  10. Normalize

    
    $ dhall < t.dhall 
    
    [ { groups = [ "web", "xmpp" ], user = "singpolyma" }
    , { groups = [ "web", "xmpp" ], user = "otherguy" }
    ]
    	
  11. YAML

    
    $ dhall-to-yaml < t.dhall 
    
    - groups:
      - web
      - xmpp
      user: singpolyma
    - groups:
      - web
      - xmpp
      user: otherguy
    	
  12. Dhall is structured templating

  13. dhall-rails I18n

    
    {
      en = {
        ducks =
          \(translation_name: < ducks >) ->
          \(args: { count: Natural }) ->
            "${Natural/show args.count} ducks"
      }
    }
    	
  14. Dhall safety features

  15. Limited access to the world

  16. Integrity protection

    
    https://example.com/code.dhall sha256:9946ffab…
    	
  17. Same origin policy

  18. Total (not Turing complete)

  19. You can still be dumb on purpose

    
    let iterate
        : (Natural → Natural) → Natural → Natural
        =   λ(f : Natural → Natural)
          → λ(n : Natural)
          → Natural/fold (n + 1) Natural f 1
    
    let increment : Natural → Natural = λ(n : Natural) → n + 1
    
    let ackermann
        : Natural → Natural → Natural
        = λ(m : Natural) →
            Natural/fold m (Natural → Natural) iterate increment
    
    in ackermann
    	
  20. Some nice features

  21. Multiline string

    
    \(someArg: Text) ->
    	''
    	This is a template contaning ${someArg}.
    	We can use ${someArg} more than once.
    	''
    	
  22. Optionals

    
    Some 1 : Optional Natural
    None Natural : Optional Natural
    	
  23. Enums

    
    let colours = < Red | Green | Blue >
    in
    merge {
    	Red = "#f00",
    	Green = "#0f0",
    	Blue = "#00f"
    } colours.Red
    	
  24. Questions?