ssm-lang / Scoria

This is an embedding of the Sparse Synchronous Model, in Haskell!
BSD 3-Clause "New" or "Revised" License
4 stars 0 forks source link

Common identifier type #52

Closed Rewbert closed 2 years ago

Rewbert commented 2 years ago

Not sure why, but I initially chose to use different kinds of identifiers. Some things were just Strings and some were more contrived types. Example:

type Reference = (String, Type)
data Procedure = Procedure
  { name :: String
  , ...
  }
data Name = Captured String SrcInfo | Fresh String

I now added a single

type SrcInformation = (String, Int, Int)
data Ident = Ident String (Maybe SrcInformation)

An Identifier is mainly just a String, but if we have plugins that can capture information from the source, we can possibly annotate that Identifier with a SrcInformation.

Rewbert commented 2 years ago

I still have a change I want to implement, but I think you can take a look at the majority of it @j-hui

In some places I use fst to get the Ident out of a Reference. I want to use another function which doesn't operate on tuples, for easier maintainability (also thinking of my other PR, where I can't use fst anymore).

Also need to document somr thing, but not a lot.

EDIT: I fix the fst issue in another PR, so I won't fix it here.