comparison src/core_util.sml @ 522:3162bbf8e30f

Avoid Especializing polymorphic code
author Adam Chlipala <adamc@hcoop.net>
date Thu, 27 Nov 2008 12:43:28 -0500
parents ae03d09043c1
children 0dd40b6bfdf3
comparison
equal deleted inserted replaced
521:31aba58a5b5b 522:3162bbf8e30f
898 decl = fn ctx => fn d => fn s => S.Continue (decl (ctx, d, s)), 898 decl = fn ctx => fn d => fn s => S.Continue (decl (ctx, d, s)),
899 bind = bind} ctx d s of 899 bind = bind} ctx d s of
900 S.Continue v => v 900 S.Continue v => v
901 | S.Return _ => raise Fail "CoreUtil.Decl.foldMapB: Impossible" 901 | S.Return _ => raise Fail "CoreUtil.Decl.foldMapB: Impossible"
902 902
903 fun exists {kind, con, exp, decl} d =
904 case mapfold {kind = fn k => fn () =>
905 if kind k then
906 S.Return ()
907 else
908 S.Continue (k, ()),
909 con = fn c => fn () =>
910 if con c then
911 S.Return ()
912 else
913 S.Continue (c, ()),
914 exp = fn e => fn () =>
915 if exp e then
916 S.Return ()
917 else
918 S.Continue (e, ()),
919 decl = fn d => fn () =>
920 if decl d then
921 S.Return ()
922 else
923 S.Continue (d, ())} d () of
924 S.Return _ => true
925 | S.Continue _ => false
926
903 end 927 end
904 928
905 structure File = struct 929 structure File = struct
906 930
907 datatype binder = datatype Exp.binder 931 datatype binder = datatype Exp.binder