<commit_before>-----------------------------------------------------------------------------
-- |
-- Module      :  Database.PostgreSQL.Simple.URL
-- Copyright   :  2014, 2015 © Futurice OY, <NAME>
-- License     :  MIT (see the file LICENSE)
--
-- Maintainer  :  <NAME> <<EMAIL>>
--
----------------------------------------------------------------------------
module Database.PostgreSQL.Simple.URL (parseDatabaseUrl, uriToConnectInfo) where

import Control.Applicative
import Data.List.Split
import Database.PostgreSQL.Simple
import Network.URI

-- | Parse string url into `ConnectInfo`.
--
-- > parseDatabaseURL "postgres://foo:<EMAIL>:2345/database" == ConnectInfo "example.com" 2345 "foo" "bar" "database"
parseDatabaseUrl :: String -> Maybe ConnectInfo
parseDatabaseUrl databaseUrl = parseURI databaseUrl >>= uriToConnectInfo<commit_msg>Warning free compilation on GHC 7.10<commit_after>-----------------------------------------------------------------------------
-- |
-- Module      :  Database.PostgreSQL.Simple.URL
-- Copyright   :  2014, 2015 © Futurice OY, <NAME>
-- License     :  MIT (see the file LICENSE)
--
-- Maintainer  :  <NAME> <<EMAIL>>
--
----------------------------------------------------------------------------
module Database.PostgreSQL.Simple.URL (parseDatabaseUrl, uriToConnectInfo) where

import Control.Applicative
import Data.List.Split
import Database.PostgreSQL.Simple
import Network.URI
import Prelude

-- | Parse string url into `ConnectInfo`.
--
-- > parseDatabaseURL "postgres://foo:<EMAIL>:2345/database" == ConnectInfo "example.com" 2345 "foo" "bar" "database"
parseDatabaseUrl :: String -> Maybe ConnectInfo
parseDatabaseUrl databaseUrl = parseURI databaseUrl >>= uriToConnectInfo
{'fraction_non_alphanumeric': 0.28281068524970965, 'fraction_numerical': 0.02032520325203252, 'mean_word_length': 1.9758203799654577, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 21, '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': '6255175', 'n_tokens_mistral': 464, 'n_tokens_neox': 435, 'n_words': 114}