hamlet/Queue-struct.ss
(module Queue-struct (planet chongkai/sml)
  (#%module-begin
   (Program:
    (STRDECTopDec:
     (STRUCTUREStrDec:
      (StrBind:
       (StrId: Queue-struct)
       (SEALStrExp:
        (STRUCTStrExp:
         (SEQStrDec:
          (DECStrDec:
           (TYPEDec:
            (TypBind:
             (TyVarseq: (TyVar: |'a|))
             (TyCon: queue-type)
             (CONTy: (Tyseq: (CONTy: (Tyseq: (VARTy: (TyVar: |'a|))) (LongTyCon: Fifo.fifo-type))) (LongTyCon: ref-type)))))
          (SEQStrDec:
           (DECStrDec: (EXCEPTIONDec: (EQUALExBind: (VId: Dequeue) (LongVId: Fifo.Dequeue))))
           (SEQStrDec:
            (DECStrDec:
             (VALDec:
              (TyVarseq:)
              (RECValBind:
               (PLAINValBind:
                (ATPat: (IDAtPat: (LongVId: mkQueue)))
                (FNExp:
                 (Match:
                  (Mrule:
                   (ATPat: (PARAtPat: (ATPat: (RECORDAtPat:))))
                   (ATExp: (PARAtExp: (APPExp: (ATExp: (IDAtExp: (LongVId: ref))) (IDAtExp: (LongVId: Fifo.empty))))))))))))
            (SEQStrDec:
             (DECStrDec:
              (VALDec:
               (TyVarseq:)
               (RECValBind:
                (PLAINValBind:
                 (ATPat: (IDAtPat: (LongVId: clear)))
                 (FNExp:
                  (Match:
                   (Mrule:
                    (ATPat: (PARAtPat: (ATPat: (IDAtPat: (LongVId: q)))))
                    (ATExp:
                     (PARAtExp:
                      (ATExp:
                       (PARAtExp:
                        (APPExp:
                         (ATExp: (IDAtExp: (LongVId: :=)))
                         (RECORDAtExp:
                          (ExpRow: (Lab: |1|) (ATExp: (IDAtExp: (LongVId: q))) (ExpRow: (Lab: |2|) (ATExp: (IDAtExp: (LongVId: Fifo.empty))))))))))))))))))
             (SEQStrDec:
              (DECStrDec:
               (VALDec:
                (TyVarseq:)
                (RECValBind:
                 (PLAINValBind:
                  (ATPat: (IDAtPat: (LongVId: enqueue)))
                  (FNExp:
                   (Match:
                    (Mrule:
                     (ATPat:
                      (PARAtPat:
                       (ATPat:
                        (RECORDAtPat:
                         (FIELDPatRow: (Lab: |1|) (ATPat: (IDAtPat: (LongVId: q))) (FIELDPatRow: (Lab: |2|) (ATPat: (IDAtPat: (LongVId: x)))))))))
                     (ATExp:
                      (PARAtExp:
                       (APPExp:
                        (ATExp: (IDAtExp: (LongVId: :=)))
                        (RECORDAtExp:
                         (ExpRow:
                          (Lab: |1|)
                          (ATExp: (IDAtExp: (LongVId: q)))
                          (ExpRow:
                           (Lab: |2|)
                           (ATExp:
                            (PARAtExp:
                             (ATExp:
                              (PARAtExp:
                               (APPExp:
                                (ATExp: (IDAtExp: (LongVId: Fifo.enqueue)))
                                (RECORDAtExp:
                                 (ExpRow:
                                  (Lab: |1|)
                                  (ATExp: (PARAtExp: (APPExp: (ATExp: (IDAtExp: (LongVId: !))) (IDAtExp: (LongVId: q)))))
                                  (ExpRow: (Lab: |2|) (ATExp: (IDAtExp: (LongVId: x))))))))))))))))))))))))
              (SEQStrDec:
               (DECStrDec:
                (VALDec:
                 (TyVarseq:)
                 (RECValBind:
                  (PLAINValBind:
                   (ATPat: (IDAtPat: (LongVId: dequeue)))
                   (FNExp:
                    (Match:
                     (Mrule:
                      (ATPat: (PARAtPat: (ATPat: (IDAtPat: (LongVId: q)))))
                      (ATExp:
                       (LETAtExp:
                        (VALDec:
                         (TyVarseq:)
                         (PLAINValBind:
                          (ATPat:
                           (RECORDAtPat:
                            (FIELDPatRow: (Lab: |1|) (ATPat: (IDAtPat: (LongVId: newq))) (FIELDPatRow: (Lab: |2|) (ATPat: (IDAtPat: (LongVId: x)))))))
                          (ATExp:
                           (PARAtExp:
                            (APPExp:
                             (ATExp: (IDAtExp: (LongVId: Fifo.dequeue)))
                             (PARAtExp: (ATExp: (PARAtExp: (APPExp: (ATExp: (IDAtExp: (LongVId: !))) (IDAtExp: (LongVId: q)))))))))))
                        (ATExp:
                         (SEQAtExp:
                          (ATExp:
                           (PARAtExp:
                            (APPExp:
                             (ATExp: (IDAtExp: (LongVId: :=)))
                             (RECORDAtExp: (ExpRow: (Lab: |1|) (ATExp: (IDAtExp: (LongVId: q))) (ExpRow: (Lab: |2|) (ATExp: (IDAtExp: (LongVId: newq)))))))))
                          (PARAtExp: (ATExp: (IDAtExp: (LongVId: x)))))))))))))))
               (SEQStrDec:
                (DECStrDec:
                 (VALDec:
                  (TyVarseq:)
                  (RECValBind:
                   (PLAINValBind:
                    (ATPat: (IDAtPat: (LongVId: delete)))
                    (FNExp:
                     (Match:
                      (Mrule:
                       (ATPat:
                        (PARAtPat:
                         (ATPat:
                          (RECORDAtPat:
                           (FIELDPatRow: (Lab: |1|) (ATPat: (IDAtPat: (LongVId: q))) (FIELDPatRow: (Lab: |2|) (ATPat: (IDAtPat: (LongVId: pred)))))))))
                       (ATExp:
                        (PARAtExp:
                         (ATExp:
                          (PARAtExp:
                           (APPExp:
                            (ATExp: (IDAtExp: (LongVId: :=)))
                            (RECORDAtExp:
                             (ExpRow:
                              (Lab: |1|)
                              (ATExp: (IDAtExp: (LongVId: q)))
                              (ExpRow:
                               (Lab: |2|)
                               (ATExp:
                                (PARAtExp:
                                 (APPExp:
                                  (ATExp: (IDAtExp: (LongVId: Fifo.delete)))
                                  (RECORDAtExp:
                                   (ExpRow:
                                    (Lab: |1|)
                                    (ATExp: (PARAtExp: (APPExp: (ATExp: (IDAtExp: (LongVId: !))) (IDAtExp: (LongVId: q)))))
                                    (ExpRow: (Lab: |2|) (ATExp: (IDAtExp: (LongVId: pred))))))))))))))))))))))))
                (SEQStrDec:
                 (DECStrDec:
                  (VALDec:
                   (TyVarseq:)
                   (RECValBind:
                    (PLAINValBind:
                     (ATPat: (IDAtPat: (LongVId: head)))
                     (FNExp:
                      (Match:
                       (Mrule:
                        (ATPat: (PARAtPat: (ATPat: (IDAtPat: (LongVId: q)))))
                        (ATExp:
                         (PARAtExp:
                          (APPExp:
                           (ATExp: (IDAtExp: (LongVId: Fifo.head)))
                           (PARAtExp: (ATExp: (PARAtExp: (APPExp: (ATExp: (IDAtExp: (LongVId: !))) (IDAtExp: (LongVId: q))))))))))))))))
                 (SEQStrDec:
                  (DECStrDec:
                   (VALDec:
                    (TyVarseq:)
                    (RECValBind:
                     (PLAINValBind:
                      (ATPat: (IDAtPat: (LongVId: peek)))
                      (FNExp:
                       (Match:
                        (Mrule:
                         (ATPat: (PARAtPat: (ATPat: (IDAtPat: (LongVId: q)))))
                         (ATExp:
                          (PARAtExp:
                           (APPExp:
                            (ATExp: (IDAtExp: (LongVId: Fifo.peek)))
                            (PARAtExp: (ATExp: (PARAtExp: (APPExp: (ATExp: (IDAtExp: (LongVId: !))) (IDAtExp: (LongVId: q))))))))))))))))
                  (SEQStrDec:
                   (DECStrDec:
                    (VALDec:
                     (TyVarseq:)
                     (RECValBind:
                      (PLAINValBind:
                       (ATPat: (IDAtPat: (LongVId: isEmpty)))
                       (FNExp:
                        (Match:
                         (Mrule:
                          (ATPat: (PARAtPat: (ATPat: (IDAtPat: (LongVId: q)))))
                          (ATExp:
                           (PARAtExp:
                            (APPExp:
                             (ATExp: (IDAtExp: (LongVId: Fifo.isEmpty)))
                             (PARAtExp: (ATExp: (PARAtExp: (APPExp: (ATExp: (IDAtExp: (LongVId: !))) (IDAtExp: (LongVId: q))))))))))))))))
                   (SEQStrDec:
                    (DECStrDec:
                     (VALDec:
                      (TyVarseq:)
                      (RECValBind:
                       (PLAINValBind:
                        (ATPat: (IDAtPat: (LongVId: length)))
                        (FNExp:
                         (Match:
                          (Mrule:
                           (ATPat: (PARAtPat: (ATPat: (IDAtPat: (LongVId: q)))))
                           (ATExp:
                            (PARAtExp:
                             (APPExp:
                              (ATExp: (IDAtExp: (LongVId: Fifo.length)))
                              (PARAtExp: (ATExp: (PARAtExp: (APPExp: (ATExp: (IDAtExp: (LongVId: !))) (IDAtExp: (LongVId: q))))))))))))))))
                    (SEQStrDec:
                     (DECStrDec:
                      (VALDec:
                       (TyVarseq:)
                       (RECValBind:
                        (PLAINValBind:
                         (ATPat: (IDAtPat: (LongVId: contents)))
                         (FNExp:
                          (Match:
                           (Mrule:
                            (ATPat: (PARAtPat: (ATPat: (IDAtPat: (LongVId: q)))))
                            (ATExp:
                             (PARAtExp:
                              (APPExp:
                               (ATExp: (IDAtExp: (LongVId: Fifo.contents)))
                               (PARAtExp: (ATExp: (PARAtExp: (APPExp: (ATExp: (IDAtExp: (LongVId: !))) (IDAtExp: (LongVId: q))))))))))))))))
                     (SEQStrDec:
                      (DECStrDec:
                       (VALDec:
                        (TyVarseq:)
                        (RECValBind:
                         (PLAINValBind:
                          (ATPat: (IDAtPat: (LongVId: app)))
                          (FNExp:
                           (Match:
                            (Mrule:
                             (ATPat: (IDAtPat: (LongVId: f)))
                             (FNExp:
                              (Match:
                               (Mrule:
                                (ATPat: (IDAtPat: (LongVId: q)))
                                (ATExp:
                                 (PARAtExp:
                                  (APPExp:
                                   (ATExp: (PARAtExp: (APPExp: (ATExp: (IDAtExp: (LongVId: Fifo.app))) (IDAtExp: (LongVId: f)))))
                                   (PARAtExp: (ATExp: (PARAtExp: (APPExp: (ATExp: (IDAtExp: (LongVId: !))) (IDAtExp: (LongVId: q)))))))))))))))))))
                      (SEQStrDec:
                       (DECStrDec:
                        (VALDec:
                         (TyVarseq:)
                         (RECValBind:
                          (PLAINValBind:
                           (ATPat: (IDAtPat: (LongVId: map)))
                           (FNExp:
                            (Match:
                             (Mrule:
                              (ATPat: (IDAtPat: (LongVId: f)))
                              (FNExp:
                               (Match:
                                (Mrule:
                                 (ATPat: (IDAtPat: (LongVId: q)))
                                 (ATExp:
                                  (PARAtExp:
                                   (APPExp:
                                    (ATExp: (IDAtExp: (LongVId: ref)))
                                    (PARAtExp:
                                     (ATExp:
                                      (PARAtExp:
                                       (APPExp:
                                        (ATExp: (PARAtExp: (APPExp: (ATExp: (IDAtExp: (LongVId: Fifo.map))) (IDAtExp: (LongVId: f)))))
                                        (PARAtExp: (ATExp: (PARAtExp: (APPExp: (ATExp: (IDAtExp: (LongVId: !))) (IDAtExp: (LongVId: q)))))))))))))))))))))))
                       (SEQStrDec:
                        (DECStrDec:
                         (VALDec:
                          (TyVarseq:)
                          (RECValBind:
                           (PLAINValBind:
                            (ATPat: (IDAtPat: (LongVId: foldl)))
                            (FNExp:
                             (Match:
                              (Mrule:
                               (ATPat: (IDAtPat: (LongVId: f)))
                               (FNExp:
                                (Match:
                                 (Mrule:
                                  (ATPat: (IDAtPat: (LongVId: b)))
                                  (FNExp:
                                   (Match:
                                    (Mrule:
                                     (ATPat: (IDAtPat: (LongVId: q)))
                                     (ATExp:
                                      (PARAtExp:
                                       (APPExp:
                                        (ATExp:
                                         (PARAtExp:
                                          (APPExp:
                                           (ATExp: (PARAtExp: (APPExp: (ATExp: (IDAtExp: (LongVId: Fifo.foldl))) (IDAtExp: (LongVId: f)))))
                                           (IDAtExp: (LongVId: b)))))
                                        (PARAtExp: (ATExp: (PARAtExp: (APPExp: (ATExp: (IDAtExp: (LongVId: !))) (IDAtExp: (LongVId: q))))))))))))))))))))))
                        (DECStrDec:
                         (VALDec:
                          (TyVarseq:)
                          (RECValBind:
                           (PLAINValBind:
                            (ATPat: (IDAtPat: (LongVId: foldr)))
                            (FNExp:
                             (Match:
                              (Mrule:
                               (ATPat: (IDAtPat: (LongVId: f)))
                               (FNExp:
                                (Match:
                                 (Mrule:
                                  (ATPat: (IDAtPat: (LongVId: b)))
                                  (FNExp:
                                   (Match:
                                    (Mrule:
                                     (ATPat: (IDAtPat: (LongVId: q)))
                                     (ATExp:
                                      (PARAtExp:
                                       (APPExp:
                                        (ATExp:
                                         (PARAtExp:
                                          (APPExp:
                                           (ATExp: (PARAtExp: (APPExp: (ATExp: (IDAtExp: (LongVId: Fifo.foldr))) (IDAtExp: (LongVId: f)))))
                                           (IDAtExp: (LongVId: b)))))
                                        (PARAtExp:
                                         (ATExp:
                                          (PARAtExp: (APPExp: (ATExp: (IDAtExp: (LongVId: !))) (IDAtExp: (LongVId: q))))))))))))))))))))))))))))))))))))))
        (IDSigExp: (SigId: QUEUE-sig)))))))))