{
  "id": 1279449,
  "title": "What If a Function Definition Looked Like Its Type?",
  "url": "https://urgent.news/2026/08/16/what-if-a-function-definition-looked-like-its-type",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-08-16T13:53:16.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/kentaromorishita/what-if-a-function-definition-looked-like-its-type-4b8c"
  },
  "original_language": "en",
  "account": "The Seseragi function syntax presents an intriguing concept: defining a function in a way that mirrors its type definition. At first glance, the syntax may seem unconventional due to the absence of parameter-list parentheses and commas. However, after adapting to this syntax, those aspects ceased to be the most appealing feature.\n\nOne of the most intriguing aspects of Seseragi's fn syntax is that the function's type is directly visible within the function definition. For example, the function definition `fn add a : Int - b : Int - Int = a + b` not only defines the function but also displays its type, which is `Int - Int - Int`. This feature allows the reader to understand the function's type in a more intuitive manner.\n\nThe parameter names are placed on the function's input side of the type, making it easier to visualize the function's type structure. The function type, `Int - Int - Int`, is presented before the parameter names, `a : Int - b : Int - Int`, giving a clearer picture of the function's input and output types.\n\nThis design choice emphasizes the relationship between the function definition and its type, making it less like defining two parameters followed by a return type, and more like describing the function type `Int - Int - Int` and then providing names for the inputs, `a` and `b`. The function type is conceptually placed first, and the definition merely adds names for the inputs without altering the overall shape significantly.\n\nUnderlying this syntax is ordinary currying. Seseragi functions are curried, meaning that the function type `Int - Int - Int` can be interpreted as `Int - (Int - Int)`. The first input leads to a new function of type `Int - Int`, and applying the second input to this nested function yields the final result, an `Int`. The function application follows the same structure, with each argument advancing through one arrow in the function type.\n\nThis continuous function type, `Int - Int - Int`, is not merely a matter of reducing punctuation; it reveals a deeper understanding of the function type. For example, comparing `Int - Int - Int` to the TypeScript syntax `function add(a: number, b: number): number { return a + b }` or Rust's `fn add(a: i32, b: i32) -> i32 { a + b }`, the parentheses around parameter groups in the latter languages are more like a cohesive unit. However, Seseragi's type `Int - Int - Int` suggests a different, more nuanced relationship between the inputs and outputs.\n\nIn Seseragi, parentheses around tuples, such as `(Int, Int) - Int`, convey a distinct meaning compared to the function type `Int - Int - Int`. The parentheses signify a tuple value, `(Int, Int)`, rather than a grouping of independent parameters. This distinction highlights the importance of the current fn syntax in Seseragi, as it brings the shape of the function type into the definition.\n\nWhile removing parentheses may not be the primary goal, it does result in a more visually appealing and type-accurate representation. For instance, omitting the return type, as in `fn add a : Int - b : Int = a + b`, would leave the visible function type incomplete. The compiler could potentially infer the return type, but explicitly declaring it maintains clarity for both the human reader and the compiler.\n\nIn conclusion, Seseragi's fn syntax offers an innovative way of defining functions that align closely with their type definitions. This approach enhances readability and comprehension by making the function type more visible and emphasizing the function's curried nature. Although the removal of parentheses may seem like a mere aesthetic choice, it ultimately contributes to a clearer understanding of the function's type and behavior.",
  "summary": "A Seseragi function can be defined like this: fn add a : Int -> b : Int -> Int = a + b At first, the obvious visual differences are the missing parameter-list parentheses and commas. But after using this syntax, those stopped being the part I liked most. Remove the parameter names: Int -> Int -> Int The function type is still sitting there almost untouched. When I look at the function definition,…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}