the-sett / elm-syntax-dsl

A DSL for creating Elm syntax trees and pretty printing Elm source code.
BSD 3-Clause "New" or "Revised" License
20 stars 4 forks source link

Pattern declarations should not be allowed at top-level. #2

Closed rupertlssmith closed 5 years ago

rupertlssmith commented 5 years ago

This is not valid Elm syntax:

type Singleton
    = Singleton String

(Singleton val) = Singleton "test"

but this is:

val = 
    let
        (Singleton innerVal) = Singleton "test"
    in
       innerVal
rupertlssmith commented 5 years ago

The only pattern that should be allowed at top-level is varPattern.

Should remove patternDecl and replace it with valueDecl - which is like a funDecl but with no arguments.