Skip to content
This repository has been archived by the owner on Aug 5, 2024. It is now read-only.

assertions to create new type checking rules #16

Open
fnoble opened this issue Apr 17, 2015 · 2 comments
Open

assertions to create new type checking rules #16

fnoble opened this issue Apr 17, 2015 · 2 comments
Assignees

Comments

@fnoble
Copy link
Contributor

fnoble commented Apr 17, 2015

e.g.

lol = seqList [
  FnDef "lol" (FnT [("a", IntType), ("b", IntType)] [
    ("va", VecType ["a"] NumType),
    ("vb", VecType ["b"] NumType)
    ] Void) $ seqList [
      assert $ "a" == 2 * "b",    -- Should allow the type checker to use the rule 
                                  -- a = 2b and insert an assertion into the generated C
      "va" := "vb" :# "vb"
    ]
 ]
@kovach
Copy link
Contributor

kovach commented Apr 17, 2015

in this case, should the type signature just be
...("va", VecType [2 * "b"] NumType)...

I'd like to have invariants like this enforced by the type system whenever possible.

@fnoble
Copy link
Contributor Author

fnoble commented Apr 17, 2015

Yes, this is a simple example but I think there are cases when you don't want to do this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants