mirror of
https://github.com/ilyakooo0/elm-bridge.git
synced 2024-09-11 14:05:55 +03:00
Added tuple-check for base <=4.17 back in
This commit is contained in:
parent
b5af449545
commit
0c91e706a1
@ -3,7 +3,7 @@
|
||||
-}
|
||||
module Elm.TyRep where
|
||||
|
||||
import qualified Data.Char as Char
|
||||
import qualified Data.Char as Char
|
||||
import Data.List
|
||||
import Data.Proxy
|
||||
import Data.Typeable (TyCon, TypeRep, Typeable, splitTyConApp,
|
||||
@ -85,8 +85,8 @@ isNamed s =
|
||||
|
||||
isEmpty :: SumTypeFields -> Bool
|
||||
isEmpty (Anonymous []) = True
|
||||
isEmpty (Named []) = True
|
||||
isEmpty _ = False
|
||||
isEmpty (Named []) = True
|
||||
isEmpty _ = False
|
||||
|
||||
data SumTypeConstructor
|
||||
= STC
|
||||
@ -189,6 +189,11 @@ toElmType ty = toElmType' $ typeRep ty
|
||||
isTuple :: String -> Bool
|
||||
isTuple "Unit" = True
|
||||
isTuple ('T': 'u' : 'p': 'l' : 'e' : ds) = all Char.isDigit ds
|
||||
isTuple ('(':xs) = isTuple' $ reverse xs -- base <= 4.17
|
||||
where
|
||||
isTuple' :: String -> Bool
|
||||
isTuple' (')':xs') = all (== ',') xs'
|
||||
isTuple' _ = False
|
||||
isTuple _ = False
|
||||
|
||||
typeApplication :: TyCon -> [TypeRep] -> EType
|
||||
|
Loading…
Reference in New Issue
Block a user