--- |Converts a 'CIAscii' to 'Scheme' without any validation on the
--- string.
-unsafeCreateScheme ∷ CIAscii → Scheme
-{-# INLINE CONLIKE unsafeCreateScheme #-}
-unsafeCreateScheme = Scheme
+instance Default (Parser Scheme) where
+ {-# INLINEABLE def #-}
+ def = do x ← satisfy first
+ xs ← takeWhile nonFirst
+ return ∘ fromBS $ x `BS.cons` xs
+ <?>
+ "scheme"
+ where
+ {-# INLINE first #-}
+ first = isAlpha_ascii
+ {-# INLINE nonFirst #-}
+ nonFirst c
+ = isAlpha_ascii c ∨
+ c ≡ '+' ∨
+ c ≡ '-' ∨
+ c ≡ '.'
+ {-# INLINE fromBS #-}
+ fromBS = Scheme ∘ A.toCIAscii ∘ A.unsafeFromByteString
+
+instance ConvertSuccess Scheme CIAscii where
+ {-# INLINE convertSuccess #-}
+ convertSuccess (Scheme s) = s
+
+instance ConvertAttempt CIAscii Scheme where
+ {-# INLINE convertAttempt #-}
+ convertAttempt = parseAttempt' def ∘ A.fromCIAscii
+
+deriveAttempts [ ([t| Scheme |], [t| CIAscii |])
+ ]