Quantcast
Channel: ReScript Forum - Latest posts
Viewing all articles
Browse latest Browse all 1819

Guidance for nested data types

$
0
0

I think it depends on how the rest of your app is going to be structured. I’m a sucker for doing #1 but it really works best if you’re handling it some single entry point and calling other methods to “evaluate” what should happen -

let whatShouldIDo = foo => {
  // ...
  Terminal.Echo("Hello World")
}

let main () => {
  let input = parse()
  let action = whatShouldIDo(input)
  Terminal.run(action)
}

If you expect the terminal to be referenced throughout code like in a UI with multiple buttons, then I’d go with what @tsnobip shown and create a Terminal module that simply defines all the methods


Viewing all articles
Browse latest Browse all 1819

Trending Articles