-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
import Prelude
import Option
import Elara.Prim
type Parser a = Parser (String -> Option a)
def any : Parser Char
let any =
\s -> match stringToList s with
[] -> None
(x::xs) -> Some x
let main =
print (any "aaaa")[error]: Type error: The following types are not subtypes:
Text -> (Option.Option Char )
is not a subtype of
(Main.Parser Char )
CallStack (from HasCallStack):
NotSubtype, called at src\Elara\TypeInfer\Infer.hs:591:20 in elara-0.1.0-AAjdvmSf6cE4txRpFuPlaU:E
lara.TypeInfer.Infer
subtype, called at src\Elara\TypeInfer\Infer.hs:1332:9 in elara-0.1.0-AAjdvmSf6cE4txRpFuPlaU:Elar
a.TypeInfer.Infer
check, called at src\Elara\TypeInfer.hs:166:22 in elara-0.1.0-AAjdvmSf6cE4txRpFuPlaU:Elara.TypeIn
fer
The following context is available:
ÔÇó g18 = (Option.Option j18? )
ÔÇó j18 = Char
ÔÇó f18 = Text
ÔÇó Main.any: (Main.Parser Char )
ÔÇó Main.Parser:
forall a_62.
(Text -> (Option.Option a_62 )) -> (Main.Parser a_62 )
ÔÇó Main.Parser: Main.Parser
ÔÇó Option.map:
forall a_63.
forall b_64.
(a_63 -> b_64) -> (Option.Option a_63 ) -> (Option.Option b_64 )
ÔÇó u17 = a_63
ÔÇó v17 = b_64
ÔÇó Option.None: forall a_68 . (Option.Option a_68 )
ÔÇó Option.Some: forall a_68 . a_68 -> (Option.Option a_68 )
ÔÇó Option.Option: Option.Option
ÔÇó Prelude.(>>):
forall a_101.
forall b_102.
forall c_103.
(a_101 -> b_102) -> (b_102 -> c_103) -> a_101 -> c_103
ÔÇó Prelude.(/=): forall a_98 . a_98 -> a_98 -> Bool
ÔÇó c17 = a_98
ÔÇó Prelude.(++): Text -> Text -> Text
ÔÇó x16 = Char
ÔÇó Prelude.stringToList: Text -> (Elara.Prim.List Char )
ÔÇó o16 = Text
ÔÇó n16 = Char
ÔÇó p16 = Char
ÔÇó m16 = (Elara.Prim.List Char )
ÔÇó e16 = Integer
ÔÇó Prelude.sequence_:
forall a_82.
(Elara.Prim.List (Elara.Prim.IO a_82 ) ) -> (Elara.Prim.IO Unit )
ÔÇó u15 = (Elara.Prim.IO a_82 )
ÔÇó x15 = Unit
ÔÇó t15 = Unit
ÔÇó Prelude.sequence:
forall a_78.
(Elara.Prim.List (Elara.Prim.IO a_78 ) ) ->
(Elara.Prim.IO (Elara.Prim.List a_78 ) )
ÔÇó d15 = (Elara.Prim.IO a_78 )
ÔÇó h15 = a_78
ÔÇó g15 = (Elara.Prim.List a_78 )
ÔÇó a15 = (Elara.Prim.List a_78 )
ÔÇó Prelude.(*>):
forall a_91.
forall b_92.
(Elara.Prim.IO a_91 ) ->
(Elara.Prim.IO b_92 ) ->
(Elara.Prim.IO b_92 )
ÔÇó p14 = b_92
ÔÇó o14 = a_91
ÔÇó Prelude.print: forall a_76 . a_76 -> (Elara.Prim.IO Unit )
ÔÇó Prelude.not: Bool -> Bool
ÔÇó Prelude.listToString: (Elara.Prim.List Char ) -> Text
ÔÇó t13 = Char
ÔÇó Prelude.identity: forall a_70 . a_70 -> a_70
ÔÇó Prelude.charToInt: Char -> Integer
ÔÇó k13 = Char
ÔÇó i13 = Char
ÔÇó g13 = Char
ÔÇó e13 = Char
ÔÇó c13 = Char
ÔÇó a13 = Char
ÔÇó y12 = Char
ÔÇó w12 = Char
ÔÇó u12 = Char
ÔÇó s12 = Char
ÔÇó List.sum: (Elara.Prim.List Integer ) -> Integer
ÔÇó o12 = Integer
ÔÇó List.reverse:
forall a_47 . (Elara.Prim.List a_47 ) -> (Elara.Prim.List a_47 )
ÔÇó e12 = a_47
ÔÇó h12 = a_47
ÔÇó g12 = a_47
ÔÇó f12 = a_47
ÔÇó List.(<>):
forall a_54.
(Elara.Prim.List a_54 ) ->
(Elara.Prim.List a_54 ) ->
(Elara.Prim.List a_54 )
ÔÇó v11 = a_54
ÔÇó x11 = a_54
ÔÇó w11 = a_54
ÔÇó List.map:
forall a_41.
forall b_42.
(a_41 -> b_42) ->
(Elara.Prim.List a_41 ) ->
(Elara.Prim.List b_42 )
ÔÇó k11 = a_41
ÔÇó n11 = b_42
ÔÇó m11 = a_41
ÔÇó l11 = b_42
ÔÇó List.length: forall a_37 . (Elara.Prim.List a_37 ) -> Integer
ÔÇó z10 = a_37
ÔÇó List.last: forall a_33 . (Elara.Prim.List a_33 ) -> a_33
ÔÇó o10 = a_33
ÔÇó t10 = a_33
ÔÇó p10 = (Elara.Prim.List a_33 )
ÔÇó List.isEmpty: forall a_29 . (Elara.Prim.List a_29 ) -> Bool
ÔÇó i10 = a_29
ÔÇó List.head: forall a_25 . (Elara.Prim.List a_25 ) -> a_25
ÔÇó c10 = a_25
ÔÇó List.filter:
forall a_20.
(a_20 -> Bool) ->
(Elara.Prim.List a_20 ) ->
(Elara.Prim.List a_20 )
ÔÇó r9 = a_20
ÔÇó w9 = a_20
ÔÇó u9 = a_20
ÔÇó t9 = a_20
ÔÇó Elara.Prim.Nil: forall a_17 . (Elara.Prim.List a_17 )
ÔÇó Elara.Prim.Cons:
forall a_17.
a_17 -> (Elara.Prim.List a_17 ) -> (Elara.Prim.List a_17 )
ÔÇó Elara.Prim.List: Elara.Prim.List
ÔÇó Elara.Prim.(|>): forall a_13 b_14 . a_13 -> (a_13 -> b_14) -> b_14
ÔÇó Elara.Prim.(>>=):
forall a_9.
forall b_10.
(Elara.Prim.IO a_9 ) ->
(a_9 -> (Elara.Prim.IO b_10 )) ->
(Elara.Prim.IO b_10 )
ÔÇó z8 = b_10
ÔÇó y8 = a_9
ÔÇó Elara.Prim.(==): forall a_8 . a_8 -> a_8 -> Bool
ÔÇó Elara.Prim.(-): Integer -> Integer -> Integer
ÔÇó z7 = a8? -> b8?
ÔÇó a8 = Integer
ÔÇó b8 = c8? -> d8?
ÔÇó c8 = Integer
ÔÇó d8 = Integer
ÔÇó Elara.Prim.(+): Integer -> Integer -> Integer
ÔÇó p7 = q7? -> r7?
ÔÇó q7 = Integer
ÔÇó r7 = s7? -> t7?
ÔÇó s7 = Integer
ÔÇó t7 = Integer
ÔÇó Elara.Prim.(*): Integer -> Integer -> Integer
ÔÇó f7 = g7? -> h7?
ÔÇó g7 = Integer
ÔÇó h7 = i7? -> j7?
ÔÇó i7 = Integer
ÔÇó j7 = Integer
ÔÇó Elara.Prim.undefined: forall a_7 . a_7
ÔÇó Elara.Prim.unconsString: Text -> (Elara.Prim.Tuple2 Char Text )
ÔÇó t6 = u6? -> v6?
ÔÇó u6 = Text
ÔÇó v6 = (Elara.Prim.Tuple2 w6? x6? )
ÔÇó w6 = Char
ÔÇó x6 = Text
ÔÇó Elara.Prim.Tuple2:
forall a_18 b_19 . a_18 -> b_19 -> (Elara.Prim.Tuple2 a_18 b_19 )
ÔÇó Elara.Prim.Tuple2: Elara.Prim.Tuple2
ÔÇó Elara.Prim.toString: forall a_6 . a_6 -> Text
ÔÇó Elara.Prim.stringLength: Text -> Integer
ÔÇó b6 = c6? -> d6?
ÔÇó c6 = Text
ÔÇó d6 = Integer
ÔÇó Elara.Prim.readFile: Text -> (Elara.Prim.IO Text )
ÔÇó u5 = v5? -> w5?
ÔÇó v5 = Text
ÔÇó w5 = (Elara.Prim.IO x5? )
ÔÇó x5 = Text
ÔÇó Elara.Prim.pure: forall a_5 . a_5 -> (Elara.Prim.IO a_5 )
ÔÇó Elara.Prim.println: Text -> (Elara.Prim.IO Unit )
ÔÇó d5 = e5? -> f5?
ÔÇó e5 = Text
ÔÇó f5 = (Elara.Prim.IO g5? )
ÔÇó g5 = Unit
ÔÇó Elara.Prim.ioBind:
forall a_3.
forall b_4.
(Elara.Prim.IO a_3 ) ->
(a_3 -> (Elara.Prim.IO b_4 )) ->
(Elara.Prim.IO b_4 )
ÔÇó Elara.Prim.empty: forall a_2 . (Elara.Prim.List a_2 )
ÔÇó Elara.Prim.consString: Char -> Text -> Text
ÔÇó u3 = v3? -> w3?
ÔÇó v3 = Char
ÔÇó w3 = x3? -> y3?
ÔÇó x3 = Text
ÔÇó y3 = Text
ÔÇó Elara.Prim.cons:
forall a_1.
a_1 -> (Elara.Prim.List a_1 ) -> (Elara.Prim.List a_1 )
ÔÇó Elara.Prim.elaraPrimitive: forall a_0 . Text -> a_0
ÔÇó Elara.Prim.String: Text
ÔÇó Elara.Prim.Int: Integer
ÔÇó Elara.Prim.Char: Char
ÔÇó Elara.Prim.Bool: Bool
ÔÇó Elara.Prim.IO: Elara.Prim.IO
ÔÇó Elara.Prim.True: Bool
ÔÇó Elara.Prim.False: Bool
ÔĽşÔöÇÔöÇԾ source.elr@5:17-5:44
Ôöé
5 Ôöé type Parser a = Parser (String -> Option a)
ÔÇó ÔöČÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇÔöÇ
ÔÇó ÔĽ░ÔĽŞ Has type (Main.Parser Char )
ÔÇó
9 Ôöé ÔĽşÔöĄ \s -> match stringToList s with
10 Ôöé Ôöé [] -> None
11 Ôöé ÔöťÔöĄ (x::xs) -> Some x
ÔÇó Ôöé
ÔÇó ÔĽ░ÔĽŞ Has type Text -> (Option.Option Char )
ÔöÇÔöÇÔöÇÔöÇÔöÇÔĽ»
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels