ref: ee79af7381357c5e7331a9c4f5a037136cdd6a56
parent: 1ec99d57cbaf79279eb19232deaf9941ff10cf29
author: Lennart Augustsson <lennart@augustsson.net>
date: Mon Oct 30 05:46:15 EDT 2023
Get rid of some more eq function.
--- a/comb/mhs.comb
+++ b/comb/mhs.comb
@@ -1,3 +1,3 @@
v4.0
-1170
-((A :0 ((B (B (B (B C)))) ((B (B (B C))) ((B (B C)) P)))) ((A :1 (T (BK (BK (BK K))))) ((A :2 (T (K (BK (BK K))))) ((A :3 (T (K (K (BK K))))) ((A :4 (T (K (K (K K))))) ((A :5 (T (K (K (K A))))) ((A :6 (K (noDefault "Alternative.empty"))) ((A :7 (K (noDefault "Alternative.<|>"))) ((A :8 ((S (((S' S') ((B _14) _1)) (((C' _128) ((B _12) _1)) _235))) _5)) ((A :9 ((S (((S' C') _3) _4)) (((C' _13) _1) _234))) ((A :10 (((S' P) _2) (((C' _13) _1) _936))) ((A :11 ((B (B (B (B C)))) ((B (B (B C))) ((B (B C)) P)))) ((A :12 (T (BK (BK (BK K))))) ((A :13 (T (K (BK (BK K))))) ((A :14 (T (K (K (BK K))))) ((A :15 (T (K (K (K K))))) ((A :16 (T (K (K (K A))))) ((A :17 (K (noDefault "Applicative.pure"))) ((A :18 (K (noDefault "Applicative.<*>"))) ((A :19 (((S' B) _14) (((C' _125) _12) _117))) ((A :20 (((S' B) _14) (((C' _128) _12) _118))) ((A :21 _1008) ((A :22 ((B _1050) _21)) ((A :23 (((S' _1050) _21) I)) ((A :24 _978) ((A :25 (_24 "undefined")) ((A :26 I) ((A :27 (((C' B) _1007) ((C _116) _26))) ((A :28 (((C' _27) ((_124 _1021) _106)) ((_116 (_34 _1023)) _105))) ((A :29 ((B ((S _1050) (_34 _1023))) _24)) ((A :30 ((B (B (B C))) ((B (B C)) P))) ((A :31 (T (BK (BK K)))) ((A :32 (T (K (BK K)))) ((A :33 (T (K (K K)))) ((A :34 (T (K (K A)))) ((A :35 (K (noDefault "Monad.>>="))) ((A :36 (((C' (C' B)) _32) K)) ((A :37 ((B _13) _31)) ((A :38 (((S' (C' B)) _32) (((S' (C' B)) _32) (B' _34)))) ((A :39 P) ((A :40 (T K)) ((A :41 (T A)) ((A :42 (K _24)) ((A :43 ((B (B Y)) (((S' B) (B' ((B P) ((C _34) _234)))) (((S' (C' B)) ((B (B (C' B))) (B' _32))) (((S' (C' (C' B))) (B' _32)) (((C' B) (B' _34)) _235)))))) ((A :44 ((B (B Y)) (((S' B) (B' ((B P) ((C _34) _936)))) (((C' (C' B)) ((B (B (C' B))) (B' _32))) BK)))) ((A :45 ((B T) ((C _34) _936))) ((A :46 ((C _43) _117)) ((A :47 ((B _119) _32)) ((A :48 ((B C) ((B C') _32))) ((A :49 ((B _119) _48)) ((A :50 T) ((A :51 ((_123 ((B (B (_114 _50))) ((B ((C' C) _54)) (B P)))) (_127 _51))) ((A :52 (((((_11 _51) ((B (_114 _50)) P)) (_38 _53)) ((B (B (_114 _50))) (((C' B) ((B C) _54)) (BK _54)))) (_20 _52))) ((A :53 ((((_30 _52) ((B (B (_114 _50))) (((C' B) ((B C) _54)) (B _54)))) (_15 _52)) (_13 _52))) ((A :54 (T I)) ((A :55 ((B (_116 _264)) _54)) ((A :56 ((B (_114 _50)) (B (P _936)))) ((A :57 ((B (_114 _50)) (BK (P _936)))) ((A :58 ((_114 _50) ((S P) I))) ((A :59 ((B (_114 _50)) ((C (S' P)) I))) ((A :60 ((_109 ((C ((C S') _63)) I)) (_113 _60))) ((A :61 (R _68)) ((A :62 (T _67)) ((A :63 ((P _68) _67)) ((A :64 _68) ((A :65 ((C ((C S') _63)) I)) ((A :66 ((C S) _63)) ((A :67 K) ((A :68 A) ((A :69 ((_109 _972) _973)) ((A :70 ((((((((_243 _69) (_252 _70)) _974) _975) _976) _977) (_257 _70)) (_258 _70))) ((A :71 ((_109 _982) (_113 _71))) ((A :72 ((((((((_243 _71) _981) (((C' (C' (_110 _259))) _981) _261)) (((C' (C' (_111 _259))) _981) _263)) (((C' (C' (_110 _259))) _981) _263)) (((C' (C' (_111 _259))) _981) _263)) (_257 _72)) (_258 _72))) ((A :73 _983) ((A :74 _984) ((A :75 (((S' _62) (_975 #97)) ((C _975) #122))) ((A :76 (((S' _62) (_975 #65)) ((C _975) #90))) ((A :77 (((S' _61) _75) _76)) ((A :78 (((S' _62) (_975 #48)) ((C _975) #57))) ((A :79 (((S' _61) _77) _78)) ((A :80 (((S' _62) (_975 #32)) ((C _975) #126))) ((A :81 (((S' _61) ((C (_110 _69)) #32)) (((S' _61) ((C (_110 _69)) #9)) ((C (_110 _69)) #10)))) ((A :82 ((S ((S (((S' _62) (_975 #65)) ((C _975) #90))) (_68 (((noMatch "lib/Data/Char.hs") #3) #8)))) ((B _73) (((C' _129) (((C' _130) _74) (_74 #65))) (_74 #97))))) ((A :83 ((S ((S (((S' _62) (_975 #97)) ((C _975) #97))) (_68 (((noMatch "lib/Data/Char.hs") #3) #8)))) ((B _73) (((C' _129) (((C' _130) _74) (_74 #97))) (_74 #65))))) ((A :84 _943) ((A :85 _944) ((A :86 _945) ((A :87 _946) ((A :88 (_85 %0.0)) ((A :89 _84) ((A :90 _85) ((A :91 _86) ((A :92 _87) ((A :93 ((_109 _947) _948)) ((A :94 (_110 _93)) ((A :95 (_111 _93)) ((A :96 _949) ((A :97 _950) ((A :98 _951) ((A :99 _952) ((A :100 _96) ((A :101 _97) ((A :102 _98) ((A :103 _99) ((A :104 _953) ((A :105 ((B BK) T)) ((A :106 (BK T)) ((A :107 (((S' _109) (((S' C) ((B (C S')) (((C' C) ((B (C C')) ((B _110) (T K)))) (K _67)))) ((B ((C' B) (T (K _67)))) ((B _110) (T
\ No newline at end of file
+1168
+((A :0 ((B (B (B (B C)))) ((B (B (B C))) ((B (B C)) P)))) ((A :1 (T (BK (BK (BK K))))) ((A :2 (T (K (BK (BK K))))) ((A :3 (T (K (K (BK K))))) ((A :4 (T (K (K (K K))))) ((A :5 (T (K (K (K A))))) ((A :6 (K (noDefault "Alternative.empty"))) ((A :7 (K (noDefault "Alternative.<|>"))) ((A :8 ((S (((S' S') ((B _14) _1)) (((C' _128) ((B _12) _1)) _235))) _5)) ((A :9 ((S (((S' C') _3) _4)) (((C' _13) _1) _234))) ((A :10 (((S' P) _2) (((C' _13) _1) _934))) ((A :11 ((B (B (B (B C)))) ((B (B (B C))) ((B (B C)) P)))) ((A :12 (T (BK (BK (BK K))))) ((A :13 (T (K (BK (BK K))))) ((A :14 (T (K (K (BK K))))) ((A :15 (T (K (K (K K))))) ((A :16 (T (K (K (K A))))) ((A :17 (K (noDefault "Applicative.pure"))) ((A :18 (K (noDefault "Applicative.<*>"))) ((A :19 (((S' B) _14) (((C' _125) _12) _117))) ((A :20 (((S' B) _14) (((C' _128) _12) _118))) ((A :21 _1006) ((A :22 ((B _1048) _21)) ((A :23 (((S' _1048) _21) I)) ((A :24 _976) ((A :25 (_24 "undefined")) ((A :26 I) ((A :27 (((C' B) _1005) ((C _116) _26))) ((A :28 (((C' _27) ((_124 _1019) _106)) ((_116 (_34 _1021)) _105))) ((A :29 ((B ((S _1048) (_34 _1021))) _24)) ((A :30 ((B (B (B C))) ((B (B C)) P))) ((A :31 (T (BK (BK K)))) ((A :32 (T (K (BK K)))) ((A :33 (T (K (K K)))) ((A :34 (T (K (K A)))) ((A :35 (K (noDefault "Monad.>>="))) ((A :36 (((C' (C' B)) _32) K)) ((A :37 ((B _13) _31)) ((A :38 (((S' (C' B)) _32) (((S' (C' B)) _32) (B' _34)))) ((A :39 P) ((A :40 (T K)) ((A :41 (T A)) ((A :42 (K _24)) ((A :43 ((B (B Y)) (((S' B) (B' ((B P) ((C _34) _234)))) (((S' (C' B)) ((B (B (C' B))) (B' _32))) (((S' (C' (C' B))) (B' _32)) (((C' B) (B' _34)) _235)))))) ((A :44 ((B (B Y)) (((S' B) (B' ((B P) ((C _34) _934)))) (((C' (C' B)) ((B (B (C' B))) (B' _32))) BK)))) ((A :45 ((B T) ((C _34) _934))) ((A :46 ((C _43) _117)) ((A :47 ((B _119) _32)) ((A :48 ((B C) ((B C') _32))) ((A :49 ((B _119) _48)) ((A :50 T) ((A :51 ((_123 ((B (B (_114 _50))) ((B ((C' C) _54)) (B P)))) (_127 _51))) ((A :52 (((((_11 _51) ((B (_114 _50)) P)) (_38 _53)) ((B (B (_114 _50))) (((C' B) ((B C) _54)) (BK _54)))) (_20 _52))) ((A :53 ((((_30 _52) ((B (B (_114 _50))) (((C' B) ((B C) _54)) (B _54)))) (_15 _52)) (_13 _52))) ((A :54 (T I)) ((A :55 ((B (_116 _264)) _54)) ((A :56 ((B (_114 _50)) (B (P _934)))) ((A :57 ((B (_114 _50)) (BK (P _934)))) ((A :58 ((_114 _50) ((S P) I))) ((A :59 ((B (_114 _50)) ((C (S' P)) I))) ((A :60 ((_109 ((C ((C S') _63)) I)) (_113 _60))) ((A :61 (R _68)) ((A :62 (T _67)) ((A :63 ((P _68) _67)) ((A :64 _68) ((A :65 ((C ((C S') _63)) I)) ((A :66 ((C S) _63)) ((A :67 K) ((A :68 A) ((A :69 ((_109 _970) _971)) ((A :70 ((((((((_243 _69) (_252 _70)) _972) _973) _974) _975) (_257 _70)) (_258 _70))) ((A :71 ((_109 _980) (_113 _71))) ((A :72 ((((((((_243 _71) _979) (((C' (C' (_110 _259))) _979) _261)) (((C' (C' (_111 _259))) _979) _263)) (((C' (C' (_110 _259))) _979) _263)) (((C' (C' (_111 _259))) _979) _263)) (_257 _72)) (_258 _72))) ((A :73 _981) ((A :74 _982) ((A :75 (((S' _62) (_973 #97)) ((C _973) #122))) ((A :76 (((S' _62) (_973 #65)) ((C _973) #90))) ((A :77 (((S' _61) _75) _76)) ((A :78 (((S' _62) (_973 #48)) ((C _973) #57))) ((A :79 (((S' _61) _77) _78)) ((A :80 (((S' _62) (_973 #32)) ((C _973) #126))) ((A :81 (((S' _61) ((C (_110 _69)) #32)) (((S' _61) ((C (_110 _69)) #9)) ((C (_110 _69)) #10)))) ((A :82 ((S ((S (((S' _62) (_973 #65)) ((C _973) #90))) (_68 (((noMatch "lib/Data/Char.hs") #3) #8)))) ((B _73) (((C' _129) (((C' _130) _74) (_74 #65))) (_74 #97))))) ((A :83 ((S ((S (((S' _62) (_973 #97)) ((C _973) #97))) (_68 (((noMatch "lib/Data/Char.hs") #3) #8)))) ((B _73) (((C' _129) (((C' _130) _74) (_74 #97))) (_74 #65))))) ((A :84 _941) ((A :85 _942) ((A :86 _943) ((A :87 _944) ((A :88 (_85 %0.0)) ((A :89 _84) ((A :90 _85) ((A :91 _86) ((A :92 _87) ((A :93 ((_109 _945) _946)) ((A :94 (_110 _93)) ((A :95 (_111 _93)) ((A :96 _947) ((A :97 _948) ((A :98 _949) ((A :99 _950) ((A :100 _96) ((A :101 _97) ((A :102 _98) ((A :103 _99) ((A :104 _951) ((A :105 ((B BK) T)) ((A :106 (BK T)) ((A :107 (((S' _109) (((S' C) ((B (C S')) (((C' C) ((B (C C')) ((B _110) (T K)))) (K _67)))) ((B ((C' B) (T (K _67)))) ((B _110) (T
\ No newline at end of file
--- a/src/MicroHs/Ident.hs
+++ b/src/MicroHs/Ident.hs
@@ -14,7 +14,6 @@
addIdentSuffix,
SLoc(..), noSLoc, isNoSLoc,
showSLoc,
- compareIdent,
expectQualified,
) where
import Data.Eq
@@ -81,14 +80,6 @@
isIdent :: String -> Ident -> Bool
isIdent s (Ident _ i) = s == i
-{--leIdent :: Ident -> Ident -> Bool
-leIdent (Ident _ i) (Ident _ j) = i <= j
-
-eqIdent :: Ident -> Ident -> Bool
-eqIdent (Ident _ i) (Ident _ j) = i == j
--}
-
qualIdent :: --XHasCallStack =>
Ident -> Ident -> Ident
--XqualIdent _ (Ident _ i) | isQual i = error $ "already qualified " ++ i
@@ -148,8 +139,3 @@
showSLoc (SLoc fn l c) =
if null fn then "no location" else
showString fn ++ ": " ++ "line " ++ showInt l ++ ", col " ++ showInt c
-
-compareIdent :: Ident -> Ident -> Ordering
-compareIdent (Ident _ s) (Ident _ t) = compareString s t
-
-
--- a/src/MicroHs/TypeCheck.hs
+++ b/src/MicroHs/TypeCheck.hs
@@ -71,12 +71,9 @@
--Xderiving(Show)
instance Eq Entry where
- (==) = eqEntry
+ Entry x _ == Entry y _ = getIdent x == getIdent y
-eqEntry :: Entry -> Entry -> Bool
-eqEntry (Entry x _) (Entry y _) = (getIdent x) == (getIdent y)
-
entryType :: Entry -> EType
entryType (Entry _ t) = t
@@ -285,7 +282,7 @@
[ (v, [e]) | ValueExport i e <- ves, v <- qns is mn i ] ++
[ (v, [e]) | TypeExport _ _ cs <- tes, ValueExport i e <- cs, v <- qns is mn i ] ++
[ (v, [Entry (EVar v) t]) | (i, (_, _, t, _)) <- cls, let { v = mkClassConstructor i } ]- in stFromListWith (unionBy eqEntry) $ concatMap syms mdls
+ in stFromListWith union $ concatMap syms mdls
allSyns =
let
syns (_, TModule _ _ _ ses _ _ _ _) = ses
@@ -294,7 +291,7 @@
allTypes =
let
types (is, TModule mn _ tes _ _ _ _ _) = [ (v, [e]) | TypeExport i e _ <- tes, v <- qns is mn i ]
- in stFromListWith (unionBy eqEntry) $ concatMap types mdls
+ in stFromListWith union $ concatMap types mdls
allFixes =
let
fixes (_, TModule _ fes _ _ _ _ _ _) = fes
--
⑨