summaryrefslogtreecommitdiff
path: root/templates/data.purs.ede
diff options
context:
space:
mode:
Diffstat (limited to 'templates/data.purs.ede')
-rw-r--r--templates/data.purs.ede20
1 files changed, 19 insertions, 1 deletions
diff --git a/templates/data.purs.ede b/templates/data.purs.ede
index ccaa7de..a26f292 100644
--- a/templates/data.purs.ede
+++ b/templates/data.purs.ede
@@ -2,8 +2,17 @@
2-- {{ dateTime }} 2-- {{ dateTime }}
3 3
4module {{ moduleName }} where 4module {{ moduleName }} where
5import Prelude
6import Data.Generic
7import Data.Maybe (Maybe(..))
8import Data.StrMap (StrMap(..))
9import Data.Map (Map(..))
10import Data.List (List(..))
11import Linear
5 12
6{% for t in definitions %} 13{% for t in dataAndType %}
14{% case t.value | constType %}
15{% when "DataDef" %}
7data {{ t.value.dataName }}{% for c in t.value.constructors %} 16data {{ t.value.dataName }}{% for c in t.value.constructors %}
8{% if c.value.fields | hasFieldNames %} 17{% if c.value.fields | hasFieldNames %}
9 {% if c.first %}={% else %}|{% endif %} {{ c.value.name }} 18 {% if c.first %}={% else %}|{% endif %} {{ c.value.name }}
@@ -13,4 +22,13 @@ data {{ t.value.dataName }}{% for c in t.value.constructors %}
13{% else %} 22{% else %}
14 {% if c.first %}={% else %}|{% endif %} {{ c.value.name }}{% for f in c.value.fields %} {{ f.value.fieldType | psType | parens }}{% endfor %}{% endif %}{% endfor %} 23 {% if c.first %}={% else %}|{% endif %} {{ c.value.name }}{% for f in c.value.fields %} {{ f.value.fieldType | psType | parens }}{% endfor %}{% endif %}{% endfor %}
15 24
25{% when "TypeAlias" %}
26type {{ t.value.aliasName }} = {{ t.value.aliasType | psType }}
27
28{% endcase %}
16{% endfor %} 29{% endfor %}
30{% for t in definitions %}{% let l = t.value.instances | length %}{% if l > 0 %}{# FIXME!!! #}
31derive instance generic{{ t.value.dataName }} :: Generic {{ t.value.dataName }}
32instance show{{ t.value.dataName }} :: Show {{ t.value.dataName }} where show = gShow
33instance eq{{ t.value.dataName }} :: Eq {{ t.value.dataName }} where eq = gEq
34{% endif %}{% endlet %}{% endfor %}