Skip to content

Typing & composability issue #175

Open
@Armael

Description

@Armael
open Tyxml

let page title content = [%html {|                                                  
  <html>                                                                            
    <head>                                                                          
     <title>|} title {|</title>                                                     
     <link rel=stylesheet href="/style.css" />                                      
    </head>                                                                         
    <body>|} content {|</body>                                                      
    </html>                                                                         
 |}]

let a_or_button contents =
  if true then
    Html.a contents
  else
    Html.button contents

let _ = page [%html "foo"] [Html.a []]
let _ = page [%html "foo"] [Html.button []]
let _ = page [%html "foo"] [a_or_button []]

Surprisingly, the last line fails to typecheck, with the following error: https://paste.isomorphis.me/Tgo

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions