summaryrefslogtreecommitdiff
path: root/templates/data.purs.ede
blob: a26f2927f62d9976820f4da2af8bd3dd29b69dea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
-- generated file, do not modify!
-- {{ dateTime }}

module {{ moduleName }} where
import Prelude
import Data.Generic
import Data.Maybe (Maybe(..))
import Data.StrMap (StrMap(..))
import Data.Map (Map(..))
import Data.List (List(..))
import Linear

{% for t in dataAndType %}
{% case t.value | constType %}
{% when "DataDef" %}
data {{ t.value.dataName }}{% for c in t.value.constructors %}
{% if c.value.fields | hasFieldNames %}
  {% if c.first %}={% else %}|{% endif %} {{ c.value.name }}
{% for f in c.value.fields %}{% if f.first %}  { {%else%}  , {%endif%}{{ f.value.fieldName }} :: {{ f.value.fieldType | psType }}
{% endfor %}
  }
{% else %}
  {% if c.first %}={% else %}|{% endif %} {{ c.value.name }}{% for f in c.value.fields %} {{ f.value.fieldType | psType | parens }}{% endfor %}{% endif %}{% endfor %}

{% when "TypeAlias" %}
type {{ t.value.aliasName }} = {{ t.value.aliasType | psType }}

{% endcase %}
{% endfor %}
{% for t in definitions %}{% let l = t.value.instances | length %}{% if l > 0 %}{# FIXME!!! #}
derive instance generic{{ t.value.dataName }} :: Generic {{ t.value.dataName }}
instance show{{ t.value.dataName }} :: Show {{ t.value.dataName }} where show = gShow
instance eq{{ t.value.dataName }}   :: Eq {{ t.value.dataName }}   where eq = gEq
{% endif %}{% endlet %}{% endfor %}