diff options
Diffstat (limited to 'stdlib/source/library/lux/type/abstract.lux')
-rw-r--r-- | stdlib/source/library/lux/type/abstract.lux | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/stdlib/source/library/lux/type/abstract.lux b/stdlib/source/library/lux/type/abstract.lux index 9a9e1d473..d3a6b5c35 100644 --- a/stdlib/source/library/lux/type/abstract.lux +++ b/stdlib/source/library/lux/type/abstract.lux @@ -28,7 +28,7 @@ (def: (push value stack) (All (_ a) (-> a (Stack a) (Stack a))) - (#.Item value stack)) + {#.Item value stack}) (def: pop (All (_ a) (-> (Stack a) (Maybe (Stack a)))) @@ -48,7 +48,7 @@ (template: (!peek <source> <reference> <then>) [(loop [entries <source>] (case entries - (#.Item [head_name head] tail) + {#.Item [head_name head] tail} (if (text\= <reference> head_name) <then> (recur tail)) @@ -60,13 +60,13 @@ (-> Text (List [Text Global]) (Stack Frame)) (!peek source reference (case head - (#.Definition [exported? frame_type frame_value]) + {#.Definition [exported? frame_type frame_value]} (:as (Stack Frame) frame_value) - (^or (#.Type _) - (#.Alias _) - (#.Label _) - (#.Slot _)) + (^or {#.Type _} + {#.Alias _} + {#.Label _} + {#.Slot _}) (undefined)))) (def: (peek_frames reference definition_reference source) @@ -82,15 +82,15 @@ (let [[reference definition_reference] (name_of ..frames) current_frames (peek_frames reference definition_reference (value@ #.modules compiler))] (case (case frame - (#.Some frame) + {#.Some frame} (list.example (function (_ [actual _]) (text\= frame actual)) current_frames) #.None (..peek current_frames)) - (#.Some frame) - (#.Right [compiler frame]) + {#.Some frame} + {#.Right [compiler frame]} #.None (exception.except ..no_active_frames []))))) @@ -101,17 +101,17 @@ (def: .public (specific name) (-> Text (Meta Frame)) - (..peek! (#.Some name))) + (..peek! {#.Some name})) (template: (!push <source> <reference> <then>) [(loop [entries <source>] (case entries - (#.Item [head_name head] tail) + {#.Item [head_name head] tail} (if (text\= <reference> head_name) - (#.Item [head_name <then>] - tail) - (#.Item [head_name head] - (recur tail))) + {#.Item [head_name <then>] + tail} + {#.Item [head_name head] + (recur tail)}) #.End (undefined)))]) @@ -120,15 +120,15 @@ (-> Text Frame (List [Text Global]) (List [Text Global])) (!push source reference (case head - (#.Definition [exported? frames_type frames_value]) - (#.Definition [exported? + {#.Definition [exported? frames_type frames_value]} + {#.Definition [exported? frames_type - (..push frame (:as (Stack Frame) frames_value))]) + (..push frame (:as (Stack Frame) frames_value))]} - (^or (#.Type _) - (#.Alias _) - (#.Label _) - (#.Slot _)) + (^or {#.Type _} + {#.Alias _} + {#.Label _} + {#.Slot _}) (undefined)))) (def: (push_frame [module_reference definition_reference] frame source) @@ -139,30 +139,30 @@ (def: (push! frame) (-> Frame (Meta Any)) (function (_ compiler) - (#.Right [(revised@ #.modules + {#.Right [(revised@ #.modules (..push_frame (name_of ..frames) frame) compiler) - []]))) + []]})) (def: (pop_frame_definition reference source) (-> Text (List [Text Global]) (List [Text Global])) (!push source reference (case head - (#.Definition [exported? frames_type frames_value]) - (#.Definition [exported? + {#.Definition [exported? frames_type frames_value]} + {#.Definition [exported? frames_type (let [current_frames (:as (Stack Frame) frames_value)] (case (..pop current_frames) - (#.Some current_frames') + {#.Some current_frames'} current_frames' #.None - current_frames))]) + current_frames))]} - (^or (#.Type _) - (#.Alias _) - (#.Label _) - (#.Slot _)) + (^or {#.Type _} + {#.Alias _} + {#.Label _} + {#.Slot _}) (undefined)))) (def: (pop_frame [module_reference definition_reference] source) @@ -172,10 +172,10 @@ (syntax: (pop! []) (function (_ compiler) - (#.Right [(revised@ #.modules + {#.Right [(revised@ #.modules (..pop_frame (name_of ..frames)) compiler) - (list)]))) + (list)]})) (def: cast (Parser [(Maybe Text) Code]) @@ -242,8 +242,8 @@ (type: (Selection a) (Variant - (#Specific Code a) - (#Current a))) + {#Specific Code a} + {#Current a})) (def: (selection parser) (All (_ a) (-> (Parser a) (Parser (Selection a)))) @@ -252,26 +252,26 @@ (syntax: .public (:transmutation [selection (..selection <code>.any)]) (case selection - (#Specific specific value) + {#Specific specific value} (in (list (` (.|> (~ value) (..:representation (~ specific)) (..:abstraction (~ specific)))))) - (#Current value) + {#Current value} (in (list (` (.|> (~ value) ..:representation ..:abstraction)))))) (syntax: .public (^:representation [selection (<code>.form (..selection <code>.local_identifier)) body <code>.any branches (<>.some <code>.any)]) (case selection - (#Specific specific name) + {#Specific specific name} (let [g!var (code.local_identifier name)] (in (list& g!var (` (.let [(~ g!var) (..:representation (~ specific) (~ g!var))] (~ body))) branches))) - (#Current name) + {#Current name} (let [g!var (code.local_identifier name)] (in (list& g!var (` (.let [(~ g!var) (..:representation (~ g!var))] |