unison-parser-typechecker-0.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Unison.Share.Types

Description

Types related to Share and Codeservers.

Synopsis

Documentation

data CodeserverURI Source #

This type is expanded out into all of its fields because we require certain pieces which are optional in a URI, and also to make it more typesafe to eventually convert into a BaseURL for servant clients.

newtype CodeserverId Source #

This is distinct from the codeserver URI in that we store credentials by a normalized ID, since it's much easier to look up that way than from an arbitrary path. We may wish to use explicitly named configurations in the future. This currently uses a stringified uriAuthority.

Constructors

CodeserverId 

Fields

Instances

Instances details
FromJSON CodeserverId Source # 
Instance details

Defined in Unison.Share.Types

FromJSONKey CodeserverId Source # 
Instance details

Defined in Unison.Share.Types

ToJSON CodeserverId Source # 
Instance details

Defined in Unison.Share.Types

ToJSONKey CodeserverId Source # 
Instance details

Defined in Unison.Share.Types

Show CodeserverId Source # 
Instance details

Defined in Unison.Share.Types

Eq CodeserverId Source # 
Instance details

Defined in Unison.Share.Types

Ord CodeserverId Source # 
Instance details

Defined in Unison.Share.Types

data Scheme Source #

Constructors

Http 
Https 

Instances

Instances details
Show Scheme Source # 
Instance details

Defined in Unison.Share.Types

Eq Scheme Source # 
Instance details

Defined in Unison.Share.Types

Methods

(==) :: Scheme -> Scheme -> Bool #

(/=) :: Scheme -> Scheme -> Bool #

Ord Scheme Source # 
Instance details

Defined in Unison.Share.Types

codeserverFromURI :: URI -> Maybe CodeserverURI Source #

>>> import Data.Maybe (fromJust)
>>> codeserverFromURI . fromJust $ parseURI "http://localhost:8080"
Just http://localhost:8080
>>> codeserverFromURI . fromJust $ parseURI "http://localhost:80"
Just http://localhost:80
>>> codeserverFromURI . fromJust $ parseURI "https://share.unison-lang.org/api"
Just https://share.unison-lang.org/api
>>> codeserverFromURI . fromJust $ parseURI "http://share.unison-lang.org/api"
Just http://share.unison-lang.org/api

codeserverIdFromURI :: URI -> Either Text CodeserverId Source #

Gets the part of the CodeserverURI that we use for identifying that codeserver in credentials files.

>>> import Data.Maybe (fromJust)
>>> import Network.URI (parseURI)
>>> codeserverIdFromURI (fromJust $ parseURI "http://localhost:5424/api")
>>> codeserverIdFromURI (fromJust $ parseURI "https://share.unison-lang.org/api")
Right "localhost:5424"
Right "share.unison-lang.org"

codeserverIdFromCodeserverURI :: CodeserverURI -> CodeserverId Source #

Gets the CodeserverId for a given CodeserverURI

codeserverBaseURL :: CodeserverURI -> BaseUrl Source #

Builds a servant-compatible BaseUrl for a given CodeserverURI.