<commit_before>module Node.Express.App
    ( AppM
    , App
    , HandlerFn
    , listenHttp, listenHttps, listenHostHttp, listenHostHttps
    , listenPipe, makeHttpServer, makeHttpsServer, apply
    , use, useExternal, useAt, useAtExternal, useOnParam, useOnError
    , getProp, setProp
    , http, get, post, put, delete, all

    , mkApplication, _getProp, _setProp, _http, _httpServer, _httpsServer, _listenHttp, _listenHttps
    , _listenHostHttp, _listenHostHttps, _listenPipe, _use, _useExternal, _useAt, _useAtExternal, _useOnParam, _useOnError
    ) where

import Prelude hiding (apply)

import Data.Function.Uncurried (Fn2, Fn3, Fn4, runFn4, runFn3, runFn2)
import Data.Maybe (Maybe(..))
import Effect (Effect)
import Effect.Class (class MonadEffect, liftEffect)
import Effect.Exception (Error)
import Foreign (Foreign, unsafeToForeign)
import Node.Express.Handler (Handler, runHandlerM)
import Node.Express.Types (class RoutePattern, Application, Response, Request, Event, Host, Path, Port, Pipe, Method(..), Middleware)
import Node.HTTP (Server)

-- | Monad responsible for application related operations (initial setup mostly).
data AppM a = AppM (Application -> Effect a)
type App = AppM Unit

type HandlerFn = Request -> Response -> Effect Unit -> Effect Unit

instance functorAppM :: Functor AppM where
    map f (AppM h) = AppM \app -> liftM1 f $ h app

instance applyAppM :: Apply AppM where
    apply (AppM f) (AppM h) = AppM \app -> do
        res <- h app
        trans <- f app
        pure $ trans res<commit_msg>fix(#106): applyAppM effect order is wrong<commit_after>module Node.Express.App
    ( AppM
    , App
    , HandlerFn
    , listenHttp, listenHttps, listenHostHttp, listenHostHttps
    , listenPipe, makeHttpServer, makeHttpsServer, apply
    , use, useExternal, useAt, useAtExternal, useOnParam, useOnError
    , getProp, setProp
    , http, get, post, put, delete, all

    , mkApplication, _getProp, _setProp, _http, _httpServer, _httpsServer, _listenHttp, _listenHttps
    , _listenHostHttp, _listenHostHttps, _listenPipe, _use, _useExternal, _useAt, _useAtExternal, _useOnParam, _useOnError
    ) where

import Prelude hiding (apply)

import Data.Function.Uncurried (Fn2, Fn3, Fn4, runFn4, runFn3, runFn2)
import Data.Maybe (Maybe(..))
import Effect (Effect)
import Effect.Class (class MonadEffect, liftEffect)
import Effect.Exception (Error)
import Foreign (Foreign, unsafeToForeign)
import Node.Express.Handler (Handler, runHandlerM)
import Node.Express.Types (class RoutePattern, Application, Response, Request, Event, Host, Path, Port, Pipe, Method(..), Middleware)
import Node.HTTP (Server)

-- | Monad responsible for application related operations (initial setup mostly).
data AppM a = AppM (Application -> Effect a)
type App = AppM Unit

type HandlerFn = Request -> Response -> Effect Unit -> Effect Unit

instance functorAppM :: Functor AppM where
    map f (AppM h) = AppM \app -> liftM1 f $ h app

instance applyAppM :: Apply AppM where
    apply (AppM f) (AppM h) = AppM \app -> do
        trans <- f app
        res <- h app
        pure $ trans res
{'fraction_non_alphanumeric': 0.09609803289261529, 'fraction_numerical': 0.005482102547565301, 'mean_word_length': 4.085245901639344, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3711910', 'n_tokens_mistral': 982, 'n_tokens_neox': 966, 'n_words': 326}