mirror of
https://github.com/higherkindness/mu-haskell.git
synced 2024-08-16 18:00:33 +03:00
120 lines
3.0 KiB
Plaintext
120 lines
3.0 KiB
Plaintext
{-# START_FILE {{name}}.cabal #-}
|
||
name: {{name}}
|
||
version: 0.1.0.0
|
||
|
||
-- synopsis:
|
||
-- description:
|
||
homepage: https://github.com/{{github-username}}{{^github-username}}githubuser{{/github-username}}/{{name}}#readme
|
||
author: {{author-name}}{{^author-name}}Author name here{{/author-name}}
|
||
maintainer: {{author-email}}{{^author-email}}example@example.com{{/author-email}}
|
||
copyright: {{copyright}}{{^copyright}}{{year}}{{^year}}2020{{/year}} {{author-name}}{{^author-name}}Author name here{{/author-name}}{{/copyright}}
|
||
category: {{category}}{{^category}}Web{{/category}}
|
||
build-type: Simple
|
||
cabal-version: >=1.10
|
||
extra-source-files: README.md
|
||
|
||
executable {{name}}
|
||
hs-source-dirs: src
|
||
main-is: Main.hs
|
||
other-modules: Schema
|
||
ghc-options: -Wall
|
||
default-language: Haskell2010
|
||
build-depends:
|
||
base >=4.12 && <5
|
||
, mu-avro >=0.4.0
|
||
, mu-grpc-server >=0.4.0
|
||
, mu-rpc >=0.4.0
|
||
, mu-schema >=0.3.1
|
||
, text
|
||
|
||
{-# START_FILE stack.yaml #-}
|
||
resolver: lts-16.22
|
||
allow-newer: true
|
||
extra-deps:
|
||
# mu
|
||
- mu-schema-0.3.1.1
|
||
- mu-rpc-0.4.0.1
|
||
- mu-optics-0.3.0.1
|
||
- mu-avro-0.4.0.2
|
||
- mu-protobuf-0.4.0.3
|
||
- mu-grpc-server-0.4.0.0
|
||
- mu-grpc-common-0.4.0.0
|
||
- compendium-client-0.2.1.1
|
||
# dependencies of mu
|
||
- http2-client-0.9.0.0
|
||
- http2-grpc-types-0.5.0.0
|
||
- http2-grpc-proto3-wire-0.1.0.0
|
||
- warp-grpc-0.4.0.1
|
||
- proto3-wire-1.2.0
|
||
- parameterized-0.5.0.0
|
||
|
||
{-# START_FILE Setup.hs #-}
|
||
import Distribution.Simple
|
||
main = defaultMain
|
||
|
||
{-# START_FILE .gitignore #-}
|
||
.stack-work/
|
||
stack*.yaml.lock
|
||
*~
|
||
|
||
{-# START_FILE README.md #-}
|
||
# {{name}}
|
||
|
||
{-# START_FILE {{name}}.avdl #-}
|
||
@namespace("{{name}}")
|
||
protocol Service {
|
||
|
||
}
|
||
|
||
{-# START_FILE src/Schema.hs #-}
|
||
{-# language DataKinds #-}
|
||
{-# language DeriveAnyClass #-}
|
||
{-# language DeriveGeneric #-}
|
||
{-# language DuplicateRecordFields #-}
|
||
{-# language FlexibleContexts #-}
|
||
{-# language FlexibleInstances #-}
|
||
{-# language MultiParamTypeClasses #-}
|
||
{-# language PolyKinds #-}
|
||
{-# language TemplateHaskell #-}
|
||
{-# language TypeFamilies #-}
|
||
{-# language TypeOperators #-}
|
||
|
||
module Schema where
|
||
|
||
-- import Data.Text as T
|
||
-- import GHC.Generics
|
||
|
||
import Mu.Quasi.Avro
|
||
import Mu.Schema
|
||
|
||
avdl "TheSchema" "TheService" "." "{{name}}.avdl"
|
||
|
||
-- A. Map to Haskell types
|
||
-- data Message
|
||
-- = Message { ... }
|
||
-- deriving ( Eq, Show, Generic
|
||
-- , ToSchema TheSchema "Message"
|
||
-- , FromSchema TheSchema "Message" )
|
||
|
||
-- B. Use optics
|
||
type Message = Term TheSchema (TheSchema :/: "Message")
|
||
|
||
{-# START_FILE src/Main.hs #-}
|
||
{-# language FlexibleContexts #-}
|
||
{-# language PartialTypeSignatures #-}
|
||
{-# language OverloadedStrings #-}
|
||
{-# OPTIONS_GHC -fno-warn-partial-type-signatures #-}
|
||
|
||
module Main where
|
||
|
||
import Mu.GRpc.Server
|
||
import Mu.Server
|
||
|
||
import Schema
|
||
|
||
main :: IO ()
|
||
main = runGRpcApp msgAvro 8080 server
|
||
|
||
server :: MonadServer m => SingleServerT i TheService m _
|
||
server = singleService ()
|