gleam-lang/gleam

Re-export types and values from other modules

Open

#614 创建于 2020年5月28日

在 GitHub 查看
 (27 评论) (13 反应) (0 负责人)Rust (21,417 star) (960 fork)batch import
discussionhelp wanted

描述

It would be nice to be able to re-export a type or function from another module.

Here's an idea for a syntax:

// one.gleam
pub type MyType {
  MyConstructor
}

pub fn my_function() -> Nil {
  Nil
}
// two.gleam

import two.{pub MyType, pub MyConstructor, pub my_function}

Questions

Should it be permitted to export only a subset of a type's constructors? This would mean it would not possible for users to pattern match on all records as only some have been exported. The above syntax would allow that.

贡献者指南